gazer 0.2.14 → 0.2.15
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/import.rb +21 -13
- data/lib/gzr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f1519e5c9690bd1028b3f899c281502a5d7746c
|
4
|
+
data.tar.gz: 673d9a3e988c95521fedf378ee276834d4d8345d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4fd5dc05483d6cfd4e38bfb5cfa2b12b808db121ae8dc83855caeb29c40f58fbf232b94c7d26ed413864acde333224d540f33fb5100e3cba9ae56157c42a55f
|
7
|
+
data.tar.gz: fc06b562eecf5daf51072c253dba790459dab3aecf9531969a4993fdfc2ba688894d87ce4684f40f00abbe75a2eaf1ad9e92ff150a3cd5d4fd8e0d933bf2defb
|
data/Gemfile.lock
CHANGED
@@ -90,24 +90,32 @@ module Gzr
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def sync_dashboard(source,target_space_id)
|
93
|
-
|
94
|
-
title_used = search_dashboards_by_title(source[:title], target_space_id).fetch(0,nil)
|
93
|
+
# try to find dashboard by slug in target space
|
95
94
|
existing_dashboard = search_dashboards_by_slug(source[:slug], target_space_id).fetch(0,nil) if source[:slug]
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
95
|
+
# check for dash of same title in target space
|
96
|
+
title_used = search_dashboards_by_title(source[:title], target_space_id).fetch(0,nil)
|
97
|
+
|
98
|
+
# If there is no match by slug in target space or no slug given, then we match by title
|
99
|
+
existing_dashboard ||= title_used
|
100
|
+
|
101
|
+
# same_title is now a flag indicating that there is already a dash in the same space with
|
102
|
+
# that title, and it is the one we are updating.
|
103
|
+
same_title = (title_used&.fetch(:id,nil) == existing_dashboard&.fetch(:id,nil))
|
104
|
+
|
105
|
+
# check if the slug is used by any dashboard
|
106
|
+
slug_used = search_dashboards_by_slug(source[:slug]).fetch(0,nil) if source[:slug]
|
107
|
+
|
108
|
+
# same_slug is now a flag indicating that there is already a dash with
|
109
|
+
# that slug, but it is the one we are updating.
|
110
|
+
same_slug = (slug_used&.fetch(:id,nil) == existing_dashboard&.fetch(:id,nil))
|
103
111
|
|
104
|
-
if slug_used then
|
112
|
+
if slug_used && !same_slug then
|
105
113
|
say_warning "slug #{slug_used.slug} already used for dashboard #{slug_used.title} in space #{slug_used.space_id}"
|
106
114
|
say_warning "dashboard will be imported with new slug"
|
107
115
|
end
|
108
116
|
|
109
117
|
if existing_dashboard then
|
110
|
-
if title_used then
|
118
|
+
if title_used && !same_title then
|
111
119
|
raise Gzr::CLI::Error, "Dashboard #{source[:title]} already exists in space #{target_space_id}\nDelete it before trying to upate another dashboard to have that title."
|
112
120
|
end
|
113
121
|
if @options[:force] then
|
@@ -115,10 +123,10 @@ module Gzr
|
|
115
123
|
new_dash = source.select do |k,v|
|
116
124
|
(keys_to_keep('update_dashboard') - [:space_id,:user_id,:slug]).include? k
|
117
125
|
end
|
118
|
-
new_dash[:slug] = source[:slug] unless slug_used
|
126
|
+
new_dash[:slug] = source[:slug] unless slug_used && !same_slug
|
119
127
|
return update_dashboard(existing_dashboard.id,new_dash)
|
120
128
|
else
|
121
|
-
raise Gzr::CLI::Error, "Dashboard #{
|
129
|
+
raise Gzr::CLI::Error, "Dashboard #{existing_dashboard[:title]} with slug #{existing_dashboard[:slug]} already exists in space #{target_space_id}\nUse --force if you want to overwrite it"
|
122
130
|
end
|
123
131
|
else
|
124
132
|
new_dash = source.select do |k,v|
|
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.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike DeAngelo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-reader
|