rollout-ui 0.4.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28a0fb4a8472f7306389a27a5a876393b4448cd6cbaec5f2a88b8bc8efbfb5ce
4
- data.tar.gz: 973788c7f25536390ee88921f831f7ffb0e30c311106576665c79c9837bc1e7d
3
+ metadata.gz: 23d80e49f2a5b8224f029c2f3345e19028947ae8e2db02c38240cb4b3a93b3a9
4
+ data.tar.gz: 4e1bf428271120df8b39f797b43cdb0031539779dfac48a9d1d2d8e4e117c364
5
5
  SHA512:
6
- metadata.gz: 43d5446ef0c8508709a07723445ebf0334bb6b9b9f4dd4e19ec813e965d186e81f99ae1ff1e2c54f463d0385cf59b1d78f5f5a5c6fa784ff21a3e8a6eff391f1
7
- data.tar.gz: 255a70ad4639eb42da84b492e6659e3c71d39fad19fca1e5543fbb9454038dd801b23efb77527ba4bd81b0a3a4cc7298f87a31e57ad329317856aad2bcca0c54
6
+ metadata.gz: 0cb581a7d9caa5bf22d3fa404561dbbc221db7a39f0a85438a47c0033a293924c00484457e1fb5f11e995d8d1e61b7b8e2881eff094adad6265415aacd78d465
7
+ data.tar.gz: 8f8acc759b488724625a5b2c5ac147523db44ccf0f3105b4a4418f74d5f43a52fb1a23772636ec5dab13f0006a3b70d41136525050e3256dc5659037173663e5
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.7.2
1
+ 3.1.2
@@ -1,5 +1,5 @@
1
1
  class Rollout
2
2
  module UI
3
- VERSION = "0.4.0"
3
+ VERSION = "0.5.1"
4
4
  end
5
5
  end
@@ -1,68 +1,76 @@
1
1
  a.text-sm.text-blue-600(href=index_path class='hover:text-blue-700 hover:underline')
2
2
  ' ← back to overview
3
3
 
4
+ - if params[:error]
5
+ pre.text-red-500= params[:error]
4
6
  h2.font-semibold.text-xl.text-gray-500.pt-12
5
7
  = @feature.name
6
8
 
7
9
  .w-8.h-1.bg-gray-300.my-10
10
+ main.p-6.bg-gray-100.max-w-lg.w-full.text-sm.rounded-sm
11
+ form#updateFormSubmit action=feature_path(@feature.name) method='POST'
12
+ input type='hidden' name='last_updated_at' value=(@feature.data['updated_at'])
13
+ .mb-5
14
+ label.block.text-gray-500.mb-2(for='description') Description
15
+ input.appearance-none.border.rounded-sm.w-full.py-2.px-4.text-gray-600.leading-relaxed.bg-white(
16
+ name='description'
17
+ id='description'
18
+ value=@feature.data['description']
19
+ class='hover:border-gray-500'
20
+ )
8
21
 
