foreman_acd 0.7.0 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -5
  3. data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +17 -2
  4. data/app/controllers/foreman_acd/app_definitions_controller.rb +104 -7
  5. data/app/controllers/foreman_acd/app_instances_controller.rb +15 -30
  6. data/app/controllers/foreman_acd/concerns/app_instance_mixins.rb +36 -0
  7. data/app/controllers/ui_acd_controller.rb +42 -3
  8. data/app/lib/actions/foreman_acd/run_configurator.rb +1 -0
  9. data/app/models/concerns/foreman_acd/host_managed_extensions.rb +40 -27
  10. data/app/models/foreman_acd/app_instance.rb +47 -2
  11. data/app/models/foreman_acd/foreman_host.rb +8 -0
  12. data/app/services/foreman_acd/app_deployer.rb +19 -2
  13. data/app/services/foreman_acd/inventory_creator.rb +11 -1
  14. data/app/views/foreman_acd/app_definitions/_form.html.erb +4 -0
  15. data/app/views/foreman_acd/app_definitions/import.html.erb +20 -1
  16. data/app/views/foreman_acd/app_definitions/index.html.erb +3 -6
  17. data/app/views/foreman_acd/app_instances/_form.html.erb +4 -0
  18. data/app/views/foreman_acd/app_instances/index.html.erb +15 -11
  19. data/app/views/foreman_acd/app_instances/report.html.erb +7 -2
  20. data/app/views/ui_acd/host_report.json.rabl +4 -0
  21. data/app/views/ui_acd/report_data.json.rabl +10 -0
  22. data/app/views/ui_acd/validate_hostname.json.rabl +6 -0
  23. data/config/routes.rb +3 -0
  24. data/db/migrate/20210818125913_add_is_existing_host_to_foreman_host.rb +8 -0
  25. data/db/migrate/20210902110645_add_initial_configure_task.rb +8 -0
  26. data/lib/foreman_acd/plugin.rb +9 -9
  27. data/lib/foreman_acd/version.rb +1 -1
  28. data/lib/foreman_acd.rb +27 -9
  29. data/package.json +8 -25
  30. data/test/controllers/ui_acd_controller_test.rb +4 -1
  31. data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
  32. data/webpack/__snapshots__/helper.test.js.snap +1 -1
  33. data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +34 -10
  34. data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +12 -0
  35. data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +1 -0
  36. data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +30 -9
  37. data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +4 -0
  38. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +1 -0
  39. data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +12 -0
  40. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinition.test.js.snap +31 -5
  41. data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +8 -0
  42. data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +1 -1
  43. data/webpack/components/ApplicationDefinition/components/__tests__/__snapshots__/AnsiblePlaybookSelector.test.js.snap +3 -3
  44. data/webpack/components/ApplicationDefinition/index.js +8 -0
  45. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.js +214 -0
  46. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.scss +1 -0
  47. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportActions.js +161 -0
  48. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportConstants.js +6 -0
  49. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportReducer.js +79 -0
  50. data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportSelectors.js +8 -0
  51. data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportConfData_1.fixtures.js +129 -0
  52. data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportReducer.fixtures.js +29 -0
  53. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImport.test.js +20 -0
  54. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportReducer.test.js +43 -0
  55. data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportSelectors.test.js +29 -0
  56. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImport.test.js.snap +62 -0
  57. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportReducer.test.js.snap +362 -0
  58. data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportSelectors.test.js.snap +130 -0
  59. data/webpack/components/ApplicationDefinitionImport/index.js +32 -0
  60. data/webpack/components/ApplicationInstance/ApplicationInstance.js +102 -26
  61. data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +118 -6
  62. data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +4 -0
  63. data/webpack/components/ApplicationInstance/ApplicationInstanceHelper.js +15 -0
  64. data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +71 -30
  65. data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +4 -0
  66. data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +2 -0
  67. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +1 -0
  68. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +12 -0
  69. data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +12 -0
  70. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +98 -7
  71. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceReducer.test.js.snap +271 -0
  72. data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +8 -0
  73. data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +1 -0
  74. data/webpack/components/ApplicationInstance/components/ServiceCounter.js +1 -1
  75. data/webpack/components/ApplicationInstance/helper.js +0 -0
  76. data/webpack/components/ApplicationInstance/index.js +8 -0
  77. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +81 -6
  78. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +35 -1
  79. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +3 -0
  80. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +19 -0
  81. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +4 -0
  82. data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReport.test.js.snap +1 -124
  83. data/webpack/components/ApplicationInstanceReport/index.js +8 -1
  84. data/webpack/components/ExistingHostSelection/ExistingHostSelection.js +104 -0
  85. data/webpack/components/ExistingHostSelection/ExistingHostSelection.scss +15 -0
  86. data/webpack/components/ExistingHostSelection/ExistingHostSelectionActions.js +71 -0
  87. data/webpack/components/ExistingHostSelection/ExistingHostSelectionConstants.js +4 -0
  88. data/webpack/components/ExistingHostSelection/ExistingHostSelectionHelper.js +0 -0
  89. data/webpack/components/ExistingHostSelection/ExistingHostSelectionReducer.js +90 -0
  90. data/webpack/components/ExistingHostSelection/ExistingHostSelectionSelectors.js +8 -0
  91. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData_1.fixtures.js +191 -0
  92. data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionReducer.fixtures.js +203 -0
  93. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelection.test.js +19 -0
  94. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionReducer.test.js +59 -0
  95. data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionSelectors.test.js +36 -0
  96. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelection.test.js.snap +35 -0
  97. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionReducer.test.js.snap +614 -0
  98. data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionSelectors.test.js.snap +27 -0
  99. data/webpack/components/ExistingHostSelection/components/ServiceSelector.js +48 -0
  100. data/webpack/components/ExistingHostSelection/components/__tests__/ServiceSelector.test.js +35 -0
  101. data/webpack/components/ExistingHostSelection/components/__tests__/__snapshots__/ServiceSelector.test.js.snap +77 -0
  102. data/webpack/components/ExistingHostSelection/index.js +26 -0
  103. data/webpack/components/ParameterSelection/ParameterSelection.js +103 -1
  104. data/webpack/components/ParameterSelection/ParameterSelection.scss +7 -0
  105. data/webpack/components/ParameterSelection/ParameterSelectionActions.js +46 -4
  106. data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +2 -0
  107. data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +5 -1
  108. data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +52 -11
  109. data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +2 -0
  110. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +8 -0
  111. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +2 -0
  112. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -0
  113. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +96 -0
  114. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +117 -17
  115. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +13 -0
  116. data/webpack/components/ParameterSelection/index.js +4 -1
  117. data/webpack/components/SyncGitRepo/SyncGitRepo.js +2 -10
  118. data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +2 -3
  119. data/webpack/components/SyncGitRepo/SyncGitRepoConstants.js +0 -1
  120. data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +1 -0
  121. data/webpack/components/SyncGitRepo/components/FormTextInput.js +1 -1
  122. data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +3 -2
  123. data/webpack/components/common/DeleteTableEntry.js +16 -2
  124. data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +38 -0
  125. data/webpack/helper.js +21 -1
  126. data/webpack/helper.test.js +20 -1
  127. data/webpack/index.js +5 -0
  128. data/webpack/js-yaml.js +3874 -0
  129. data/webpack/reducer.js +13 -2
  130. data/webpack/test_setup.js +0 -2
  131. metadata +46 -2
