foreman_acd 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +75 -0
- data/app/controllers/foreman_acd/app_instances_controller.rb +19 -2
- data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +1 -1
- data/app/controllers/foreman_acd/remote_execution_controller.rb +37 -21
- data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +12 -7
- data/app/lib/actions/foreman_acd/run_configurator.rb +10 -7
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +2 -2
- 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 +1 -1
- 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 +8 -2
- data/app/services/foreman_acd/inventory_creator.rb +14 -0
- data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +41 -7
- data/app/views/foreman_acd/app_definitions/_form.html.erb +1 -1
- data/app/views/foreman_acd/app_instances/_form.html.erb +1 -1
- data/app/views/foreman_acd/app_instances/index.html.erb +5 -3
- data/app/views/foreman_acd/app_instances/report.html.erb +1 -1
- data/app/views/templates/job/run_acd_ansible_playbook.erb +1 -1
- data/config/routes.rb +3 -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/seeds.d/75-job_templates.rb +1 -1
- data/lib/foreman_acd.rb +12 -0
- data/lib/foreman_acd/engine.rb +26 -4
- data/lib/foreman_acd/plugin.rb +0 -9
- data/lib/foreman_acd/version.rb +1 -1
- data/lib/tasks/foreman_acd_tasks.rake +0 -12
- data/package.json +8 -8
- 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 +22 -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.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 +1 -1
- 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 +25 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionReducer.test.js +119 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +41 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinition.test.js.snap +200 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionReducer.test.js.snap +3033 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +299 -0
- data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +1 -0
- 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/ApplicationInstance/ApplicationInstance.js +3 -5
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceConfData_1.fixtures.js +263 -0
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +78 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +23 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +119 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +44 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +209 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceReducer.test.js.snap +2719 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +276 -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 +130 -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/ParameterSelection/ParameterSelectionReducer.js +2 -21
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +116 -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 +31 -25
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -6
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +2 -126
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +1483 -872
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +117 -79
- data/webpack/components/SyncGitRepo/SyncGitRepo.js +210 -0
- data/webpack/components/SyncGitRepo/SyncGitRepo.scss +1 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +124 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoConstants.js +9 -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 +30 -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 +46 -0
- data/webpack/components/SyncGitRepo/index.js +28 -0
- 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 +2 -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 +15 -1
- data/webpack/helper.test.js +37 -0
- data/webpack/index.js +2 -0
- data/webpack/reducer.js +4 -0
- metadata +92 -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,137 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`SyncGitRepoReducer should handle git repo sync be erroneous 1`] = `
|
4
|
+
Object {
|
5
|
+
"error": "Something really bad happend",
|
6
|
+
"gitCommit": "master",
|
7
|
+
"gitUrl": "https://github.com/alpha.git",
|
8
|
+
"loading": false,
|
9
|
+
"path": "https://example.com",
|
10
|
+
"scmType": Object {
|
11
|
+
"git": "git",
|
12
|
+
},
|
13
|
+
"scmTypes": Object {
|
14
|
+
"directory": "directory",
|
15
|
+
"git": "git",
|
16
|
+
},
|
17
|
+
}
|
18
|
+
`;
|
19
|
+
|
20
|
+
exports[`SyncGitRepoReducer should handle git repo sync be successful 1`] = `
|
21
|
+
Object {
|
22
|
+
"gitCommit": "master",
|
23
|
+
"gitUrl": "https://github.com/alpha.git",
|
24
|
+
"path": "https://example.com",
|
25
|
+
"scmType": Object {
|
26
|
+
"git": "git",
|
27
|
+
},
|
28
|
+
"scmTypes": Object {
|
29
|
+
"directory": "directory",
|
30
|
+
"git": "git",
|
31
|
+
},
|
32
|
+
}
|
33
|
+
`;
|
34
|
+
|
35
|
+
exports[`SyncGitRepoReducer should initialize component 1`] = `
|
36
|
+
Object {
|
37
|
+
"gitCommit": "master",
|
38
|
+
"gitUrl": "https://github.com/alpha.git",
|
39
|
+
"loading": false,
|
40
|
+
"path": "https://example.com",
|
41
|
+
"scmType": Object {
|
42
|
+
"git": "git",
|
43
|
+
},
|
44
|
+
"scmTypes": Object {
|
45
|
+
"directory": "directory",
|
46
|
+
"git": "git",
|
47
|
+
},
|
48
|
+
}
|
49
|
+
`;
|
50
|
+
|
51
|
+
exports[`SyncGitRepoReducer should load git commit 1`] = `
|
52
|
+
Object {
|
53
|
+
"gitCommit": Object {
|
54
|
+
"gitCommit": "master",
|
55
|
+
},
|
56
|
+
"gitUrl": "https://github.com/alpha.git",
|
57
|
+
"path": "https://example.com",
|
58
|
+
"scmType": Object {
|
59
|
+
"git": "git",
|
60
|
+
},
|
61
|
+
"scmTypes": Object {
|
62
|
+
"directory": "directory",
|
63
|
+
"git": "git",
|
64
|
+
},
|
65
|
+
}
|
66
|
+
`;
|
67
|
+
|
68
|
+
exports[`SyncGitRepoReducer should load git url 1`] = `
|
69
|
+
Object {
|
70
|
+
"gitCommit": "master",
|
71
|
+
"gitUrl": undefined,
|
72
|
+
"path": "https://example.com",
|
73
|
+
"scmType": Object {
|
74
|
+
"git": "git",
|
75
|
+
},
|
76
|
+
"scmTypes": Object {
|
77
|
+
"directory": "directory",
|
78
|
+
"git": "git",
|
79
|
+
},
|
80
|
+
}
|
81
|
+
`;
|
82
|
+
|
83
|
+
exports[`SyncGitRepoReducer should load path 1`] = `
|
84
|
+
Object {
|
85
|
+
"gitCommit": "master",
|
86
|
+
"gitUrl": "https://github.com/alpha.git",
|
87
|
+
"path": Object {
|
88
|
+
"path": "https://example.com",
|
89
|
+
},
|
90
|
+
"scmType": Object {
|
91
|
+
"git": "git",
|
92
|
+
},
|
93
|
+
"scmTypes": Object {
|
94
|
+
"directory": "directory",
|
95
|
+
"git": "git",
|
96
|
+
},
|
97
|
+
}
|
98
|
+
`;
|
99
|
+
|
100
|
+
exports[`SyncGitRepoReducer should load scm_type 1`] = `
|
101
|
+
Object {
|
102
|
+
"gitCommit": "master",
|
103
|
+
"gitUrl": "https://github.com/alpha.git",
|
104
|
+
"path": "https://example.com",
|
105
|
+
"scmType": Object {
|
106
|
+
"scmType": Object {
|
107
|
+
"git": "git",
|
108
|
+
},
|
109
|
+
},
|
110
|
+
"scmTypes": Object {
|
111
|
+
"directory": "directory",
|
112
|
+
"git": "git",
|
113
|
+
},
|
114
|
+
}
|
115
|
+
`;
|
116
|
+
|
117
|
+
exports[`SyncGitRepoReducer should request handle git repo sync 1`] = `
|
118
|
+
Object {
|
119
|
+
"gitCommit": "master",
|
120
|
+
"gitUrl": "https://github.com/alpha.git",
|
121
|
+
"loading": true,
|
122
|
+
"path": "https://example.com",
|
123
|
+
"scmType": Object {
|
124
|
+
"git": "git",
|
125
|
+
},
|
126
|
+
"scmTypes": Object {
|
127
|
+
"directory": "directory",
|
128
|
+
"git": "git",
|
129
|
+
},
|
130
|
+
}
|
131
|
+
`;
|
132
|
+
|
133
|
+
exports[`SyncGitRepoReducer should return initial state 1`] = `
|
134
|
+
Object {
|
135
|
+
"loading": false,
|
136
|
+
}
|
137
|
+
`;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
+
|
3
|
+
exports[`SyncGitRepoSelectors should return gitCommit from syncGitRepoConfData_1 fixtures 1`] = `"master"`;
|
4
|
+
|
5
|
+
exports[`SyncGitRepoSelectors should return gitUrl from syncGitRepoConfData_1 fixtures 1`] = `"https://github.com/alpha.git"`;
|
6
|
+
|
7
|
+
exports[`SyncGitRepoSelectors should return path from syncGitRepoConfData_1 fixtures 1`] = `"https://example.com"`;
|
8
|
+
|
9
|
+
exports[`SyncGitRepoSelectors should return scmType from syncGitRepoConfData_1 fixtures 1`] = `
|
10
|
+
Object {
|
11
|
+
"git": "git",
|
12
|
+
}
|
13
|
+
`;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import ExtTextInput from '../../common/ExtTextInput';
|
4
|
+
import RailsData from '../../common/RailsData'
|
5
|
+
|
6
|
+
const FormTextInput= ({
|
7
|
+
label,
|
8
|
+
hidden,
|
9
|
+
editable,
|
10
|
+
viewText,
|
11
|
+
onChange,
|
12
|
+
parameter,
|
13
|
+
}) =>{
|
14
|
+
return (
|
15
|
+
<div >
|
16
|
+
<div >
|
17
|
+
<ExtTextInput
|
18
|
+
label={label}
|
19
|
+
editable={editable}
|
20
|
+
viewText={viewText}
|
21
|
+
onChange={onChange}
|
22
|
+
/>
|
23
|
+
<RailsData
|
24
|
+
key='ansible_playbook_id'
|
25
|
+
view='ansible_playbook'
|
26
|
+
parameter={parameter}
|
27
|
+
value={viewText}
|
28
|
+
/>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
);
|
32
|
+
};
|
33
|
+
|
34
|
+
FormTextInput.propTypes = {
|
35
|
+
label: PropTypes.string.isRequired,
|
36
|
+
editable: PropTypes.bool.isRequired,
|
37
|
+
viewText: PropTypes.string,
|
38
|
+
onChange: PropTypes.func.isRequired,
|
39
|
+
parameter: PropTypes.string,
|
40
|
+
};
|
41
|
+
|
42
|
+
export default FormTextInput;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import ExtSelect from '../../common/ExtSelect';
|
4
|
+
import RailsData from '../../common/RailsData'
|
5
|
+
|
6
|
+
const ScmTypeSelector= ({
|
7
|
+
label,
|
8
|
+
hidden,
|
9
|
+
editable,
|
10
|
+
viewText,
|
11
|
+
selectValue,
|
12
|
+
onChange,
|
13
|
+
options,
|
14
|
+
}) =>{
|
15
|
+
return (
|
16
|
+
<div className="form-group">
|
17
|
+
<label className="col-md-2 control-label">{label}</label>
|
18
|
+
<div className="col-md-4">
|
19
|
+
<ExtSelect
|
20
|
+
editable={ editable }
|
21
|
+
viewText={viewText}
|
22
|
+
selectValue={selectValue}
|
23
|
+
onChange={onChange}
|
24
|
+
options={options}
|
25
|
+
/>
|
26
|
+
<RailsData
|
27
|
+
key='ansible_playbook_id'
|
28
|
+
view='ansible_playbook'
|
29
|
+
parameter='scm_type'
|
30
|
+
value={selectValue}
|
31
|
+
/>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
);
|
35
|
+
};
|
36
|
+
|
37
|
+
ScmTypeSelector.propTypes = {
|
38
|
+
label: PropTypes.string.isRequired,
|
39
|
+
editable: PropTypes.bool.isRequired,
|
40
|
+
viewText: PropTypes.string,
|
41
|
+
selectValue: PropTypes.string,
|
42
|
+
onChange: PropTypes.func.isRequired,
|
43
|
+
options: PropTypes.object,
|
44
|
+
};
|
45
|
+
|
46
|
+
export default ScmTypeSelector;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { bindActionCreators } from 'redux';
|
2
|
+
import { connect } from 'react-redux';
|
3
|
+
|
4
|
+
import './SyncGitRepo.scss';
|
5
|
+
import SyncGitRepo from './SyncGitRepo';
|
6
|
+
import * as SyncGitRepoActions from './SyncGitRepoActions';
|
7
|
+
|
8
|
+
import {
|
9
|
+
selectScmType,
|
10
|
+
selectPath,
|
11
|
+
selectGitCommit,
|
12
|
+
selectGitUrl,
|
13
|
+
} from './SyncGitRepoSelectors';
|
14
|
+
|
15
|
+
const mapStateToProps = state => ({
|
16
|
+
scmType: selectScmType(state),
|
17
|
+
gitCommit: selectGitCommit(state),
|
18
|
+
path: selectPath(state),
|
19
|
+
gitUrl: selectGitUrl(state)
|
20
|
+
});
|
21
|
+
|
22
|
+
const mapDispatchToProps = dispatch =>
|
23
|
+
bindActionCreators(SyncGitRepoActions, dispatch);
|
24
|
+
|
25
|
+
export default connect(
|
26
|
+
mapStateToProps,
|
27
|
+
mapDispatchToProps
|
28
|
+
)(SyncGitRepo);
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import TextInput from 'foremanReact/components/common/forms/TextInput';
|
4
|
+
|
5
|
+
const ExtTextInput= ({
|
6
|
+
hidden,
|
7
|
+
editable,
|
8
|
+
viewText,
|
9
|
+
label,
|
10
|
+
onChange,
|
11
|
+
additionalData,
|
12
|
+
}) =>{
|
13
|
+
if (hidden) {
|
14
|
+
return null;
|
15
|
+
}
|
16
|
+
|
17
|
+
if (!editable) {
|
18
|
+
return (
|
19
|
+
<div className="form-group">
|
20
|
+
<label className="col-md-2 control-label">{label}</label>
|
21
|
+
<div className="col-md-4">{viewText}</div>
|
22
|
+
</div>
|
23
|
+
);
|
24
|
+
}
|
25
|
+
|
26
|
+
return (
|
27
|
+
<TextInput
|
28
|
+
label={label}
|
29
|
+
value={viewText}
|
30
|
+
onChange={e => onChange(e.target.value, additionalData) }
|
31
|
+
/>
|
32
|
+
);
|
33
|
+
};
|
34
|
+
|
35
|
+
ExtTextInput.propTypes = {
|
36
|
+
hidden: PropTypes.bool.isRequired,
|
37
|
+
editable: PropTypes.bool.isRequired,
|
38
|
+
viewText: PropTypes.string,
|
39
|
+
onChange: PropTypes.func.isRequired,
|
40
|
+
additionalData: PropTypes.object,
|
41
|
+
};
|
42
|
+
|
43
|
+
export default ExtTextInput;
|
@@ -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,6 @@
|
|
2
2
|
|
3
3
|
exports[`DeleteTableEntry should render delete parameter 1`] = `
|
4
4
|
<span>
|
5
|
-
|
6
5
|
<Button
|
7
6
|
active={false}
|
8
7
|
block={false}
|
@@ -13,6 +12,7 @@ exports[`DeleteTableEntry should render delete parameter 1`] = `
|
|
13
12
|
>
|
14
13
|
<Icon
|
15
14
|
name="delete"
|
15
|
+
title="Delete entry"
|
16
16
|
type="pf"
|
17
17
|
/>
|
18
18
|
</Button>
|
@@ -21,7 +21,6 @@ exports[`DeleteTableEntry should render delete parameter 1`] = `
|
|
21
21
|
|
22
22
|
exports[`DeleteTableEntry should render disabled button 1`] = `
|
23
23
|
<span>
|
24
|
-
|
25
24
|
<Button
|
26
25
|
active={false}
|
27
26
|
block={false}
|
@@ -32,6 +31,7 @@ exports[`DeleteTableEntry should render disabled button 1`] = `
|
|
32
31
|
>
|
33
32
|
<Icon
|
34
33
|
name="delete"
|
34
|
+
title="Delete entry"
|
35
35
|
type="pf"
|
36
36
|
/>
|
37
37
|
</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
|
+
`;
|