gazer 0.3.5 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/Gemfile.lock +1 -1
- data/lib/gzr/commands/dashboard/import_lookml.rb +8 -1
- data/lib/gzr/commands/dashboard/sync_lookml.rb +52 -0
- data/lib/gzr/commands/dashboard.rb +14 -0
- data/lib/gzr/modules/connection.rb +1 -1
- data/lib/gzr/modules/dashboard.rb +10 -0
- data/lib/gzr/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ee219afcd17f3191d17c1f87ed6b6683beecc7210736fa9da4e5190bc9cab07
|
4
|
+
data.tar.gz: 6982e0ee5cb893d2ef81e23987e7fe26f729f8c33bd417195c0d226dff01e4a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e28feecde59cbe5d3dc3b0f0da26162bd057828d2e6c615cb0598ed834e2729770fa6d4fb1a2a2ffb7e4e80624adba886a1ef17aa7990df41f05baef8d84f5b
|
7
|
+
data.tar.gz: d5688042b3437473cec0caed7e3521e1b38f10d22fee304cabfb01052c36a03a88269c16bb7b4338f74e401b2cc7470e4e169fa4c346d6efcd487893f36fc015
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.3.7](https://github.com/looker-open-source/gzr/compare/v0.3.6...v0.3.7) (2023-05-10)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* option to sync lookml dashboard on import_lookml if it exists already ([#196](https://github.com/looker-open-source/gzr/issues/196)) ([c8ec619](https://github.com/looker-open-source/gzr/commit/c8ec619186c6a0ce81633d701f78444f4e488a5b))
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* Update connection calling wrong API method ([#197](https://github.com/looker-open-source/gzr/issues/197)) ([e122b47](https://github.com/looker-open-source/gzr/commit/e122b47fca9f2ff218cff0904c147cf94d54fe69))
|
14
|
+
|
15
|
+
## [0.3.6](https://github.com/looker-open-source/gzr/compare/v0.3.5...v0.3.6) (2023-05-09)
|
16
|
+
|
17
|
+
|
18
|
+
### Features
|
19
|
+
|
20
|
+
* dashboard sync_lookml to sync UDDs with their associated lookml dashboards ([#194](https://github.com/looker-open-source/gzr/issues/194)) ([7b94a79](https://github.com/looker-open-source/gzr/commit/7b94a7962d36d865759b105b481f602aac87523e))
|
21
|
+
|
3
22
|
## [0.3.5](https://github.com/looker-open-source/gzr/compare/v0.3.4...v0.3.5) (2023-05-05)
|
4
23
|
|
5
24
|
|
data/Gemfile.lock
CHANGED
@@ -49,12 +49,19 @@ module Gzr
|
|
49
49
|
matching_title = false
|
50
50
|
end
|
51
51
|
|
52
|
-
if matching_title
|
52
|
+
if matching_title && !(matching_title.first[:lookml_link_id] == @dashboard_id)
|
53
53
|
raise Gzr::CLI::Error, "Dashboard #{dash[:title]} already exists in folder #{@target_folder_id}\nUse --force if you want to overwrite it" unless @options[:force]
|
54
54
|
say_ok "Deleting existing dashboard #{matching_title.first[:id]} #{matching_title.first[:title]} in folder #{@target_folder_id}", output: output
|
55
55
|
update_dashboard(matching_title.first[:id],{:deleted=>true})
|
56
56
|
end
|
57
57
|
|
58
|
+
if matching_title && (matching_title.first[:lookml_link_id] == @dashboard_id)
|
59
|
+
raise Gzr::CLI::Error, "Linked Dashboard #{dash[:title]} already exists in folder #{@target_folder_id}\nUse --sync if you want to synchronize it" unless @options[:sync]
|
60
|
+
say_ok "Syncing existing dashboard #{matching_title.first[:id]} #{matching_title.first[:title]} in folder #{@target_folder_id}", output: output
|
61
|
+
output.puts sync_lookml_dashboard(@dashboard_id)
|
62
|
+
return
|
63
|
+
end
|
64
|
+
|
58
65
|
new_dash = import_lookml_dashboard(@dashboard_id,@target_folder_id)
|
59
66
|
|
60
67
|
if @options[:unlink]
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, 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 SyncLookml < Gzr::Command
|
32
|
+
include Gzr::Dashboard
|
33
|
+
def initialize(dashboard_id, options)
|
34
|
+
super()
|
35
|
+
@dashboard_id = dashboard_id
|
36
|
+
@options = options
|
37
|
+
end
|
38
|
+
|
39
|
+
def execute(input: $stdin, output: $stdout)
|
40
|
+
say_warning("options: #{@options.inspect}", output: output) if @options[:debug]
|
41
|
+
with_session do
|
42
|
+
|
43
|
+
dash = query_dashboard(@dashboard_id)
|
44
|
+
raise Gzr::CLI::Error, "Dashboard with id #{@dashboard_id} does not exist" unless dash
|
45
|
+
|
46
|
+
say_ok sync_lookml_dashboard(@dashboard_id)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -104,6 +104,8 @@ module Gzr
|
|
104
104
|
desc: 'Unlink the new user defined dashboard from the LookML dashboard'
|
105
105
|
method_option :force, type: :boolean,
|
106
106
|
desc: 'Overwrite a dashboard with the same name in the target folder'
|
107
|
+
method_option :sync, type: :boolean,
|
108
|
+
desc: 'If linked dashboard already exists, sync it with LookML dashboard'
|
107
109
|
def import_lookml(dashboard_id, target_folder_id)
|
108
110
|
if options[:help]
|
109
111
|
invoke :help, ['import_lookml']
|
@@ -112,6 +114,18 @@ module Gzr
|
|
112
114
|
Gzr::Commands::Dashboard::ImportLookml.new(dashboard_id, target_folder_id, options).execute
|
113
115
|
end
|
114
116
|
end
|
117
|
+
|
118
|
+
desc 'sync_lookml DASHBOARD_ID', 'Sync any UDD from a lookml dashboard'
|
119
|
+
method_option :help, aliases: '-h', type: :boolean,
|
120
|
+
desc: 'Display usage information'
|
121
|
+
def sync_lookml(dashboard_id)
|
122
|
+
if options[:help]
|
123
|
+
invoke :help, ['sync_lookml']
|
124
|
+
else
|
125
|
+
require_relative 'dashboard/sync_lookml'
|
126
|
+
Gzr::Commands::Dashboard::SyncLookml.new(dashboard_id, options).execute
|
127
|
+
end
|
128
|
+
end
|
115
129
|
end
|
116
130
|
end
|
117
131
|
end
|
@@ -98,7 +98,7 @@ module Gzr
|
|
98
98
|
def update_connection(name,body)
|
99
99
|
data = nil
|
100
100
|
begin
|
101
|
-
data = @sdk.
|
101
|
+
data = @sdk.update_connection(name,body).to_attrs
|
102
102
|
rescue LookerSDK::NotFound => e
|
103
103
|
say_warning "Connection #{name} not found"
|
104
104
|
rescue LookerSDK::Error => e
|
@@ -364,5 +364,15 @@ module Gzr
|
|
364
364
|
raise
|
365
365
|
end
|
366
366
|
end
|
367
|
+
|
368
|
+
def sync_lookml_dashboard(id)
|
369
|
+
begin
|
370
|
+
return @sdk.sync_lookml_dashboard(id, {})
|
371
|
+
rescue LookerSDK::Error => e
|
372
|
+
say_error "Error sync_lookml_dashboard(#{id})"
|
373
|
+
say_error e
|
374
|
+
raise
|
375
|
+
end
|
376
|
+
end
|
367
377
|
end
|
368
378
|
end
|
data/lib/gzr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gazer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike DeAngelo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-reader
|
@@ -303,6 +303,7 @@ files:
|
|
303
303
|
- lib/gzr/commands/dashboard/import_lookml.rb
|
304
304
|
- lib/gzr/commands/dashboard/mv.rb
|
305
305
|
- lib/gzr/commands/dashboard/rm.rb
|
306
|
+
- lib/gzr/commands/dashboard/sync_lookml.rb
|
306
307
|
- lib/gzr/commands/folder.rb
|
307
308
|
- lib/gzr/commands/folder/cat.rb
|
308
309
|
- lib/gzr/commands/folder/create.rb
|