admission 0.2.1 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -5
- data/bin/build +10 -0
- data/lib/admission/arbitration.rb +1 -0
- data/lib/admission/resource_arbitration.rb +4 -0
- data/lib/admission/version.rb +1 -1
- data/lib/admission/visualisation_app.rb +125 -0
- data/visualisation/components/app_container.jsx +7 -2
- data/visualisation/components/input_with_select.jsx +30 -17
- data/visualisation/components/nested_list_row.jsx +48 -0
- data/visualisation/components/privilege_select.jsx +28 -9
- data/visualisation/components/privileges_panel.jsx +62 -3
- data/visualisation/components/rules_panel.jsx +124 -0
- data/visualisation/dist/app.js +6 -0
- data/visualisation/helpers.js +69 -0
- data/visualisation/index.jsx +17 -60
- data/visualisation/package.json +4 -1
- data/visualisation/reducers/index.js +9 -4
- data/visualisation/server.rb +23 -0
- data/visualisation/style.scss +124 -19
- data/visualisation/webpack.config.js +13 -3
- data/visualisation/yarn.lock +28 -0
- metadata +9 -4
- data/bin/server.rb +0 -26
- data/lib/admission/visualisation.rb +0 -81
data/visualisation/style.scss
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
$border-color: black;
|
2
|
-
|
3
|
-
$
|
2
|
+
//$border-color2: #6d3291;
|
3
|
+
$border-color2: #4a207e;
|
4
|
+
$bg-color: #eee6ff;
|
5
|
+
$bg-selected: #d5c3fc;
|
4
6
|
|
5
7
|
$border: 5;
|
6
8
|
|
@@ -22,18 +24,25 @@ html, body {
|
|
22
24
|
body {
|
23
25
|
margin: 0;
|
24
26
|
align-items: center;
|
25
|
-
justify-content: center;
|
27
|
+
//justify-content: center;
|
26
28
|
background-color: #717171;
|
29
|
+
overflow-y: scroll;
|
27
30
|
}
|
28
31
|
|
29
32
|
#admission-visualisation {
|
30
33
|
flex: 0 0;
|
31
34
|
max-width: 100%;
|
32
35
|
max-height: 100%;
|
33
|
-
background-color: $bg-color;
|
34
36
|
|
35
37
|
.splash-message {
|
36
38
|
padding: px(2 * $border);
|
39
|
+
background-color: $bg-color;
|
40
|
+
margin: px(10 * $border) 0;
|
41
|
+
}
|
42
|
+
|
43
|
+
.admission-app-container {
|
44
|
+
background-color: $bg-color;
|
45
|
+
margin: px(10 * $border) 0;
|
37
46
|
}
|
38
47
|
|
39
48
|
.panels-list {
|
@@ -46,16 +55,19 @@ body {
|
|
46
55
|
margin: px($border);
|
47
56
|
margin-left: 0;
|
48
57
|
padding: px(2 * $border);
|
49
|
-
border:
|
58
|
+
border: 2px solid $border-color;
|
50
59
|
cursor: pointer;
|
51
60
|
font-weight: bold;
|
52
61
|
&:first-of-type { margin-left: px($border); }
|
53
62
|
|
54
63
|
&.active {
|
55
|
-
|
56
|
-
border-style:
|
64
|
+
background-color: $bg-selected;
|
65
|
+
border-style: solid;
|
57
66
|
color: $border-color2;
|
58
67
|
}
|
68
|
+
&:hover {
|
69
|
+
background-color: $bg-selected;
|
70
|
+
}
|
59
71
|
}
|
60
72
|
}
|
61
73
|
|
@@ -63,13 +75,6 @@ body {
|
|
63
75
|
padding: px($border);
|
64
76
|
}
|
65
77
|
|
66
|
-
.controls-row {
|
67
|
-
> * {
|
68
|
-
display: inline-block;
|
69
|
-
margin-left: px($border);
|
70
|
-
&:first-child { margin-left: 0; }
|
71
|
-
}
|
72
|
-
}
|
73
78
|
}
|
74
79
|
|
75
80
|
.flex-column {
|
@@ -90,18 +95,34 @@ body {
|
|
90
95
|
}
|
91
96
|
}
|
92
97
|
|
98
|
+
.check_box {
|
99
|
+
display: inline-block;
|
100
|
+
padding: px($border);
|
101
|
+
border: 1px solid $border-color;
|
102
|
+
background-color: white;
|
103
|
+
&.checked { background-color: $bg-selected; }
|
104
|
+
&:hover { cursor: pointer }
|
105
|
+
}
|
106
|
+
|
93
107
|
.button {
|
108
|
+
display: inline-block;
|
94
109
|
padding: px($border);
|
95
110
|
margin: 0;
|
96
111
|
border: 1px solid $border-color;
|
97
112
|
border-radius: 0;
|
98
113
|
background-color: white;
|
99
114
|
&:hover {
|
100
|
-
background-color:
|
115
|
+
background-color: $bg-selected;
|
116
|
+
cursor: pointer;
|
117
|
+
}
|
118
|
+
|
119
|
+
&.small {
|
120
|
+
font-size: 80%;
|
121
|
+
padding: px($border / 2);
|
101
122
|
}
|
102
123
|
}
|
103
124
|
|
104
|
-
.
|
125
|
+
.select_box {
|
105
126
|
> ._inputs {
|
106
127
|
display: flex;
|
107
128
|
> input {
|
@@ -117,27 +138,111 @@ body {
|
|
117
138
|
> ._dropdown {
|
118
139
|
position: relative;
|
119
140
|
> ul {
|
141
|
+
z-index: 1;
|
120
142
|
background-color: white;
|
121
143
|
position: absolute;
|
122
|
-
width:
|
144
|
+
max-width: 300%;
|
123
145
|
border: 1px solid $border-color;
|
124
|
-
border-top: none;
|
125
146
|
list-style-type: none;
|
126
147
|
margin: 0;
|
127
148
|
padding: 0;
|
149
|
+
top: -1px;
|
128
150
|
> li {
|
129
151
|
@include no-select();
|
130
152
|
padding: px($border);
|
131
153
|
border: 1px solid transparent;
|
154
|
+
overflow: hidden;
|
132
155
|
&.selected {
|
133
156
|
background-color: $border-color2;
|
134
157
|
color: white;
|
135
158
|
}
|
136
159
|
&:hover {
|
137
|
-
background-color: $bg-
|
160
|
+
background-color: $bg-selected;
|
161
|
+
color: inherit;
|
138
162
|
}
|
139
163
|
}
|
140
164
|
}
|
141
165
|
}
|
142
166
|
|
167
|
+
}
|
168
|
+
|
169
|
+
.controls {
|
170
|
+
> .controls-group {
|
171
|
+
margin-left: px($border);
|
172
|
+
border-left: 1px solid $border-color;
|
173
|
+
padding-left: px($border);
|
174
|
+
|
175
|
+
&:first-child {
|
176
|
+
margin-left: 0;
|
177
|
+
border-left: none;
|
178
|
+
padding-left: 0;
|
179
|
+
}
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
.controls-group {
|
184
|
+
display: inline-block;
|
185
|
+
margin: px($border) 0;
|
186
|
+
> * {
|
187
|
+
display: inline-block;
|
188
|
+
margin-left: px($border);
|
189
|
+
&:first-child { margin-left: 0; }
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
.nested-list {
|
194
|
+
$_color: black;
|
195
|
+
|
196
|
+
width: 500px;
|
197
|
+
padding: px($border) 0 0 0;
|
198
|
+
list-style-type: none;
|
199
|
+
margin: 0 0 0 px($border);
|
200
|
+
z-index: 0;
|
201
|
+
|
202
|
+
.nested-list-content {
|
203
|
+
display: inline-block;
|
204
|
+
.icon {
|
205
|
+
margin-left: px($border);
|
206
|
+
}
|
207
|
+
.content {
|
208
|
+
margin-left: px($border);
|
209
|
+
}
|
210
|
+
}
|
211
|
+
|
212
|
+
position: relative;
|
213
|
+
&:before {
|
214
|
+
content: '';
|
215
|
+
position: absolute;
|
216
|
+
display: block;
|
217
|
+
width: 0;
|
218
|
+
top: 0;
|
219
|
+
bottom: 0;
|
220
|
+
left: 0;
|
221
|
+
border-left: 1px solid $_color;
|
222
|
+
}
|
223
|
+
|
224
|
+
> li {
|
225
|
+
padding-left: px(3*$border);
|
226
|
+
line-height: 1.5em;
|
227
|
+
|
228
|
+
position: relative;
|
229
|
+
&:before {
|
230
|
+
content: '';
|
231
|
+
position: absolute;
|
232
|
+
display: block;
|
233
|
+
width: px(3*$border);
|
234
|
+
height: 0;
|
235
|
+
margin-top: px(1);
|
236
|
+
top: 0.75em;
|
237
|
+
left: 0;
|
238
|
+
border-top: 1px solid $_color;
|
239
|
+
}
|
240
|
+
&:last-child:before {
|
241
|
+
background-color: $bg-color;
|
242
|
+
height: auto;
|
243
|
+
top: 0.75em;
|
244
|
+
bottom: 0;
|
245
|
+
}
|
246
|
+
}
|
247
|
+
|
143
248
|
}
|
@@ -1,10 +1,18 @@
|
|
1
1
|
var path = require('path');
|
2
|
+
var UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
3
|
+
|
4
|
+
var production_build = process.env.BUILD === 'dist';
|
5
|
+
|
6
|
+
var plugins = [];
|
7
|
+
if (production_build) {
|
8
|
+
plugins.push(new UglifyJSPlugin({output: {ascii_only: true}}));
|
9
|
+
}
|
2
10
|
|
3
11
|
module.exports = {
|
4
12
|
entry: './index.jsx',
|
5
13
|
output: {
|
6
|
-
filename: '
|
7
|
-
path: path.resolve(__dirname, 'build')
|
14
|
+
filename: 'app.js',
|
15
|
+
path: path.resolve(__dirname, (production_build ? 'dist' : 'build'))
|
8
16
|
},
|
9
17
|
|
10
18
|
module: {
|
@@ -28,5 +36,7 @@ module.exports = {
|
|
28
36
|
|
29
37
|
resolve: {
|
30
38
|
extensions: ['.js', '.jsx']
|
31
|
-
}
|
39
|
+
},
|
40
|
+
|
41
|
+
plugins: plugins
|
32
42
|
};
|
data/visualisation/yarn.lock
CHANGED
@@ -2878,6 +2878,10 @@ source-list-map@^1.1.1:
|
|
2878
2878
|
version "1.1.2"
|
2879
2879
|
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-1.1.2.tgz#9889019d1024cce55cdc069498337ef6186a11a1"
|
2880
2880
|
|
2881
|
+
source-list-map@^2.0.0:
|
2882
|
+
version "2.0.0"
|
2883
|
+
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.0.tgz#aaa47403f7b245a92fbc97ea08f250d6087ed085"
|
2884
|
+
|
2881
2885
|
source-map-support@^0.4.2:
|
2882
2886
|
version "0.4.15"
|
2883
2887
|
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.15.tgz#03202df65c06d2bd8c7ec2362a193056fef8d3b1"
|
@@ -3106,10 +3110,27 @@ uglify-js@^2.8.27:
|
|
3106
3110
|
optionalDependencies:
|
3107
3111
|
uglify-to-browserify "~1.0.0"
|
3108
3112
|
|
3113
|
+
uglify-js@^2.8.29:
|
3114
|
+
version "2.8.29"
|
3115
|
+
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd"
|
3116
|
+
dependencies:
|
3117
|
+
source-map "~0.5.1"
|
3118
|
+
yargs "~3.10.0"
|
3119
|
+
optionalDependencies:
|
3120
|
+
uglify-to-browserify "~1.0.0"
|
3121
|
+
|
3109
3122
|
uglify-to-browserify@~1.0.0:
|
3110
3123
|
version "1.0.2"
|
3111
3124
|
resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
|
3112
3125
|
|
3126
|
+
uglifyjs-webpack-plugin@^0.4.6:
|
3127
|
+
version "0.4.6"
|
3128
|
+
resolved "https://registry.yarnpkg.com/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-0.4.6.tgz#b951f4abb6bd617e66f63eb891498e391763e309"
|
3129
|
+
dependencies:
|
3130
|
+
source-map "^0.5.6"
|
3131
|
+
uglify-js "^2.8.29"
|
3132
|
+
webpack-sources "^1.0.1"
|
3133
|
+
|
3113
3134
|
uid-number@^0.0.6:
|
3114
3135
|
version "0.0.6"
|
3115
3136
|
resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81"
|
@@ -3187,6 +3208,13 @@ webpack-sources@^0.2.3:
|
|
3187
3208
|
source-list-map "^1.1.1"
|
3188
3209
|
source-map "~0.5.3"
|
3189
3210
|
|
3211
|
+
webpack-sources@^1.0.1:
|
3212
|
+
version "1.0.1"
|
3213
|
+
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.0.1.tgz#c7356436a4d13123be2e2426a05d1dad9cbe65cf"
|
3214
|
+
dependencies:
|
3215
|
+
source-list-map "^2.0.0"
|
3216
|
+
source-map "~0.5.3"
|
3217
|
+
|
3190
3218
|
webpack@^2.6.1:
|
3191
3219
|
version "2.6.1"
|
3192
3220
|
resolved "https://registry.yarnpkg.com/webpack/-/webpack-2.6.1.tgz#2e0457f0abb1ac5df3ab106c69c672f236785f07"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: admission
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- doooby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: update-me
|
14
14
|
email: zelazk.o@email.cz
|
@@ -23,8 +23,8 @@ files:
|
|
23
23
|
- LICENSE
|
24
24
|
- README.md
|
25
25
|
- admission.gemspec
|
26
|
+
- bin/build
|
26
27
|
- bin/rspec
|
27
|
-
- bin/server.rb
|
28
28
|
- lib/admission.rb
|
29
29
|
- lib/admission/ability.rb
|
30
30
|
- lib/admission/admission.rb
|
@@ -35,7 +35,7 @@ files:
|
|
35
35
|
- lib/admission/resource_arbitration.rb
|
36
36
|
- lib/admission/status.rb
|
37
37
|
- lib/admission/version.rb
|
38
|
-
- lib/admission/
|
38
|
+
- lib/admission/visualisation_app.rb
|
39
39
|
- spec/integration/_helper.rb
|
40
40
|
- spec/integration/action_arbitrating_spec.rb
|
41
41
|
- spec/integration/resource_arbitrating_spec.rb
|
@@ -55,12 +55,17 @@ files:
|
|
55
55
|
- visualisation/actions/index.js
|
56
56
|
- visualisation/components/app_container.jsx
|
57
57
|
- visualisation/components/input_with_select.jsx
|
58
|
+
- visualisation/components/nested_list_row.jsx
|
58
59
|
- visualisation/components/privilege_select.jsx
|
59
60
|
- visualisation/components/privileges_panel.jsx
|
61
|
+
- visualisation/components/rules_panel.jsx
|
60
62
|
- visualisation/dist/.gitkeep
|
63
|
+
- visualisation/dist/app.js
|
64
|
+
- visualisation/helpers.js
|
61
65
|
- visualisation/index.jsx
|
62
66
|
- visualisation/package.json
|
63
67
|
- visualisation/reducers/index.js
|
68
|
+
- visualisation/server.rb
|
64
69
|
- visualisation/style.scss
|
65
70
|
- visualisation/webpack.config.js
|
66
71
|
- visualisation/yarn.lock
|
data/bin/server.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
# Set up gems listed in the Gemfile.
|
5
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
6
|
-
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
7
|
-
|
8
|
-
require 'rack'
|
9
|
-
require 'byebug'
|
10
|
-
|
11
|
-
require_relative '../lib/admission'
|
12
|
-
require_relative '../lib/admission/visualisation'
|
13
|
-
require_relative '../spec/test_context/index'
|
14
|
-
|
15
|
-
Admission::Visualisation.set :js_entry,
|
16
|
-
Admission::Visualisation::ASSETS_PATH.join('build', 'admission_visualisation.js')
|
17
|
-
|
18
|
-
Admission::Visualisation.set :admission_data,
|
19
|
-
{
|
20
|
-
order: PRIVILEGES_ORDER,
|
21
|
-
rules: ACTIONS_RULES,
|
22
|
-
arbitrator: Admission::Arbitration
|
23
|
-
}
|
24
|
-
|
25
|
-
|
26
|
-
Rack::Handler::WEBrick.run Admission::Visualisation
|
@@ -1,81 +0,0 @@
|
|
1
|
-
require 'sinatra/base'
|
2
|
-
require 'sinatra/json'
|
3
|
-
require 'haml'
|
4
|
-
require 'pathname'
|
5
|
-
|
6
|
-
class Admission::Visualisation < Sinatra::Base
|
7
|
-
ASSETS_PATH = Pathname.new(__FILE__).join('..', '..', '..', 'visualisation')
|
8
|
-
|
9
|
-
enable :inline_templates
|
10
|
-
|
11
|
-
set :js_entry, ASSETS_PATH.join('dist', 'admission_visualisation.js')
|
12
|
-
|
13
|
-
get '/' do
|
14
|
-
haml :index
|
15
|
-
end
|
16
|
-
|
17
|
-
get '/admission_visualisation.js' do
|
18
|
-
send_file settings.js_entry
|
19
|
-
end
|
20
|
-
|
21
|
-
get '/admission_data' do
|
22
|
-
json Admission::Visualisation.admission_data_to_js(
|
23
|
-
**settings.admission_data)
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.admission_data_to_js order:, rules:, arbitrator:, **_
|
27
|
-
js_data = {}
|
28
|
-
|
29
|
-
top_levels = []
|
30
|
-
privileges = order.values.inject Array.new do |arr, levels|
|
31
|
-
tops, others = levels.to_a.partition{|key, _| key == :'^'}
|
32
|
-
tops.first[1].tap{|privilege| top_levels << privilege.text_key}
|
33
|
-
|
34
|
-
others.each do |_, privilege|
|
35
|
-
arr << {name: privilege.name, level: privilege.level,
|
36
|
-
inherits: privilege.inherited && privilege.inherited.map(&:text_key)}
|
37
|
-
end
|
38
|
-
|
39
|
-
arr
|
40
|
-
end
|
41
|
-
js_data[:top_levels] = top_levels
|
42
|
-
js_data[:privileges] = privileges
|
43
|
-
|
44
|
-
rules = if arbitrator == Admission::Arbitration
|
45
|
-
rules.to_a.map do |scope, index|
|
46
|
-
|
47
|
-
index = index.to_a.map do |privilege, rule|
|
48
|
-
if rule.is_a? Proc
|
49
|
-
rule = 'proc'
|
50
|
-
end
|
51
|
-
|
52
|
-
[privilege.text_key, rule]
|
53
|
-
end
|
54
|
-
|
55
|
-
[scope, Hash[index]]
|
56
|
-
end
|
57
|
-
|
58
|
-
else
|
59
|
-
raise "not implemented for #{arbitrator.name}"
|
60
|
-
|
61
|
-
end
|
62
|
-
js_data[:rules] = Hash[rules]
|
63
|
-
|
64
|
-
js_data
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
__END__
|
70
|
-
|
71
|
-
@@ layout
|
72
|
-
!!! 5
|
73
|
-
%html
|
74
|
-
%head
|
75
|
-
%title= 'Admission'
|
76
|
-
%body.flex-column
|
77
|
-
= yield
|
78
|
-
|
79
|
-
@@ index
|
80
|
-
#admission-visualisation(data-url="/admission_data")
|
81
|
-
%script(src="/admission_visualisation.js")
|