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.
- checksums.yaml +4 -4
- data/README.md +107 -56
- data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +124 -0
- data/app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb +72 -0
- data/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +2 -2
- data/app/controllers/foreman_acd/api/v2/app_instances_controller.rb +62 -0
- data/app/controllers/foreman_acd/app_definitions_controller.rb +46 -9
- data/app/controllers/foreman_acd/app_instances_controller.rb +96 -90
- data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +23 -0
- data/app/controllers/foreman_acd/concerns/app_definition_parameters.rb +1 -1
- data/app/controllers/foreman_acd/concerns/app_instance_parameters.rb +1 -1
- data/app/controllers/foreman_acd/remote_execution_controller.rb +46 -0
- data/app/controllers/ui_acd_controller.rb +20 -4
- data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +42 -0
- data/app/lib/actions/foreman_acd/run_configurator.rb +41 -0
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +51 -0
- data/app/models/foreman_acd/acd_provider.rb +30 -0
- data/app/models/foreman_acd/ansible_playbook.rb +67 -0
- data/app/models/foreman_acd/app_definition.rb +25 -1
- data/app/models/foreman_acd/app_instance.rb +42 -0
- data/app/models/foreman_acd/foreman_host.rb +23 -0
- data/app/models/foreman_acd/taxonomy_extensions.rb +17 -0
- data/app/services/foreman_acd/app_configurator.rb +54 -0
- data/app/services/foreman_acd/app_deployer.rb +151 -0
- data/app/services/foreman_acd/inventory_creator.rb +54 -0
- data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +30 -0
- data/app/views/foreman_acd/ansible_playbooks/edit.html.erb +11 -0
- data/app/views/foreman_acd/ansible_playbooks/index.html.erb +30 -0
- data/app/views/foreman_acd/ansible_playbooks/new.html.erb +3 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/base.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/index.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/show.json.rabl +9 -0
- data/app/views/foreman_acd/api/v2/app_definitions/base.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_definitions/index.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_definitions/show.json.rabl +9 -0
- data/app/views/foreman_acd/api/v2/app_instances/base.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_instances/index.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_instances/show.json.rabl +5 -0
- data/app/views/foreman_acd/app_definitions/_form.html.erb +34 -20
- data/app/views/foreman_acd/app_definitions/edit.html.erb +10 -0
- data/app/views/foreman_acd/app_definitions/import.html.erb +18 -0
- data/app/views/foreman_acd/app_definitions/index.html.erb +10 -6
- data/app/views/foreman_acd/app_instances/_form.html.erb +12 -10
- data/app/views/foreman_acd/app_instances/edit.html.erb +10 -0
- data/app/views/foreman_acd/app_instances/index.html.erb +87 -9
- data/app/views/foreman_acd/app_instances/report.html.erb +22 -0
- data/app/views/templates/job/run_acd_ansible_playbook.erb +62 -0
- data/app/views/ui_acd/ansible_data.json.rabl +6 -0
- data/app/views/ui_acd/app.json.rabl +6 -2
- data/app/views/ui_acd/app_definition.json.rabl +1 -1
- data/app/views/ui_acd/{fdata.json.rabl → foreman_data.json.rabl} +1 -1
- data/config/routes.rb +35 -1
- data/db/migrate/20190610202252_create_app_definitions.rb +1 -3
- data/db/migrate/20190625140305_create_app_instances.rb +1 -1
- data/db/migrate/20200916091018_create_ansible_playbooks.rb +20 -0
- data/db/migrate/20200917120220_add_ansible_playbook_id.rb +14 -0
- data/db/migrate/20201016002819_add_ansible_vars_all_to_app_definitions.rb +8 -0
- data/db/migrate/20201016104338_add_ansible_vars_all_to_app_instances.rb +8 -0
- data/db/migrate/20210112111548_add_organization_to_app_instance.rb +22 -0
- data/db/migrate/20210112113853_add_location_to_app_instance.rb +8 -0
- data/db/migrate/20210202141658_create_foreman_hosts.rb +24 -0
- data/db/migrate/20210204111306_remove_hosts_from_app_instances.rb +8 -0
- data/db/migrate/20210209091014_rename_acd_tables.rb +16 -0
- data/db/migrate/20210216083522_add_last_progress_report.rb +8 -0
- data/db/migrate/20210216091529_add_last_deploy_task.rb +8 -0
- data/db/seeds.d/62_acd_proxy_feature.rb +4 -0
- data/db/seeds.d/75-job_templates.rb +13 -0
- data/lib/foreman_acd/engine.rb +21 -3
- data/lib/foreman_acd/plugin.rb +112 -20
- data/lib/foreman_acd/version.rb +1 -1
- data/locale/en/foreman_acd.edit.po +326 -0
- data/locale/en/foreman_acd.po +232 -2
- data/locale/en/foreman_acd.po.time_stamp +0 -0
- data/locale/foreman_acd.pot +343 -8
- data/package.json +1 -1
- data/test/controllers/ansible_playbooks_controller_test.rb +27 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +391 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.scss +1 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +303 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +15 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionHelper.js +26 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +269 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +9 -0
- data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +49 -0
- data/webpack/components/ApplicationDefinition/index.js +35 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +451 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.scss +11 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +247 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +15 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +309 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +10 -0
- data/webpack/components/ApplicationInstance/components/AppDefinitionSelector.js +49 -0
- data/webpack/components/ApplicationInstance/components/Service.js +30 -0
- data/webpack/components/ApplicationInstance/components/ServiceCounter.js +37 -0
- data/webpack/components/ApplicationInstance/index.js +37 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +148 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.scss +44 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +42 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +2 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +38 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +4 -0
- data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +26 -0
- data/webpack/components/ApplicationInstanceReport/index.js +25 -0
- data/webpack/components/ParameterSelection/ParameterSelection.js +131 -192
- data/webpack/components/ParameterSelection/ParameterSelection.scss +9 -0
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +87 -110
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +15 -19
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +3 -35
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +116 -84
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +3 -7
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelection.fixtures.js +12 -21
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +1 -1
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +3 -45
- data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +20 -0
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +22 -46
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -6
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +40 -265
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +11 -96
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +3 -9
- data/webpack/components/ParameterSelection/index.js +6 -8
- data/webpack/components/common/AddTableEntry.js +30 -0
- data/webpack/components/common/DeleteTableEntry.js +39 -0
- data/webpack/components/common/EasyHeaderFormatter.js +18 -0
- data/webpack/components/common/EditTableEntry.js +50 -0
- data/webpack/components/common/ExtSelect.js +43 -0
- data/webpack/components/common/LockTableEntry.js +60 -0
- data/webpack/components/common/RailsData.js +27 -0
- data/webpack/components/common/__tests__/AddTableEntry.test.js +26 -0
- data/webpack/components/common/__tests__/DeleteTableEntry.test.js +29 -0
- data/webpack/components/common/__tests__/ExtSelect.test.js +38 -0
- data/webpack/components/common/__tests__/RailsData.test.js +16 -0
- data/webpack/components/common/__tests__/__snapshots__/AddParameter.test.js.snap +35 -0
- data/webpack/components/common/__tests__/__snapshots__/AddTableEntry.test.js.snap +35 -0
- data/webpack/components/common/__tests__/__snapshots__/DeleteParameter.test.js.snap +41 -0
- data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +41 -0
- data/webpack/components/common/__tests__/__snapshots__/ExtSelect.test.js.snap +18 -0
- data/webpack/components/common/__tests__/__snapshots__/RailsData.test.js.snap +10 -0
- data/webpack/helper.js +20 -0
- data/webpack/index.js +6 -0
- data/webpack/reducer.js +43 -3
- metadata +114 -20
@@ -0,0 +1,60 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import {
|
4
|
+
Icon,
|
5
|
+
Button,
|
6
|
+
} from 'patternfly-react';
|
7
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
8
|
+
|
9
|
+
const LockTableEntry = ({
|
10
|
+
hidden,
|
11
|
+
disabled,
|
12
|
+
onLockTableEntry,
|
13
|
+
additionalData,
|
14
|
+
}) =>{
|
15
|
+
if (hidden) {
|
16
|
+
return null;
|
17
|
+
}
|
18
|
+
|
19
|
+
let lockButton;
|
20
|
+
let lockButtonTitle;
|
21
|
+
|
22
|
+
if (additionalData.rowData.locked === true) {
|
23
|
+
lockButton = 'locked';
|
24
|
+
|
25
|
+
if (disabled === true) {
|
26
|
+
lockButtonTitle = 'this entry is locked';
|
27
|
+
} else {
|
28
|
+
lockButtonTitle = 'unlock this entry';
|
29
|
+
}
|
30
|
+
} else {
|
31
|
+
lockButton = 'unlocked';
|
32
|
+
|
33
|
+
if (disabled === true) {
|
34
|
+
lockButtonTitle = 'this entry is unlocked';
|
35
|
+
} else {
|
36
|
+
lockButtonTitle = 'lock this entry';
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
return (
|
41
|
+
<span>
|
42
|
+
<Button
|
43
|
+
bsStyle="default"
|
44
|
+
disabled={disabled}
|
45
|
+
onClick={() => onLockTableEntry(additionalData) }
|
46
|
+
>
|
47
|
+
<Icon type="pf" name={lockButton} title={__(lockButtonTitle)} />
|
48
|
+
</Button>
|
49
|
+
</span>
|
50
|
+
);
|
51
|
+
};
|
52
|
+
|
53
|
+
LockTableEntry.propTypes = {
|
54
|
+
hidden: PropTypes.bool,
|
55
|
+
disabled: PropTypes.bool.isRequired,
|
56
|
+
onLockTableEntry: PropTypes.func.isRequired,
|
57
|
+
additionalData: PropTypes.object.isRequired,
|
58
|
+
};
|
59
|
+
|
60
|
+
export default LockTableEntry;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
|
4
|
+
const RailsData = ({
|
5
|
+
view,
|
6
|
+
parameter,
|
7
|
+
value,
|
8
|
+
}) => {
|
9
|
+
const id = "foreman_acd_"+ view +"_"+ parameter;
|
10
|
+
const name = "foreman_acd_"+ view +"["+ parameter +"]";
|
11
|
+
|
12
|
+
return (
|
13
|
+
<input
|
14
|
+
id={id}
|
15
|
+
name={name}
|
16
|
+
value={value}
|
17
|
+
type="hidden"
|
18
|
+
/>
|
19
|
+
);
|
20
|
+
}
|
21
|
+
|
22
|
+
RailsData.propTypes = {
|
23
|
+
view: PropTypes.string.isRequired,
|
24
|
+
parameter: PropTypes.string.isRequired,
|
25
|
+
};
|
26
|
+
|
27
|
+
export default RailsData;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
2
|
+
|
3
|
+
import AddTableEntry from '../AddTableEntry';
|
4
|
+
|
5
|
+
const noop = () => {};
|
6
|
+
|
7
|
+
const fixtures = {
|
8
|
+
'should render add parameter': {
|
9
|
+
hidden: false,
|
10
|
+
disabled: false,
|
11
|
+
onAddTableEntry: noop,
|
12
|
+
},
|
13
|
+
'should render hidden button': {
|
14
|
+
hidden: true,
|
15
|
+
disabled: false,
|
16
|
+
onAddTableEntry: noop,
|
17
|
+
},
|
18
|
+
'should render disabled button': {
|
19
|
+
hidden: false,
|
20
|
+
disabled: true,
|
21
|
+
onAddTableEntry: noop,
|
22
|
+
},
|
23
|
+
};
|
24
|
+
|
25
|
+
describe('AddTableEntry', () =>
|
26
|
+
testComponentSnapshotsWithFixtures(AddTableEntry, fixtures));
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
2
|
+
|
3
|
+
import DeleteTableEntry from '../DeleteTableEntry';
|
4
|
+
|
5
|
+
const noop = () => {};
|
6
|
+
|
7
|
+
const fixtures = {
|
8
|
+
'should render delete parameter': {
|
9
|
+
hidden: false,
|
10
|
+
disabled: false,
|
11
|
+
onDeleteTableEntry: noop,
|
12
|
+
additionalData: {},
|
13
|
+
},
|
14
|
+
'should render hidden button': {
|
15
|
+
hidden: true,
|
16
|
+
disabled: false,
|
17
|
+
onDeleteTableEntry: noop,
|
18
|
+
additionalData: {},
|
19
|
+
},
|
20
|
+
'should render disabled button': {
|
21
|
+
hidden: false,
|
22
|
+
disabled: true,
|
23
|
+
onDeleteTableEntry: noop,
|
24
|
+
additionalData: {},
|
25
|
+
},
|
26
|
+
};
|
27
|
+
|
28
|
+
describe('DeleteTableEntry', () =>
|
29
|
+
testComponentSnapshotsWithFixtures(DeleteTableEntry, fixtures));
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
2
|
+
|
3
|
+
import ExtSelect from '../ExtSelect';
|
4
|
+
|
5
|
+
const noop = () => {};
|
6
|
+
|
7
|
+
const fixtures = {
|
8
|
+
'should render selection field': {
|
9
|
+
hidden: false,
|
10
|
+
editable: false,
|
11
|
+
viewText: '',
|
12
|
+
selectValue: '1',
|
13
|
+
onChange: noop,
|
14
|
+
options: { first: 'first', second: 'second'},
|
15
|
+
additionalData: { moreData: 'moooore' },
|
16
|
+
},
|
17
|
+
'should render hidden selection field': {
|
18
|
+
hidden: true,
|
19
|
+
editable: false,
|
20
|
+
viewText: '',
|
21
|
+
selectValue: null,
|
22
|
+
onChange: noop,
|
23
|
+
options: {},
|
24
|
+
additionalData: {},
|
25
|
+
},
|
26
|
+
'should render disabled button': {
|
27
|
+
hidden: false,
|
28
|
+
editable: true,
|
29
|
+
viewText: 'Awesome Text',
|
30
|
+
selectValue: '0',
|
31
|
+
onChange: noop,
|
32
|
+
options: { first: 'first', second: 'second'},
|
33
|
+
additionalData: {},
|
34
|
+
},
|
35
|
+
};
|
36
|
+
|
37
|
+
describe('ExtSelect', () =>
|
38
|
+
testComponentSnapshotsWithFixtures(ExtSelect, fixtures));
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils';
|
2
|
+
|
3
|
+
import RailsData from '../RailsData';
|
4
|
+
|
5
|
+
const noop = () => {};
|
6
|
+
|
7
|
+
const fixtures = {
|
8
|
+
'should render rails data input field': {
|
9
|
+
view: 'nice_view',
|
10
|
+
parameter: 'nice_param',
|
11
|
+
value: 'nice_value',
|
12
|
+
},
|
13
|
+
};
|
14
|
+
|
15
|
+
describe('RailsData', () =>
|
16
|
+
testComponentSnapshotsWithFixtures(RailsData, fixtures));
|
@@ -0,0 +1,35 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`AddParameter should render add parameter 1`] = `
|
4
|
+
<Button
|
5
|
+
active={false}
|
6
|
+
block={false}
|
7
|
+
bsClass="btn"
|
8
|
+
bsStyle="default"
|
9
|
+
disabled={false}
|
10
|
+
onClick={[Function]}
|
11
|
+
>
|
12
|
+
<Icon
|
13
|
+
name="plus"
|
14
|
+
type="fa"
|
15
|
+
/>
|
16
|
+
</Button>
|
17
|
+
`;
|
18
|
+
|
19
|
+
exports[`AddParameter should render disabled button 1`] = `
|
20
|
+
<Button
|
21
|
+
active={false}
|
22
|
+
block={false}
|
23
|
+
bsClass="btn"
|
24
|
+
bsStyle="default"
|
25
|
+
disabled={true}
|
26
|
+
onClick={[Function]}
|
27
|
+
>
|
28
|
+
<Icon
|
29
|
+
name="plus"
|
30
|
+
type="fa"
|
31
|
+
/>
|
32
|
+
</Button>
|
33
|
+
`;
|
34
|
+
|
35
|
+
exports[`AddParameter should render hidden button 1`] = `""`;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`AddTableEntry should render add parameter 1`] = `
|
4
|
+
<Button
|
5
|
+
active={false}
|
6
|
+
block={false}
|
7
|
+
bsClass="btn"
|
8
|
+
bsStyle="default"
|
9
|
+
disabled={false}
|
10
|
+
onClick={[Function]}
|
11
|
+
>
|
12
|
+
<Icon
|
13
|
+
name="plus"
|
14
|
+
type="fa"
|
15
|
+
/>
|
16
|
+
</Button>
|
17
|
+
`;
|
18
|
+
|
19
|
+
exports[`AddTableEntry should render disabled button 1`] = `
|
20
|
+
<Button
|
21
|
+
active={false}
|
22
|
+
block={false}
|
23
|
+
bsClass="btn"
|
24
|
+
bsStyle="default"
|
25
|
+
disabled={true}
|
26
|
+
onClick={[Function]}
|
27
|
+
>
|
28
|
+
<Icon
|
29
|
+
name="plus"
|
30
|
+
type="fa"
|
31
|
+
/>
|
32
|
+
</Button>
|
33
|
+
`;
|
34
|
+
|
35
|
+
exports[`AddTableEntry should render hidden button 1`] = `""`;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`DeleteParameter should render delete parameter 1`] = `
|
4
|
+
<span>
|
5
|
+
|
6
|
+
<Button
|
7
|
+
active={false}
|
8
|
+
block={false}
|
9
|
+
bsClass="btn"
|
10
|
+
bsStyle="default"
|
11
|
+
disabled={false}
|
12
|
+
onClick={[Function]}
|
13
|
+
>
|
14
|
+
<Icon
|
15
|
+
name="delete"
|
16
|
+
type="pf"
|
17
|
+
/>
|
18
|
+
</Button>
|
19
|
+
</span>
|
20
|
+
`;
|
21
|
+
|
22
|
+
exports[`DeleteParameter should render disabled button 1`] = `
|
23
|
+
<span>
|
24
|
+
|
25
|
+
<Button
|
26
|
+
active={false}
|
27
|
+
block={false}
|
28
|
+
bsClass="btn"
|
29
|
+
bsStyle="default"
|
30
|
+
disabled={true}
|
31
|
+
onClick={[Function]}
|
32
|
+
>
|
33
|
+
<Icon
|
34
|
+
name="delete"
|
35
|
+
type="pf"
|
36
|
+
/>
|
37
|
+
</Button>
|
38
|
+
</span>
|
39
|
+
`;
|
40
|
+
|
41
|
+
exports[`DeleteParameter should render hidden button 1`] = `""`;
|
@@ -0,0 +1,41 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`DeleteTableEntry should render delete parameter 1`] = `
|
4
|
+
<span>
|
5
|
+
|
6
|
+
<Button
|
7
|
+
active={false}
|
8
|
+
block={false}
|
9
|
+
bsClass="btn"
|
10
|
+
bsStyle="default"
|
11
|
+
disabled={false}
|
12
|
+
onClick={[Function]}
|
13
|
+
>
|
14
|
+
<Icon
|
15
|
+
name="delete"
|
16
|
+
type="pf"
|
17
|
+
/>
|
18
|
+
</Button>
|
19
|
+
</span>
|
20
|
+
`;
|
21
|
+
|
22
|
+
exports[`DeleteTableEntry should render disabled button 1`] = `
|
23
|
+
<span>
|
24
|
+
|
25
|
+
<Button
|
26
|
+
active={false}
|
27
|
+
block={false}
|
28
|
+
bsClass="btn"
|
29
|
+
bsStyle="default"
|
30
|
+
disabled={true}
|
31
|
+
onClick={[Function]}
|
32
|
+
>
|
33
|
+
<Icon
|
34
|
+
name="delete"
|
35
|
+
type="pf"
|
36
|
+
/>
|
37
|
+
</Button>
|
38
|
+
</span>
|
39
|
+
`;
|
40
|
+
|
41
|
+
exports[`DeleteTableEntry should render hidden button 1`] = `""`;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`ExtSelect should render disabled button 1`] = `
|
4
|
+
<Select
|
5
|
+
onChange={[Function]}
|
6
|
+
options={
|
7
|
+
Object {
|
8
|
+
"first": "first",
|
9
|
+
"second": "second",
|
10
|
+
}
|
11
|
+
}
|
12
|
+
value="0"
|
13
|
+
/>
|
14
|
+
`;
|
15
|
+
|
16
|
+
exports[`ExtSelect should render hidden selection field 1`] = `""`;
|
17
|
+
|
18
|
+
exports[`ExtSelect should render selection field 1`] = `<div />`;
|
data/webpack/helper.js
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
// Some small helper methods
|
2
|
+
|
3
|
+
function arrayToObject(arr, id, value) {
|
4
|
+
var rv = {};
|
5
|
+
for (var i = 0; i < arr.length; ++i)
|
6
|
+
rv[arr[i][id]] = arr[i][value];
|
7
|
+
return rv;
|
8
|
+
}
|
9
|
+
|
10
|
+
function arrayToObjectObj(arr, id) {
|
11
|
+
var rv = {};
|
12
|
+
for (var i = 0; i < arr.length; ++i)
|
13
|
+
rv[arr[i][id]] = arr[i];
|
14
|
+
return rv;
|
15
|
+
}
|
16
|
+
|
17
|
+
export {
|
18
|
+
arrayToObject,
|
19
|
+
arrayToObjectObj
|
20
|
+
};
|
data/webpack/index.js
CHANGED
@@ -1,8 +1,14 @@
|
|
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 ApplicationDefinition from './components/ApplicationDefinition';
|
5
|
+
import ApplicationInstance from './components/ApplicationInstance';
|
6
|
+
import ApplicationInstanceReport from './components/ApplicationInstanceReport';
|
4
7
|
import reducer from './reducer';
|
5
8
|
|
6
9
|
injectReducer('foremanAcd', reducer);
|
7
10
|
|
8
11
|
componentRegistry.register({ name: 'ParameterSelection', type: ParameterSelection, });
|
12
|
+
componentRegistry.register({ name: 'ApplicationDefinition', type: ApplicationDefinition, });
|
13
|
+
componentRegistry.register({ name: 'ApplicationInstance', type: ApplicationInstance, });
|
14
|
+
componentRegistry.register({ name: 'ApplicationInstanceReport', type: ApplicationInstanceReport, });
|
data/webpack/reducer.js
CHANGED
@@ -1,7 +1,47 @@
|
|
1
1
|
import { combineReducers } from 'redux';
|
2
2
|
|
3
3
|
import parameterSelectionParameters from './components/ParameterSelection/ParameterSelectionReducer';
|
4
|
+
import applicationDefinitionConf from './components/ApplicationDefinition/ApplicationDefinitionReducer';
|
5
|
+
import applicationInstanceConf from './components/ApplicationInstance/ApplicationInstanceReducer';
|
6
|
+
import applicationInstanceReport from './components/ApplicationInstanceReport/ApplicationInstanceReportReducer';
|
4
7
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
import {
|
9
|
+
APPLICATION_DEFINITION_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE,
|
10
|
+
APPLICATION_DEFINITION_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE,
|
11
|
+
} from './components/ApplicationDefinition/ApplicationDefinitionConstants';
|
12
|
+
|
13
|
+
import {
|
14
|
+
APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE,
|
15
|
+
APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE,
|
16
|
+
} from './components/ApplicationInstance/ApplicationInstanceConstants';
|
17
|
+
|
18
|
+
const rootReducer = (state = {}, action) => {
|
19
|
+
|
20
|
+
const param_state = parameterSelectionParameters(state.parameterSelectionParameters, action);
|
21
|
+
const app_ins_report_state = applicationInstanceReport(state.applicationInstanceReport, action);
|
22
|
+
|
23
|
+
if (action.type == APPLICATION_DEFINITION_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE) {
|
24
|
+
action.payload.parameterSelection = param_state.parameters;
|
25
|
+
}
|
26
|
+
if (action.type == APPLICATION_DEFINITION_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE) {
|
27
|
+
action.payload.parameterSelection = param_state.parameters;
|
28
|
+
}
|
29
|
+
const app_def_state = applicationDefinitionConf(state.applicationDefinitionConf, action);
|
30
|
+
|
31
|
+
if (action.type == APPLICATION_INSTANCE_FOREMAN_PARAMETER_SELECTION_MODAL_CLOSE) {
|
32
|
+
action.payload.parameterSelection = param_state.parameters;
|
33
|
+
}
|
34
|
+
if (action.type == APPLICATION_INSTANCE_ANSIBLE_PARAMETER_SELECTION_MODAL_CLOSE) {
|
35
|
+
action.payload.parameterSelection = param_state.parameters;
|
36
|
+
}
|
37
|
+
const app_ins_state = applicationInstanceConf(state.applicationInstanceConf, action);
|
38
|
+
|
39
|
+
return {
|
40
|
+
applicationDefinitionConf: app_def_state,
|
41
|
+
applicationInstanceConf: app_ins_state,
|
42
|
+
parameterSelectionParameters: param_state,
|
43
|
+
applicationInstanceReport: app_ins_report_state,
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
export default rootReducer;
|