foreman_acd 0.0.6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +107 -56
  3. data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +124 -0
  4. data/app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb +72 -0
  5. data/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +2 -2
  6. data/app/controllers/foreman_acd/api/v2/app_instances_controller.rb +62 -0
  7. data/app/controllers/foreman_acd/app_definitions_controller.rb +46 -9
  8. data/app/controllers/foreman_acd/app_instances_controller.rb +96 -90
  9. data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +23 -0
  10. data/app/controllers/foreman_acd/concerns/app_definition_parameters.rb +1 -1
  11. data/app/controllers/foreman_acd/concerns/app_instance_parameters.rb +1 -1
  12. data/app/controllers/foreman_acd/remote_execution_controller.rb +46 -0
  13. data/app/controllers/ui_acd_controller.rb +20 -4
  14. data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +42 -0
  15. data/app/lib/actions/foreman_acd/run_configurator.rb +41 -0
  16. data/app/models/concerns/foreman_acd/host_managed_extensions.rb +51 -0
  17. data/app/models/foreman_acd/acd_provider.rb +30 -0
  18. data/app/models/foreman_acd/ansible_playbook.rb +67 -0
  19. data/app/models/foreman_acd/app_definition.rb +25 -1
  20. data/app/models/foreman_acd/app_instance.rb +42 -0
  21. data/app/models/foreman_acd/foreman_host.rb +23 -0
  22. data/app/models/foreman_acd/taxonomy_extensions.rb +17 -0
  23. data/app/services/foreman_acd/app_configurator.rb +54 -0
  24. data/app/services/foreman_acd/app_deployer.rb +151 -0
  25. data/app/services/foreman_acd/inventory_creator.rb +54 -0
  26. data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +30 -0
  27. data/app/views/foreman_acd/ansible_playbooks/edit.html.erb +11 -0
  28. data/app/views/foreman_acd/ansible_playbooks/index.html.erb +30 -0
  29. data/app/views/foreman_acd/ansible_playbooks/new.html.erb +3 -0
  30. data/app/views/foreman_acd/api/v2/ansible_playbooks/base.json.rabl +5 -0
  31. data/app/views/foreman_acd/api/v2/ansible_playbooks/index.json.rabl +5 -0
  32. data/app/views/foreman_acd/api/v2/ansible_playbooks/show.json.rabl +9 -0
  33. data/app/views/foreman_acd/api/v2/app_definitions/base.json.rabl +5 -0
  34. data/app/views/foreman_acd/api/v2/app_definitions/index.json.rabl +5 -0
  35. data/app/views/foreman_acd/api/v2/app_definitions/show.json.rabl +9 -0
  36. data/app/views/foreman_acd/api/v2/app_instances/base.json.rabl +5 -0
  37. data/app/views/foreman_acd/api/v2/app_instances/index.json.rabl +5 -0
  38. data/app/views/foreman_acd/api/v2/app_instances/show.json.rabl +5 -0
  39. data/app/views/foreman_acd/app_definitions/_form.html.erb +34 -20
  40. data/app/views/foreman_acd/app_definitions/edit.html.erb +10 -0
  41. data/app/views/foreman_acd/app_definitions/import.html.erb +18 -0
  42. data/app/views/foreman_acd/app_definitions/index.html.erb +10 -6
  43. data/app/views/foreman_acd/app_instances/_form.html.erb +12 -10
  44. data/app/views/foreman_acd/app_instances/edit.html.erb +10 -0
  45. data/app/views/foreman_acd/app_instances/index.html.erb +87 -9
  46. data/app/views/foreman_acd/app_instances/report.html.erb +22 -0
  47. data/app/views/templates/job/run_acd_ansible_playbook.erb +62 -0
  48. data/app/views/ui_acd/ansible_data.json.rabl +6 -0
  49. data/app/views/ui_acd/app.json.rabl +6 -2
  50. data/app/views/ui_acd/app_definition.json.rabl +1 -1
  51. data/app/views/ui_acd/{fdata.json.rabl → foreman_data.json.rabl} +1 -1
  52. data/config/routes.rb +35 -1
  53. data/db/migrate/20190610202252_create_app_definitions.rb +1 -3
  54. data/db/migrate/20190625140305_create_app_instances.rb +1 -1
  55. data/db/migrate/20200916091018_create_ansible_playbooks.rb +20 -0
  56. data/db/migrate/20200917120220_add_ansible_playbook_id.rb +14 -0
  57. data/db/migrate/20201016002819_add_ansible_vars_all_to_app_definitions.rb +8 -0
  58. data/db/migrate/20201016104338_add_ansible_vars_all_to_app_instances.rb +8 -0
  59. data/db/migrate/20210112111548_add_organization_to_app_instance.rb +22 -0
  60. data/db/migrate/20210112113853_add_location_to_app_instance.rb +8 -0
  61. data/db/migrate/20210202141658_create_foreman_hosts.rb +24 -0
  62. data/db/migrate/20210204111306_remove_hosts_from_app_instances.rb +8 -0
  63. data/db/migrate/20210209091014_rename_acd_tables.rb +16 -0
  64. data/db/migrate/20210216083522_add_last_progress_report.rb +8 -0
  65. data/db/migrate/20210216091529_add_last_deploy_task.rb +8 -0
  66. data/db/seeds.d/62_acd_proxy_feature.rb +4 -0
  67. data/db/seeds.d/75-job_templates.rb +13 -0
  68. data/lib/foreman_acd/engine.rb +21 -3
  69. data/lib/foreman_acd/plugin.rb +112 -20
  70. data/lib/foreman_acd/version.rb +1 -1
  71. data/locale/en/foreman_acd.edit.po +326 -0
  72. data/locale/en/foreman_acd.po +232 -2
  73. data/locale/en/foreman_acd.po.time_stamp +0 -0
  74. data/locale/foreman_acd.pot +343 -8
  75. data/package.json +1 -1
  76. data/test/controllers/ansible_playbooks_controller_test.rb +27 -0
  77. data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +391 -0
  78. data/webpack/components/ApplicationDefinition/ApplicationDefinition.scss +1 -0
  79. data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +303 -0
  80. data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +15 -0
  81. data/webpack/components/ApplicationDefinition/ApplicationDefinitionHelper.js +26 -0
  82. data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +269 -0
  83. data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +9 -0
  84. data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +49 -0
  85. data/webpack/components/ApplicationDefinition/index.js +35 -0
  86. data/webpack/components/ApplicationInstance/ApplicationInstance.js +451 -0
  87. data/webpack/components/ApplicationInstance/ApplicationInstance.scss +11 -0
  88. data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +247 -0
  89. data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +15 -0
  90. data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +309 -0
  91. data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +10 -0
  92. data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +49 -0
  93. data/webpack/components/ApplicationInstance/components/Service.js +30 -0
  94. data/webpack/components/ApplicationInstance/components/ServiceCounter.js +37 -0
  95. data/webpack/components/ApplicationInstance/index.js +37 -0
  96. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +148 -0
  97. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.scss +44 -0
  98. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +42 -0
  99. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +2 -0
  100. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +38 -0
  101. data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +4 -0
  102. data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +26 -0
  103. data/webpack/components/ApplicationInstanceReport/index.js +25 -0
  104. data/webpack/components/ParameterSelection/ParameterSelection.js +131 -192
  105. data/webpack/components/ParameterSelection/ParameterSelection.scss +9 -0
  106. data/webpack/components/ParameterSelection/ParameterSelectionActions.js +87 -110
  107. data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +15 -19
  108. data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +3 -35
  109. data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +116 -84
  110. data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +3 -7
  111. data/webpack/components/ParameterSelection/__fixtures__/parameterSelection.fixtures.js +12 -21
  112. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +1 -1
  113. data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +3 -45
  114. data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +20 -0
  115. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +22 -46
  116. data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -6
  117. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +40 -265
  118. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +11 -96
  119. data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +3 -9
  120. data/webpack/components/ParameterSelection/index.js +6 -8
  121. data/webpack/components/common/AddTableEntry.js +30 -0
  122. data/webpack/components/common/DeleteTableEntry.js +39 -0
  123. data/webpack/components/common/EasyHeaderFormatter.js +18 -0
  124. data/webpack/components/common/EditTableEntry.js +50 -0
  125. data/webpack/components/common/ExtSelect.js +43 -0
  126. data/webpack/components/common/LockTableEntry.js +60 -0
  127. data/webpack/components/common/RailsData.js +27 -0
  128. data/webpack/components/common/__tests__/AddTableEntry.test.js +26 -0
  129. data/webpack/components/common/__tests__/DeleteTableEntry.test.js +29 -0
  130. data/webpack/components/common/__tests__/ExtSelect.test.js +38 -0
  131. data/webpack/components/common/__tests__/RailsData.test.js +16 -0
  132. data/webpack/components/common/__tests__/__snapshots__/AddParameter.test.js.snap +35 -0
  133. data/webpack/components/common/__tests__/__snapshots__/AddTableEntry.test.js.snap +35 -0
  134. data/webpack/components/common/__tests__/__snapshots__/DeleteParameter.test.js.snap +41 -0
  135. data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +41 -0
  136. data/webpack/components/common/__tests__/__snapshots__/ExtSelect.test.js.snap +18 -0
  137. data/webpack/components/common/__tests__/__snapshots__/RailsData.test.js.snap +10 -0
  138. data/webpack/helper.js +20 -0
  139. data/webpack/index.js +6 -0
  140. data/webpack/reducer.js +43 -3
  141. metadata +114 -20
