foreman_acd 0.6.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +90 -0
- data/app/controllers/foreman_acd/app_definitions_controller.rb +104 -7
- data/app/controllers/foreman_acd/app_instances_controller.rb +34 -32
- data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +1 -1
- data/app/controllers/foreman_acd/concerns/app_instance_mixins.rb +36 -0
- data/app/controllers/foreman_acd/remote_execution_controller.rb +37 -21
- data/app/controllers/ui_acd_controller.rb +42 -3
- data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +12 -7
- data/app/lib/actions/foreman_acd/run_configurator.rb +11 -7
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +41 -28
- data/app/models/foreman_acd/acd_provider.rb +7 -1
- data/app/models/foreman_acd/ansible_playbook.rb +2 -1
- data/app/models/foreman_acd/app_instance.rb +48 -3
- data/app/models/foreman_acd/foreman_host.rb +8 -0
- data/app/services/foreman_acd/acd_proxy_proxy_selector.rb +17 -0
- data/app/services/foreman_acd/app_configurator.rb +59 -15
- data/app/services/foreman_acd/app_deployer.rb +27 -4
- data/app/services/foreman_acd/inventory_creator.rb +25 -1
- data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +41 -7
- data/app/views/foreman_acd/app_definitions/_form.html.erb +5 -1
- data/app/views/foreman_acd/app_definitions/import.html.erb +20 -1
- data/app/views/foreman_acd/app_definitions/index.html.erb +3 -6
- data/app/views/foreman_acd/app_instances/_form.html.erb +5 -1
- data/app/views/foreman_acd/app_instances/index.html.erb +18 -12
- data/app/views/foreman_acd/app_instances/report.html.erb +8 -3
- data/app/views/templates/job/run_acd_ansible_playbook.erb +1 -1
- data/app/views/ui_acd/host_report.json.rabl +4 -0
- data/app/views/ui_acd/report_data.json.rabl +10 -0
- data/app/views/ui_acd/validate_hostname.json.rabl +6 -0
- data/config/routes.rb +6 -0
- data/db/migrate/20210316151145_add_git_commit_to_ansible_playbooks.rb +8 -0
- data/db/migrate/20210503122809_add_git_url_to_ansible_playbooks.rb +8 -0
- data/db/migrate/20210818125913_add_is_existing_host_to_foreman_host.rb +8 -0
- data/db/migrate/20210902110645_add_initial_configure_task.rb +8 -0
- data/db/seeds.d/75-job_templates.rb +1 -1
- data/lib/foreman_acd/engine.rb +26 -4
- data/lib/foreman_acd/plugin.rb +9 -18
- data/lib/foreman_acd/version.rb +1 -1
- data/lib/foreman_acd.rb +30 -0
- data/lib/tasks/foreman_acd_tasks.rake +0 -12
- data/package.json +8 -22
- data/test/controllers/ansible_playbooks_controller_test.rb +1 -1
- data/test/controllers/app_instances_controller_test.rb +8 -3
- data/test/controllers/ui_acd_controller_test.rb +25 -6
- data/test/factories/foreman_acd_factories.rb +18 -4
- data/test/models/acd_provider_test.rb +37 -0
- data/test/models/ansible_playbook_test.rb +11 -0
- data/test/models/app_definition_test.rb +1 -1
- data/test/models/app_instance_test.rb +2 -0
- data/test/models/concerns/host_extensions_test.rb +26 -0
- data/test/models/foreman_host_test.rb +12 -0
- data/webpack/__mocks__/foremanReact/API.js +2 -0
- data/webpack/__mocks__/foremanReact/common/I18n.js +3 -0
- data/webpack/__mocks__/foremanReact/common/helpers.js +2 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal.js +7 -0
- data/webpack/__mocks__/foremanReact/components/common/forms/CommonForm.js +2 -0
- data/webpack/__mocks__/foremanReact/components/common/forms/TextInput.js +2 -0
- data/webpack/__mocks__/foremanReact/components/hosts/powerStatus.js +1 -0
- data/webpack/__snapshots__/helper.test.js.snap +14 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +35 -11
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +12 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +1 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +30 -9
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +4 -0
- data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionConfData_1.fixtures.js +288 -0
- data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionReducer.fixtures.js +79 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +26 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionReducer.test.js +119 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +53 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinition.test.js.snap +226 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionReducer.test.js.snap +3033 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +307 -0
- data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +2 -1
- data/webpack/components/ApplicationDefinition/components/__tests__/AnsiblePlaybookSelector.test.js +41 -0
- data/webpack/components/ApplicationDefinition/components/__tests__/__snapshots__/AnsiblePlaybookSelector.test.js.snap +121 -0
- data/webpack/components/ApplicationDefinition/index.js +8 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.js +214 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImport.scss +1 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportActions.js +161 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportConstants.js +6 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportReducer.js +79 -0
- data/webpack/components/ApplicationDefinitionImport/ApplicationDefinitionImportSelectors.js +8 -0
- data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportConfData_1.fixtures.js +129 -0
- data/webpack/components/ApplicationDefinitionImport/__fixtures__/applicationDefinitionImportReducer.fixtures.js +29 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImport.test.js +20 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportReducer.test.js +43 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/ApplicationDefinitionImportSelectors.test.js +29 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImport.test.js.snap +62 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportReducer.test.js.snap +362 -0
- data/webpack/components/ApplicationDefinitionImport/__tests__/__snapshots__/ApplicationDefinitionImportSelectors.test.js.snap +130 -0
- data/webpack/components/ApplicationDefinitionImport/index.js +32 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +105 -31
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +118 -6
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +4 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceHelper.js +15 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +71 -30
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +4 -0
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceConfData_1.fixtures.js +263 -0
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +80 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +24 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +131 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +56 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +300 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceReducer.test.js.snap +2990 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +284 -0
- data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +1 -0
- data/webpack/components/ApplicationInstance/components/ServiceCounter.js +1 -1
- data/webpack/components/ApplicationInstance/helper.js +0 -0
- data/webpack/components/ApplicationInstance/index.js +8 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +81 -6
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +35 -1
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +3 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +19 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +4 -0
- data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportData_1.fixtures.js +349 -0
- data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportReducer.fixtures.js +20 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReport.test.js +47 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportReducer.test.js +41 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportSelectors.test.js +26 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReport.test.js.snap +7 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportReducer.test.js.snap +718 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportSelectors.test.js.snap +347 -0
- data/webpack/components/ApplicationInstanceReport/components/__tests__/ReportViewer.test.js +24 -0
- data/webpack/components/ApplicationInstanceReport/components/__tests__/__snapshots__/ReportViewer.test.js.snap +24 -0
- data/webpack/components/ApplicationInstanceReport/index.js +8 -1
- data/webpack/components/ExistingHostSelection/ExistingHostSelection.js +104 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelection.scss +15 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionActions.js +71 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionConstants.js +4 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionHelper.js +0 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionReducer.js +90 -0
- data/webpack/components/ExistingHostSelection/ExistingHostSelectionSelectors.js +8 -0
- data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionConfData_1.fixtures.js +191 -0
- data/webpack/components/ExistingHostSelection/__fixtures__/existingHostSelectionReducer.fixtures.js +203 -0
- data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelection.test.js +19 -0
- data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionReducer.test.js +59 -0
- data/webpack/components/ExistingHostSelection/__tests__/ExistingHostSelectionSelectors.test.js +36 -0
- data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelection.test.js.snap +35 -0
- data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionReducer.test.js.snap +614 -0
- data/webpack/components/ExistingHostSelection/__tests__/__snapshots__/ExistingHostSelectionSelectors.test.js.snap +27 -0
- data/webpack/components/ExistingHostSelection/components/ServiceSelector.js +48 -0
- data/webpack/components/ExistingHostSelection/components/__tests__/ServiceSelector.test.js +35 -0
- data/webpack/components/ExistingHostSelection/components/__tests__/__snapshots__/ServiceSelector.test.js.snap +77 -0
- data/webpack/components/ExistingHostSelection/index.js +26 -0
- data/webpack/components/ParameterSelection/ParameterSelection.js +103 -1
- data/webpack/components/ParameterSelection/ParameterSelection.scss +7 -0
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +46 -4
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +2 -0
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +5 -1
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +51 -29
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +2 -0
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +124 -84
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +10 -4
- data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +36 -46
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +33 -25
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +12 -6
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +84 -112
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +1589 -878
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +130 -79
- data/webpack/components/ParameterSelection/index.js +4 -1
- data/webpack/components/SyncGitRepo/SyncGitRepo.js +202 -0
- data/webpack/components/SyncGitRepo/SyncGitRepo.scss +1 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +123 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoConstants.js +8 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoReducer.js +80 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoSelectors.js +6 -0
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData_1.fixtures.js +7 -0
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoReducer.fixtures.js +44 -0
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepo.test.js +27 -0
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoReducer.test.js +95 -0
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoSelectors.test.js +32 -0
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +31 -0
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoReducer.test.js.snap +137 -0
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoSelectors.test.js.snap +13 -0
- data/webpack/components/SyncGitRepo/components/FormTextInput.js +42 -0
- data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +47 -0
- data/webpack/components/SyncGitRepo/index.js +28 -0
- data/webpack/components/common/DeleteTableEntry.js +16 -2
- data/webpack/components/common/ExtTextInput.js +43 -0
- data/webpack/components/common/__tests__/EditTableEntry.test.js +53 -0
- data/webpack/components/common/__tests__/LockTableEntry.test.js +35 -0
- data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +40 -2
- data/webpack/components/common/__tests__/__snapshots__/EditTableEntry.test.js.snap +81 -0
- data/webpack/components/common/__tests__/__snapshots__/LockTableEntry.test.js.snap +60 -0
- data/webpack/helper.js +35 -1
- data/webpack/helper.test.js +56 -0
- data/webpack/index.js +7 -0
- data/webpack/js-yaml.js +3874 -0
- data/webpack/reducer.js +16 -1
- data/webpack/test_setup.js +0 -2
- metadata +136 -11
- data/webpack/components/common/EasyHeaderFormatter.js +0 -18
- data/webpack/components/common/__tests__/__snapshots__/AddParameter.test.js.snap +0 -35
- data/webpack/components/common/__tests__/__snapshots__/DeleteParameter.test.js.snap +0 -41
@@ -0,0 +1,53 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
2
|
+
|
3
|
+
import EditTableEntry from '../EditTableEntry';
|
4
|
+
|
5
|
+
const noop = () => {};
|
6
|
+
|
7
|
+
const fixtures = {
|
8
|
+
'should render edit table entry': {
|
9
|
+
hidden: false,
|
10
|
+
disabled: false,
|
11
|
+
handleLocking: false,
|
12
|
+
onEditTableEntry: noop,
|
13
|
+
additionalData: {},
|
14
|
+
},
|
15
|
+
'should render hidden button': {
|
16
|
+
hidden: true,
|
17
|
+
disabled: false,
|
18
|
+
handleLocking: false,
|
19
|
+
onEditTableEntry: noop,
|
20
|
+
additionalData: {},
|
21
|
+
},
|
22
|
+
'should render disabled button': {
|
23
|
+
hidden: false,
|
24
|
+
disabled: true,
|
25
|
+
handleLocking: false,
|
26
|
+
onEditTableEntry: noop,
|
27
|
+
additionalData: {},
|
28
|
+
},
|
29
|
+
'should render locked button': {
|
30
|
+
hidden: false,
|
31
|
+
disabled: false,
|
32
|
+
handleLocking: true,
|
33
|
+
onEditTableEntry: noop,
|
34
|
+
additionalData: { rowData: { locked: true } },
|
35
|
+
},
|
36
|
+
'should render locked and disabled button': {
|
37
|
+
hidden: false,
|
38
|
+
disabled: true,
|
39
|
+
handleLocking: true,
|
40
|
+
onEditTableEntry: noop,
|
41
|
+
additionalData: { rowData: { locked: true } },
|
42
|
+
},
|
43
|
+
'should render hidde, locked and disabled button': {
|
44
|
+
hidden: true,
|
45
|
+
disabled: true,
|
46
|
+
handleLocking: true,
|
47
|
+
onEditTableEntry: noop,
|
48
|
+
additionalData: { rowData: { locked: true } },
|
49
|
+
},
|
50
|
+
};
|
51
|
+
|
52
|
+
describe('EditTableEntry', () =>
|
53
|
+
testComponentSnapshotsWithFixtures(EditTableEntry, fixtures));
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
2
|
+
|
3
|
+
import LockTableEntry from '../LockTableEntry';
|
4
|
+
|
5
|
+
const noop = () => {};
|
6
|
+
|
7
|
+
const fixtures = {
|
8
|
+
'should render unlock table entry': {
|
9
|
+
hidden: false,
|
10
|
+
disabled: false,
|
11
|
+
onLockTableEntry: noop,
|
12
|
+
additionalData: { rowData: { locked: false } },
|
13
|
+
},
|
14
|
+
'should render locked table entry': {
|
15
|
+
hidden: false,
|
16
|
+
disabled: false,
|
17
|
+
onLockTableEntry: noop,
|
18
|
+
additionalData: { rowData: { locked: true } },
|
19
|
+
},
|
20
|
+
'should render hidden button': {
|
21
|
+
hidden: true,
|
22
|
+
disabled: false,
|
23
|
+
onLockTableEntry: noop,
|
24
|
+
additionalData: {},
|
25
|
+
},
|
26
|
+
'should render disabled button': {
|
27
|
+
hidden: false,
|
28
|
+
disabled: true,
|
29
|
+
onLockTableEntry: noop,
|
30
|
+
additionalData: { rowData: { locked: false } },
|
31
|
+
},
|
32
|
+
};
|
33
|
+
|
34
|
+
describe('LockTableEntry', () =>
|
35
|
+
testComponentSnapshotsWithFixtures(LockTableEntry, fixtures));
|
@@ -2,7 +2,25 @@
|
|
2
2
|
|
3
3
|
exports[`DeleteTableEntry should render delete parameter 1`] = `
|
4
4
|
<span>
|
5
|
-
|
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
|
+
/>
|
6
24
|
<Button
|
7
25
|
active={false}
|
8
26
|
block={false}
|
@@ -13,6 +31,7 @@ exports[`DeleteTableEntry should render delete parameter 1`] = `
|
|
13
31
|
>
|
14
32
|
<Icon
|
15
33
|
name="delete"
|
34
|
+
title="Delete entry"
|
16
35
|
type="pf"
|
17
36
|
/>
|
18
37
|
</Button>
|
@@ -21,7 +40,25 @@ exports[`DeleteTableEntry should render delete parameter 1`] = `
|
|
21
40
|
|
22
41
|
exports[`DeleteTableEntry should render disabled button 1`] = `
|
23
42
|
<span>
|
24
|
-
|
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
|
+
/>
|
25
62
|
<Button
|
26
63
|
active={false}
|
27
64
|
block={false}
|
@@ -32,6 +69,7 @@ exports[`DeleteTableEntry should render disabled button 1`] = `
|
|
32
69
|
>
|
33
70
|
<Icon
|
34
71
|
name="delete"
|
72
|
+
title="Delete entry"
|
35
73
|
type="pf"
|
36
74
|
/>
|
37
75
|
</Button>
|
@@ -0,0 +1,81 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`EditTableEntry should render disabled button 1`] = `
|
4
|
+
<span>
|
5
|
+
<Button
|
6
|
+
active={false}
|
7
|
+
block={false}
|
8
|
+
bsClass="btn"
|
9
|
+
bsStyle="default"
|
10
|
+
disabled={true}
|
11
|
+
onClick={[Function]}
|
12
|
+
>
|
13
|
+
<Icon
|
14
|
+
name="edit"
|
15
|
+
title="edit this entry"
|
16
|
+
type="pf"
|
17
|
+
/>
|
18
|
+
</Button>
|
19
|
+
</span>
|
20
|
+
`;
|
21
|
+
|
22
|
+
exports[`EditTableEntry should render edit table entry 1`] = `
|
23
|
+
<span>
|
24
|
+
<Button
|
25
|
+
active={false}
|
26
|
+
block={false}
|
27
|
+
bsClass="btn"
|
28
|
+
bsStyle="default"
|
29
|
+
disabled={false}
|
30
|
+
onClick={[Function]}
|
31
|
+
>
|
32
|
+
<Icon
|
33
|
+
name="edit"
|
34
|
+
title="edit this entry"
|
35
|
+
type="pf"
|
36
|
+
/>
|
37
|
+
</Button>
|
38
|
+
</span>
|
39
|
+
`;
|
40
|
+
|
41
|
+
exports[`EditTableEntry should render hidde, locked and disabled button 1`] = `""`;
|
42
|
+
|
43
|
+
exports[`EditTableEntry should render hidden button 1`] = `""`;
|
44
|
+
|
45
|
+
exports[`EditTableEntry should render locked and disabled button 1`] = `
|
46
|
+
<span>
|
47
|
+
<Button
|
48
|
+
active={false}
|
49
|
+
block={false}
|
50
|
+
bsClass="btn"
|
51
|
+
bsStyle="default"
|
52
|
+
disabled={true}
|
53
|
+
onClick={[Function]}
|
54
|
+
>
|
55
|
+
<Icon
|
56
|
+
name="edit"
|
57
|
+
title="This entry is locked and can not be changed."
|
58
|
+
type="pf"
|
59
|
+
/>
|
60
|
+
</Button>
|
61
|
+
</span>
|
62
|
+
`;
|
63
|
+
|
64
|
+
exports[`EditTableEntry should render locked button 1`] = `
|
65
|
+
<span>
|
66
|
+
<Button
|
67
|
+
active={false}
|
68
|
+
block={false}
|
69
|
+
bsClass="btn"
|
70
|
+
bsStyle="default"
|
71
|
+
disabled={true}
|
72
|
+
onClick={[Function]}
|
73
|
+
>
|
74
|
+
<Icon
|
75
|
+
name="edit"
|
76
|
+
title="This entry is locked and can not be changed."
|
77
|
+
type="pf"
|
78
|
+
/>
|
79
|
+
</Button>
|
80
|
+
</span>
|
81
|
+
`;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`LockTableEntry should render disabled button 1`] = `
|
4
|
+
<span>
|
5
|
+
<Button
|
6
|
+
active={false}
|
7
|
+
block={false}
|
8
|
+
bsClass="btn"
|
9
|
+
bsStyle="default"
|
10
|
+
disabled={true}
|
11
|
+
onClick={[Function]}
|
12
|
+
>
|
13
|
+
<Icon
|
14
|
+
name="unlocked"
|
15
|
+
title="this entry is unlocked"
|
16
|
+
type="pf"
|
17
|
+
/>
|
18
|
+
</Button>
|
19
|
+
</span>
|
20
|
+
`;
|
21
|
+
|
22
|
+
exports[`LockTableEntry should render hidden button 1`] = `""`;
|
23
|
+
|
24
|
+
exports[`LockTableEntry should render locked table entry 1`] = `
|
25
|
+
<span>
|
26
|
+
<Button
|
27
|
+
active={false}
|
28
|
+
block={false}
|
29
|
+
bsClass="btn"
|
30
|
+
bsStyle="default"
|
31
|
+
disabled={false}
|
32
|
+
onClick={[Function]}
|
33
|
+
>
|
34
|
+
<Icon
|
35
|
+
name="locked"
|
36
|
+
title="unlock this entry"
|
37
|
+
type="pf"
|
38
|
+
/>
|
39
|
+
</Button>
|
40
|
+
</span>
|
41
|
+
`;
|
42
|
+
|
43
|
+
exports[`LockTableEntry should render unlock table entry 1`] = `
|
44
|
+
<span>
|
45
|
+
<Button
|
46
|
+
active={false}
|
47
|
+
block={false}
|
48
|
+
bsClass="btn"
|
49
|
+
bsStyle="default"
|
50
|
+
disabled={false}
|
51
|
+
onClick={[Function]}
|
52
|
+
>
|
53
|
+
<Icon
|
54
|
+
name="unlocked"
|
55
|
+
title="lock this entry"
|
56
|
+
type="pf"
|
57
|
+
/>
|
58
|
+
</Button>
|
59
|
+
</span>
|
60
|
+
`;
|
data/webpack/helper.js
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import {
|
3
|
+
Table,
|
4
|
+
} from 'patternfly-react';
|
5
|
+
|
1
6
|
// Some small helper methods
|
2
7
|
|
3
8
|
function arrayToObject(arr, id, value) {
|
@@ -14,7 +19,36 @@ function arrayToObjectObj(arr, id) {
|
|
14
19
|
return rv;
|
15
20
|
}
|
16
21
|
|
22
|
+
function shortHostname(fqdn) {
|
23
|
+
return fqdn.split('.')[0];
|
24
|
+
}
|
25
|
+
|
26
|
+
function EasyHeaderFormatter(value, { column }) {
|
27
|
+
return (
|
28
|
+
<Table.Heading aria-label={column.header.label} {...column.header.props}>
|
29
|
+
{value}
|
30
|
+
</Table.Heading>
|
31
|
+
);
|
32
|
+
}
|
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
|
+
|
17
48
|
export {
|
18
49
|
arrayToObject,
|
19
|
-
arrayToObjectObj
|
50
|
+
arrayToObjectObj,
|
51
|
+
shortHostname,
|
52
|
+
EasyHeaderFormatter,
|
53
|
+
supportedPluginsToHiddenParameterTypes
|
20
54
|
};
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import {
|
2
|
+
arrayToObject,
|
3
|
+
arrayToObjectObj,
|
4
|
+
EasyHeaderFormatter,
|
5
|
+
supportedPluginsToHiddenParameterTypes,
|
6
|
+
} from './helper';
|
7
|
+
|
8
|
+
describe('helper', () => {
|
9
|
+
const testArray = []
|
10
|
+
testArray[0] = { id: 'i1', value: 'v1' };
|
11
|
+
testArray[1] = { id: 'i2', value: 'v2' };
|
12
|
+
testArray[2] = { id: 'i3', value: 'v3' };
|
13
|
+
|
14
|
+
it('creates a object from an array', () => {
|
15
|
+
expect(arrayToObject(testArray, 'id', 'value')).toEqual(
|
16
|
+
{
|
17
|
+
i1: 'v1',
|
18
|
+
i2: 'v2',
|
19
|
+
i3: 'v3'
|
20
|
+
}
|
21
|
+
);
|
22
|
+
});
|
23
|
+
|
24
|
+
it('creates a object from an array', () => {
|
25
|
+
expect(arrayToObjectObj(testArray, 'id')).toEqual(
|
26
|
+
{
|
27
|
+
i1: { id: 'i1', value: 'v1' },
|
28
|
+
i2: { id: 'i2', value: 'v2' },
|
29
|
+
i3: { id: 'i3', value: 'v3' },
|
30
|
+
}
|
31
|
+
);
|
32
|
+
});
|
33
|
+
|
34
|
+
it('formats a nice, easy header', () => {
|
35
|
+
expect(EasyHeaderFormatter('MyValue', { column: { header: { label: 'TheLabel', props: { p1: '1' } } } })).toMatchSnapshot();
|
36
|
+
});
|
37
|
+
|
38
|
+
it('creates hidden parameter definition by supported plugins 1', () => {
|
39
|
+
expect(supportedPluginsToHiddenParameterTypes({ puppet: false})).toEqual(
|
40
|
+
['puppetenv']
|
41
|
+
);
|
42
|
+
});
|
43
|
+
|
44
|
+
it('creates hidden parameter definition by supported plugins 2', () => {
|
45
|
+
expect(supportedPluginsToHiddenParameterTypes({ puppet: true})).toEqual(
|
46
|
+
[]
|
47
|
+
);
|
48
|
+
});
|
49
|
+
|
50
|
+
it('creates hidden parameter definition by supported plugins 3', () => {
|
51
|
+
expect(supportedPluginsToHiddenParameterTypes({})).toEqual(
|
52
|
+
[]
|
53
|
+
);
|
54
|
+
});
|
55
|
+
});
|
56
|
+
|
data/webpack/index.js
CHANGED
@@ -1,14 +1,21 @@
|
|
1
1
|
import componentRegistry from 'foremanReact/components/componentRegistry';
|
2
2
|
import injectReducer from 'foremanReact/redux/reducers/registerReducer';
|
3
3
|
import ParameterSelection from './components/ParameterSelection';
|
4
|
+
import SyncGitRepo from './components/SyncGitRepo';
|
4
5
|
import ApplicationDefinition from './components/ApplicationDefinition';
|
6
|
+
import ApplicationDefinitionImport from './components/ApplicationDefinitionImport';
|
5
7
|
import ApplicationInstance from './components/ApplicationInstance';
|
6
8
|
import ApplicationInstanceReport from './components/ApplicationInstanceReport';
|
9
|
+
import ExistingHostSelection from './components/ExistingHostSelection';
|
10
|
+
|
7
11
|
import reducer from './reducer';
|
8
12
|
|
9
13
|
injectReducer('foremanAcd', reducer);
|
10
14
|
|
11
15
|
componentRegistry.register({ name: 'ParameterSelection', type: ParameterSelection, });
|
16
|
+
componentRegistry.register({ name: 'SyncGitRepo', type: SyncGitRepo, });
|
12
17
|
componentRegistry.register({ name: 'ApplicationDefinition', type: ApplicationDefinition, });
|
18
|
+
componentRegistry.register({ name: 'ApplicationDefinitionImport', type: ApplicationDefinitionImport, });
|
13
19
|
componentRegistry.register({ name: 'ApplicationInstance', type: ApplicationInstance, });
|
14
20
|
componentRegistry.register({ name: 'ApplicationInstanceReport', type: ApplicationInstanceReport, });
|
21
|
+
componentRegistry.register({ name: 'ExistingHostSelection', type: ExistingHostSelection, });
|