9
- form.p-6.bg-gray-100.max-w-lg.w-full.text-sm.rounded-sm action=feature_path(@feature.name) method='POST'
10
- .mb-5
11
- label.block.text-gray-500.mb-2(for='description') Description
12
- input.appearance-none.border.rounded-sm.w-full.py-2.px-4.text-gray-600.leading-relaxed.bg-white(
13
- name='description'
14
- id='description'
15
- value=@feature.data['description']
16
- class='hover:border-gray-500'
17
- )
18
-
19
- .mb-5
20
- label.block.text-gray-500.mb-2(for='groups')
21
- | Groups
22
- span.ml-1.text-gray-400
23
- | (multi-select)
24
- select.block.appearance-none.w-full.bg-white.border.border-gray-300.px-4.py-3.rounded-sm.leading-relaxed(name="groups[]" id='groups' multiple=true size=(@rollout.groups.count + 1))
25
- option.py-1.px-1(value='' selected=(@feature.groups.count == 0))
26
- = '(none)'
27
- - @rollout.groups.each do |group|
28
- option.py-1.px-1(
29
- value=group
30
- selected=@feature.groups.include?(group)
31
- )
32
- = group
33
-
34
- .mb-5
35
- label.block.text-gray-500.mb-2(for='percentage') Percentage
36
- input.appearance-none.border.rounded-sm.w-full.py-2.px-4.text-gray-600.leading-relaxed.bg-white(
37
- name='percentage'
38
- id='percentage'
39
- value=@feature.percentage
40
- class='hover:border-gray-500'
41
- type='number'
42
- step='0.1'
43
- )
44
-
45
- .mb-5
46
- label.block.text-gray-500.mb-2 Users
22
+ .mb-5
23
+ label.block.text-gray-500.mb-2(for='groups')
24
+ | Groups
25
+ span.ml-1.text-gray-400
26
+ | (multi-select)
27
+ select.block.appearance-none.w-full.bg-white.border.border-gray-300.px-4.py-3.rounded-sm.leading-relaxed(name="groups[]" id='groups' multiple=true size=(@rollout.groups.count + 1))
28
+ option.py-1.px-1(value='' selected=(@feature.groups.count == 0))
29
+ = '(none)'
30
+ - @rollout.groups.each do |group|
31
+ option.py-1.px-1(
32
+ value=group
33
+ selected=@feature.groups.include?(group)
34
+ )
35
+ = group
47
36
 
