foreman_acd 0.7.0 → 0.9.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 +5 -3
- data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +17 -2
- data/app/controllers/foreman_acd/app_definitions_controller.rb +104 -7
- data/app/controllers/foreman_acd/app_instances_controller.rb +15 -30
- data/app/controllers/foreman_acd/concerns/app_instance_mixins.rb +36 -0
- data/app/controllers/ui_acd_controller.rb +38 -1
- data/app/lib/actions/foreman_acd/run_configurator.rb +1 -0
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +15 -27
- data/app/models/foreman_acd/app_instance.rb +47 -2
- data/app/models/foreman_acd/foreman_host.rb +8 -0
- data/app/services/foreman_acd/app_deployer.rb +19 -2
- data/app/services/foreman_acd/inventory_creator.rb +11 -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/index.html.erb +15 -11
- data/app/views/foreman_acd/app_instances/report.html.erb +7 -2
- 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 +3 -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/lib/foreman_acd/plugin.rb +6 -6
- data/lib/foreman_acd/version.rb +1 -1
- data/lib/foreman_acd.rb +27 -9
- data/webpack/__mocks__/foremanReact/components/ForemanModal/ForemanModalActions.js +2 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +28 -9
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +6 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +1 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +30 -9
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +3 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +1 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinition.test.js.snap +30 -5
- data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +1 -1
- data/webpack/components/ApplicationDefinition/components/__tests__/__snapshots__/AnsiblePlaybookSelector.test.js.snap +3 -3
- data/webpack/components/ApplicationDefinition/index.js +6 -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 +96 -25
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +112 -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 +3 -0
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +2 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +1 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +12 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +97 -7
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceReducer.test.js.snap +271 -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 +6 -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/__tests__/__snapshots__/ApplicationInstanceReport.test.js.snap +1 -124
- 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 +98 -1
- data/webpack/components/ParameterSelection/ParameterSelection.scss +7 -0
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +36 -2
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +2 -0
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +49 -8
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +1 -0
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +2 -0
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +96 -0
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +5 -0
- data/webpack/components/ParameterSelection/index.js +2 -1
- data/webpack/components/SyncGitRepo/SyncGitRepo.js +2 -10
- data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +1 -2
- data/webpack/components/SyncGitRepo/SyncGitRepoConstants.js +0 -1
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +1 -0
- data/webpack/components/SyncGitRepo/components/FormTextInput.js +1 -1
- data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +3 -2
- data/webpack/components/common/DeleteTableEntry.js +16 -2
- data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +38 -0
- data/webpack/helper.js +5 -0
- data/webpack/index.js +5 -0
- data/webpack/js-yaml.js +3874 -0
- data/webpack/reducer.js +13 -2
- metadata +46 -2
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
selectSortingColumns,
|
15
15
|
selectColumns,
|
16
16
|
selectParamDefinition,
|
17
|
+
selectEditParamsRowIndex,
|
17
18
|
} from './ParameterSelectionSelectors';
|
18
19
|
|
19
20
|
const mapStateToProps = state => ({
|
@@ -25,6 +26,7 @@ const mapStateToProps = state => ({
|
|
25
26
|
sortingColumns: selectSortingColumns(state),
|
26
27
|
columns: selectColumns(state),
|
27
28
|
paramDefinition: selectParamDefinition(state),
|
29
|
+
editParamsRowIndex: selectEditParamsRowIndex(state),
|
28
30
|
});
|
29
31
|
|
30
32
|
const mapDispatchToProps = dispatch =>
|
@@ -34,4 +36,3 @@ export default connect(
|
|
34
36
|
mapStateToProps,
|
35
37
|
mapDispatchToProps
|
36
38
|
)(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 }
|
@@ -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';
|
@@ -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
|
-
|
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='
|
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={
|
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}>
|
@@ -30,5 +34,6 @@ function EasyHeaderFormatter(value, { column }) {
|
|
30
34
|
export {
|
31
35
|
arrayToObject,
|
32
36
|
arrayToObjectObj,
|
37
|
+
shortHostname,
|
33
38
|
EasyHeaderFormatter
|
34
39
|
};
|
data/webpack/index.js
CHANGED
@@ -3,8 +3,11 @@ import injectReducer from 'foremanReact/redux/reducers/registerReducer';
|
|
3
3
|
import ParameterSelection from './components/ParameterSelection';
|
4
4
|
import SyncGitRepo from './components/SyncGitRepo';
|
5
5
|
import ApplicationDefinition from './components/ApplicationDefinition';
|
6
|
+
import ApplicationDefinitionImport from './components/ApplicationDefinitionImport';
|
6
7
|
import ApplicationInstance from './components/ApplicationInstance';
|
7
8
|
import ApplicationInstanceReport from './components/ApplicationInstanceReport';
|
9
|
+
import ExistingHostSelection from './components/ExistingHostSelection';
|
10
|
+
|
8
11
|
import reducer from './reducer';
|
9
12
|
|
10
13
|
injectReducer('foremanAcd', reducer);
|
@@ -12,5 +15,7 @@ injectReducer('foremanAcd', reducer);
|
|
12
15
|
componentRegistry.register({ name: 'ParameterSelection', type: ParameterSelection, });
|
13
16
|
componentRegistry.register({ name: 'SyncGitRepo', type: SyncGitRepo, });
|
14
17
|
componentRegistry.register({ name: 'ApplicationDefinition', type: ApplicationDefinition, });
|
18
|
+
componentRegistry.register({ name: 'ApplicationDefinitionImport', type: ApplicationDefinitionImport, });
|
15
19
|
componentRegistry.register({ name: 'ApplicationInstance', type: ApplicationInstance, });
|
16
20
|
componentRegistry.register({ name: 'ApplicationInstanceReport', type: ApplicationInstanceReport, });
|
21
|
+
componentRegistry.register({ name: 'ExistingHostSelection', type: ExistingHostSelection, });
|