conjur-asset-ui 1.4.2 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -3
  3. data/CHANGELOG.md +10 -0
  4. data/Makefile +19 -0
  5. data/README.md +0 -3
  6. data/Rakefile +22 -17
  7. data/TODO.md +0 -23
  8. data/app/.csscomb.json +304 -0
  9. data/app/.eslintignore +3 -0
  10. data/app/.eslintrc +265 -0
  11. data/app/config/preprocessor.js +19 -0
  12. data/app/config/webpack.js +124 -0
  13. data/app/gulpfile.js +96 -0
  14. data/app/package.json +86 -0
  15. data/app/src/actions.js +550 -0
  16. data/app/src/app.js +83 -0
  17. data/app/src/clients/audit.js +34 -0
  18. data/app/src/clients/auth.js +24 -0
  19. data/app/src/clients/generic.js +52 -0
  20. data/app/src/clients/graph.js +7 -0
  21. data/app/src/clients/layer_members.js +18 -0
  22. data/app/src/clients/list.js +31 -0
  23. data/app/src/clients/members.js +20 -0
  24. data/app/src/clients/request.js +531 -0
  25. data/app/src/clients/search.js +5 -0
  26. data/app/src/components/app/__tests__/app-test.js +22 -0
  27. data/app/src/components/app/app.js +36 -0
  28. data/app/src/components/app/wrapper.js +17 -0
  29. data/app/src/components/audit/__tests__/table_header-test.js +22 -0
  30. data/app/src/components/audit/box.js +9 -0
  31. data/app/src/components/audit/constants.js +5 -0
  32. data/app/src/components/audit/entry.js +105 -0
  33. data/app/src/components/audit/fields_mixin.js +11 -0
  34. data/app/src/components/audit/humanize_event.js +213 -0
  35. data/app/src/components/audit/table.js +64 -0
  36. data/app/src/components/audit/table_header.js +37 -0
  37. data/app/src/components/audit/timestamp.js +28 -0
  38. data/app/src/components/auth/login.js +177 -0
  39. data/app/src/components/auth/login.less +71 -0
  40. data/app/src/components/auth/logout.js +42 -0
  41. data/app/src/components/auth/logout.less +21 -0
  42. data/app/src/components/chart/chart.js +540 -0
  43. data/app/src/components/chart/chart_helper_mixin.js +78 -0
  44. data/app/src/components/custom/list.js +3 -0
  45. data/app/src/components/custom/view.js +81 -0
  46. data/app/src/components/dashboard/activity.js +144 -0
  47. data/app/src/components/dashboard/dashboard.js +46 -0
  48. data/app/src/components/flash/flash.js +98 -0
  49. data/app/src/components/flash/flash.less +3 -0
  50. data/app/src/components/generic/__tests__/time-test.js +42 -0
  51. data/app/src/components/generic/annotations.js +39 -0
  52. data/app/src/components/generic/breadcrumbs.js +57 -0
  53. data/app/src/components/generic/foldable_audit_section.js +204 -0
  54. data/app/src/components/generic/list.js +141 -0
  55. data/app/src/components/generic/list_factory.js +41 -0
  56. data/app/src/components/generic/resource_link.js +64 -0
  57. data/app/src/components/generic/role_link.js +66 -0
  58. data/app/src/components/generic/tab_mixin.js +146 -0
  59. data/app/src/components/generic/time.js +32 -0
  60. data/app/src/components/graph/__tests__/collapse-test.js +133 -0
  61. data/app/src/components/graph/__tests__/edges-from-vertices-test.js +48 -0
  62. data/app/src/components/graph/__tests__/new-vertex-set-test.js +16 -0
  63. data/app/src/components/graph/__tests__/next-id-test.js +27 -0
  64. data/app/src/components/graph/__tests__/role-kind-from-id-test.js +24 -0
  65. data/app/src/components/graph/__tests__/vertices-from-edges-test.js +72 -0
  66. data/app/src/components/graph/graph.js +449 -0
  67. data/app/src/components/graph/graph.less +39 -0
  68. data/app/src/components/graph/helpers.js +368 -0
  69. data/app/src/components/group/list.js +3 -0
  70. data/app/src/components/group/view.js +153 -0
  71. data/app/src/components/host/activity.js +111 -0
  72. data/app/src/components/host/details.js +28 -0
  73. data/app/src/components/host/executors.js +77 -0
  74. data/app/src/components/host/host_link.js +18 -0
  75. data/app/src/components/host/list.js +3 -0
  76. data/app/src/components/host/updaters.js +77 -0
  77. data/app/src/components/host/view.js +145 -0
  78. data/app/src/components/layer/list.js +3 -0
  79. data/app/src/components/layer/view.js +197 -0
  80. data/app/src/components/navbar/__tests__/navbar-test.js +21 -0
  81. data/app/src/components/navbar/nav_search_form.js +40 -0
  82. data/app/src/components/navbar/navbar.js +96 -0
  83. data/app/src/components/notfound/notfound.js +35 -0
  84. data/app/src/components/notfound/notfound.less +21 -0
  85. data/app/src/components/owned_resources/owned_resources.js +84 -0
  86. data/app/src/components/owned_resources/owned_resources_box.js +101 -0
  87. data/app/src/components/permissions/permissions.js +138 -0
  88. data/app/src/components/permissions/permissions_table.js +101 -0
  89. data/app/src/components/policy/list.js +3 -0
  90. data/app/src/components/policy/view.js +107 -0
  91. data/app/src/components/refresh/refresh.js +29 -0
  92. data/app/src/components/refresh/refresh.less +15 -0
  93. data/app/src/components/search/group.js +43 -0
  94. data/app/src/components/search/group_heading.js +50 -0
  95. data/app/src/components/search/group_title.js +37 -0
  96. data/app/src/components/search/result_item.js +55 -0
  97. data/app/src/components/search/search.js +118 -0
  98. data/app/src/components/user/activity.js +112 -0
  99. data/app/src/components/user/details.js +30 -0
  100. data/app/src/components/user/list.js +3 -0
  101. data/app/src/components/user/pubkeys.js +118 -0
  102. data/app/src/components/user/pubkeys.less +56 -0
  103. data/app/src/components/user/view.js +143 -0
  104. data/app/src/components/variable/activity.js +101 -0
  105. data/app/src/components/variable/details.js +46 -0
  106. data/app/src/components/variable/fetchers.js +77 -0
  107. data/app/src/components/variable/list.js +3 -0
  108. data/app/src/components/variable/updaters.js +77 -0
  109. data/app/src/components/variable/view.js +115 -0
  110. data/app/src/constants.js +36 -0
  111. data/{public → app/src}/images/conjur-logo.svg +0 -0
  112. data/{public → app/src}/images/icon-client-pc.svg +0 -0
  113. data/{public → app/src}/images/icon-environment.png +0 -0
  114. data/{public → app/src}/images/icon-person.svg +0 -0
  115. data/{public → app/src}/images/icon-policy.png +0 -0
  116. data/{public → app/src}/images/icon-resource.png +0 -0
  117. data/{public → app/src}/images/icon-service-dots.svg +0 -0
  118. data/{public → app/src}/images/icon-variable.png +0 -0
  119. data/app/src/pages/index.html +27 -0
  120. data/app/src/routes.js +64 -0
  121. data/app/src/stores/app_store.js +35 -0
  122. data/app/src/stores/audit_store.js +143 -0
  123. data/app/src/stores/graph_store.js +51 -0
  124. data/app/src/stores/group_store.js +104 -0
  125. data/app/src/stores/host_store.js +111 -0
  126. data/app/src/stores/layer_store.js +115 -0
  127. data/app/src/stores/policy_store.js +88 -0
  128. data/app/src/stores/resources_store.js +115 -0
  129. data/app/src/stores/route_store.js +21 -0
  130. data/app/src/stores/search_store.js +77 -0
  131. data/app/src/stores/user_store.js +109 -0
  132. data/app/src/stores/variable_store.js +93 -0
  133. data/app/src/styles/bootstrap.less +54 -0
  134. data/{public/css → app/src/styles}/styles.less +26 -82
  135. data/app/src/utils.js +38 -0
  136. data/app/src/vendor/pace.js +2 -0
  137. data/conjur-asset-ui.gemspec +3 -4
  138. data/docker/assets-build/Dockerfile +12 -0
  139. data/docker/conjur-ui/Dockerfile +33 -0
  140. data/docker/conjur-ui/README.md +38 -0
  141. data/docker/conjur-ui/mime.types +90 -0
  142. data/docker/conjur-ui/nginx.conf +110 -0
  143. data/docker/conjur-ui/start.py +72 -0
  144. data/docker/conjur-ui/start.sh +18 -0
  145. data/docker/conjur-ui/test.env +8 -0
  146. data/lib/conjur-asset-ui-version.rb +1 -1
  147. data/lib/conjur/command/ui.rb +10 -2
  148. data/lib/conjur/webserver/home.rb +3 -3
  149. data/lib/conjur/webserver/login.rb +1 -1
  150. data/lib/conjur/webserver/server.rb +16 -4
  151. data/public/js/views/roleGraph.js +91 -0
  152. metadata +167 -105
  153. data/.jshintrc +0 -41
  154. data/bower.json +0 -98
  155. data/gulpfile.js +0 -139
  156. data/package.json +0 -47
  157. data/preprocessor.js +0 -7
  158. data/public/_client_libs.html +0 -9
  159. data/public/index.html.erb +0 -63
  160. data/public/js/init.js +0 -196
  161. data/public/js/lib/pace.js +0 -2
  162. data/public/js/lib/sorted-set.no-require.js +0 -1145
  163. data/public/js/lib/sorted-set.no-require.js.txt +0 -6
  164. data/public/js/models/groupRecord.js +0 -72
  165. data/public/js/models/hostRecord.js +0 -60
  166. data/public/js/models/layerRecord.js +0 -79
  167. data/public/js/models/namespace.js +0 -12
  168. data/public/js/models/policyList.js +0 -16
  169. data/public/js/models/policyRecord.js +0 -54
  170. data/public/js/models/record.js +0 -117
  171. data/public/js/models/resourceList.js +0 -87
  172. data/public/js/models/userList.js +0 -25
  173. data/public/js/models/userRecord.js +0 -75
  174. data/public/js/models/variableList.js +0 -27
  175. data/public/js/models/variableRecord.js +0 -77
  176. data/public/js/routers.js +0 -242
  177. data/public/js/views/annotations.js +0 -47
  178. data/public/js/views/audit.js +0 -369
  179. data/public/js/views/breadcrumbs.js +0 -62
  180. data/public/js/views/chart.js +0 -617
  181. data/public/js/views/dashboard.js +0 -146
  182. data/public/js/views/generic.js +0 -122
  183. data/public/js/views/group.js +0 -109
  184. data/public/js/views/groups.js +0 -26
  185. data/public/js/views/host.js +0 -200
  186. data/public/js/views/hosts.js +0 -26
  187. data/public/js/views/layer.js +0 -146
  188. data/public/js/views/layers.js +0 -26
  189. data/public/js/views/mixins/search.js +0 -22
  190. data/public/js/views/mixins/tabs.js +0 -154
  191. data/public/js/views/namespaces.js +0 -40
  192. data/public/js/views/navSearch.js +0 -36
  193. data/public/js/views/owned.js +0 -184
  194. data/public/js/views/permissions.js +0 -254
  195. data/public/js/views/policies.js +0 -26
  196. data/public/js/views/policy.js +0 -70
  197. data/public/js/views/resource.js +0 -59
  198. data/public/js/views/role.js +0 -63
  199. data/public/js/views/searchResults.js +0 -212
  200. data/public/js/views/sections.js +0 -226
  201. data/public/js/views/time.js +0 -39
  202. data/public/js/views/user.js +0 -297
  203. data/public/js/views/users.js +0 -26
  204. data/public/js/views/variable.js +0 -310
  205. data/public/js/views/variables.js +0 -26
  206. data/spec/javascripts/helpers/.gitkeep +0 -0
  207. data/spec/javascripts/support/jasmine.yml +0 -112
  208. data/spec/javascripts/support/jasmine_helper.rb +0 -22
  209. data/spec/javascripts/support/run.html.erb +0 -23
  210. data/spec/javascripts/views/AuditSpec.js +0 -22
  211. data/spec/javascripts/views/AuditSpec.ls +0 -18
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "conjur-asset-ui",
3
+ "private": true,
4
+ "version": "1.5.1",
5
+ "description": "Conjur UI",
6
+ "author": "Nikolai Sevostjanov <nikolai.sevostjanov@gmail.com>",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git://github.com/conjurinc/conjur-asset-ui.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/conjurinc/conjur-asset-ui/issues"
14
+ },
15
+ "dependencies": {
16
+ "babel-runtime": "^5.2.15",
17
+ "bootstrap": "^3.3.4",
18
+ "classnames": "^1.2.0",
19
+ "collections": "^1.2.2",
20
+ "d3": "^3.5.5",
21
+ "dagre": "^0.7.1",
22
+ "dagre-d3": "^0.4.3",
23
+ "event-source-polyfill": "0.0.1",
24
+ "fluxxor": "^1.5.4",
25
+ "lodash": "^3.6.0",
26
+ "moment": "^2.10.2",
27
+ "react": "^0.13.2",
28
+ "react-bootstrap": "^0.21.2",
29
+ "react-router": "^0.13.2",
30
+ "react-router-bootstrap": "^0.13.0",
31
+ "superagent": "^1.2.0"
32
+ },
33
+ "devDependencies": {
34
+ "autoprefixer-loader": "^1.2.0",
35
+ "babel-core": "^5.2.15",
36
+ "babel-eslint": "^3.0.1",
37
+ "babel-loader": "^5.0.0",
38
+ "css-loader": "^0.12.0",
39
+ "del": "^1.1.1",
40
+ "eslint": "^0.20.0",
41
+ "eslint-loader": "^0.11.1",
42
+ "eslint-plugin-react": "git+https://github.com/yannickcr/eslint-plugin-react.git",
43
+ "exports-loader": "^0.6.2",
44
+ "extract-text-webpack-plugin": "^0.7.1",
45
+ "file-loader": "^0.8.1",
46
+ "gulp": "^3.8.11",
47
+ "gulp-changed": "^1.2.1",
48
+ "gulp-concat": "^2.5.2",
49
+ "gulp-filter": "^2.0.2",
50
+ "gulp-flatten": "0.0.4",
51
+ "gulp-if": "^1.2.5",
52
+ "gulp-insert": "^0.4.0",
53
+ "gulp-load-plugins": "^0.10.0",
54
+ "gulp-plumber": "^1.0.0",
55
+ "gulp-size": "^1.2.1",
56
+ "gulp-sourcemaps": "^1.5.1",
57
+ "gulp-uglify": "^1.1.0",
58
+ "gulp-util": "^3.0.4",
59
+ "jest-cli": "^0.4.1",
60
+ "less": "^2.5.0",
61
+ "less-loader": "^2.2.0",
62
+ "merge-stream": "^0.1.7",
63
+ "minimist": "^1.1.1",
64
+ "protractor": "^1.8.0",
65
+ "psi": "^1.0.6",
66
+ "react-tools": "^0.13.2",
67
+ "run-sequence": "^1.0.2",
68
+ "style-loader": "^0.12.1",
69
+ "url-loader": "^0.5.5",
70
+ "webpack": "^1.8.4",
71
+ "webpack-dev-server": "^1.8.0"
72
+ },
73
+ "main": "",
74
+ "jest": {
75
+ "rootDir": "src",
76
+ "scriptPreprocessor": "../config/preprocessor.js",
77
+ "unmockedModulePathPatterns": [
78
+ "react",
79
+ "lodash"
80
+ ]
81
+ },
82
+ "scripts": {
83
+ "test": "jest",
84
+ "eslint": "eslint src"
85
+ }
86
+ }
@@ -0,0 +1,550 @@
1
+ import _ from 'lodash';
2
+
3
+ import * as audit from './clients/audit';
4
+ import * as generic from './clients/generic';
5
+ import * as list from './clients/list';
6
+ import * as search from './clients/search';
7
+ import * as members from './clients/members';
8
+ import * as layerMembers from './clients/layer_members';
9
+ import * as graph from './clients/graph';
10
+
11
+ import {RManager} from './clients/request';
12
+
13
+ import constants from './constants';
14
+ import {readCookie} from './utils';
15
+
16
+ let rmanager;
17
+
18
+ function getFullId(kind, id) {
19
+ return window.encodeURIComponent(
20
+ `${rmanager.account}:${kind}:${id}`
21
+ );
22
+ }
23
+
24
+ export default {
25
+ getRManager() {
26
+ if (_.isUndefined(rmanager)) {
27
+ rmanager = new RManager(this.flux, readCookie('conjur_configuration'));
28
+ }
29
+
30
+ return rmanager;
31
+ },
32
+
33
+ getFullId(kind, id) {
34
+ return getFullId(kind, id);
35
+ },
36
+
37
+ flashMessage(msg, level) {
38
+ this.dispatch(constants.FLASH_MESSAGE, {msg: msg, level: level});
39
+ },
40
+
41
+ flashMessageClear() {
42
+ this.dispatch(constants.FLASH_MESSAGE_CLEAR);
43
+ },
44
+
45
+ routes: {
46
+ transition(params) {
47
+ this.dispatch(constants.ROUTES.TRANSITION, {params: params});
48
+ }
49
+ },
50
+
51
+ search(query) {
52
+ this.dispatch(constants.SEARCH.LOAD, {id: query});
53
+
54
+ search
55
+ .fetch(rmanager, query)
56
+ .then(
57
+ res => {
58
+ const payload = {id: query, type: 'SEARCH_RESULT', res: res};
59
+
60
+ this.dispatch(
61
+ constants.SEARCH.LOAD_SUCCESS,
62
+ payload
63
+ );
64
+ },
65
+ () => {
66
+ this.dispatch(constants.SEARCH.LOAD_FAIL, {id: query, type: 'SEARCH_RESULT'});
67
+ });
68
+ },
69
+
70
+ audit: {
71
+ loadAll(startFlow) {
72
+ this.dispatch(constants.AUDIT.LOAD);
73
+
74
+ audit
75
+ .fetch(rmanager, audit.c.AUDIT_ALL, null)
76
+ .then(
77
+ res => {
78
+ const payload = {res: res, startFlow: startFlow};
79
+
80
+ this.dispatch(
81
+ constants.AUDIT.LOAD_SUCCESS,
82
+ payload
83
+ );
84
+ },
85
+ () => {
86
+ this.dispatch(constants.AUDIT.LOAD_FAIL);
87
+ });
88
+ },
89
+
90
+ loadFlow(/*lastEventId*/) {
91
+ // let eventSource = audit.fetch(audit.c.AUDIT_FLOW, null);
92
+
93
+ // eventSource.onmessage = event => {
94
+ // const data = JSON.parse(event.data);
95
+
96
+ // if (data.id > lastEventId) {
97
+ // const payload = {event: data};
98
+
99
+ // this.dispatch(
100
+ // constants.AUDIT.LOAD_SUCCESS,
101
+ // payload);
102
+ // }
103
+ // };
104
+
105
+ // eventSource.onerror = () => {
106
+ // // this.dispatch(constants.AUDIT.LOAD_FAIL);
107
+ // };
108
+ },
109
+
110
+ loadForRole(kind, id) {
111
+ this.dispatch(constants.AUDIT.LOAD);
112
+
113
+ audit
114
+ .fetch(
115
+ rmanager,
116
+ audit.c.AUDIT_ROLE,
117
+ getFullId(kind, id)
118
+ )
119
+ .then(
120
+ res => {
121
+ const payload = {res: res};
122
+
123
+ this.dispatch(
124
+ constants.AUDIT.LOAD_SUCCESS,
125
+ payload
126
+ );
127
+ },
128
+ () => {
129
+ this.dispatch(constants.AUDIT.LOAD_FAIL, {kind: kind, id: id});
130
+ });
131
+ },
132
+
133
+ loadForResource(kind, id) {
134
+ this.dispatch(constants.AUDIT.LOAD);
135
+
136
+ audit
137
+ .fetch(
138
+ rmanager,
139
+ audit.c.AUDIT_RESOURCE,
140
+ getFullId(kind, id)
141
+ )
142
+ .then(
143
+ res => {
144
+ const payload = {res: res};
145
+
146
+ this.dispatch(
147
+ constants.AUDIT.LOAD_SUCCESS,
148
+ payload
149
+ );
150
+ },
151
+ () => {
152
+ this.dispatch(constants.AUDIT.LOAD_FAIL, {kind: kind, id: id});
153
+ });
154
+ }
155
+ },
156
+
157
+ resources: {
158
+ load(kind) {
159
+ this.dispatch(constants.RESOURCES.LOAD);
160
+
161
+ list
162
+ .fetch(rmanager, kind)
163
+ .then(
164
+ res => {
165
+ this.dispatch(constants.RESOURCES.LOAD_SUCCESS, {res: res});
166
+ },
167
+ () => {
168
+ this.dispatch(constants.RESOURCES.LOAD_FAIL, {id: kind});
169
+ });
170
+ },
171
+
172
+ loadOne(kind, id) {
173
+ this.dispatch(constants.RESOURCE.LOAD);
174
+
175
+ list
176
+ .fetchOne(rmanager, kind, id)
177
+ .then(
178
+ res => {
179
+ this.dispatch(constants.RESOURCE.LOAD_SUCCESS, {kind: kind, id: id, res: res});
180
+ },
181
+ () => {
182
+ this.dispatch(constants.RESOURCE.LOAD_FAIL, {kind: kind, id: id});
183
+ });
184
+ }
185
+ },
186
+
187
+ graph: {
188
+ load(kind, id) {
189
+ this.dispatch(constants.GRAPH.LOAD);
190
+
191
+ graph
192
+ .fetch(
193
+ rmanager,
194
+ getFullId(kind, id)
195
+ )
196
+ .then(
197
+ res => {
198
+ const payload = {kind: kind, id: id, res: res};
199
+
200
+ this.dispatch(
201
+ constants.GRAPH.LOAD_SUCCESS,
202
+ payload
203
+ );
204
+ },
205
+ () => {
206
+ this.dispatch(constants.GRAPH.LOAD_FAIL, {id: id});
207
+ });
208
+ }
209
+ },
210
+
211
+ user: {
212
+ load(id) {
213
+ this.dispatch(constants.USER.LOAD, {id: id});
214
+
215
+ [
216
+ generic.c.ATTRIBUTES,
217
+ generic.c.OWNED_RESOURCES,
218
+ generic.c.ALL_ROLES,
219
+ generic.c.PUBLIC_KEYS
220
+ ].forEach((type) => {
221
+ this.dispatch(constants.USER.LOAD, {id: id, type: type});
222
+
223
+ generic
224
+ .fetch(rmanager, type, 'user', id)
225
+ .then(
226
+ res => {
227
+ const payload = {id: id, type: type, res: res};
228
+
229
+ this.dispatch(
230
+ constants.USER.LOAD_SUCCESS,
231
+ payload
232
+ );
233
+ },
234
+ () => {
235
+ this.dispatch(constants.USER.LOAD_FAIL, {type: type});
236
+ });
237
+ });
238
+
239
+ this.dispatch(constants.USER.LOAD, {id: id, type: 'RESOURCES'});
240
+
241
+ list
242
+ .fetchResources(rmanager, getFullId('user', id))
243
+ .then(
244
+ res => {
245
+ const payload = {id: id, type: 'RESOURCES', res: res};
246
+
247
+ this.dispatch(
248
+ constants.USER.LOAD_SUCCESS,
249
+ payload
250
+ );
251
+ },
252
+ () => {
253
+ this.dispatch(constants.USER.LOAD_FAIL, {type: 'RESOURCES'});
254
+ });
255
+ }
256
+ },
257
+
258
+ group: {
259
+ load(id) {
260
+ this.dispatch(constants.GROUP.LOAD, {id: id});
261
+
262
+ [
263
+ generic.c.ATTRIBUTES,
264
+ generic.c.OWNED_RESOURCES,
265
+ generic.c.ALL_ROLES
266
+ ].forEach((type) => {
267
+ this.dispatch(constants.GROUP.LOAD, {id: id, type: type});
268
+
269
+ generic
270
+ .fetch(rmanager, type, 'group', id)
271
+ .then(
272
+ res => {
273
+ const payload = {id: id, type: type, res: res};
274
+
275
+ this.dispatch(
276
+ constants.GROUP.LOAD_SUCCESS,
277
+ payload
278
+ );
279
+ },
280
+ () => {
281
+ this.dispatch(constants.GROUP.LOAD_FAIL, {type: type});
282
+ });
283
+ });
284
+
285
+ this.dispatch(constants.GROUP.LOAD, {id: id, type: 'GROUP_ROLES'});
286
+
287
+ list
288
+ .fetchGroupRoles(rmanager, id)
289
+ .then(
290
+ res => {
291
+ const payload = {id: id, type: 'GROUP_ROLES', res: res};
292
+
293
+ this.dispatch(
294
+ constants.GROUP.LOAD_SUCCESS,
295
+ payload
296
+ );
297
+ },
298
+ () => {
299
+ this.dispatch(constants.GROUP.LOAD_FAIL, {type: 'GROUP_ROLES'});
300
+ });
301
+
302
+ this.dispatch(constants.GROUP.LOAD, {id: id, type: 'RESOURCES'});
303
+
304
+ list
305
+ .fetchResources(rmanager, getFullId('group', id))
306
+ .then(
307
+ res => {
308
+ const payload = {id: id, type: 'RESOURCES', res: res};
309
+
310
+ this.dispatch(
311
+ constants.GROUP.LOAD_SUCCESS,
312
+ payload
313
+ );
314
+ },
315
+ () => {
316
+ this.dispatch(constants.GROUP.LOAD_FAIL, {type: 'RESOURCES'});
317
+ });
318
+ }
319
+ },
320
+
321
+ host: {
322
+ load(id) {
323
+ this.dispatch(constants.HOST.LOAD, {id: id});
324
+
325
+ [
326
+ generic.c.ATTRIBUTES,
327
+ generic.c.OWNED_RESOURCES,
328
+ generic.c.ALL_ROLES
329
+ ].forEach((type) => {
330
+ this.dispatch(constants.HOST.LOAD, {id: id, type: type});
331
+
332
+ generic
333
+ .fetch(rmanager, type, 'host', id)
334
+ .then(
335
+ res => {
336
+ const payload = {id: id, type: type, res: res};
337
+
338
+ this.dispatch(
339
+ constants.HOST.LOAD_SUCCESS,
340
+ payload
341
+ );
342
+ },
343
+ () => {
344
+ this.dispatch(constants.HOST.LOAD_FAIL, {type: type});
345
+ });
346
+ });
347
+
348
+ [
349
+ members.c.MEMBERS_EXECUTE,
350
+ members.c.MEMBERS_UPDATE
351
+ ].forEach((type) => {
352
+ this.dispatch(constants.HOST.LOAD, {id: id, type: type});
353
+
354
+ members
355
+ .fetch(rmanager, constants.HOST.ASSET_TYPE, type, id)
356
+ .then(
357
+ res => {
358
+ const payload = {id: id, type: type, res: res};
359
+
360
+ this.dispatch(
361
+ constants.HOST.LOAD_SUCCESS,
362
+ payload
363
+ );
364
+ },
365
+ () => {
366
+ this.dispatch(constants.HOST.LOAD_FAIL, {type: type});
367
+ });
368
+ });
369
+
370
+ this.dispatch(constants.HOST.LOAD, {id: id, type: 'RESOURCES'});
371
+
372
+ list
373
+ .fetchResources(rmanager, getFullId('host', id))
374
+ .then(
375
+ res => {
376
+ const payload = {id: id, type: 'RESOURCES', res: res};
377
+
378
+ this.dispatch(
379
+ constants.HOST.LOAD_SUCCESS,
380
+ payload
381
+ );
382
+ },
383
+ () => {
384
+ this.dispatch(constants.HOST.LOAD_FAIL, {type: 'RESOURCES'});
385
+ });
386
+ }
387
+ },
388
+
389
+ layer: {
390
+ load(id) {
391
+ this.dispatch(constants.LAYER.LOAD, {id: id});
392
+
393
+ [
394
+ generic.c.ATTRIBUTES,
395
+ generic.c.OWNED_RESOURCES,
396
+ generic.c.ALL_ROLES
397
+ ].forEach((type) => {
398
+ this.dispatch(constants.LAYER.LOAD, {id: id, type: type});
399
+
400
+ generic
401
+ .fetch(rmanager, type, 'layer', id)
402
+ .then(
403
+ res => {
404
+ const payload = {id: id, type: type, res: res};
405
+
406
+ this.dispatch(
407
+ constants.LAYER.LOAD_SUCCESS,
408
+ payload
409
+ );
410
+ },
411
+ () => {
412
+ this.dispatch(constants.LAYER.LOAD_FAIL, {type: type});
413
+ });
414
+ });
415
+
416
+ [
417
+ layerMembers.c.LAYER_MEMBERS_USE,
418
+ layerMembers.c.LAYER_MEMBERS_ADMIN
419
+ ].forEach((type) => {
420
+ this.dispatch(constants.LAYER.LOAD, {id: id, type: type});
421
+
422
+ layerMembers
423
+ .fetch(rmanager, type, id)
424
+ .then(
425
+ res => {
426
+ const payload = {id: id, type: type, res: res};
427
+
428
+ this.dispatch(
429
+ constants.LAYER.LOAD_SUCCESS,
430
+ payload
431
+ );
432
+ },
433
+ () => {
434
+ this.dispatch(constants.LAYER.LOAD_FAIL, {type: type});
435
+ });
436
+ });
437
+
438
+ this.dispatch(constants.LAYER.LOAD, {id: id, type: 'RESOURCES'});
439
+
440
+ list
441
+ .fetchResources(rmanager, getFullId('layer', id))
442
+ .then(
443
+ res => {
444
+ const payload = {id: id, type: 'RESOURCES', res: res};
445
+
446
+ this.dispatch(
447
+ constants.LAYER.LOAD_SUCCESS,
448
+ payload
449
+ );
450
+ },
451
+ () => {
452
+ this.dispatch(constants.LAYER.LOAD_FAIL, {type: 'RESOURCES'});
453
+ });
454
+ }
455
+ },
456
+
457
+ variable: {
458
+ load(id) {
459
+ this.dispatch(constants.VARIABLE.LOAD, {id: id});
460
+
461
+ [
462
+ generic.c.ATTRIBUTES
463
+ ].forEach((type) => {
464
+ this.dispatch(constants.VARIABLE.LOAD, {id: id, type: type});
465
+
466
+ generic
467
+ .fetch(rmanager, type, 'variable', id)
468
+ .then(
469
+ res => {
470
+ const payload = {id: id, type: type, res: res};
471
+
472
+ this.dispatch(
473
+ constants.VARIABLE.LOAD_SUCCESS,
474
+ payload
475
+ );
476
+ },
477
+ () => {
478
+ this.dispatch(constants.VARIABLE.LOAD_FAIL, {type: type});
479
+ });
480
+ });
481
+
482
+ [
483
+ members.c.MEMBERS_EXECUTE,
484
+ members.c.MEMBERS_UPDATE
485
+ ].forEach((type) => {
486
+ this.dispatch(constants.VARIABLE.LOAD, {id: id, type: type});
487
+
488
+ members
489
+ .fetch(rmanager, constants.VARIABLE.ASSET_TYPE, type, id)
490
+ .then(
491
+ res => {
492
+ const payload = {id: id, type: type, res: res};
493
+
494
+ this.dispatch(
495
+ constants.VARIABLE.LOAD_SUCCESS,
496
+ payload
497
+ );
498
+ },
499
+ () => {
500
+ this.dispatch(constants.VARIABLE.LOAD_FAIL, {type: type});
501
+ });
502
+ });
503
+ }
504
+ },
505
+
506
+ policy: {
507
+ load(id) {
508
+ this.dispatch(constants.POLICY.LOAD, {id: id});
509
+
510
+ [
511
+ generic.c.OWNED_RESOURCES,
512
+ generic.c.ALL_ROLES
513
+ ].forEach((type) => {
514
+ this.dispatch(constants.POLICY.LOAD, {id: id, type: type});
515
+
516
+ generic
517
+ .fetch(rmanager, type, 'policy', id)
518
+ .then(
519
+ res => {
520
+ const payload = {id: id, type: type, res: res};
521
+
522
+ this.dispatch(
523
+ constants.POLICY.LOAD_SUCCESS,
524
+ payload
525
+ );
526
+ },
527
+ () => {
528
+ this.dispatch(constants.POLICY.LOAD_FAIL, {type: type});
529
+ });
530
+ });
531
+
532
+ this.dispatch(constants.POLICY.LOAD, {id: id, type: 'RESOURCES'});
533
+
534
+ list
535
+ .fetchResources(rmanager, getFullId('policy', id))
536
+ .then(
537
+ res => {
538
+ const payload = {id: id, type: 'RESOURCES', res: res};
539
+
540
+ this.dispatch(
541
+ constants.POLICY.LOAD_SUCCESS,
542
+ payload
543
+ );
544
+ },
545
+ () => {
546
+ this.dispatch(constants.POLICY.LOAD_FAIL, {type: 'RESOURCES'});
547
+ });
548
+ }
549
+ }
550
+ };