foreman_acd 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +619 -0
  3. data/README.md +87 -0
  4. data/Rakefile +49 -0
  5. data/app/assets/javascripts/foreman_acd/acd_dummy.js +3 -0
  6. data/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +55 -0
  7. data/app/controllers/foreman_acd/api/v2/base_controller.rb +16 -0
  8. data/app/controllers/foreman_acd/app_definitions_controller.rb +53 -0
  9. data/app/controllers/foreman_acd/app_instances_controller.rb +158 -0
  10. data/app/controllers/foreman_acd/application_controller.rb +10 -0
  11. data/app/controllers/foreman_acd/concerns/app_definition_parameters.rb +23 -0
  12. data/app/controllers/foreman_acd/concerns/app_instance_parameters.rb +23 -0
  13. data/app/controllers/ui_acd_controller.rb +30 -0
  14. data/app/models/foreman_acd/app_definition.rb +23 -0
  15. data/app/models/foreman_acd/app_instance.rb +21 -0
  16. data/app/views/foreman_acd/app_definitions/_form.html.erb +40 -0
  17. data/app/views/foreman_acd/app_definitions/edit.html.erb +11 -0
  18. data/app/views/foreman_acd/app_definitions/index.html.erb +27 -0
  19. data/app/views/foreman_acd/app_definitions/new.html.erb +10 -0
  20. data/app/views/foreman_acd/app_instances/_form.html.erb +46 -0
  21. data/app/views/foreman_acd/app_instances/edit.html.erb +11 -0
  22. data/app/views/foreman_acd/app_instances/index.html.erb +30 -0
  23. data/app/views/foreman_acd/app_instances/new.html.erb +11 -0
  24. data/app/views/ui_acd/app.json.rabl +9 -0
  25. data/app/views/ui_acd/app_definition.json.rabl +5 -0
  26. data/app/views/ui_acd/computeprofile.json.rabl +4 -0
  27. data/app/views/ui_acd/domain.json.rabl +4 -0
  28. data/app/views/ui_acd/environment.json.rabl +4 -0
  29. data/app/views/ui_acd/fdata.json.rabl +24 -0
  30. data/app/views/ui_acd/lifecycle_environment.json.rabl +4 -0
  31. data/app/views/ui_acd/ptable.json.rabl +4 -0
  32. data/config/routes.rb +24 -0
  33. data/db/migrate/20190610202252_create_app_definitions.rb +19 -0
  34. data/db/migrate/20190625140305_create_app_instances.rb +19 -0
  35. data/lib/foreman_acd/engine.rb +43 -0
  36. data/lib/foreman_acd/plugin.rb +80 -0
  37. data/lib/foreman_acd/version.rb +5 -0
  38. data/lib/foreman_acd.rb +7 -0
  39. data/lib/tasks/foreman_acd_tasks.rake +47 -0
  40. data/locale/Makefile +60 -0
  41. data/locale/en/foreman_acd.po +19 -0
  42. data/locale/foreman_acd.pot +19 -0
  43. data/locale/gemspec.rb +2 -0
  44. data/package.json +121 -0
  45. data/test/controllers/app_definitions_controller_test.rb +24 -0
  46. data/test/controllers/app_instances_controller_test.rb +24 -0
  47. data/test/controllers/ui_acd_controller_test.rb +26 -0
  48. data/test/factories/foreman_acd_factories.rb +17 -0
  49. data/test/models/app_definition_test.rb +11 -0
  50. data/test/models/app_instance_test.rb +8 -0
  51. data/test/test_plugin_helper.rb +8 -0
  52. data/webpack/__mocks__/foremanReact/components/common/forms/Select.js +2 -0
  53. data/webpack/components/ParameterSelection/ParameterSelection.js +468 -0
  54. data/webpack/components/ParameterSelection/ParameterSelection.scss +3 -0
  55. data/webpack/components/ParameterSelection/ParameterSelectionActions.js +294 -0
  56. data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +31 -0
  57. data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +52 -0
  58. data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +175 -0
  59. data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +15 -0
  60. data/webpack/components/ParameterSelection/__fixtures__/parameterSelection.fixtures.js +162 -0
  61. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +194 -0
  62. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +127 -0
  63. data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +48 -0
  64. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +150 -0
  65. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +47 -0
  66. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +454 -0
  67. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +2265 -0
  68. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +209 -0
  69. data/webpack/components/ParameterSelection/index.js +39 -0
  70. data/webpack/index.js +8 -0
  71. data/webpack/reducer.js +7 -0
  72. data/webpack/test_setup.js +11 -0
  73. metadata +206 -0
