gazer 0.2.50 → 0.2.56
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/.github/scripts/parse_version.sh +16 -0
- data/.github/workflows/ruby-ci.yml +29 -5
- data/CHANGELOG.md +43 -6
- data/Gemfile.lock +18 -13
- data/lib/gzr/cli.rb +5 -0
- data/lib/gzr/commands/dashboard/cat.rb +1 -23
- data/lib/gzr/commands/dashboard/import.rb +10 -1
- data/lib/gzr/commands/look/cat.rb +1 -8
- data/lib/gzr/commands/look/import.rb +11 -0
- data/lib/gzr/commands/space/export.rb +4 -28
- data/lib/gzr/commands/space.rb +2 -0
- data/lib/gzr/modules/dashboard.rb +27 -0
- data/lib/gzr/modules/look.rb +12 -0
- data/lib/gzr/modules/plan.rb +7 -0
- data/lib/gzr/modules/session.rb +1 -1
- 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: 1ea7a19e3df2caa6fb79f02bbb863ef1688ef6fcaf7085aad7e69a6de4f746e4
|
|
4
|
+
data.tar.gz: 9bfc4b089129a37b893bccd3a618c0e4bfdd3362903e9eeb6aefde6e23a0cb15
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec1bb2791f6c6e0d7fabbdf93813b5893159f61d2cfbbe8ac2b1200ca7fb48a0d5042d3567d8eb18c9b4071181787f5ce4b4b9b4cba04b2b6278884adc7d133f
|
|
7
|
+
data.tar.gz: 8081f73a584aed294764c7bc7ede5dddde9aaa5fe23ea96e85c3a407073a5105e690c32c6b074b29ab2269169cfbb12d0d8d2c0754ddee7f59907032c5dd776b
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
BEFORE_MAJ=21
|
|
4
|
+
BEFORE_MIN=18
|
|
5
|
+
IFS=_ read -r maj min
|
|
6
|
+
if [ "$maj" -lt "$BEFORE_MAJ" ]; then
|
|
7
|
+
echo "${maj}_${min}"
|
|
8
|
+
elif [ "$maj" -eq "$BEFORE_MAJ" ]; then
|
|
9
|
+
if [ "$min" -lt "$BEFORE_MIN" ]; then
|
|
10
|
+
echo "${maj}_${min}"
|
|
11
|
+
else
|
|
12
|
+
echo "21_18"
|
|
13
|
+
fi
|
|
14
|
+
else
|
|
15
|
+
echo "21_18"
|
|
16
|
+
fi
|
|
@@ -9,16 +9,21 @@ on:
|
|
|
9
9
|
env:
|
|
10
10
|
LOOKERSDK_BASE_URL: https://localhost:20000
|
|
11
11
|
LOOKERSDK_VERIFY_SSL: false
|
|
12
|
-
TS_JUNIT_OUTPUT_DIR: results/sdk-codegen
|
|
13
12
|
LOOKERSDK_CLIENT_ID: ${{ secrets.LOOKERSDK_CLIENT_ID__21_18 }}
|
|
14
13
|
LOOKERSDK_CLIENT_SECRET: ${{ secrets.LOOKERSDK_CLIENT_SECRET__21_18 }}
|
|
15
14
|
|
|
16
15
|
jobs:
|
|
17
16
|
test:
|
|
18
|
-
|
|
19
|
-
runs-on:
|
|
17
|
+
name: Test - ${{ matrix.os }} / Looker.${{ matrix.looker }} / Ruby.${{ matrix.ruby-version }}
|
|
18
|
+
runs-on: ${{ matrix.os }}-latest
|
|
20
19
|
strategy:
|
|
21
20
|
matrix:
|
|
21
|
+
os:
|
|
22
|
+
- ubuntu
|
|
23
|
+
looker:
|
|
24
|
+
- '21_18'
|
|
25
|
+
- '21_20'
|
|
26
|
+
- '22_0'
|
|
22
27
|
ruby-version: [2.5.8]
|
|
23
28
|
|
|
24
29
|
steps:
|
|
@@ -38,11 +43,30 @@ jobs:
|
|
|
38
43
|
# TODO: can we cache some layers of the image for faster download?
|
|
39
44
|
# we probably don't want to cache the final image for IP security...
|
|
40
45
|
run: |
|
|
41
|
-
docker pull --quiet us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker
|
|
46
|
+
docker pull --quiet us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker/${{ matrix.looker }}
|
|
42
47
|
# set $LOOKER_OPTS to --no-ssl if we want to turn off ssl
|
|
43
|
-
docker run --name looker-sdk-codegen-ci -d -p 10000:9999 -p 20000:19999 us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker
|
|
48
|
+
docker run --name looker-sdk-codegen-ci -d -p 10000:9999 -p 20000:19999 us-west1-docker.pkg.dev/cloud-looker-sdk-codegen-cicd/looker/${{ matrix.looker }}
|
|
44
49
|
docker logs -f looker-sdk-codegen-ci --until=30s &
|
|
45
50
|
|
|
51
|
+
- name: Determine credentials version
|
|
52
|
+
# Prior to 21_18, each version had different credentials and a
|
|
53
|
+
# different secret. 21_20 and later all use the same credentials
|
|
54
|
+
# as 21_18. The parse_version.sh script parses the version and
|
|
55
|
+
# yields 21_12, 21_14, 21_16 etc for those versions but 21_18 for
|
|
56
|
+
# anything 21_18, 21_20, 22_0, etc.
|
|
57
|
+
#
|
|
58
|
+
# This can be factored out entirely once 21_18 is the earliest
|
|
59
|
+
# supported looker version.
|
|
60
|
+
run: |
|
|
61
|
+
echo "CREDENTIALS_VERSION=$(${{ github.workspace }}/.github/scripts/parse_version.sh <<< ${{ matrix.looker }})" >> $GITHUB_ENV
|
|
62
|
+
|
|
63
|
+
- name: Set up Looker credentials
|
|
64
|
+
# Load the correct credentials based on the version from
|
|
65
|
+
# the prior step.
|
|
66
|
+
run: |
|
|
67
|
+
echo "LOOKERSDK_CLIENT_ID=${{ secrets[format('LOOKERSDK_CLIENT_ID__{0}', env.CREDENTIALS_VERSION )] }}" >> $GITHUB_ENV
|
|
68
|
+
echo "LOOKERSDK_CLIENT_SECRET=${{ secrets[format('LOOKERSDK_CLIENT_SECRET__{0}', env.CREDENTIALS_VERSION )] }}" >> $GITHUB_ENV
|
|
69
|
+
|
|
46
70
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
47
71
|
uses: ruby/setup-ruby@v1
|
|
48
72
|
with:
|
data/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,59 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
### [0.2.
|
|
3
|
+
### [0.2.56](https://www.github.com/looker-open-source/gzr/compare/v0.2.55...v0.2.56) (2022-07-14)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- release version ([c94373c](https://www.github.com/looker-open-source/gzr/commit/c94373ce0677b4bd86e525f6a7e15b0204cb69fe))
|
|
4
8
|
|
|
9
|
+
### [0.2.55](https://github.com/looker-open-source/gzr/compare/v0.2.54...v0.2.55) (2022-07-14)
|
|
5
10
|
|
|
6
11
|
### Bug Fixes
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
- Added alias for folder command to point to space. ([#133](https://github.com/looker-open-source/gzr/issues/133)) ([e54ffe0](https://github.com/looker-open-source/gzr/commit/e54ffe0c8c1ba300b5d989c5b16b8a234e9623b1))
|
|
14
|
+
- For dashboard cat with --plans ([#131](https://github.com/looker-open-source/gzr/issues/131)) ([59c961d](https://github.com/looker-open-source/gzr/commit/59c961dca820654c8ca228fc79429079ac4825bd))
|
|
9
15
|
|
|
10
|
-
### [0.2.
|
|
16
|
+
### [0.2.54](https://www.github.com/looker-open-source/gzr/compare/v0.2.53...v0.2.54) (2022-03-17)
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
11
19
|
|
|
20
|
+
- Avoid API 4.0 for deprecation of spaces endpoint ([#124](https://www.github.com/looker-open-source/gzr/issues/124)) ([#125](https://www.github.com/looker-open-source/gzr/issues/125)) ([3823399](https://www.github.com/looker-open-source/gzr/commit/38233991bfc5456ac0cf3d485d12520f50a2ea76))
|
|
21
|
+
|
|
22
|
+
### [0.2.53](https://www.github.com/looker-open-source/gzr/compare/v0.2.52...v0.2.53) (2021-12-14)
|
|
12
23
|
|
|
13
24
|
### Bug Fixes
|
|
14
25
|
|
|
15
|
-
|
|
26
|
+
- fix version ([#121](https://www.github.com/looker-open-source/gzr/issues/121)) ([f9b0b22](https://www.github.com/looker-open-source/gzr/commit/f9b0b2237eb3c520aabc2f1ff5a63ddf6c934ce4))
|
|
16
27
|
|
|
17
|
-
### [0.2.
|
|
28
|
+
### [0.2.52](https://www.github.com/looker-open-source/gzr/compare/v0.2.51...v0.2.52) (2021-12-14)
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
18
31
|
|
|
32
|
+
- version number ([#119](https://www.github.com/looker-open-source/gzr/issues/119)) ([b55a892](https://www.github.com/looker-open-source/gzr/commit/b55a892d8d040ce4547924d613a590877e129322))
|
|
33
|
+
|
|
34
|
+
### [0.2.51](https://www.github.com/looker-open-source/gzr/compare/v0.2.50...v0.2.51) (2021-12-14)
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
- detect if dashboard import gets a look file and vice versa, warn on importing a deleted dashboard or look ([#116](https://www.github.com/looker-open-source/gzr/issues/116)) ([a12dc25](https://www.github.com/looker-open-source/gzr/commit/a12dc2525bed55816b368306f2d05a24dc07aaf4))
|
|
39
|
+
- Gemfile.lock was out of date ([a4e49c3](https://www.github.com/looker-open-source/gzr/commit/a4e49c3972772e0629a8f1589172ddd136ee7e21))
|
|
40
|
+
- refactored look and dashboard cat commands and space export to use the same code to generate each look and dashboard file. ([#114](https://www.github.com/looker-open-source/gzr/issues/114)) ([8dadd50](https://www.github.com/looker-open-source/gzr/commit/8dadd500376e2b971c38dbcd69f507268a3e6b9e))
|
|
41
|
+
- remove Thor deprecation warning ([#115](https://www.github.com/looker-open-source/gzr/issues/115)) ([1100c5a](https://www.github.com/looker-open-source/gzr/commit/1100c5a24b0626c01c6248d87172c7ab624bf42f))
|
|
42
|
+
|
|
43
|
+
### [0.2.50](https://www.github.com/looker-open-source/gzr/compare/v0.2.49...v0.2.50) (2021-11-19)
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
- resolved warnings in gemspec. Improved handling of live tests ([6291147](https://www.github.com/looker-open-source/gzr/commit/6291147a09f55ed095d718a7a998d5af09b716e3))
|
|
48
|
+
|
|
49
|
+
### [0.2.49](https://www.github.com/looker-open-source/gzr/compare/v0.2.48...v0.2.49) (2021-11-18)
|
|
50
|
+
|
|
51
|
+
### Bug Fixes
|
|
52
|
+
|
|
53
|
+
- Bump version ([652486c](https://www.github.com/looker-open-source/gzr/commit/652486ce6571d4fea2d3ea847c5927395aa4373e))
|
|
54
|
+
|
|
55
|
+
### [0.2.48](https://www.github.com/looker-open-source/gzr/compare/v0.2.47...v0.2.48) (2021-11-18)
|
|
19
56
|
|
|
20
57
|
### Bug Fixes
|
|
21
58
|
|
|
22
|
-
|
|
59
|
+
- Add release please workflow to automate releases ([6279bc6](https://www.github.com/looker-open-source/gzr/commit/6279bc68fcfd8f09f7385053767e6a9571570333))
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
gazer (0.2.
|
|
4
|
+
gazer (0.2.56)
|
|
5
5
|
looker-sdk (~> 0.1.1)
|
|
6
6
|
net-http-persistent (~> 4.0, >= 4.0.1)
|
|
7
7
|
netrc (~> 0.11.0)
|
|
@@ -19,35 +19,39 @@ GEM
|
|
|
19
19
|
public_suffix (>= 2.0.2, < 5.0)
|
|
20
20
|
connection_pool (2.2.5)
|
|
21
21
|
diff-lcs (1.4.4)
|
|
22
|
-
faraday (1.
|
|
22
|
+
faraday (1.10.0)
|
|
23
23
|
faraday-em_http (~> 1.0)
|
|
24
24
|
faraday-em_synchrony (~> 1.0)
|
|
25
25
|
faraday-excon (~> 1.1)
|
|
26
|
-
faraday-httpclient (~> 1.0
|
|
26
|
+
faraday-httpclient (~> 1.0)
|
|
27
|
+
faraday-multipart (~> 1.0)
|
|
27
28
|
faraday-net_http (~> 1.0)
|
|
28
|
-
faraday-net_http_persistent (~> 1.
|
|
29
|
+
faraday-net_http_persistent (~> 1.0)
|
|
29
30
|
faraday-patron (~> 1.0)
|
|
30
31
|
faraday-rack (~> 1.0)
|
|
31
|
-
|
|
32
|
+
faraday-retry (~> 1.0)
|
|
32
33
|
ruby2_keywords (>= 0.0.4)
|
|
33
34
|
faraday-em_http (1.0.0)
|
|
34
35
|
faraday-em_synchrony (1.0.0)
|
|
35
36
|
faraday-excon (1.1.0)
|
|
36
37
|
faraday-httpclient (1.0.1)
|
|
38
|
+
faraday-multipart (1.0.4)
|
|
39
|
+
multipart-post (~> 2)
|
|
37
40
|
faraday-net_http (1.0.1)
|
|
38
41
|
faraday-net_http_persistent (1.2.0)
|
|
39
42
|
faraday-patron (1.0.0)
|
|
40
43
|
faraday-rack (1.0.0)
|
|
41
|
-
|
|
44
|
+
faraday-retry (1.0.3)
|
|
45
|
+
looker-sdk (0.1.2)
|
|
42
46
|
faraday (>= 1.2, < 2.0)
|
|
43
47
|
sawyer (~> 0.8)
|
|
44
|
-
multipart-post (2.
|
|
48
|
+
multipart-post (2.2.3)
|
|
45
49
|
net-http-persistent (4.0.1)
|
|
46
50
|
connection_pool (~> 2.2)
|
|
47
51
|
netrc (0.11.0)
|
|
48
52
|
pastel (0.8.0)
|
|
49
53
|
tty-color (~> 0.5)
|
|
50
|
-
public_suffix (4.0.
|
|
54
|
+
public_suffix (4.0.7)
|
|
51
55
|
rake (12.3.3)
|
|
52
56
|
rspec (3.10.0)
|
|
53
57
|
rspec-core (~> 3.10.0)
|
|
@@ -64,15 +68,15 @@ GEM
|
|
|
64
68
|
rspec-support (3.10.2)
|
|
65
69
|
ruby2_keywords (0.0.5)
|
|
66
70
|
rubyzip (1.3.0)
|
|
67
|
-
sawyer (0.
|
|
71
|
+
sawyer (0.9.2)
|
|
68
72
|
addressable (>= 2.3.5)
|
|
69
|
-
faraday (
|
|
73
|
+
faraday (>= 0.17.3, < 3)
|
|
70
74
|
strings (0.2.1)
|
|
71
75
|
strings-ansi (~> 0.2)
|
|
72
76
|
unicode-display_width (>= 1.5, < 3.0)
|
|
73
77
|
unicode_utils (~> 1.4)
|
|
74
78
|
strings-ansi (0.2.0)
|
|
75
|
-
thor (1.1
|
|
79
|
+
thor (1.2.1)
|
|
76
80
|
tty-color (0.6.0)
|
|
77
81
|
tty-cursor (0.7.1)
|
|
78
82
|
tty-reader (0.9.0)
|
|
@@ -85,11 +89,12 @@ GEM
|
|
|
85
89
|
strings (~> 0.2.0)
|
|
86
90
|
tty-screen (~> 0.8)
|
|
87
91
|
tty-tree (0.4.0)
|
|
88
|
-
unicode-display_width (2.
|
|
92
|
+
unicode-display_width (2.2.0)
|
|
89
93
|
unicode_utils (1.4.0)
|
|
90
94
|
wisper (2.0.1)
|
|
91
95
|
|
|
92
96
|
PLATFORMS
|
|
97
|
+
x86_64-darwin-21
|
|
93
98
|
x86_64-linux
|
|
94
99
|
|
|
95
100
|
DEPENDENCIES
|
|
@@ -102,4 +107,4 @@ RUBY VERSION
|
|
|
102
107
|
ruby 2.5.8p224
|
|
103
108
|
|
|
104
109
|
BUNDLED WITH
|
|
105
|
-
2.
|
|
110
|
+
2.3.9
|
data/lib/gzr/cli.rb
CHANGED
|
@@ -29,6 +29,10 @@ module Gzr
|
|
|
29
29
|
#
|
|
30
30
|
# @api public
|
|
31
31
|
class CLI < Thor
|
|
32
|
+
def self.exit_on_failure?
|
|
33
|
+
true
|
|
34
|
+
end
|
|
35
|
+
|
|
32
36
|
class_option :debug, type: :boolean, default: false, desc: 'Run in debug mode'
|
|
33
37
|
class_option :host, type: :string, default: 'localhost', desc: 'Looker Host'
|
|
34
38
|
class_option :port, type: :string, default: '19999', desc: 'Looker API Port'
|
|
@@ -53,6 +57,7 @@ module Gzr
|
|
|
53
57
|
puts "v#{Gzr::VERSION}"
|
|
54
58
|
end
|
|
55
59
|
map %w(--version -v) => :version
|
|
60
|
+
map folder: :space # Alias folder command to space
|
|
56
61
|
|
|
57
62
|
require_relative 'commands/attribute'
|
|
58
63
|
register Gzr::Commands::Attribute, 'attribute', 'attribute [SUBCOMMAND]', 'Command description...'
|
|
@@ -43,29 +43,7 @@ module Gzr
|
|
|
43
43
|
def execute(*args, input: $stdin, output: $stdout)
|
|
44
44
|
say_warning("options: #{@options.inspect}") if @options[:debug]
|
|
45
45
|
with_session("3.1") do
|
|
46
|
-
data =
|
|
47
|
-
data[:dashboard_elements].each_index do |i|
|
|
48
|
-
element = data[:dashboard_elements][i]
|
|
49
|
-
find_vis_config_reference(element) do |vis_config|
|
|
50
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
|
51
|
-
rewrite_color_palette!(o,default_colors)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
merge_result = merge_query(element[:merge_result_id])&.to_attrs if element[:merge_result_id]
|
|
55
|
-
if merge_result
|
|
56
|
-
merge_result[:source_queries].each_index do |j|
|
|
57
|
-
source_query = merge_result[:source_queries][j]
|
|
58
|
-
merge_result[:source_queries][j][:query] = query(source_query[:query_id]).to_attrs
|
|
59
|
-
end
|
|
60
|
-
find_vis_config_reference(merge_result) do |vis_config|
|
|
61
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
|
62
|
-
rewrite_color_palette!(o,default_colors)
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
data[:dashboard_elements][i][:merge_result] = merge_result
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
data[:scheduled_plans] = query_scheduled_plans_for_dashboard(@dashboard_id,"all").to_attrs if @options[:plans]
|
|
46
|
+
data = cat_dashboard(@dashboard_id)
|
|
69
47
|
|
|
70
48
|
replacements = {}
|
|
71
49
|
if @options[:transform]
|
|
@@ -53,8 +53,17 @@ module Gzr
|
|
|
53
53
|
|
|
54
54
|
read_file(@file) do |data|
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
if data[:deleted]
|
|
57
|
+
say_warning("Attempt to import a deleted dashboard!")
|
|
58
|
+
say_warning("This may result in errors.")
|
|
59
|
+
end
|
|
57
60
|
|
|
61
|
+
if !data[:dashboard_elements]
|
|
62
|
+
say_error("File contains no dashboard_elements! Is this a look?")
|
|
63
|
+
raise Gzr::CLI::Error, "import file is not a valid dashboard"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
dashboard = sync_dashboard(data,@dest_space_id, output: output)
|
|
58
67
|
|
|
59
68
|
dashboard[:dashboard_filters] ||= []
|
|
60
69
|
source_filters = data[:dashboard_filters].sort { |a,b| a[:row] <=> b[:row] }
|
|
@@ -42,14 +42,7 @@ module Gzr
|
|
|
42
42
|
def execute(input: $stdin, output: $stdout)
|
|
43
43
|
say_warning("options: #{@options.inspect}") if @options[:debug]
|
|
44
44
|
with_session do
|
|
45
|
-
data =
|
|
46
|
-
find_vis_config_reference(data) do |vis_config|
|
|
47
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
|
48
|
-
rewrite_color_palette!(o,default_colors)
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
data[:scheduled_plans] = query_scheduled_plans_for_look(@look_id,"all").to_attrs if @options[:plans]
|
|
45
|
+
data = cat_look(@look_id)
|
|
53
46
|
file_name = if @options[:dir]
|
|
54
47
|
@options[:simple_filename] ? "Look_#{data[:id]}.json" : "Look_#{data[:id]}_#{data[:title]}.json"
|
|
55
48
|
else
|
|
@@ -49,6 +49,17 @@ module Gzr
|
|
|
49
49
|
@me ||= query_me("id")
|
|
50
50
|
|
|
51
51
|
read_file(@file) do |data|
|
|
52
|
+
|
|
53
|
+
if data[:deleted]
|
|
54
|
+
say_warning("Attempt to import a deleted look!")
|
|
55
|
+
say_warning("This may result in errors.")
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
if data[:dashboard_elements]
|
|
59
|
+
say_error("File contains dashboard_elements! Is this a dashboard?")
|
|
60
|
+
raise Gzr::CLI::Error, "import file is not a valid look"
|
|
61
|
+
end
|
|
62
|
+
|
|
52
63
|
look = upsert_look(@me.id,create_fetch_query(data[:query]).id,@dest_space_id,data,output: output)
|
|
53
64
|
upsert_plans_for_look(look.id,@me.id,data[:scheduled_plans]) if data[:scheduled_plans]
|
|
54
65
|
output.puts "Imported look #{look.id}" unless @options[:plain]
|
|
@@ -25,6 +25,7 @@ require_relative '../../command'
|
|
|
25
25
|
require_relative '../../modules/space'
|
|
26
26
|
require_relative '../../modules/look'
|
|
27
27
|
require_relative '../../modules/dashboard'
|
|
28
|
+
require_relative '../../modules/plan'
|
|
28
29
|
require_relative '../../modules/filehelper'
|
|
29
30
|
require 'pathname'
|
|
30
31
|
require 'stringio'
|
|
@@ -37,6 +38,7 @@ module Gzr
|
|
|
37
38
|
include Gzr::Space
|
|
38
39
|
include Gzr::Look
|
|
39
40
|
include Gzr::Dashboard
|
|
41
|
+
include Gzr::Plan
|
|
40
42
|
include Gzr::FileHelper
|
|
41
43
|
def initialize(space_id, options)
|
|
42
44
|
super()
|
|
@@ -96,39 +98,13 @@ module Gzr
|
|
|
96
98
|
end)
|
|
97
99
|
end
|
|
98
100
|
space[:looks].each do |l|
|
|
99
|
-
look =
|
|
100
|
-
find_vis_config_reference(look) do |vis_config|
|
|
101
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
|
102
|
-
rewrite_color_palette!(o,default_colors)
|
|
103
|
-
end
|
|
104
|
-
end
|
|
101
|
+
look = cat_look(l[:id])
|
|
105
102
|
write_file("Look_#{look[:id]}_#{look[:title]}.json", base, path) do |f|
|
|
106
103
|
f.write JSON.pretty_generate(look)
|
|
107
104
|
end
|
|
108
105
|
end
|
|
109
106
|
space[:dashboards].each do |d|
|
|
110
|
-
data =
|
|
111
|
-
data[:dashboard_elements].each_index do |i|
|
|
112
|
-
element = data[:dashboard_elements][i]
|
|
113
|
-
find_vis_config_reference(element) do |vis_config|
|
|
114
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
|
115
|
-
rewrite_color_palette!(o,default_colors)
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
merge_result = merge_query(element[:merge_result_id])&.to_attrs() if element[:merge_result_id]
|
|
119
|
-
if merge_result
|
|
120
|
-
merge_result[:source_queries].each_index do |j|
|
|
121
|
-
source_query = merge_result[:source_queries][j]
|
|
122
|
-
merge_result[:source_queries][j][:query] = query(source_query[:query_id]).to_attrs()
|
|
123
|
-
end
|
|
124
|
-
find_vis_config_reference(merge_result) do |vis_config|
|
|
125
|
-
find_color_palette_reference(vis_config) do |o,default_colors|
|
|
126
|
-
rewrite_color_palette!(o,default_colors)
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
data[:dashboard_elements][i][:merge_result] = merge_result
|
|
130
|
-
end
|
|
131
|
-
end
|
|
107
|
+
data = cat_dashboard(d[:id])
|
|
132
108
|
write_file("Dashboard_#{data[:id]}_#{data[:title]}.json", base, path) do |f|
|
|
133
109
|
f.write JSON.pretty_generate(data)
|
|
134
110
|
end
|
data/lib/gzr/commands/space.rb
CHANGED
|
@@ -64,6 +64,8 @@ module Gzr
|
|
|
64
64
|
desc 'export SPACE_ID', 'Export a space, including all child looks, dashboards, and spaces.'
|
|
65
65
|
method_option :help, aliases: '-h', type: :boolean,
|
|
66
66
|
desc: 'Display usage information'
|
|
67
|
+
method_option :plans, type: :boolean,
|
|
68
|
+
desc: 'Include scheduled plans'
|
|
67
69
|
method_option :dir, type: :string, default: '.',
|
|
68
70
|
desc: 'Directory to store output tree'
|
|
69
71
|
method_option :tar, type: :string,
|
|
@@ -226,5 +226,32 @@ module Gzr
|
|
|
226
226
|
end
|
|
227
227
|
data
|
|
228
228
|
end
|
|
229
|
+
|
|
230
|
+
def cat_dashboard(dashboard_id)
|
|
231
|
+
data = query_dashboard(dashboard_id).to_attrs
|
|
232
|
+
data[:dashboard_elements].each_index do |i|
|
|
233
|
+
element = data[:dashboard_elements][i]
|
|
234
|
+
find_vis_config_reference(element) do |vis_config|
|
|
235
|
+
find_color_palette_reference(vis_config) do |o,default_colors|
|
|
236
|
+
rewrite_color_palette!(o,default_colors)
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
merge_result = merge_query(element[:merge_result_id])&.to_attrs if element[:merge_result_id]
|
|
240
|
+
if merge_result
|
|
241
|
+
merge_result[:source_queries].each_index do |j|
|
|
242
|
+
source_query = merge_result[:source_queries][j]
|
|
243
|
+
merge_result[:source_queries][j][:query] = query(source_query[:query_id]).to_attrs
|
|
244
|
+
end
|
|
245
|
+
find_vis_config_reference(merge_result) do |vis_config|
|
|
246
|
+
find_color_palette_reference(vis_config) do |o,default_colors|
|
|
247
|
+
rewrite_color_palette!(o,default_colors)
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
data[:dashboard_elements][i][:merge_result] = merge_result
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
data[:scheduled_plans] = query_scheduled_plans_for_dashboard(@dashboard_id,"all") if @options[:plans]
|
|
254
|
+
data
|
|
255
|
+
end
|
|
229
256
|
end
|
|
230
257
|
end
|
data/lib/gzr/modules/look.rb
CHANGED
|
@@ -188,5 +188,17 @@ module Gzr
|
|
|
188
188
|
end
|
|
189
189
|
return create_merge_query(new_merge_result)
|
|
190
190
|
end
|
|
191
|
+
|
|
192
|
+
def cat_look(look_id)
|
|
193
|
+
data = query_look(look_id).to_attrs
|
|
194
|
+
find_vis_config_reference(data) do |vis_config|
|
|
195
|
+
find_color_palette_reference(vis_config) do |o,default_colors|
|
|
196
|
+
rewrite_color_palette!(o,default_colors)
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
data[:scheduled_plans] = query_scheduled_plans_for_look(@look_id,"all")&.to_attrs if @options[:plans]
|
|
201
|
+
data
|
|
202
|
+
end
|
|
191
203
|
end
|
|
192
204
|
end
|
data/lib/gzr/modules/plan.rb
CHANGED
|
@@ -49,6 +49,9 @@ module Gzr
|
|
|
49
49
|
data = nil
|
|
50
50
|
begin
|
|
51
51
|
data = @sdk.scheduled_plans_for_look(look_id,req)
|
|
52
|
+
return nil if data.respond_to?(:message) && data.message == 'Not found'
|
|
53
|
+
rescue LookerSDK::NotFound
|
|
54
|
+
return nil
|
|
52
55
|
rescue LookerSDK::ClientError => e
|
|
53
56
|
say_error "Unable to get scheduled_plans_for_look(#{look_id},#{JSON.pretty_generate(req)})"
|
|
54
57
|
say_error e.message
|
|
@@ -65,11 +68,15 @@ module Gzr
|
|
|
65
68
|
data = nil
|
|
66
69
|
begin
|
|
67
70
|
data = @sdk.scheduled_plans_for_dashboard(dashboard_id,req)
|
|
71
|
+
return nil if data.respond_to?(:message) && data.message == 'Not found'
|
|
72
|
+
rescue LookerSDK::NotFound
|
|
73
|
+
return nil
|
|
68
74
|
rescue LookerSDK::ClientError => e
|
|
69
75
|
say_error "Unable to get scheduled_plans_for_dashboard(#{dashboard_id},#{JSON.pretty_generate(req)})"
|
|
70
76
|
say_error e.message
|
|
71
77
|
raise
|
|
72
78
|
end
|
|
79
|
+
data.map! {|plan| plan.to_attrs}
|
|
73
80
|
data
|
|
74
81
|
end
|
|
75
82
|
|
data/lib/gzr/modules/session.rb
CHANGED
|
@@ -155,7 +155,7 @@ module Gzr
|
|
|
155
155
|
begin
|
|
156
156
|
versions_response = agent.call(:get,"/versions")
|
|
157
157
|
@versions = versions_response.data.supported_versions
|
|
158
|
-
@current_version =
|
|
158
|
+
@current_version = "3.1"
|
|
159
159
|
rescue Faraday::SSLError => e
|
|
160
160
|
raise Gzr::CLI::Error, "SSL Certificate could not be verified\nDo you need the --no-verify-ssl option or the --no-ssl option?"
|
|
161
161
|
rescue Faraday::ConnectionFailed => cf
|
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.2.
|
|
4
|
+
version: 0.2.56
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike DeAngelo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-07-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: tty-reader
|
|
@@ -216,6 +216,7 @@ executables:
|
|
|
216
216
|
extensions: []
|
|
217
217
|
extra_rdoc_files: []
|
|
218
218
|
files:
|
|
219
|
+
- ".github/scripts/parse_version.sh"
|
|
219
220
|
- ".github/scripts/wait_for_looker.sh"
|
|
220
221
|
- ".github/workflows/release.yml"
|
|
221
222
|
- ".github/workflows/ruby-ci.yml"
|