@@ -13,23 +13,27 @@ import {
13
13
  import * as sort from 'sortabular';
14
14
 
15
15
  import {
16
- INIT_PARAMETER_SELECTION,
17
- PARAMETER_TYPES,
18
- PARAMETER_DELETE,
19
- PARAMETER_ADD,
20
- PARAMETER_EDIT_ACTIVATE,
21
- PARAMETER_EDIT_CONFIRM,
22
- PARAMETER_EDIT_CHANGE,
23
- PARAMETER_EDIT_CANCEL,
24
- PARAMETER_SORT,
25
- LOAD_PARAMETER_SELECTION_REQUEST,
26
- LOAD_PARAMETER_SELECTION_SUCCESS,
27
- LOAD_PARAMETER_SELECTION_FAILURE,
28
- LOAD_FOREMAN_DATA_REQUEST,
29
- LOAD_FOREMAN_DATA_SUCCESS,
30
- LOAD_FOREMAN_DATA_FAILURE,
16
+ PARAMETER_SELECTION_INIT,
17
+ PARAMETER_SELECTION_TYPES,
18
+ PARAMETER_SELECTION_LOCK,
19
+ PARAMETER_SELECTION_DELETE,
20
+ PARAMETER_SELECTION_ADD,
21
+ PARAMETER_SELECTION_EDIT_ACTIVATE,
22
+ PARAMETER_SELECTION_EDIT_CONFIRM,
23
+ PARAMETER_SELECTION_EDIT_CHANGE,
24
+ PARAMETER_SELECTION_EDIT_CANCEL,
25
+ PARAMETER_SELECTION_SORT,
26
+ PARAMETER_SELECTION_PARAM_TYPE_FOREMAN,
27
+ PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE,
28
+ PARAMETER_SELECTION_LOAD_PARAM_DATA_REQUEST,
29
+ PARAMETER_SELECTION_LOAD_PARAM_DATA_SUCCESS,
30
+ PARAMETER_SELECTION_LOAD_PARAM_DATA_FAILURE,
31
31
  } from './ParameterSelectionConstants';
32
32
 
33
+ import {
34
+ APPLICATION_DEFINITION_PARAMETER_SELECTION_MODAL_CLOSE,
35
+ } from '../ApplicationDefinition/ApplicationDefinitionConstants';
36
+
33
37
  export const initialState = Immutable({
34
38
  editMode: false,
35
39
  error: { errorMsg: '', status: '', statusText: '' },
@@ -39,83 +43,97 @@ const parameterSelectionParameters = (state = initialState, action) => {
39
43
  const { payload } = action;
40
44
 
41
45
  switch (action.type) {
42
- case INIT_PARAMETER_SELECTION: {
46
+ case PARAMETER_SELECTION_INIT: {
43
47
  return state.merge(payload);
44
48
  }
45
- case PARAMETER_ADD: {
46
- var rows = [];
47
- var index = 0;
49
+ case PARAMETER_SELECTION_ADD: {
50
+ let parameters = [];
51
+ let index = 1;
48
52
 
49
- if ('rows' in state && state.rows !== undefined && state.rows.length > 0) {
50
- rows = cloneDeep(state.rows);
51
- index = Math.max(...rows.map(e => e.id)) + 1;
53
+ if ('parameters' in state && state.parameters !== undefined && state.parameters.length > 0) {
54
+ parameters = cloneDeep(state.parameters);
55
+ index = Math.max(...parameters.map(e => e.id)) + 1;
52
56
  }
53
57
 
54
- const newRow = {id: index, name: "", description: '', type: '', value: '', newEntry: true };
58
+ const newRow = {id: index, locked: false, name: "", description: '', type: '', value: '', newEntry: true };
55
59
  newRow.backup = cloneDeep(newRow)
56
- rows.push(newRow);
60
+ parameters.push(newRow);
57
61
 
58
62
  return state.merge({
59
63
  editMode: true,
60
- rows: rows
64
+ parameters: parameters
61
65
  });
62
66
  }
63
- case PARAMETER_DELETE: {
64
- var rows = state.rows.filter(v => v.id !== payload.rowData.id);
67
+ case PARAMETER_SELECTION_LOCK: {
68
+ const parameters = cloneDeep(state.parameters);
69
+ const index = findIndex(parameters, { id: payload.rowData.id });
70
+
71
+ if (parameters[index].locked !== undefined) {
72
+ parameters[index].locked = !parameters[index].locked;
73
+ } else {
74
+ parameters[index].locked = true;
75
+ }
76
+
65
77
  return state.merge({
66
- rows: rows,
67
- parameterTypes: filterUsedParameterTypes(PARAMETER_TYPES, rows),
78
+ parameters: parameters
79
+ });
80
+ }
81
+ case PARAMETER_SELECTION_DELETE: {
82
+ const parameters = state.parameters.filter(v => v.id !== payload.rowData.id);
83
+ return state.merge({
84
+ parameters: parameters,
85
+ parameterTypes: filterUsedParameterTypes(PARAMETER_SELECTION_TYPES, parameters),
68
86
  })
69
87
  }
70
- case PARAMETER_EDIT_ACTIVATE: {
71
- const rows = cloneDeep(state.rows);
72
- const index = findIndex(rows, { id: payload.rowData.id });
88
+ case PARAMETER_SELECTION_EDIT_ACTIVATE: {
89
+ const parameters = cloneDeep(state.parameters);
90
+ const index = findIndex(parameters, { id: payload.rowData.id });
73
91
 
74
- rows[index].backup = cloneDeep(rows[index]);
92
+ parameters[index].backup = cloneDeep(parameters[index]);
75
93
 
76
94
  return state.merge({
77
95
  editMode: true,
78
- rows: rows
96
+ parameters: parameters
79
97
  });
80
98
  }
81
- case PARAMETER_EDIT_CONFIRM: {
82
- const rows = cloneDeep(state.rows);
83
- const index = findIndex(rows, { id: payload.rowData.id });
99
+ case PARAMETER_SELECTION_EDIT_CONFIRM: {
100
+ const parameters = cloneDeep(state.parameters);
101
+ const index = findIndex(parameters, { id: payload.rowData.id });
84
102
 
85
- delete rows[index].backup;
86
- delete rows[index].newEntry;
103
+ delete parameters[index].backup;
104
+ delete parameters[index].newEntry;
87
105
 
88
106
  return state.merge({
89
107
  editMode: false,
90
- parameterTypes: filterUsedParameterTypes(PARAMETER_TYPES, rows),
91
- rows: rows
108
+ parameterTypes: filterUsedParameterTypes(PARAMETER_SELECTION_TYPES, parameters),
109
+ parameters: parameters
92
110
  });
93
111
  }
94
- case PARAMETER_EDIT_CHANGE: {
95
- const rows = cloneDeep(state.rows);
96
- const index = findIndex(rows, { id: payload.rowData.id });
112
+ case PARAMETER_SELECTION_EDIT_CHANGE: {
113
+ const parameters = cloneDeep(state.parameters);
114
+ const index = findIndex(parameters, { id: payload.rowData.id });
97
115
 
98
- rows[index][payload.property] = payload.value;
116
+ parameters[index][payload.property] = payload.value;
99
117
 
100
- return state.set('rows', rows);
118
+ return state.set('parameters', parameters);
101
119
  }
102
- case PARAMETER_EDIT_CANCEL: {
103
- const rows = cloneDeep(state.rows);
104
- const index = findIndex(rows, { id: payload.rowData.id });
120
+ case PARAMETER_SELECTION_EDIT_CANCEL: {
121
+ const parameters = cloneDeep(state.parameters);
122
+ const index = findIndex(parameters, { id: payload.rowData.id });
105
123
 
106
- rows[index] = cloneDeep(rows[index].backup);
107
- delete rows[index].backup;
124
+ parameters[index] = cloneDeep(parameters[index].backup);
125
+ delete parameters[index].backup;
108
126
 
109
- if (rows[index].newEntry === true) {
110
- rows.splice(index, 1);
127
+ if (parameters[index].newEntry === true) {
128
+ parameters.splice(index, 1);
111
129
  }
112
130
 
113
131
  return state.merge({
114
132
  editMode: false,
115
- rows: rows
133
+ parameters: parameters
116
134
  });
117
135
  }
118
- case PARAMETER_SORT: {
136
+ case PARAMETER_SELECTION_SORT: {
119
137
  const selectedColumn = payload.selectedColumn;
120
138
  return state.set(
121
139
  'sortingColumns',
@@ -126,45 +144,59 @@ const parameterSelectionParameters = (state = initialState, action) => {
126
144
  })
127
145
  );
128
146
  }
129
- case LOAD_PARAMETER_SELECTION_FAILURE: {
130
- return state.merge({ error: payload.error, loading: false });
131
- }
132
- case LOAD_PARAMETER_SELECTION_REQUEST: {
133
- return state.set('loading', true);
134
- }
135
- case LOAD_PARAMETER_SELECTION_SUCCESS: {
136
- return state.merge({
137
- appDefinition: payload.app_definition,
138
- loading: false,
139
- rows: JSON.parse(payload.app_definition.parameters),
140
- hostgroupId: payload.app_definition.hostgroup_id,
141
- foremanData: payload.fdata,
142
- });
143
- }
144
- case LOAD_FOREMAN_DATA_FAILURE: {
147
+ case PARAMETER_SELECTION_LOAD_PARAM_DATA_FAILURE: {
145
148
  return state.merge({
146
149
  error: payload.error,
147
150
  loading: false
148
151
  });
149
152
  }
150
- case LOAD_FOREMAN_DATA_REQUEST: {
151
- var newState = {
152
- foremanData: {},
153
- hostgroupId: -1,
154
- loading: true
155
- };
156
-
157
- if (payload.clearRows === true) {
158
- Object.assign(newState, { rows: [] });
153
+ case PARAMETER_SELECTION_LOAD_PARAM_DATA_REQUEST: {
154
+ let newState = {};
155
+
156
+ if (payload.dataType == PARAMETER_SELECTION_PARAM_TYPE_FOREMAN) {
157
+ newState = {
158
+ paramData: {},
159
+ hostgroupId: -1,
160
+ loading: true
161
+ };
162
+ } else if (payload.dataType == PARAMETER_SELECTION_PARAM_TYPE_ANSIBLE) {
163
+ newState = {
164
+ loading: true
165
+ };
166
+ }
167
+
168
+ if (payload.clearParameters === true) {
169
+ Object.assign(newState, { parameters: [] });
170
+ }
171
+
172
+ return state.merge(newState);
173
+ }
174
+ case PARAMETER_SELECTION_LOAD_PARAM_DATA_SUCCESS: {
175
+ let newState = {};
176
+
177
+ if (payload.dataType == PARAMETER_SELECTION_PARAM_TYPE_FOREMAN) {
178
+ newState = {
179
+ loading: false,
180
+ paramData: payload,
181
+ hostgroupId: payload.hostgroup_id,
182
+ };
159
183
  }
160
184
 
161
185
  return state.merge(newState);
162
186
  }
163
- case LOAD_FOREMAN_DATA_SUCCESS: {
187
+ case APPLICATION_DEFINITION_PARAMETER_SELECTION_MODAL_CLOSE: {
188
+ const parameters = cloneDeep(state.parameters);
189
+
190
+ parameters.forEach((param, index) => {
191
+ delete parameters[index].backup;
192
+ if (parameters[index].newEntry === true) {
193
+ parameters.splice(index, 1);
194
+ }
195
+ });
196
+
164
197
  return state.merge({
165
- loading: false,
166
- foremanData: payload,
167
- hostgroupId: payload.hostgroup_id,
198
+ editMode: false,
199
+ parameters: parameters
168
200
  });
169
201
  }
170
202
  default:
@@ -1,15 +1,11 @@
1
- import { differenceBy, slice, includes, uniq } from 'lodash';
2
- import Immutable from 'seamless-immutable';
3
- import { createSelector } from 'reselect';
4
-
5
1
  const parameterState = state => state.foremanAcd.parameterSelectionParameters;
6
2
 
7
3
  export const selectLoading = state => parameterState(state).loading;
8
4
  export const selectEditMode = state => parameterState(state).editMode;
9
- export const selectForemanData = state => parameterState(state).foremanData;
5
+ export const selectParamData = state => parameterState(state).paramData;
10
6
  export const selectParameterTypes = state => parameterState(state).parameterTypes;
11
- export const selectRows = state => parameterState(state).rows;
7
+ export const selectParameters = state => parameterState(state).parameters;
12
8
  export const selectSortingColumns = state => parameterState(state).sortingColumns;
13
9
  export const selectColumns = state => parameterState(state).columns;
14
- export const selectAppDefinition = state => parameterState(state).appDefinition;
10
+ export const selectParamDefinition = state => parameterState(state).paramDefinition;
15
11
  export const selectHostgroupId = state => parameterState(state).hostgroupId;
@@ -1,21 +1,14 @@
1
1
  export const newDefinition = {
2
- organization: "Default Organization",
3
- location: "Default Location",
4
- hostgroups: {
5
- "1": "centos7"
2
+ mode: "newDefinition",
3
+ serviceDefinition: {
4
+ id: 1,
5
+ name: "Test123",
6
+ hostgroup_id: 1
6
7
  },
7
- loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
8
- mode: "newDefinition"
9
8
  };
10
9
  export const editDefinition = {
11
- organization: "Default Organization",
12
- location: "Default Location",
13
- hostgroups: {
14
- "1": "centos7"
15
- },
16
- loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
17
10
  mode: "editDefinition",
18
- appDefinition: {
11
+ serviceDefinition: {
19
12
  id: 1,
20
13
  name: "Test123",
21
14
  hostgroup_id: 1
@@ -82,21 +75,19 @@ export const editDefinition = {
82
75
 
83
76
  export const newInstance = {
84
77
  mode: "newInstance",
85
- organization: "Default Organization",
86
- location: "Default Location",
87
78
  applications: {
88
79
  "1": "Test123",
89
80
  "2": "sowasvonneu"
90
81
  },
91
- loadParameterSelectionUrl: "/acd/ui_acd_app/__id__",
92
- loadForemanDataUrl: "/acd/ui_acd_fdata/__id__"
82
+ serviceDefinition: {
83
+ id: 1,
84
+ name: "Test123",
85
+ hostgroup_id: 1
86
+ },
93
87
  };
94
88
  export const editInstance = {
95
89
  mode: "editInstance",
96
- organization: "Default Organization",
97
- location: "Default Location",
98
- loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
99
- appDefinition: {
90
+ serviceDefinition: {
100
91
  id: 1,
101
92
  name: "Test123",
102
93
  hostgroup_id: 1
@@ -127,7 +127,7 @@ export const parameterSelectionData_1 = {
127
127
  }
128
128
  }
129
129
  ],
130
- rows: [
130
+ parameters: [
131
131
  {
132
132
  id: 1,
133
133
  name: 'PuppetEnv',
@@ -13,9 +13,9 @@ export const successState = Immutable(parameterSelectionData_1);
13
13
 
14
14
  const EDIT_ROW_ID = 5;
15
15
 
16
- var editClone = parameterSelectionData_1;
17
- var editIndex = findIndex(editClone.rows, { id: EDIT_ROW_ID })
18
- editClone["rows"][editIndex].backup = cloneDeep(editClone["rows"][editIndex]);
16
+ const editClone = parameterSelectionData_1;
17
+ const editIndex = findIndex(editClone.parameters, { id: EDIT_ROW_ID })
18
+ editClone["parameters"][editIndex].backup = cloneDeep(editClone["parameters"][editIndex]);
19
19
  export const editState = Immutable(editClone);
20
20
 
21
21
  export const initParameterSelectionPayload = parameterSelectionData_1;
@@ -83,45 +83,3 @@ export const loadForemanDataSuccessPayload = {
83
83
  export const loadForemanDataFailurePayload = {
84
84
  error: "Something really bad happend",
85
85
  };
86
-
87
- export const loadParameterSelectionRequestPayload = { };
88
- export const loadParameterSelectionSuccessPayload = {
89
- app_definition: {
90
- id: 2,
91
- name: "sowasvonneu",
92
- description: "",
93
- hostgroup_id: 1,
94
- parameters: "[{\"id\":0,\"name\":\"richtigneu\",\"description\":\"\",\"type\":\"puppetenv\",\"value\":\"1\"},{\"id\":1,\"name\":\"ganzgut\",\"description\":\"\",\"type\":\"ip\",\"value\":\"1.1.1.2\"}]",
95
- created_at: "2019-11-13 17:47:27 +0100",
96
- updated_at: "2019-11-13 17:47:27 +0100"
97
- },
98
- fdata: {
99
- hostgroup_id: 1,
100
- environments: [
101
- {
102
- id: 1,
103
- name: "production"
104
- },
105
- {
106
- id: 2,
107
- name: "test"
108
- }
109
- ],
110
- lifecycle_environments: [],
111
- domains: [],
112
- computeprofiles: [],
113
- ptables: [
114
- {
115
- id: 105,
116
- name: "Kickstart default"
117
- },
118
- {
119
- id: 104,
120
- name: "Kickstart default thin"
121
- }
122
- ]
123
- }
124
- };
125
- export const loadParameterSelectionFailurePayload = {
126
- error: "Something really bad happend",
127
- };
@@ -15,32 +15,52 @@ const noop = () => {};
15
15
 
16
16
  const fixtures = {
17
17
  'should render newDefinition': {
18
+ location: "Default Location",
19
+ organization: "Default Organization",
20
+ loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
18
21
  loading: false,
19
22
  data: newDefinition,
20
23
  error: { statusText: '', errorMsg: '' },
21
24
  initParameterSelection: noop,
22
25
  loadForemanData: noop,
26
+ addParameter: noop,
27
+ deleteParameter: noop,
23
28
  },
24
29
  'should render editDefinition': {
30
+ location: "Default Location",
31
+ organization: "Default Organization",
32
+ loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
25
33
  loading: false,
26
34
  data: editDefinition,
27
35
  error: { statusText: '', errorMsg: '' },
28
36
  initParameterSelection: noop,
29
37
  loadForemanData: noop,
38
+ addParameter: noop,
39
+ deleteParameter: noop,
30
40
  },
31
41
  'should render newInstance': {
42
+ location: "Default Location",
43
+ organization: "Default Organization",
32
44
  loading: false,
45
+ loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
33
46
  data: newInstance,
34
47
  error: { statusText: '', errorMsg: '' },
35
48
  initParameterSelection: noop,
36
49
  loadForemanData: noop,
50
+ addParameter: noop,
51
+ deleteParameter: noop,
37
52
  },
38
53
  'should render editInstance': {
54
+ location: "Default Location",
55
+ organization: "Default Organization",
39
56
  loading: false,
57
+ loadForemanDataUrl: "/acd/ui_acd_fdata/__id__",
40
58
  data: editInstance,
41
59
  error: { statusText: '', errorMsg: '' },
42
60
  initParameterSelection: noop,
43
61
  loadForemanData: noop,
62
+ addParameter: noop,
63
+ deleteParameter: noop,
44
64
  },
45
65
  };
46
66