@@ -0,0 +1,47 @@
1
+ import { testSelectorsSnapshotWithFixtures } from 'react-redux-test-utils';
2
+
3
+ import {
4
+ selectLoading,
5
+ selectEditMode,
6
+ selectForemanData,
7
+ selectParameterTypes,
8
+ selectRows,
9
+ selectSortingColumns,
10
+ selectColumns,
11
+ selectAppDefinition,
12
+ selectHostgroupId,
13
+ } from '../ParameterSelectionSelectors';
14
+
15
+ import {
16
+ parameterSelectionData_1,
17
+ } from '../__fixtures__/parameterSelectionData_1.fixtures';
18
+
19
+ const stateFactory = obj => ({
20
+ foremanAcd: {
21
+ parameterSelectionParameters: obj,
22
+ },
23
+ });
24
+
25
+ const fixtures = {
26
+ 'should return loading from parameterSelectionData_1 fixtures': () =>
27
+ selectLoading(stateFactory(parameterSelectionData_1)),
28
+ 'should return editMode from parameterSelectionData_1 fixtures': () =>
29
+ selectEditMode(stateFactory(parameterSelectionData_1)),
30
+ 'should return foremanData from parameterSelectionData_1 fixtures': () =>
31
+ selectForemanData(stateFactory(parameterSelectionData_1)),
32
+ 'should return parameterTypes from parameterSelectionData_1 fixtures': () =>
33
+ selectParameterTypes(stateFactory(parameterSelectionData_1)),
34
+ 'should return rows from parameterSelectionData_1 fixtures': () =>
35
+ selectRows(stateFactory(parameterSelectionData_1)),
36
+ 'should return sortingColumns from parameterSelectionData_1 fixtures': () =>
37
+ selectSortingColumns(stateFactory(parameterSelectionData_1)),
38
+ 'should return columns from parameterSelectionData_1 fixtures': () =>
39
+ selectColumns(stateFactory(parameterSelectionData_1)),
40
+ 'should return appDefinition from parameterSelectionData_1 fixtures': () =>
41
+ selectAppDefinition(stateFactory(parameterSelectionData_1)),
42
+ 'should return hostgroupId from parameterSelectionData_1 fixtures': () =>
43
+ selectHostgroupId(stateFactory(parameterSelectionData_1)),
44
+ };
45
+
46
+ describe('ParameterSelectionSelectors', () =>
47
+ testSelectorsSnapshotWithFixtures(fixtures));
@@ -0,0 +1,454 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ParameterSelection should render editDefinition 1`] = `
4
+ <div>
5
+ <div
6
+ className="clearfix"
7
+ >
8
+ <div
9
+ className="form-group"
10
+ >
11
+ <label
12
+ className="col-md-2 control-label"
13
+ >
14
+ Host Group
15
+ </label>
16
+ <div
17
+ className="col-md-4"
18
+ >
19
+ <div />
20
+ <input
21
+ id="foreman_acd_app_definition_hostgroup_id"
22
+ name="foreman_acd_app_definition[hostgroup_id]"
23
+ type="hidden"
24
+ value={-1}
25
+ />
26
+ </div>
27
+ </div>
28
+ </div>
29
+ <div
30
+ className="clearfix"
31
+ >
32
+ <div
33
+ className="form-group"
34
+ >
35
+ <label
36
+ className="col-md-1 control-label"
37
+ >
38
+ Application parameters
39
+ </label>
40
+ <div
41
+ className="col-md-5"
42
+ >
43
+  
44
+ </div>
45
+ </div>
46
+ </div>
47
+ <div
48
+ className="clearfix"
49
+ >
50
+ <div
51
+ className="form-group"
52
+ >
53
+ <Button
54
+ active={false}
55
+ block={false}
56
+ bsClass="btn"
57
+ bsStyle="default"
58
+ disabled={true}
59
+ onClick={[Function]}
60
+ >
61
+ <Icon
62
+ name="plus"
63
+ type="fa"
64
+ />
65
+ </Button>
66
+ <TablePfProvider
67
+ bordered={true}
68
+ className=""
69
+ columns={Array []}
70
+ components={
71
+ Object {
72
+ "body": Object {
73
+ "cell": [Function],
74
+ "row": [Function],
75
+ },
76
+ "header": Object {
77
+ "cell": [Function],
78
+ },
79
+ }
80
+ }
81
+ condensed={false}
82
+ dataTable={true}
83
+ hover={true}
84
+ inlineEdit={true}
85
+ striped={true}
86
+ >
87
+ <Header
88
+ headerRows={
89
+ Array [
90
+ Array [],
91
+ ]
92
+ }
93
+ />
94
+ <Body
95
+ onRow={[Function]}
96
+ rowKey="id"
97
+ rows={Array []}
98
+ />
99
+ </TablePfProvider>
100
+ <Button
101
+ active={false}
102
+ block={false}
103
+ bsClass="btn"
104
+ bsStyle="default"
105
+ disabled={true}
106
+ onClick={[Function]}
107
+ >
108
+ <Icon
109
+ name="plus"
110
+ type="fa"
111
+ />
112
+ </Button>
113
+ </div>
114
+ <input
115
+ id="foreman_acd_app_definition_parameters"
116
+ name="foreman_acd_app_definition[parameters]"
117
+ type="hidden"
118
+ value="[]"
119
+ />
120
+ </div>
121
+ </div>
122
+ `;
123
+
124
+ exports[`ParameterSelection should render editInstance 1`] = `
125
+ <div>
126
+ <div
127
+ className="clearfix"
128
+ >
129
+ <div
130
+ className="form-group"
131
+ >
132
+ <label
133
+ className="col-md-2 control-label"
134
+ >
135
+ Application Definition
136
+ </label>
137
+ <div
138
+ className="col-md-4"
139
+ >
140
+ <div />
141
+ <input
142
+ id="foreman_acd_app_instance_app_definition_id"
143
+ name="foreman_acd_app_instance[app_definition_id]"
144
+ type="hidden"
145
+ value=""
146
+ />
147
+ </div>
148
+ </div>
149
+ </div>
150
+ <div
151
+ className="clearfix"
152
+ >
153
+ <div
154
+ className="form-group"
155
+ >
156
+ <label
157
+ className="col-md-1 control-label"
158
+ >
159
+ Application parameters
160
+ </label>
161
+ <div
162
+ className="col-md-5"
163
+ >
164
+  
165
+ </div>
166
+ </div>
167
+ </div>
168
+ <div
169
+ className="clearfix"
170
+ >
171
+ <div
172
+ className="form-group"
173
+ >
174
+ <TablePfProvider
175
+ bordered={true}
176
+ className=""
177
+ columns={Array []}
178
+ components={
179
+ Object {
180
+ "body": Object {
181
+ "cell": [Function],
182
+ "row": [Function],
183
+ },
184
+ "header": Object {
185
+ "cell": [Function],
186
+ },
187
+ }
188
+ }
189
+ condensed={false}
190
+ dataTable={true}
191
+ hover={true}
192
+ inlineEdit={true}
193
+ striped={true}
194
+ >
195
+ <Header
196
+ headerRows={
197
+ Array [
198
+ Array [],
199
+ ]
200
+ }
201
+ />
202
+ <Body
203
+ onRow={[Function]}
204
+ rowKey="id"
205
+ rows={Array []}
206
+ />
207
+ </TablePfProvider>
208
+ </div>
209
+ <input
210
+ id="foreman_acd_app_instance_parameters"
211
+ name="foreman_acd_app_instance[parameters]"
212
+ type="hidden"
213
+ value="[]"
214
+ />
215
+ </div>
216
+ </div>
217
+ `;
218
+
219
+ exports[`ParameterSelection should render newDefinition 1`] = `
220
+ <div>
221
+ <div
222
+ className="clearfix"
223
+ >
224
+ <div
225
+ className="form-group"
226
+ >
227
+ <label
228
+ className="col-md-2 control-label"
229
+ >
230
+ Host Group
231
+ </label>
232
+ <div
233
+ className="col-md-4"
234
+ >
235
+ <Select
236
+ allowClear={true}
237
+ key="key"
238
+ onChange={[Function]}
239
+ options={
240
+ Object {
241
+ "1": "centos7",
242
+ }
243
+ }
244
+ value="-1"
245
+ />
246
+ <input
247
+ id="foreman_acd_app_definition_hostgroup_id"
248
+ name="foreman_acd_app_definition[hostgroup_id]"
249
+ type="hidden"
250
+ value={-1}
251
+ />
252
+ </div>
253
+ </div>
254
+ </div>
255
+ <div
256
+ className="clearfix"
257
+ >
258
+ <div
259
+ className="form-group"
260
+ >
261
+ <label
262
+ className="col-md-1 control-label"
263
+ >
264
+ Application parameters
265
+ </label>
266
+ <div
267
+ className="col-md-5"
268
+ >
269
+  
270
+ </div>
271
+ </div>
272
+ </div>
273
+ <div
274
+ className="clearfix"
275
+ >
276
+ <div
277
+ className="form-group"
278
+ >
279
+ <Button
280
+ active={false}
281
+ block={false}
282
+ bsClass="btn"
283
+ bsStyle="default"
284
+ disabled={true}
285
+ onClick={[Function]}
286
+ >
287
+ <Icon
288
+ name="plus"
289
+ type="fa"
290
+ />
291
+ </Button>
292
+ <TablePfProvider
293
+ bordered={true}
294
+ className=""
295
+ columns={Array []}
296
+ components={
297
+ Object {
298
+ "body": Object {
299
+ "cell": [Function],
300
+ "row": [Function],
301
+ },
302
+ "header": Object {
303
+ "cell": [Function],
304
+ },
305
+ }
306
+ }
307
+ condensed={false}
308
+ dataTable={true}
309
+ hover={true}
310
+ inlineEdit={true}
311
+ striped={true}
312
+ >
313
+ <Header
314
+ headerRows={
315
+ Array [
316
+ Array [],
317
+ ]
318
+ }
319
+ />
320
+ <Body
321
+ onRow={[Function]}
322
+ rowKey="id"
323
+ rows={Array []}
324
+ />
325
+ </TablePfProvider>
326
+ <Button
327
+ active={false}
328
+ block={false}
329
+ bsClass="btn"
330
+ bsStyle="default"
331
+ disabled={true}
332
+ onClick={[Function]}
333
+ >
334
+ <Icon
335
+ name="plus"
336
+ type="fa"
337
+ />
338
+ </Button>
339
+ </div>
340
+ <input
341
+ id="foreman_acd_app_definition_parameters"
342
+ name="foreman_acd_app_definition[parameters]"
343
+ type="hidden"
344
+ value="[]"
345
+ />
346
+ </div>
347
+ </div>
348
+ `;
349
+
350
+ exports[`ParameterSelection should render newInstance 1`] = `
351
+ <div>
352
+ <div
353
+ className="clearfix"
354
+ >
355
+ <div
356
+ className="form-group"
357
+ >
358
+ <label
359
+ className="col-md-2 control-label"
360
+ >
361
+ Application Definition
362
+ </label>
363
+ <div
364
+ className="col-md-4"
365
+ >
366
+ <Select
367
+ allowClear={true}
368
+ key="key"
369
+ onChange={[Function]}
370
+ options={
371
+ Object {
372
+ "1": "Test123",
373
+ "2": "sowasvonneu",
374
+ }
375
+ }
376
+ value=""
377
+ />
378
+ <input
379
+ id="foreman_acd_app_instance_app_definition_id"
380
+ name="foreman_acd_app_instance[app_definition_id]"
381
+ type="hidden"
382
+ value=""
383
+ />
384
+ </div>
385
+ </div>
386
+ </div>
387
+ <div
388
+ className="clearfix"
389
+ >
390
+ <div
391
+ className="form-group"
392
+ >
393
+ <label
394
+ className="col-md-1 control-label"
395
+ >
396
+ Application parameters
397
+ </label>
398
+ <div
399
+ className="col-md-5"
400
+ >
401
+  
402
+ </div>
403
+ </div>
404
+ </div>
405
+ <div
406
+ className="clearfix"
407
+ >
408
+ <div
409
+ className="form-group"
410
+ >
411
+ <TablePfProvider
412
+ bordered={true}
413
+ className=""
414
+ columns={Array []}
415
+ components={
416
+ Object {
417
+ "body": Object {
418
+ "cell": [Function],
419
+ "row": [Function],
420
+ },
421
+ "header": Object {
422
+ "cell": [Function],
423
+ },
424
+ }
425
+ }
426
+ condensed={false}
427
+ dataTable={true}
428
+ hover={true}
429
+ inlineEdit={true}
430
+ striped={true}
431
+ >
432
+ <Header
433
+ headerRows={
434
+ Array [
435
+ Array [],
436
+ ]
437
+ }
438
+ />
439
+ <Body
440
+ onRow={[Function]}
441
+ rowKey="id"
442
+ rows={Array []}
443
+ />
444
+ </TablePfProvider>
445
+ </div>
446
+ <input
447
+ id="foreman_acd_app_instance_parameters"
448
+ name="foreman_acd_app_instance[parameters]"
449
+ type="hidden"
450
+ value="[]"
451
+ />
452
+ </div>
453
+ </div>
454
+ `;