@@ -49,6 +49,54 @@ exports[`ParameterSelection should render ansible parameter selection 1`] = `
49
49
  />
50
50
  </div>
51
51
  </div>
52
+ <div>
53
+ <ForemanModal
54
+ dialogClassName="complex_data_modal"
55
+ id="ParameterSelectionComplexDataModal"
56
+ title="YAML Data Input"
57
+ >
58
+ <Header
59
+ closeButton={false}
60
+ />
61
+ <textarea
62
+ defaultValue=""
63
+ id="yamlData"
64
+ onChange={[Function]}
65
+ style={
66
+ Object {
67
+ "fontFamily": "Courier",
68
+ "height": "350px",
69
+ "width": "550px",
70
+ }
71
+ }
72
+ />
73
+ <Footer>
74
+ <div>
75
+ <div />
76
+ <Button
77
+ active={false}
78
+ block={false}
79
+ bsClass="btn"
80
+ bsStyle="primary"
81
+ disabled={false}
82
+ onClick={[Function]}
83
+ >
84
+ Save
85
+ </Button>
86
+ <Button
87
+ active={false}
88
+ block={false}
89
+ bsClass="btn"
90
+ bsStyle="default"
91
+ disabled={false}
92
+ onClick={[Function]}
93
+ >
94
+ Cancel
95
+ </Button>
96
+ </div>
97
+ </Footer>
98
+ </ForemanModal>
99
+ </div>
52
100
  </div>
53
101
  `;