48
- - if @feature.users.count > 100
49
- .appearance-none.border.rounded-sm.w-full.py-2.px-4.text-gray-600.leading-relaxed.bg-gray-100
50
- = @feature.users.count
51
- - else
52
- textarea.appearance-none.border.rounded-sm.w-full.py-2.px-4.text-gray-600.leading-relaxed.bg-white(
53
- name='users'
54
- id='users'
55
- value=@feature.users.join(', ')
37
+ .mb-5
38
+ label.block.text-gray-500.mb-2(for='percentage') Percentage
39
+ input.appearance-none.border.rounded-sm.w-full.py-2.px-4.text-gray-600.leading-relaxed.bg-white(
40
+ name='percentage'
41
+ id='percentage'
42
+ value=@feature.percentage
56
43
  class='hover:border-gray-500'
57
- rows='2'
44
+ type='number'
45
+ step='0.1'
58
46
  )
59
- = @feature.users.join(', ')
47
+
48
+ .mb-5
49
+ label.block.text-gray-500.mb-2 Users
50
+
51
+ - if @feature.users.count > 150
52
+ .appearance-none.border.rounded-sm.w-full.py-2.px-4.text-gray-600.leading-relaxed.bg-gray-100
53
+ = @feature.users.count
54
+ - else
55
+ textarea.appearance-none.border.rounded-sm.w-full.py-2.px-4.text-gray-600.leading-relaxed.bg-white(
56
+ name='users'
57
+ id='users'
58
+ value=@feature.users.join(', ')
59
+ class='hover:border-gray-500'
60
+ rows='2'
61
+ )
62
+ = @feature.users.join(', ')
60
63
 
61
64
  .flex.items-center.justify-end
62
65
  form action=delete_feature_path(@feature.name) method='POST'
63
66
  button.mr-5.text-gray-600(class='hover:underline' type='submit' onclick="return confirm('Are you sure you want to delete #{@feature.name}?')")
64
- ' Delete
65
- button.py-4.px-5.bg-gray-700.text-gray-200.rounded-sm.font-bold.leading-none.transition-colors.duration-200(class='hover:bg-gray-800' type='submit') Update
67
+ | Delete
68
+ button.py-4.px-5.bg-gray-700.text-gray-200.rounded-sm.font-bold.leading-none.transition-colors.duration-200(
69
+ type='submit'
70
+ class='hover:bg-gray-800'
71
+ form='updateFormSubmit'
72
+ )
73
+ | Update
66
74
 
67
75
  - history_events = @rollout.respond_to?(:logging) ? @rollout.logging.events(@feature.name).reverse : []
68
76
 
@@ -49,7 +49,10 @@ module Rollout::UI
49
49
  post '/features/:feature_name' do
50
50
  rollout = config.get(:instance)
51
51
  actor = config.get(:actor, scope: self)
52
-
52
+ feature_data = rollout.get(params[:feature_name]).data
53
+ if feature_data['updated_at'] && params[:last_updated_at] != feature_data['updated_at']
54
+ redirect "#{feature_path(params[:feature_name])}?error=Rollout version outdated. Review changes below and try again."
55
+ end
53
56
  with_rollout_context(rollout, actor: actor) do
54
57
  rollout.with_feature(params[:feature_name]) do |feature|
55
58
  feature.percentage = params[:percentage].to_f.clamp(0.0, 100.0)
@@ -58,6 +61,7 @@ module Rollout::UI
58
61
  feature.users = params[:users].split(',').map(&:strip).uniq.sort
59
62
  end
60
63
  feature.data.update(description: params[:description])
64
+ feature.data.update(updated_at: Time.now.to_i)
61
65
  end
62
66
  end
63
67
 
@@ -71,6 +75,7 @@ module Rollout::UI
71
75
  with_rollout_context(rollout, actor: actor) do
72
76
  rollout.with_feature(params[:feature_name]) do |feature|
73
77
  feature.percentage = params[:percentage].to_f.clamp(0.0, 100.0)
78
+ feature.data.update(updated_at: Time.now.to_i)
74
79
  end
75
80
  end
76
81
 
data/rollout-ui.gemspec CHANGED
@@ -25,12 +25,13 @@ Gem::Specification.new do |spec|
25
25
  spec.add_dependency 'rollout', '~> 2.5'
26
26
  spec.add_dependency 'sinatra', '~> 2.0'
27
27
  spec.add_dependency 'sinatra-contrib', '~> 2.1'
28
- spec.add_dependency 'slim', '~> 4.0'
28
+ spec.add_dependency 'slim', ['>= 3.0', '< 5.0']
29
29
 
30
30
  spec.add_development_dependency 'bundler', '>= 1.17'
31
31
  spec.add_development_dependency 'rake', '~> 10.0'
32
32
  spec.add_development_dependency 'rspec', '~> 3.0'
33
33
  spec.add_development_dependency 'rerun', '~> 0.13'
34
34
  spec.add_development_dependency 'rack-test'
35
+ spec.add_development_dependency 'puma'
35
36
  spec.add_development_dependency 'pry'
36
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollout-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - FetLife
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-03 00:00:00.000000000 Z
11
+ date: 2022-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rollout
@@ -56,16 +56,22 @@ dependencies:
56
56
  name: slim
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ - - "<"
60
63
  - !ruby/object:Gem::Version
61
- version: '4.0'
64
+ version: '5.0'
62
65
  type: :runtime
63
66
  prerelease: false
64
67
  version_requirements: !ruby/object:Gem::Requirement
65
68
  requirements:
66
- - - "~>"
69
+ - - ">="
67
70
  - !ruby/object:Gem::Version
68
- version: '4.0'
71
+ version: '3.0'
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '5.0'
69
75
  - !ruby/object:Gem::Dependency
70
76
  name: bundler
71
77
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +142,20 @@ dependencies:
136
142
  - - ">="
137
143
  - !ruby/object:Gem::Version
138
144
  version: '0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: puma
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
139
159
  - !ruby/object:Gem::Dependency
140
160
  name: pry
141
161
  requirement: !ruby/object:Gem::Requirement
@@ -185,7 +205,7 @@ homepage: https://github.com/fetlife/rollout-ui
185
205
  licenses:
186
206
  - MIT
187
207
  metadata: {}
188
- post_install_message:
208
+ post_install_message:
189
209
  rdoc_options: []
190
210
  require_paths:
191
211
  - lib
@@ -200,8 +220,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
220
  - !ruby/object:Gem::Version
201
221
  version: '0'
202
222
  requirements: []
203
- rubygems_version: 3.1.4
204
- signing_key:
223
+ rubygems_version: 3.3.21
224
+ signing_key:
205
225
  specification_version: 4
206
226
  summary: ''
207
227
  test_files: []