gazer 0.2.25 → 0.2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gzr/commands/dashboard.rb +14 -0
- data/lib/gzr/commands/dashboard/mv.rb +64 -0
- data/lib/gzr/commands/look.rb +14 -0
- data/lib/gzr/commands/look/mv.rb +64 -0
- data/lib/gzr/templates/dashboard/mv/.gitkeep +1 -0
- data/lib/gzr/templates/look/mv/.gitkeep +1 -0
- data/lib/gzr/version.rb +1 -1
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d1e32cfce7c2cad7d7249e1a3cfb8fe7558bfd2
|
4
|
+
data.tar.gz: b34b7bd990eed0cc15b8e85bd12787d48696aa88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec961462fb46c86d90a83dd53628177c78cf78c8e2734750e152828209bf2ffc649e2a17051fdc0c4a194fb811c2637f8c6a683793485809e04fc53f4093ce7b
|
7
|
+
data.tar.gz: 39945616e4f5380be52973a50c46bd45cbf86332a2a01c7ded1b5816b96557e5637fff4e4e75a564573fa2aa0d5f6c895c9ca875860711ee6e0fb531ef20820a
|
data/Gemfile.lock
CHANGED
@@ -29,6 +29,20 @@ module Gzr
|
|
29
29
|
|
30
30
|
namespace :dashboard
|
31
31
|
|
32
|
+
desc 'mv DASHBOARD_ID TARGET_SPACE_ID', 'Move a dashboard to the given space'
|
33
|
+
method_option :help, aliases: '-h', type: :boolean,
|
34
|
+
desc: 'Display usage information'
|
35
|
+
method_option :force, type: :boolean,
|
36
|
+
desc: 'Overwrite a dashboard with the same name in the target space'
|
37
|
+
def mv(dashboard_id, target_space_id)
|
38
|
+
if options[:help]
|
39
|
+
invoke :help, ['mv']
|
40
|
+
else
|
41
|
+
require_relative 'dashboard/mv'
|
42
|
+
Gzr::Commands::Dashboard::Mv.new(dashboard_id, target_space_id, options).execute
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
32
46
|
desc 'cat DASHBOARD_ID', 'Output the JSON representation of a dashboard to the screen or a file'
|
33
47
|
method_option :help, aliases: '-h', type: :boolean,
|
34
48
|
desc: 'Display usage information'
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2018 Mike DeAngelo Looker Data Sciences, Inc.
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
# frozen_string_literal: true
|
23
|
+
|
24
|
+
require_relative '../../../gzr'
|
25
|
+
require_relative '../../command'
|
26
|
+
require_relative '../../modules/dashboard'
|
27
|
+
|
28
|
+
module Gzr
|
29
|
+
module Commands
|
30
|
+
class Dashboard
|
31
|
+
class Mv < Gzr::Command
|
32
|
+
include Gzr::Dashboard
|
33
|
+
def initialize(dashboard_id, target_space_id, options)
|
34
|
+
super()
|
35
|
+
@dashboard_id = dashboard_id
|
36
|
+
@target_space_id = target_space_id
|
37
|
+
@options = options
|
38
|
+
end
|
39
|
+
|
40
|
+
def execute(input: $stdin, output: $stdout)
|
41
|
+
say_warning("options: #{@options.inspect}", output: output) if @options[:debug]
|
42
|
+
with_session do
|
43
|
+
|
44
|
+
dash = query_dashboard(@dashboard_id)
|
45
|
+
raise Gzr::CLI::Error, "Dashboard with id #{@dashboard_id} does not exist" unless dash
|
46
|
+
|
47
|
+
matching_title = search_dashboards_by_title(dash[:title],@target_space_id)
|
48
|
+
if matching_title.empty? || matching_title.first[:deleted]
|
49
|
+
matching_title = false
|
50
|
+
end
|
51
|
+
|
52
|
+
if matching_title
|
53
|
+
raise Gzr::CLI::Error, "Dashboard #{dash[:title]} already exists in space #{@target_space_id}\nUse --force if you want to overwrite it" unless @options[:force]
|
54
|
+
say_ok "Deleting existing dashboard #{matching_title.first[:id]} #{matching_title.first[:title]} in space #{@target_space_id}", output: output
|
55
|
+
update_dashboard(matching_title.first[:id],{:deleted=>true})
|
56
|
+
end
|
57
|
+
update_dashboard(dash[:id],{:space_id=>@target_space_id})
|
58
|
+
output.puts "Moved dashboard #{dash[:id]} to space #{@target_space_id}" unless @options[:plain]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/gzr/commands/look.rb
CHANGED
@@ -29,6 +29,20 @@ module Gzr
|
|
29
29
|
|
30
30
|
namespace :look
|
31
31
|
|
32
|
+
desc 'mv LOOK_ID TARGET_SPACE_ID', 'Move a look to the given space'
|
33
|
+
method_option :help, aliases: '-h', type: :boolean,
|
34
|
+
desc: 'Display usage information'
|
35
|
+
method_option :force, type: :boolean,
|
36
|
+
desc: 'Overwrite a look with the same name in the target space'
|
37
|
+
def mv(look_id, target_space_id)
|
38
|
+
if options[:help]
|
39
|
+
invoke :help, ['mv']
|
40
|
+
else
|
41
|
+
require_relative 'look/mv'
|
42
|
+
Gzr::Commands::Look::Mv.new(look_id, target_space_id, options).execute
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
32
46
|
desc 'rm LOOK_ID', 'Delete look given by LOOK_ID'
|
33
47
|
method_option :help, aliases: '-h', type: :boolean,
|
34
48
|
desc: 'Display usage information'
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2018 Mike DeAngelo Looker Data Sciences, Inc.
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
# frozen_string_literal: true
|
23
|
+
|
24
|
+
require_relative '../../../gzr'
|
25
|
+
require_relative '../../command'
|
26
|
+
require_relative '../../modules/look'
|
27
|
+
|
28
|
+
module Gzr
|
29
|
+
module Commands
|
30
|
+
class Look
|
31
|
+
class Mv < Gzr::Command
|
32
|
+
include Gzr::Look
|
33
|
+
def initialize(look_id, target_space_id, options)
|
34
|
+
super()
|
35
|
+
@look_id = look_id
|
36
|
+
@target_space_id = target_space_id
|
37
|
+
@options = options
|
38
|
+
end
|
39
|
+
|
40
|
+
def execute(input: $stdin, output: $stdout)
|
41
|
+
say_warning("options: #{@options.inspect}", output: output) if @options[:debug]
|
42
|
+
with_session do
|
43
|
+
|
44
|
+
look = query_look(@look_id)
|
45
|
+
raise Gzr::CLI::Error, "Look with id #{@look_id} does not exist" unless look
|
46
|
+
|
47
|
+
matching_title = search_looks_by_title(look[:title],@target_space_id)
|
48
|
+
if matching_title.empty? || matching_title.first[:deleted]
|
49
|
+
matching_title = false
|
50
|
+
end
|
51
|
+
|
52
|
+
if matching_title
|
53
|
+
raise Gzr::CLI::Error, "Look #{look[:title]} already exists in space #{@target_space_id}\nUse --force if you want to overwrite it" unless @options[:force]
|
54
|
+
say_ok "Deleting existing look #{matching_title.first[:id]} #{matching_title.first[:title]} in space #{@target_space_id}", output: output
|
55
|
+
update_look(matching_title.first[:id],{:deleted=>true})
|
56
|
+
end
|
57
|
+
update_look(look[:id],{:space_id=>@target_space_id})
|
58
|
+
output.puts "Moved look #{look[:id]} to space #{@target_space_id}" unless @options[:plain]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
#
|
@@ -0,0 +1 @@
|
|
1
|
+
#
|
data/lib/gzr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gazer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.26
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike DeAngelo
|
@@ -210,6 +210,7 @@ files:
|
|
210
210
|
- lib/gzr/commands/dashboard.rb
|
211
211
|
- lib/gzr/commands/dashboard/cat.rb
|
212
212
|
- lib/gzr/commands/dashboard/import.rb
|
213
|
+
- lib/gzr/commands/dashboard/mv.rb
|
213
214
|
- lib/gzr/commands/dashboard/rm.rb
|
214
215
|
- lib/gzr/commands/group.rb
|
215
216
|
- lib/gzr/commands/group/ls.rb
|
@@ -218,6 +219,7 @@ files:
|
|
218
219
|
- lib/gzr/commands/look.rb
|
219
220
|
- lib/gzr/commands/look/cat.rb
|
220
221
|
- lib/gzr/commands/look/import.rb
|
222
|
+
- lib/gzr/commands/look/mv.rb
|
221
223
|
- lib/gzr/commands/look/rm.rb
|
222
224
|
- lib/gzr/commands/model.rb
|
223
225
|
- lib/gzr/commands/model/ls.rb
|
@@ -277,12 +279,14 @@ files:
|
|
277
279
|
- lib/gzr/templates/connection/ls/.gitkeep
|
278
280
|
- lib/gzr/templates/dashboard/cat/.gitkeep
|
279
281
|
- lib/gzr/templates/dashboard/import/.gitkeep
|
282
|
+
- lib/gzr/templates/dashboard/mv/.gitkeep
|
280
283
|
- lib/gzr/templates/dashboard/rm/.gitkeep
|
281
284
|
- lib/gzr/templates/group/ls/.gitkeep
|
282
285
|
- lib/gzr/templates/group/member_groups/.gitkeep
|
283
286
|
- lib/gzr/templates/group/member_users/.gitkeep
|
284
287
|
- lib/gzr/templates/look/cat/.gitkeep
|
285
288
|
- lib/gzr/templates/look/import/.gitkeep
|
289
|
+
- lib/gzr/templates/look/mv/.gitkeep
|
286
290
|
- lib/gzr/templates/look/rm/.gitkeep
|
287
291
|
- lib/gzr/templates/model/ls/.gitkeep
|
288
292
|
- lib/gzr/templates/permissions/ls/.gitkeep
|