54
102
 
@@ -101,5 +149,53 @@ exports[`ParameterSelection should render foreman parameter selection 1`] = `
101
149
  />
102
150
  </div>
103
151
  </div>
152
+ <div>
153
+ <ForemanModal
154
+ dialogClassName="complex_data_modal"
155
+ id="ParameterSelectionComplexDataModal"
156
+ title="YAML Data Input"
157
+ >
158
+ <Header
159
+ closeButton={false}
160
+ />
161
+ <textarea
162
+ defaultValue=""
163
+ id="yamlData"
164
+ onChange={[Function]}
165
+ style={
166
+ Object {
167
+ "fontFamily": "Courier",
168
+ "height": "350px",
169
+ "width": "550px",
170
+ }
171
+ }
172
+ />
173
+ <Footer>
174
+ <div>
175
+ <div />
176
+ <Button
177
+ active={false}
178
+ block={false}
179
+ bsClass="btn"
180
+ bsStyle="primary"
181
+ disabled={false}
182
+ onClick={[Function]}
183
+ >
184
+ Save
185
+ </Button>
186
+ <Button
187
+ active={false}
188
+ block={false}
189
+ bsClass="btn"
190
+ bsStyle="default"
191
+ disabled={false}
192
+ onClick={[Function]}
193
+ >
194
+ Cancel
195
+ </Button>
196
+ </div>
197
+ </Footer>
198
+ </ForemanModal>
199
+ </div>
104
200
  </div>
105
201
  `;
@@ -2,6 +2,14 @@
2
2
 
3
3
  exports[`ParameterSelectionReducer should activate edit parameter 1`] = `
4
4
  Object {
5
+ "allowedParameterTypes": Array [
6
+ "domain",
7
+ "hostparam",
8
+ "ip",
9
+ "ptable",
10
+ "puppetenv",
11
+ "password",
12
+ ],
5
13
  "columns": Array [
6
14
  Object {
7
15
  "cell": Object {
@@ -136,6 +144,7 @@ Object {
136
144
  },
137
145
  ],
138
146
  "editMode": true,
147
+ "editParamsRowIndex": 1,
139
148
  "error": Object {
140
149
  "errorMsg": "",
141
150
  "status": "",
@@ -239,6 +248,14 @@ Object {
239
248
 
240
249
  exports[`ParameterSelectionReducer should add a parameter 1`] = `
