foreman_acd 0.0.2 → 0.2.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 +2 -0
- data/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +1 -2
- data/app/controllers/foreman_acd/app_definitions_controller.rb +29 -1
- data/app/controllers/foreman_acd/app_instances_controller.rb +70 -21
- 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/ui_acd_controller.rb +0 -1
- data/app/models/foreman_acd/app_definition.rb +0 -1
- data/app/views/foreman_acd/app_definitions/_form.html.erb +6 -14
- data/app/views/foreman_acd/app_definitions/import.html.erb +18 -0
- data/app/views/foreman_acd/app_definitions/index.html.erb +9 -5
- data/app/views/foreman_acd/app_instances/_form.html.erb +5 -5
- data/app/views/foreman_acd/app_instances/deploy.html.erb +19 -0
- data/app/views/foreman_acd/app_instances/index.html.erb +6 -5
- data/app/views/foreman_acd/app_instances/report.html.erb +19 -0
- data/app/views/ui_acd/app_definition.json.rabl +1 -1
- data/config/routes.rb +7 -0
- data/db/migrate/20190610202252_create_app_definitions.rb +1 -3
- data/db/migrate/20190625140305_create_app_instances.rb +1 -1
- data/lib/foreman_acd/plugin.rb +19 -2
- data/lib/foreman_acd/version.rb +1 -1
- data/package.json +9 -33
- data/test/controllers/app_definitions_controller_test.rb +1 -0
- data/test/controllers/app_instances_controller_test.rb +1 -0
- data/test/controllers/ui_acd_controller_test.rb +10 -0
- data/test/models/app_definition_test.rb +1 -0
- data/test/models/app_instance_test.rb +1 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +261 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.scss +1 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +211 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +9 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +147 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +6 -0
- data/webpack/components/ApplicationDefinition/index.js +29 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +342 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.scss +11 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +210 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +12 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +223 -0
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +8 -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 +33 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +155 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.scss +27 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +86 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +4 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +52 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +5 -0
- data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +26 -0
- data/webpack/components/ApplicationInstanceReport/index.js +27 -0
- data/webpack/components/ParameterSelection/ParameterSelection.js +65 -161
- data/webpack/components/ParameterSelection/ParameterSelection.scss +10 -3
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +42 -71
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +12 -19
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +3 -3
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +76 -75
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +2 -6
- 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 +4 -6
- data/webpack/components/common/AddTableEntry.js +30 -0
- data/webpack/components/common/DeleteTableEntry.js +39 -0
- data/webpack/components/common/ExtSelect.js +43 -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 +40 -3
- metadata +51 -48
@@ -6,11 +6,9 @@ class CreateAppDefinitions < ActiveRecord::Migration[5.2]
|
|
6
6
|
create_table :app_definitions do |t|
|
7
7
|
t.string :name, :default => '', :null => false, :limit => 255, :unique => true
|
8
8
|
t.text :description
|
9
|
-
t.
|
10
|
-
t.text :parameters
|
9
|
+
t.text :services
|
11
10
|
t.timestamps :null => true
|
12
11
|
end
|
13
|
-
add_foreign_key :app_definitions, :hostgroups
|
14
12
|
end
|
15
13
|
|
16
14
|
def down
|
@@ -7,7 +7,7 @@ class CreateAppInstances < ActiveRecord::Migration[5.2]
|
|
7
7
|
t.string :name, :default => '', :null => false, :limit => 255, :unique => true
|
8
8
|
t.column :app_definition_id, :integer, :null => false
|
9
9
|
t.text :description
|
10
|
-
t.text :
|
10
|
+
t.text :hosts
|
11
11
|
t.timestamps :null => true
|
12
12
|
end
|
13
13
|
add_foreign_key :app_instances, :app_definitions
|
data/lib/foreman_acd/plugin.rb
CHANGED
@@ -39,6 +39,16 @@ Foreman::Plugin.register :foreman_acd do
|
|
39
39
|
:'foreman_acd/api/v2/app_definitions' => [:destroy] },
|
40
40
|
:resource_type => 'ForemanAcd::AppDefinition'
|
41
41
|
|
42
|
+
permission :export_app_definitions,
|
43
|
+
{ :'foreman_acd/app_definitions' => [:export],
|
44
|
+
:'foreman_acd/api/v2/app_definitions' => [:export] },
|
45
|
+
:resource_type => 'ForemanAcd::AppDefinition'
|
46
|
+
|
47
|
+
permission :import_app_definitions,
|
48
|
+
{ :'foreman_acd/app_definitions' => [:import],
|
49
|
+
:'foreman_acd/api/v2/app_definitions' => [:import] },
|
50
|
+
:resource_type => 'ForemanAcd::AppDefinition'
|
51
|
+
|
42
52
|
permission :create_app_instances,
|
43
53
|
{ :'foreman_acd/app_instances' => [:new, :create],
|
44
54
|
:'foreman_acd/api/v2/app_instances' => [:create] },
|
@@ -63,18 +73,25 @@ Foreman::Plugin.register :foreman_acd do
|
|
63
73
|
{ :'foreman_acd/app_instances' => [:deploy],
|
64
74
|
:'foreman_acd/api/v2/app_instances' => [:deploy] },
|
65
75
|
:resource_type => 'ForemanAcd::AppInstance'
|
76
|
+
|
77
|
+
permission :report_app_instances,
|
78
|
+
{ :'foreman_acd/app_instances' => [:report],
|
79
|
+
:'foreman_acd/api/v2/app_instances' => [:report] },
|
80
|
+
:resource_type => 'ForemanAcd::AppInstance'
|
66
81
|
end
|
67
82
|
|
68
83
|
# Manager Role
|
69
84
|
role 'Application Centric Deployment Manager', [:create_app_definitions,
|
70
85
|
:view_app_definitions,
|
71
86
|
:edit_app_definitions,
|
72
|
-
:
|
87
|
+
:export_app_definitions,
|
88
|
+
:import_app_definitions]
|
73
89
|
|
74
90
|
# User Role
|
75
91
|
role 'Application Centric Deployment User', [:create_app_instances,
|
76
92
|
:view_app_instances,
|
77
93
|
:edit_app_instances,
|
78
94
|
:destroy_app_instances,
|
79
|
-
:deploy_app_instances
|
95
|
+
:deploy_app_instances,
|
96
|
+
:report_app_instances]
|
80
97
|
end
|
data/lib/foreman_acd/version.rb
CHANGED
data/package.json
CHANGED
@@ -1,66 +1,42 @@
|
|
1
1
|
{
|
2
2
|
"name": "foreman_acd",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.0.6",
|
4
4
|
"description": "foreman application centric deployment",
|
5
5
|
"main": "index.js",
|
6
6
|
"directories": {
|
7
7
|
"test": "test"
|
8
8
|
},
|
9
9
|
"dependencies": {
|
10
|
-
"
|
11
|
-
"c3": "^0.4.11",
|
12
|
-
"humanize-duration": "^3.20.1",
|
10
|
+
"@theforeman/vendor": "^1.7.0",
|
13
11
|
"react-intl": "^2.8.0"
|
14
12
|
},
|
15
13
|
"devDependencies": {
|
16
|
-
"@
|
17
|
-
"@storybook/addon-knobs": "^5.0.1",
|
18
|
-
"@storybook/react": "^5.0.1",
|
19
|
-
"@theforeman/vendor-dev": "^1.4.0",
|
20
|
-
"classnames": "^2.2.5",
|
14
|
+
"@theforeman/vendor-dev": "^1.7.0",
|
21
15
|
"babel-eslint": "^8.2.1",
|
22
16
|
"babel-jest": "^23.6.0",
|
23
|
-
"babel-loader": "^7.1.1",
|
24
17
|
"babel-plugin-dynamic-import-node": "^2.0.0",
|
25
|
-
"babel-plugin-module-resolver": "^3.2.0",
|
26
|
-
"babel-plugin-lodash": "^3.3.2",
|
27
|
-
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
28
18
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
29
19
|
"babel-plugin-transform-object-assign": "^6.22.0",
|
30
20
|
"babel-plugin-transform-object-rest-spread": "^6.26.0",
|
31
|
-
"babel-
|
21
|
+
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
32
22
|
"babel-preset-env": "^1.6.0",
|
33
|
-
"babel-preset-react": "^6.
|
23
|
+
"babel-preset-react": "^6.24.1",
|
34
24
|
"enzyme": "^3.7.0",
|
35
|
-
"enzyme-adapter-react-16": "^1.
|
36
|
-
"enzyme-to-json": "^3.
|
25
|
+
"enzyme-adapter-react-16": "^1.7.0",
|
26
|
+
"enzyme-to-json": "^3.3.5",
|
37
27
|
"eslint": "^4.18.1",
|
38
|
-
"eslint-config-airbnb": "^16.0.0",
|
39
28
|
"eslint-plugin-import": "^2.8.0",
|
40
29
|
"eslint-plugin-jest": "^21.2.0",
|
41
|
-
"eslint-plugin-jsx-a11y": "^6.0.2",
|
42
30
|
"eslint-plugin-patternfly-react": "^0.2.1",
|
43
31
|
"eslint-plugin-react": "^7.4.0",
|
44
32
|
"identity-obj-proxy": "^3.0.0",
|
45
33
|
"lodash": "^4.17.11",
|
34
|
+
"jest": "^23.6.0",
|
46
35
|
"jest-cli": "^23.6.0",
|
47
36
|
"jest-prop-type-error": "^1.1.0",
|
48
|
-
"patternfly": "^3.58.0",
|
49
|
-
"patternfly-react": "^2.31.0",
|
50
|
-
"prettier": "^1.16.4",
|
51
|
-
"prop-types": "^15.6.2",
|
52
|
-
"react": "^16.8.1",
|
53
|
-
"react-redux": "^5.0.7",
|
54
37
|
"react-redux-test-utils": "^0.1.1",
|
55
|
-
"react-bootstrap": "^0.32.1",
|
56
|
-
"react-dom": "^16.6.3",
|
57
|
-
"react-json-tree": "^0.11.0",
|
58
|
-
"redux": "^3.7.2",
|
59
|
-
"redux-thunk": "^2.3.0",
|
60
|
-
"reselect": "^3.0.1",
|
61
|
-
"seamless-immutable": "^7.1.3",
|
62
38
|
"sortabular": "~1.5.1",
|
63
|
-
"table-resolver": "~3.
|
39
|
+
"table-resolver": "~3.2.0"
|
64
40
|
},
|
65
41
|
"scripts": {
|
66
42
|
"test": "node node_modules/.bin/jest --no-cache"
|
@@ -3,6 +3,16 @@
|
|
3
3
|
require 'test_plugin_helper'
|
4
4
|
require 'nokogiri'
|
5
5
|
|
6
|
+
module Katello
|
7
|
+
# Mock Katello::KTEnvironment so that tests run without Katello
|
8
|
+
class KTEnvironment
|
9
|
+
def self.all
|
10
|
+
[{ :id => 1, :name => 'Library' }, { :id => 2, :name => 'Test' }]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# UI Controller tests
|
6
16
|
class UiAcdControllerTest < ActionController::TestCase
|
7
17
|
test 'get app json' do
|
8
18
|
app_def = FactoryBot.create(:app_definition)
|
@@ -0,0 +1,261 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import {
|
4
|
+
Icon,
|
5
|
+
Button,
|
6
|
+
} from 'patternfly-react';
|
7
|
+
import * as resolve from 'table-resolver';
|
8
|
+
import ForemanModal from 'foremanReact/components/ForemanModal';
|
9
|
+
import Select from 'foremanReact/components/common/forms/Select';
|
10
|
+
import ParameterSelection from '../ParameterSelection';
|
11
|
+
import AddTableEntry from '../common/AddTableEntry';
|
12
|
+
import DeleteTableEntry from '../common/DeleteTableEntry';
|
13
|
+
import RailsData from '../common/RailsData'
|
14
|
+
|
15
|
+
import {
|
16
|
+
Table,
|
17
|
+
FormControl,
|
18
|
+
inlineEditFormatterFactory,
|
19
|
+
} from 'patternfly-react';
|
20
|
+
|
21
|
+
class ApplicationDefinition extends React.Component {
|
22
|
+
|
23
|
+
constructor(props) {
|
24
|
+
super(props);
|
25
|
+
}
|
26
|
+
|
27
|
+
isEditing({rowData}) {
|
28
|
+
return (rowData.backup !== undefined);
|
29
|
+
}
|
30
|
+
|
31
|
+
componentDidMount() {
|
32
|
+
const {
|
33
|
+
data: { services, hostgroups },
|
34
|
+
initApplicationDefinition,
|
35
|
+
addApplicationDefinitionService,
|
36
|
+
deleteApplicationDefinitionService,
|
37
|
+
activateEditApplicationDefinitionService,
|
38
|
+
changeEditApplicationDefinitionService,
|
39
|
+
openParameterSelectionModal,
|
40
|
+
closeParameterSelectionModal,
|
41
|
+
} = this.props;
|
42
|
+
|
43
|
+
const inlineEditButtonsFormatter = inlineEditFormatterFactory({
|
44
|
+
isEditing: additionalData => this.props.editMode,
|
45
|
+
renderValue: (value, additionalData) => (
|
46
|
+
<td style={{ padding: '2px' }}>
|
47
|
+
<Button
|
48
|
+
bsStyle="default"
|
49
|
+
onClick={() => activateEditApplicationDefinitionService(additionalData)}
|
50
|
+
>
|
51
|
+
<Icon type="pf" name="edit" />
|
52
|
+
</Button>
|
53
|
+
<Button
|
54
|
+
bsStyle="default"
|
55
|
+
onClick={() => openParameterSelectionModal(additionalData)}
|
56
|
+
>
|
57
|
+
<Icon type="pf" name="settings" />
|
58
|
+
</Button>
|
59
|
+
<DeleteTableEntry
|
60
|
+
hidden={false}
|
61
|
+
disabled={false}
|
62
|
+
onDeleteTableEntry={deleteApplicationDefinitionService}
|
63
|
+
additionalData={additionalData}
|
64
|
+
/>
|
65
|
+
</td>
|
66
|
+
),
|
67
|
+
renderEdit: (value, additionalData) => (
|
68
|
+
<td style={{ padding: '2px' }}>
|
69
|
+
<Button bsStyle="default" disabled>
|
70
|
+
<Icon type="pf" name="edit" />
|
71
|
+
</Button>
|
72
|
+
<Button bsStyle="default" disabled>
|
73
|
+
<Icon type="pf" name="settings" />
|
74
|
+
</Button>
|
75
|
+
<DeleteTableEntry
|
76
|
+
hidden={false}
|
77
|
+
disabled={true}
|
78
|
+
onDeleteTableEntry={deleteApplicationDefinitionService}
|
79
|
+
additionalData={additionalData}
|
80
|
+
/>
|
81
|
+
</td>
|
82
|
+
)
|
83
|
+
});
|
84
|
+
this.inlineEditButtonsFormatter = inlineEditButtonsFormatter;
|
85
|
+
|
86
|
+
const headerFormatter = value => <Table.Heading>{value}</Table.Heading>;
|
87
|
+
this.headerFormatter = headerFormatter;
|
88
|
+
|
89
|
+
const inlineEditFormatterImpl = {
|
90
|
+
renderValue: (value, additionalData) => (
|
91
|
+
<td>
|
92
|
+
<span className="static">{value}</span>
|
93
|
+
</td>
|
94
|
+
),
|
95
|
+
renderEditText: (value, additionalData, subtype='text') => (
|
96
|
+
<td className="editing">
|
97
|
+
<FormControl
|
98
|
+
type={subtype}
|
99
|
+
defaultValue={value}
|
100
|
+
onBlur={e => changeEditApplicationDefinitionService(e.target.value, additionalData) }
|
101
|
+
/>
|
102
|
+
</td>
|
103
|
+
),
|
104
|
+
renderEditSelect: (value, additionalData, options) => (
|
105
|
+
<td className="editing">
|
106
|
+
<Select
|
107
|
+
value={value.toString()}
|
108
|
+
onChange={e => changeEditApplicationDefinitionService(e.target.value, additionalData) }
|
109
|
+
options={options}
|
110
|
+
allowClear
|
111
|
+
key="key"
|
112
|
+
/>
|
113
|
+
</td>
|
114
|
+
)
|
115
|
+
};
|
116
|
+
|
117
|
+
const inlineEditFormatter = inlineEditFormatterFactory({
|
118
|
+
isEditing: additionalData => this.isEditing(additionalData),
|
119
|
+
renderValue: (value, additionalData) => {
|
120
|
+
let prettyValue = value;
|
121
|
+
if (additionalData.property == 'hostgroup') {
|
122
|
+
prettyValue = hostgroups[value];
|
123
|
+
}
|
124
|
+
return inlineEditFormatterImpl.renderValue(prettyValue, additionalData)
|
125
|
+
},
|
126
|
+
renderEdit: (value, additionalData) => {
|
127
|
+
if (additionalData.property == 'hostgroup') {
|
128
|
+
if (additionalData.rowData.newEntry === true) {
|
129
|
+
return inlineEditFormatterImpl.renderEditSelect(value, additionalData, hostgroups);
|
130
|
+
}
|
131
|
+
return inlineEditFormatterImpl.renderValue(hostgroups[value], additionalData)
|
132
|
+
}
|
133
|
+
return inlineEditFormatterImpl.renderEditText(value, additionalData);
|
134
|
+
}
|
135
|
+
});
|
136
|
+
this.inlineEditFormatter = inlineEditFormatter;
|
137
|
+
|
138
|
+
initApplicationDefinition(
|
139
|
+
services,
|
140
|
+
this.headerFormatter,
|
141
|
+
this.inlineEditFormatter,
|
142
|
+
this.inlineEditButtonsFormatter,
|
143
|
+
);
|
144
|
+
};
|
145
|
+
|
146
|
+
render() {
|
147
|
+
const {
|
148
|
+
data: { organization, location, loadForemanDataUrl },
|
149
|
+
services,
|
150
|
+
columns,
|
151
|
+
addApplicationDefinitionService,
|
152
|
+
confirmEditApplicationDefinitionService,
|
153
|
+
cancelEditApplicationDefinitionService,
|
154
|
+
openParameterSelectionModal,
|
155
|
+
closeParameterSelectionModal,
|
156
|
+
ParameterSelectionModal,
|
157
|
+
} = this.props;
|
158
|
+
|
159
|
+
return (
|
160
|
+
<span>
|
161
|
+
<div className="form-group">
|
162
|
+
<AddTableEntry
|
163
|
+
hidden={ false }
|
164
|
+
disabled={ this.props.editMode }
|
165
|
+
onAddTableEntry={ addApplicationDefinitionService }
|
166
|
+
/>
|
167
|
+
<Table.PfProvider
|
168
|
+
striped
|
169
|
+
bordered
|
170
|
+
hover
|
171
|
+
dataTable
|
172
|
+
inlineEdit
|
173
|
+
columns={columns}
|
174
|
+
components={{
|
175
|
+
body: {
|
176
|
+
row: Table.InlineEditRow,
|
177
|
+
cell: cellProps => cellProps.children
|
178
|
+
}
|
179
|
+
}}
|
180
|
+
>
|
181
|
+
<Table.Header headerRows={resolve.headerRows({ columns })} />
|
182
|
+
<Table.Body
|
183
|
+
rows={services}
|
184
|
+
rowKey="id"
|
185
|
+
onRow={(rowData, { rowIndex }) => ({
|
186
|
+
role: 'row',
|
187
|
+
isEditing: () => this.isEditing({ rowData }),
|
188
|
+
onCancel: () => cancelEditApplicationDefinitionService({ rowData, rowIndex }),
|
189
|
+
onConfirm: () => confirmEditApplicationDefinitionService({ rowData, rowIndex }),
|
190
|
+
last: rowIndex === services.length - 1
|
191
|
+
})}
|
192
|
+
/>
|
193
|
+
</Table.PfProvider>
|
194
|
+
<AddTableEntry
|
195
|
+
hidden={ false }
|
196
|
+
disabled={ this.props.editMode }
|
197
|
+
onAddTableEntry={ addApplicationDefinitionService }
|
198
|
+
/>
|
199
|
+
</div>
|
200
|
+
<div>
|
201
|
+
<ForemanModal
|
202
|
+
id="AppDefinitionParamSelection"
|
203
|
+
dialogClassName="param_selection_modal"
|
204
|
+
title="Parameter definition for Application Definition"
|
205
|
+
>
|
206
|
+
<ForemanModal.Header closeButton={false}>
|
207
|
+
Parameter definition
|
208
|
+
</ForemanModal.Header>
|
209
|
+
{this.props.parametersData ? (
|
210
|
+
<ParameterSelection
|
211
|
+
location={ location }
|
212
|
+
organization={ organization }
|
213
|
+
loadForemanDataUrl= { loadForemanDataUrl }
|
214
|
+
data={ this.props.parametersData }
|
215
|
+
/>
|
216
|
+
) : (<span>Empty</span>)
|
217
|
+
}
|
218
|
+
<ForemanModal.Footer>
|
219
|
+
<div>
|
220
|
+
<Button bsStyle="primary" onClick={() => closeParameterSelectionModal({ mode: 'save' })}>Save</Button>
|
221
|
+
<Button bsStyle="default" onClick={() => closeParameterSelectionModal({ mode: 'cancel' })}>Cancel</Button>
|
222
|
+
</div>
|
223
|
+
</ForemanModal.Footer>
|
224
|
+
</ForemanModal>
|
225
|
+
</div>
|
226
|
+
<RailsData
|
227
|
+
key='applications_definition'
|
228
|
+
view='app_definition'
|
229
|
+
parameter='services'
|
230
|
+
value={JSON.stringify(this.props.services)}
|
231
|
+
/>
|
232
|
+
</span>
|
233
|
+
)};
|
234
|
+
}
|
235
|
+
|
236
|
+
ApplicationDefinition.defaultProps = {
|
237
|
+
error: {},
|
238
|
+
editMode: false,
|
239
|
+
services: [],
|
240
|
+
parametersData: {},
|
241
|
+
columns: [],
|
242
|
+
editParamsOfRowId: null,
|
243
|
+
}
|
244
|
+
|
245
|
+
ApplicationDefinition.propTypes = {
|
246
|
+
initApplicationDefinition: PropTypes.func,
|
247
|
+
editMode: PropTypes.bool.isRequired,
|
248
|
+
services: PropTypes.array,
|
249
|
+
columns: PropTypes.array,
|
250
|
+
addApplicationDefinitionService: PropTypes.func,
|
251
|
+
deleteApplicationDefinitionService: PropTypes.func,
|
252
|
+
activateEditApplicationDefinitionService: PropTypes.func,
|
253
|
+
confirmEditApplicationDefinitionService: PropTypes.func,
|
254
|
+
cancelEditApplicationDefinitionService: PropTypes.func,
|
255
|
+
changeEditApplicationDefinitionService: PropTypes.func,
|
256
|
+
openParameterSelectionModal: PropTypes.func,
|
257
|
+
closeParameterSelectionModal: PropTypes.func,
|
258
|
+
parametersData: PropTypes.object,
|
259
|
+
};
|
260
|
+
|
261
|
+
export default ApplicationDefinition;
|