241
250
  Object {
251
+ "allowedParameterTypes": Array [
252
+ "domain",
253
+ "hostparam",
254
+ "ip",
255
+ "ptable",
256
+ "puppetenv",
257
+ "password",
258
+ ],
242
259
  "columns": Array [
243
260
  Object {
244
261
  "cell": Object {
@@ -373,6 +390,7 @@ Object {
373
390
  },
374
391
  ],
375
392
  "editMode": true,
393
+ "editParamsRowIndex": 3,
376
394
  "error": Object {
377
395
  "errorMsg": "",
378
396
  "status": "",
@@ -460,6 +478,7 @@ Object {
460
478
  "backup": Object {
461
479
  "description": "",
462
480
  "id": 3,
481
+ "isYaml": false,
463
482
  "locked": false,
464
483
  "name": "",
465
484
  "newEntry": true,
@@ -468,6 +487,7 @@ Object {
468
487
  },
469
488
  "description": "",
470
489
  "id": 3,
490
+ "isYaml": false,
471
491
  "locked": false,
472
492
  "name": "",
473
493
  "newEntry": true,
@@ -486,6 +506,14 @@ Object {
486
506
 
487
507
  exports[`ParameterSelectionReducer should cancel edit parameter 1`] = `
488
508
  Object {
509
+ "allowedParameterTypes": Array [
510
+ "domain",
511
+ "hostparam",
512
+ "ip",
513
+ "ptable",
514
+ "puppetenv",
515
+ "password",
516
+ ],
489
517
  "columns": Array [
490
518
  Object {
491
519
  "cell": Object {
@@ -715,6 +743,14 @@ Object {
715
743
 
716
744
  exports[`ParameterSelectionReducer should change edit parameter 1`] = `
717
745
  Object {
746
+ "allowedParameterTypes": Array [
747
+ "domain",
748
+ "hostparam",
749
+ "ip",
750
+ "ptable",
751
+ "puppetenv",
752
+ "password",
753
+ ],
718
754
  "columns": Array [
719
755
  Object {
720
756
  "cell": Object {
@@ -849,6 +885,7 @@ Object {
849
885
  },
850
886
  ],
851
887
  "editMode": false,
888
+ "editParamsRowIndex": 1,
852
889
  "error": Object {
853
890
  "errorMsg": "",
854
891
  "status": "",
@@ -952,6 +989,14 @@ Object {
952
989
 
953
990
  exports[`ParameterSelectionReducer should confirm edit parameter 1`] = `
954
991
  Object {
992
+ "allowedParameterTypes": Array [
993
+ "domain",
994
+ "hostparam",
995
+ "ip",
996
+ "ptable",
997
+ "puppetenv",
998
+ "password",
999
+ ],
955
1000
  "columns": Array [
956
1001
  Object {
957
1002
  "cell": Object {
@@ -1144,14 +1189,14 @@ Object {
1144
1189
  "id": 1,
1145
1190
  "name": "web",
1146
1191
  },
1147
- "parameterTypes": Object {
1148
- "domain": "Domain",
1149
- "hostparam": "Host parameter",
1150
- "ip": "IP",
1151
- "password": "Root password",
1152
- "ptable": "Partition table",
1153
- "puppetenv": "Puppet environment",
1154
- },
1192
+ "parameterTypes": Array [
1193
+ "domain",
1194
+ "hostparam",
1195
+ "ip",
1196
+ "ptable",
1197
+ "puppetenv",
1198
+ "password",
1199
+ ],
1155
1200
  "parameters": Array [
1156
1201
  Object {
1157
1202
  "description": "",
@@ -1181,6 +1226,14 @@ Object {
1181
1226
 
1182
1227
  exports[`ParameterSelectionReducer should delete a parameter 1`] = `
1183
1228
  Object {
1229
+ "allowedParameterTypes": Array [
1230
+ "domain",
1231
+ "hostparam",
1232
+ "ip",
1233
+ "ptable",
1234
+ "puppetenv",
1235
+ "password",
1236
+ ],
1184
1237
  "columns": Array [
1185
1238
  Object {
1186
1239
  "cell": Object {
@@ -1373,15 +1426,14 @@ Object {
1373
1426
  "id": 1,
1374
1427
  "name": "web",
1375
1428
  },
1376
- "parameterTypes": Object {
1377
- "domain": "Domain",
1378
- "hostparam": "Host parameter",
1379
- "ip": "IP",
1380
- "lifecycleenv": "Lifecycle environment",
1381
- "password": "Root password",
1382
- "ptable": "Partition table",
1383
- "puppetenv": "Puppet environment",
1384
- },
1429
+ "parameterTypes": Array [
1430
+ "domain",
1431
+ "hostparam",
1432
+ "ip",
1433
+ "ptable",
1434
+ "puppetenv",
1435
+ "password",
1436
+ ],
1385
1437
  "parameters": Array [
1386
1438
  Object {
1387
1439
  "description": "",
@@ -1403,6 +1455,14 @@ Object {
1403
1455
 
1404
1456
  exports[`ParameterSelectionReducer should initialize component 1`] = `
1405
1457
  Object {
1458
+ "allowedParameterTypes": Array [
1459
+ "domain",
1460
+ "hostparam",
1461
+ "ip",
1462
+ "ptable",
1463
+ "puppetenv",
1464
+ "password",
1465
+ ],
1406
1466
  "columns": Array [
1407
1467
  Object {
1408
1468
  "cell": Object {
@@ -1640,6 +1700,14 @@ Object {
1640
1700
 
1641
1701
  exports[`ParameterSelectionReducer should load param data be erroneous 1`] = `
1642
1702
  Object {
1703
+ "allowedParameterTypes": Array [
1704
+ "domain",
1705
+ "hostparam",
1706
+ "ip",
1707
+ "ptable",
1708
+ "puppetenv",
1709
+ "password",
1710
+ ],
1643
1711
  "columns": Array [
1644
1712
  Object {
1645
1713
  "cell": Object {
@@ -1865,6 +1933,14 @@ Object {
1865
1933
 
1866
1934
  exports[`ParameterSelectionReducer should load param data be successful 1`] = `
1867
1935
  Object {
1936
+ "allowedParameterTypes": Array [
1937
+ "domain",
1938
+ "hostparam",
1939
+ "ip",
1940
+ "ptable",
1941
+ "puppetenv",
1942
+ "password",
1943
+ ],
1868
1944
  "columns": Array [
1869
1945
  Object {
1870
1946
  "cell": Object {
@@ -2094,6 +2170,14 @@ Object {
2094
2170
 
2095
2171
  exports[`ParameterSelectionReducer should lock a parameter 1`] = `
2096
2172
  Object {
2173
+ "allowedParameterTypes": Array [
2174
+ "domain",
2175
+ "hostparam",
2176
+ "ip",
2177
+ "ptable",
2178
+ "puppetenv",
2179
+ "password",
2180
+ ],
2097
2181
  "columns": Array [
2098
2182
  Object {
2099
2183
  "cell": Object {
@@ -2323,6 +2407,14 @@ Object {
2323
2407
 
2324
2408
  exports[`ParameterSelectionReducer should request load param data 1`] = `
2325
2409
  Object {
2410
+ "allowedParameterTypes": Array [
2411
+ "domain",
2412
+ "hostparam",
2413
+ "ip",
2414
+ "ptable",
2415
+ "puppetenv",
2416
+ "password",
2417
+ ],
2326
2418
  "columns": Array [
2327
2419
  Object {
2328
2420
  "cell": Object {
@@ -2563,6 +2655,14 @@ Object {
2563
2655
 
2564
2656
  exports[`ParameterSelectionReducer should sort parameter 1`] = `
2565
2657
  Object {
2658
+ "allowedParameterTypes": Array [
2659
+ "domain",
2660
+ "hostparam",
2661
+ "ip",
2662
+ "ptable",
2663
+ "puppetenv",
2664
+ "password",
2665
+ ],
2566
2666
  "columns": Array [
2567
2667
  Object {
2568
2668
  "cell": Object {
@@ -8,6 +8,17 @@ Object {
8
8
  }
9
9
  `;
10
10
 
11
+ exports[`ParameterSelectionSelectors should return allowedParameterTypes from parameterSelectionData_1 fixtures 1`] = `
12
+ Array [
13
+ "domain",
14
+ "hostparam",
15
+ "ip",
16
+ "ptable",
17
+ "puppetenv",
18
+ "password",
19
+ ]
20
+ `;
21
+
11
22
  exports[`ParameterSelectionSelectors should return columns from parameterSelectionData_1 fixtures 1`] = `
12
23
  Array [
13
24
  Object {
@@ -146,6 +157,8 @@ Array [
146
157
 
147
158
  exports[`ParameterSelectionSelectors should return editMode from parameterSelectionData_1 fixtures 1`] = `false`;
148
159
 
160
+ exports[`ParameterSelectionSelectors should return editParamsRowIndex from parameterSelectionData_1 fixtures 1`] = `undefined`;
161
+
149
162
  exports[`ParameterSelectionSelectors should return hostgroupId from parameterSelectionData_1 fixtures 1`] = `1`;
150
163
 
151
164
  exports[`ParameterSelectionSelectors should return loading from parameterSelectionData_1 fixtures 1`] = `false`;
@@ -9,22 +9,26 @@ import {
9
9
  selectLoading,
10
10
  selectEditMode,
11
11
  selectParamData,
12
+ selectAllowedParameterTypes,
12
13
  selectParameterTypes,
13
14
  selectParameters,
14
15
  selectSortingColumns,
15
16
  selectColumns,
16
17
  selectParamDefinition,
18
+ selectEditParamsRowIndex,
17
19
  } from './ParameterSelectionSelectors';
18
20
 
19
21
  const mapStateToProps = state => ({
20
22
  loading: selectLoading(state),
21
23
  editMode: selectEditMode(state),
22
24
  paramData: selectParamData(state),
25
+ allowedParameterTypes: selectAllowedParameterTypes(state),
23
26
  parameterTypes: selectParameterTypes(state),
24
27
  parameters: selectParameters(state),
25
28
  sortingColumns: selectSortingColumns(state),
26
29
  columns: selectColumns(state),
27
30
  paramDefinition: selectParamDefinition(state),
31
+ editParamsRowIndex: selectEditParamsRowIndex(state),
28
32
  });
29
33
 
30
34
  const mapDispatchToProps = dispatch =>
@@ -34,4 +38,3 @@ export default connect(
34
38
  mapStateToProps,
35
39
  mapDispatchToProps
36
40
  )(ParameterSelection);
37
-
@@ -9,7 +9,6 @@ import {
9
9
  translate as __
10
10
  } from 'foremanReact/common/I18n';
11
11
  import {Select, TextInput} from 'foremanReact/components/common/forms/Select';
12
- import RailsData from '../common/RailsData';
13
12
  import ScmTypeSelector from './components/ScmTypeSelector';
14
13
  import FormTextInput from './components/FormTextInput'
15
14
  import { arrayToObject } from '../../helper';
@@ -46,14 +45,6 @@ class SyncGitRepo extends React.Component {
46
45
  msg += __("Git URL cannot be blank");
47
46
  }
48
47
  }
49
-
50
- if (this.props.gitCommit === "") {
51
- result = false;
52
-
53
- if (msg == "") {
54
- msg += __("Git Branch/Commit/Tag cannot be blank");
55
- }
56
- }
57
48
  }
58
49
 
59
50
  if (this.props.scmType !== "git" && this.props.scmType !== "directory" ) {
@@ -126,6 +117,7 @@ class SyncGitRepo extends React.Component {
126
117
  <div>
127
118
  <ScmTypeSelector
128
119
  label="SCM Type *"
120
+ hidden={ false }
129
121
  editable={ appDefinitions.length == 0 }
130
122
  viewText={ scmTypes[scmType] }
131
123
  options={ scmTypes }
@@ -162,7 +154,7 @@ class SyncGitRepo extends React.Component {
162
154
  ) : (<div></div>)}
163
155
  {(scmType === "git") ? (
164
156
  <FormTextInput
165
- label="Git Branch/Commit/Tag *"
157
+ label="Git Branch/Commit/Tag"
166
158
  editable= { appDefinitions.length == 0 }
167
159
  viewText={ gitCommit }
168
160
  onChange={ loadGitCommit }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { API, actionTypeGenerator } from 'foremanReact/redux/API';
3
3
  import { sprintf, translate as __ } from 'foremanReact/common/I18n';
4
- import { addToast } from 'foremanReact/redux/actions/toasts';
4
+ import { addToast } from 'foremanReact/components/ToastsList';
5
5
 
6
6
  import {
7
7
  SYNC_GIT_REPO_INIT,
@@ -12,7 +12,6 @@ import {
12
12
  SYNC_GIT_REPO_REQUEST,
13
13
  SYNC_GIT_REPO_FAILURE,
14
14
  SYNC_GIT_REPO_SUCCESS,
15
- SYNC_GIT_REPOSITORY,
16
15
  } from './SyncGitRepoConstants';
17
16
 
18
17
  export const initSyncGitRepo = (
@@ -36,7 +35,7 @@ export const initSyncGitRepo = (
36
35
 
37
36
  const errorHandler = (msg, err) => {
38
37
  const error = {
39
- errorMsg: 'Failed to fetch data from server.',
38
+ errorMsg: __('Failed to fetch data from server.'),
40
39
  statusText: err,
41
40
  };
42
41
  return { type: msg, payload: { error } };
@@ -6,4 +6,3 @@ export const SYNC_GIT_REPO_LOAD_GIT_URL = 'SYNC_GIT_REPO_LOAD_GIT_URL';
6
6
  export const SYNC_GIT_REPO_REQUEST = 'SYNC_GIT_REPO_REQUEST';
7
7
  export const SYNC_GIT_REPO_SUCCESS = 'SYNC_GIT_REPO_SUCCESS';
8
8
  export const SYNC_GIT_REPO_FAILURE = 'SYNC_GIT_REPO_FAILURE';
9
- export const SYNC_GIT_REPOSITORY = 'ANSIBLE_PLAYBOOK_SYNC_GIT_REPOSITORY';
@@ -5,6 +5,7 @@ exports[`SyncGitRepo should render ansible playbook 1`] = `
5
5
  <div>
6
6
  <ScmTypeSelector
7
7
  editable={true}
8
+ hidden={false}
8
9
  label="SCM Type *"
9
10
  onChange={[Function]}
10
11
  options={Object {}}
@@ -21,7 +21,7 @@ const FormTextInput= ({
21
21
  onChange={onChange}
22
22
  />
23
23
  <RailsData
24
- key='ansible_playbook_id'
24
+ key='ansible_playbook_form_data'
25
25
  view='ansible_playbook'
26
26
  parameter={parameter}
27
27
  value={viewText}
@@ -17,14 +17,15 @@ const ScmTypeSelector= ({
17
17
  <label className="col-md-2 control-label">{label}</label>
18
18
  <div className="col-md-4">
19
19
  <ExtSelect
20
- editable={ editable }
20
+ hidden={hidden}
21
+ editable={editable}
21
22
  viewText={viewText}
22
23
  selectValue={selectValue}
23
24
  onChange={onChange}
24
25
  options={options}
25
26
  />
26
27
  <RailsData
27
- key='ansible_playbook_id'
28
+ key='ansible_playbook_scm_data'
28
29
  view='ansible_playbook'
29
30
  parameter='scm_type'
30
31
  value={selectValue}
@@ -1,8 +1,9 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import {
4
4
  Icon,
5
5
  Button,
6
+ MessageDialog,
6
7
  } from 'patternfly-react';
7
8
  import { translate as __ } from 'foremanReact/common/I18n';
8
9
 
@@ -16,12 +17,25 @@ const DeleteTableEntry = ({
16
17
  return null;
17
18
  }
18
19
 
20
+ const [showModal, setShowModal] = useState(false);
21
+ const toggleModal = () => setShowModal(!showModal);
22
+
19
23
  return (
20
24
  <span>
25
+ <MessageDialog
26
+ show={showModal}
27
+ onHide={toggleModal}
28
+ primaryAction={() => onDeleteTableEntry(additionalData)}
29
+ secondaryAction={toggleModal}
30
+ primaryActionButtonContent={__('Confirm')}
31
+ secondaryActionButtonContent={__('Cancel')}
32
+ title={__('Confirm action')}
33
+ primaryContent={__('Are you sure you wish to delete this item?')}
34
+ />
21
35
  <Button
22
36
  bsStyle="default"
23
37
  disabled={disabled}
24
- onClick={() => window.confirm(__("Are you sure you wish to delete this item?")) && onDeleteTableEntry(additionalData) }
38
+ onClick={toggleModal}
25
39
  >
26
40
  <Icon type="pf" name="delete" title={__("Delete entry")} />
27
41
  </Button>
@@ -2,6 +2,25 @@
2
2
 
3
3
  exports[`DeleteTableEntry should render delete parameter 1`] = `
4
4
  <span>
5
+ <MessageDialog
6
+ accessibleDescription=""
7
+ accessibleName=""
8
+ className=""
9
+ enforceFocus={true}
10
+ footer={null}
11
+ icon={null}
12
+ onHide={[Function]}
13
+ primaryAction={[Function]}
14
+ primaryActionButtonBsStyle="primary"
15
+ primaryActionButtonContent="Confirm"
16
+ primaryContent="Are you sure you wish to delete this item?"
17
+ secondaryAction={[Function]}
18
+ secondaryActionButtonBsStyle="default"
19
+ secondaryActionButtonContent="Cancel"
20
+ secondaryContent={null}
21
+ show={false}
22
+ title="Confirm action"
23
+ />
5
24
  <Button
6
25
  active={false}
7
26
  block={false}
@@ -21,6 +40,25 @@ exports[`DeleteTableEntry should render delete parameter 1`] = `
21
40
 
22
41
  exports[`DeleteTableEntry should render disabled button 1`] = `
23
42
  <span>
43
+ <MessageDialog
44
+ accessibleDescription=""
45
+ accessibleName=""
46
+ className=""
47
+ enforceFocus={true}
48
+ footer={null}
49
+ icon={null}
50
+ onHide={[Function]}
51
+ primaryAction={[Function]}
52
+ primaryActionButtonBsStyle="primary"
53
+ primaryActionButtonContent="Confirm"
54
+ primaryContent="Are you sure you wish to delete this item?"
55
+ secondaryAction={[Function]}
56
+ secondaryActionButtonBsStyle="default"
57
+ secondaryActionButtonContent="Cancel"
58
+ secondaryContent={null}
59
+ show={false}
60
+ title="Confirm action"
61
+ />
24
62
  <Button
25
63
  active={false}
26
64
  block={false}
data/webpack/helper.js CHANGED
@@ -19,6 +19,10 @@ function arrayToObjectObj(arr, id) {
19
19
  return rv;
20
20
  }
21
21
 
22
+ function shortHostname(fqdn) {
23
+ return fqdn.split('.')[0];
24
+ }
25
+
22
26
  function EasyHeaderFormatter(value, { column }) {
23
27
  return (
24
28
  <Table.Heading aria-label={column.header.label} {...column.header.props}>
@@ -27,8 +31,24 @@ function EasyHeaderFormatter(value, { column }) {
27
31
  );
28
32
  }
29
33
 
34
+ function supportedPluginsToHiddenParameterTypes(supportedPlugins) {
35
+ let hiddenParameterTypes = [];
36
+
37
+ if (supportedPlugins['puppet'] == false) {
38
+ hiddenParameterTypes.push("puppetenv");
39
+ }
40
+
41
+ if (supportedPlugins['katello'] == false) {
42
+ hiddenParameterTypes.push("lifecycleenv");
43
+ }
44
+
45
+ return hiddenParameterTypes;
46
+ }
47
+
30
48
  export {
31
49
  arrayToObject,
32
50
  arrayToObjectObj,
33
- EasyHeaderFormatter
51
+ shortHostname,
52
+ EasyHeaderFormatter,
53
+ supportedPluginsToHiddenParameterTypes
34
54
  };