foreman_remote_execution 3.1.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.eslintrc +5 -30
- data/.github/workflows/ci.yml +100 -0
- data/.gitignore +1 -0
- data/.rubocop_todo.yml +3 -0
- data/Gemfile +1 -0
- data/app/controllers/api/v2/job_invocations_controller.rb +22 -1
- data/app/controllers/api/v2/template_invocations_controller.rb +4 -1
- data/app/helpers/job_invocations_chart_helper.rb +2 -0
- data/app/helpers/job_invocations_helper.rb +6 -1
- data/app/helpers/remote_execution_helper.rb +39 -30
- data/app/lib/actions/remote_execution/run_host_job.rb +3 -2
- data/app/lib/proxy_api/remote_execution_ssh.rb +6 -0
- data/app/models/concerns/foreman_remote_execution/host_extensions.rb +1 -1
- data/app/models/concerns/foreman_remote_execution/orchestration/ssh.rb +63 -0
- data/app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb +4 -0
- data/app/models/host_status/execution_status.rb +9 -1
- data/app/models/remote_execution_provider.rb +5 -0
- data/app/services/default_proxy_proxy_selector.rb +18 -0
- data/app/views/api/v2/job_invocations/main.json.rabl +8 -2
- data/app/views/job_invocations/_card_results.html.erb +1 -0
- data/app/views/job_invocations/_card_user_input.html.erb +1 -1
- data/app/views/job_invocations/_tab_hosts.html.erb +3 -23
- data/app/views/job_invocations/_tab_overview.html.erb +1 -1
- data/app/views/job_invocations/_user_input.html.erb +1 -1
- data/app/views/job_invocations/show.html.erb +1 -7
- data/app/views/job_invocations/show.json.erb +4 -0
- data/config/routes.rb +2 -1
- data/db/seeds.d/70-job_templates.rb +1 -1
- data/foreman_remote_execution.gemspec +5 -6
- data/lib/foreman_remote_execution/engine.rb +2 -0
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/locale/action_names.rb +3 -3
- data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/de/foreman_remote_execution.po +65 -16
- data/locale/en/foreman_remote_execution.po +63 -15
- data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/en_GB/foreman_remote_execution.po +64 -15
- data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/es/foreman_remote_execution.po +66 -17
- data/locale/foreman_remote_execution.pot +193 -148
- data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/fr/foreman_remote_execution.po +66 -17
- data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ja/foreman_remote_execution.po +66 -17
- data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ko/foreman_remote_execution.po +65 -15
- data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/pt_BR/foreman_remote_execution.po +66 -17
- data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ru/foreman_remote_execution.po +65 -18
- data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_CN/foreman_remote_execution.po +66 -17
- data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_TW/foreman_remote_execution.po +65 -16
- data/package.json +16 -33
- data/test/functional/api/v2/job_invocations_controller_test.rb +42 -14
- data/test/functional/job_invocations_controller_test.rb +12 -0
- data/test/models/orchestration/ssh_test.rb +56 -0
- data/test/unit/concerns/host_extensions_test.rb +7 -0
- data/test/unit/remote_execution_provider_test.rb +4 -1
- data/webpack/__mocks__/foremanReact/common/I18n.js +1 -0
- data/webpack/__mocks__/foremanReact/components/common/ActionButtons/ActionButtons.js +3 -0
- data/webpack/__mocks__/foremanReact/constants.js +3 -0
- data/webpack/index.js +9 -22
- data/webpack/react_app/components/TargetingHosts/TargetingHosts.js +52 -0
- data/webpack/react_app/components/TargetingHosts/TargetingHostsActions.js +8 -0
- data/webpack/react_app/components/TargetingHosts/TargetingHostsConsts.js +1 -0
- data/webpack/react_app/components/TargetingHosts/TargetingHostsSelectors.js +12 -0
- data/webpack/react_app/components/TargetingHosts/__tests__/HostItem.test.js +6 -0
- data/webpack/react_app/components/TargetingHosts/__tests__/HostStatus.test.js +6 -0
- data/webpack/react_app/components/TargetingHosts/__tests__/TargetingHosts.test.js +6 -0
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/HostItem.test.js.snap +31 -0
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/HostStatus.test.js.snap +12 -0
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHosts.test.js.snap +81 -0
- data/webpack/react_app/components/TargetingHosts/__tests__/fixtures.js +43 -0
- data/webpack/react_app/components/TargetingHosts/components/HostItem.js +39 -0
- data/webpack/react_app/components/TargetingHosts/components/HostStatus.js +54 -0
- data/webpack/react_app/components/TargetingHosts/index.js +37 -0
- data/webpack/react_app/components/jobInvocations/AggregateStatus/index.js +10 -0
- data/webpack/react_app/components/jobInvocations/AggregateStatus/index.test.js +6 -3
- data/webpack/react_app/components/jobInvocations/index.js +19 -7
- data/webpack/react_app/redux/actions/jobInvocations/index.js +12 -8
- data/webpack/react_app/redux/consts.js +1 -2
- data/webpack/react_app/redux/reducers/jobInvocations/index.fixtures.js +8 -40
- data/webpack/react_app/redux/reducers/jobInvocations/index.test.js +17 -11
- data/webpack/test_setup.js +2 -1
- metadata +31 -14
- data/.hound.yml +0 -19
- data/.travis.yml +0 -6
- data/app/views/job_invocations/_host_actions_td.html.erb +0 -3
- data/app/views/job_invocations/_host_name_td.html.erb +0 -8
- data/app/views/job_invocations/_host_status_td.html.erb +0 -1
- data/app/views/job_invocations/show.js.erb +0 -23
|
@@ -48,6 +48,13 @@ class ForemanRemoteExecutionHostExtensionsTest < ActiveSupport::TestCase
|
|
|
48
48
|
_(host.host_param('remote_execution_ssh_keys')).must_include sshkey
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
+
it 'merges ssh key as a string from host parameters and proxies' do
|
|
52
|
+
key = 'ssh-rsa not-even-a-key something@somewhere.com'
|
|
53
|
+
host.host_parameters << FactoryBot.create(:host_parameter, :host => host, :name => 'remote_execution_ssh_keys', :value => key)
|
|
54
|
+
_(host.host_param('remote_execution_ssh_keys')).must_include key
|
|
55
|
+
_(host.host_param('remote_execution_ssh_keys')).must_include sshkey
|
|
56
|
+
end
|
|
57
|
+
|
|
51
58
|
it 'has ssh keys in the parameters even when no user specified' do
|
|
52
59
|
# this is a case, when using the helper in provisioning templates
|
|
53
60
|
FactoryBot.create(:smart_proxy, :ssh)
|
|
@@ -149,7 +149,10 @@ class RemoteExecutionProviderTest < ActiveSupport::TestCase
|
|
|
149
149
|
FactoryBot.create(:host) do |host|
|
|
150
150
|
host.interfaces = [FactoryBot.build(:nic_managed, flags.merge(:ip => nil, :name => 'somehost.somedomain.org', :primary => true)),
|
|
151
151
|
FactoryBot.build(:nic_managed, flags.merge(:ip => '127.0.0.1'))]
|
|
152
|
-
end
|
|
152
|
+
end.reload
|
|
153
|
+
# Reassigning the interfaces triggers the on-deletion ssh key removal for the interface which is being replaced
|
|
154
|
+
# This has an undesired side effect of caching the original interface as execution one which made the tests
|
|
155
|
+
# give wrong results. Reloading the host wipes the cache
|
|
153
156
|
end
|
|
154
157
|
|
|
155
158
|
let(:flags) do
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const translate = s => s;
|
data/webpack/index.js
CHANGED
|
@@ -1,29 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
-
import { mount, registerReducer } from 'foremanReact/common/MountingService';
|
|
4
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
1
|
+
import { registerReducer } from 'foremanReact/common/MountingService';
|
|
5
2
|
import componentRegistry from 'foremanReact/components/componentRegistry';
|
|
6
3
|
import JobInvocationContainer from './react_app/components/jobInvocations';
|
|
4
|
+
import TargetingHosts from './react_app/components/TargetingHosts';
|
|
7
5
|
import rootReducer from './react_app/redux/reducers';
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
name: 'JobInvocationContainer',
|
|
11
|
-
type:
|
|
7
|
+
const components = [
|
|
8
|
+
{ name: 'JobInvocationContainer', type: JobInvocationContainer },
|
|
9
|
+
{ name: 'TargetingHosts', type: TargetingHosts },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
components.forEach(component => {
|
|
13
|
+
componentRegistry.register(component);
|
|
12
14
|
});
|
|
13
15
|
|
|
14
16
|
registerReducer('foremanRemoteExecutionReducers', rootReducer);
|
|
15
|
-
|
|
16
|
-
if (window.location.href.match(/job_invocations/)) {
|
|
17
|
-
const jobInvocationId = parseInt(
|
|
18
|
-
new URI(window.location.href).filename(),
|
|
19
|
-
10,
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const mountJobInvocationContainer = () => {
|
|
23
|
-
mount('JobInvocationContainer', '#status_chart', {
|
|
24
|
-
url: `/job_invocations/chart?id=${jobInvocationId}`,
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
document.addEventListener('page:change', mountJobInvocationContainer);
|
|
29
|
-
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
|
4
|
+
import { LoadingState, Alert } from 'patternfly-react';
|
|
5
|
+
import { STATUS } from 'foremanReact/constants';
|
|
6
|
+
import HostItem from './components/HostItem';
|
|
7
|
+
|
|
8
|
+
const TargetingHosts = ({ status, items }) => {
|
|
9
|
+
if (status === STATUS.ERROR) {
|
|
10
|
+
return (
|
|
11
|
+
<Alert type="error">
|
|
12
|
+
{__(
|
|
13
|
+
'There was an error while updating the status, try refreshing the page.'
|
|
14
|
+
)}
|
|
15
|
+
</Alert>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<LoadingState loading={!items.length}>
|
|
21
|
+
<div>
|
|
22
|
+
<table className="table table-bordered table-striped table-hover">
|
|
23
|
+
<thead>
|
|
24
|
+
<tr>
|
|
25
|
+
<th>{__('Host')}</th>
|
|
26
|
+
<th>{__('Status')}</th>
|
|
27
|
+
<th>{__('Actions')}</th>
|
|
28
|
+
</tr>
|
|
29
|
+
</thead>
|
|
30
|
+
<tbody>
|
|
31
|
+
{items.map(host => (
|
|
32
|
+
<HostItem
|
|
33
|
+
key={host.name}
|
|
34
|
+
name={host.name}
|
|
35
|
+
link={host.link}
|
|
36
|
+
status={host.status}
|
|
37
|
+
actions={host.actions}
|
|
38
|
+
/>
|
|
39
|
+
))}
|
|
40
|
+
</tbody>
|
|
41
|
+
</table>
|
|
42
|
+
</div>
|
|
43
|
+
</LoadingState>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
TargetingHosts.propTypes = {
|
|
48
|
+
status: PropTypes.string.isRequired,
|
|
49
|
+
items: PropTypes.array.isRequired,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default TargetingHosts;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getURI } from 'foremanReact/common/urlHelpers';
|
|
2
|
+
import { get } from 'foremanReact/redux/API';
|
|
3
|
+
import { withInterval } from 'foremanReact/redux/middlewares/IntervalMiddleware';
|
|
4
|
+
import { TARGETING_HOSTS } from './TargetingHostsConsts';
|
|
5
|
+
|
|
6
|
+
const url = getURI().addQuery('format', 'json');
|
|
7
|
+
export const getData = () =>
|
|
8
|
+
withInterval(get({ key: TARGETING_HOSTS, url }), 1000);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const TARGETING_HOSTS = 'TARGETING_HOSTS';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
selectAPIStatus,
|
|
3
|
+
selectAPIResponse,
|
|
4
|
+
} from 'foremanReact/redux/API/APISelectors';
|
|
5
|
+
import { TARGETING_HOSTS } from './TargetingHostsConsts';
|
|
6
|
+
|
|
7
|
+
export const selectItems = state =>
|
|
8
|
+
selectAPIResponse(state, TARGETING_HOSTS).hosts || [];
|
|
9
|
+
|
|
10
|
+
export const selectAutoRefresh = state =>
|
|
11
|
+
selectAPIResponse(state, TARGETING_HOSTS).autoRefresh;
|
|
12
|
+
export const selectStatus = state => selectAPIStatus(state, TARGETING_HOSTS);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
+
import HostStatus from '../components/HostStatus';
|
|
3
|
+
import { HostStatusFixtures } from './fixtures';
|
|
4
|
+
|
|
5
|
+
describe('HostStatus', () =>
|
|
6
|
+
testComponentSnapshotsWithFixtures(HostStatus, HostStatusFixtures));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
+
import TargetingHosts from '../TargetingHosts';
|
|
3
|
+
import { TargetingHostsFixtures } from './fixtures';
|
|
4
|
+
|
|
5
|
+
describe('TargetingHosts', () =>
|
|
6
|
+
testComponentSnapshotsWithFixtures(TargetingHosts, TargetingHostsFixtures));
|
data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/HostItem.test.js.snap
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`HostItem renders 1`] = `
|
|
4
|
+
<tr
|
|
5
|
+
id="targeting-host-Host1"
|
|
6
|
+
>
|
|
7
|
+
<td
|
|
8
|
+
className="host_name"
|
|
9
|
+
>
|
|
10
|
+
<a
|
|
11
|
+
href="/host1"
|
|
12
|
+
>
|
|
13
|
+
Host1
|
|
14
|
+
</a>
|
|
15
|
+
</td>
|
|
16
|
+
<td
|
|
17
|
+
className="host_status"
|
|
18
|
+
>
|
|
19
|
+
<HostStatus
|
|
20
|
+
status="success"
|
|
21
|
+
/>
|
|
22
|
+
</td>
|
|
23
|
+
<td
|
|
24
|
+
className="host_actions"
|
|
25
|
+
>
|
|
26
|
+
<ActionButtons
|
|
27
|
+
buttons={Array []}
|
|
28
|
+
/>
|
|
29
|
+
</td>
|
|
30
|
+
</tr>
|
|
31
|
+
`;
|
data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHosts.test.js.snap
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`TargetingHosts renders 1`] = `
|
|
4
|
+
<LoadingState
|
|
5
|
+
additionalClasses=""
|
|
6
|
+
loading={false}
|
|
7
|
+
loadingText="Loading"
|
|
8
|
+
size="lg"
|
|
9
|
+
timeout={300}
|
|
10
|
+
>
|
|
11
|
+
<div>
|
|
12
|
+
<table
|
|
13
|
+
className="table table-bordered table-striped table-hover"
|
|
14
|
+
>
|
|
15
|
+
<thead>
|
|
16
|
+
<tr>
|
|
17
|
+
<th>
|
|
18
|
+
Host
|
|
19
|
+
</th>
|
|
20
|
+
<th>
|
|
21
|
+
Status
|
|
22
|
+
</th>
|
|
23
|
+
<th>
|
|
24
|
+
Actions
|
|
25
|
+
</th>
|
|
26
|
+
</tr>
|
|
27
|
+
</thead>
|
|
28
|
+
<tbody>
|
|
29
|
+
<HostItem
|
|
30
|
+
actions={Array []}
|
|
31
|
+
key="host"
|
|
32
|
+
link="/link"
|
|
33
|
+
name="host"
|
|
34
|
+
status="success"
|
|
35
|
+
/>
|
|
36
|
+
</tbody>
|
|
37
|
+
</table>
|
|
38
|
+
</div>
|
|
39
|
+
</LoadingState>
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
exports[`TargetingHosts renders with error 1`] = `
|
|
43
|
+
<Alert
|
|
44
|
+
className=""
|
|
45
|
+
onDismiss={null}
|
|
46
|
+
type="error"
|
|
47
|
+
>
|
|
48
|
+
There was an error while updating the status, try refreshing the page.
|
|
49
|
+
</Alert>
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
exports[`TargetingHosts renders with loading 1`] = `
|
|
53
|
+
<LoadingState
|
|
54
|
+
additionalClasses=""
|
|
55
|
+
loading={true}
|
|
56
|
+
loadingText="Loading"
|
|
57
|
+
size="lg"
|
|
58
|
+
timeout={300}
|
|
59
|
+
>
|
|
60
|
+
<div>
|
|
61
|
+
<table
|
|
62
|
+
className="table table-bordered table-striped table-hover"
|
|
63
|
+
>
|
|
64
|
+
<thead>
|
|
65
|
+
<tr>
|
|
66
|
+
<th>
|
|
67
|
+
Host
|
|
68
|
+
</th>
|
|
69
|
+
<th>
|
|
70
|
+
Status
|
|
71
|
+
</th>
|
|
72
|
+
<th>
|
|
73
|
+
Actions
|
|
74
|
+
</th>
|
|
75
|
+
</tr>
|
|
76
|
+
</thead>
|
|
77
|
+
<tbody />
|
|
78
|
+
</table>
|
|
79
|
+
</div>
|
|
80
|
+
</LoadingState>
|
|
81
|
+
`;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const HostItemFixtures = {
|
|
2
|
+
renders: {
|
|
3
|
+
name: 'Host1',
|
|
4
|
+
link: '/host1',
|
|
5
|
+
status: 'success',
|
|
6
|
+
actions: [],
|
|
7
|
+
},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const HostStatusFixtures = {
|
|
11
|
+
renders: {
|
|
12
|
+
status: 'success',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const TargetingHostsFixtures = {
|
|
17
|
+
renders: {
|
|
18
|
+
status: '',
|
|
19
|
+
items: [
|
|
20
|
+
{
|
|
21
|
+
name: 'host',
|
|
22
|
+
link: '/link',
|
|
23
|
+
status: 'success',
|
|
24
|
+
actions: [],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
'renders with error': {
|
|
29
|
+
status: 'ERROR',
|
|
30
|
+
items: [
|
|
31
|
+
{
|
|
32
|
+
name: 'host',
|
|
33
|
+
link: '/link',
|
|
34
|
+
status: 'success',
|
|
35
|
+
actions: [],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
'renders with loading': {
|
|
40
|
+
status: '',
|
|
41
|
+
items: [],
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ActionButtons } from 'foremanReact/components/common/ActionButtons/ActionButtons';
|
|
4
|
+
import HostStatus from './HostStatus';
|
|
5
|
+
|
|
6
|
+
const HostItem = ({ name, link, status, actions }) => {
|
|
7
|
+
const hostLink = link ? (
|
|
8
|
+
<a href={link}>{name}</a>
|
|
9
|
+
) : (
|
|
10
|
+
<a href="#" className="disabled">
|
|
11
|
+
{name}
|
|
12
|
+
</a>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<tr id={`targeting-host-${name}`}>
|
|
17
|
+
<td className="host_name">{hostLink}</td>
|
|
18
|
+
<td className="host_status">
|
|
19
|
+
<HostStatus status={status} />
|
|
20
|
+
</td>
|
|
21
|
+
<td className="host_actions">
|
|
22
|
+
<ActionButtons buttons={[...actions]} />
|
|
23
|
+
</td>
|
|
24
|
+
</tr>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
HostItem.propTypes = {
|
|
29
|
+
name: PropTypes.string.isRequired,
|
|
30
|
+
link: PropTypes.string.isRequired,
|
|
31
|
+
status: PropTypes.string.isRequired,
|
|
32
|
+
actions: PropTypes.array,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
HostItem.defaultProps = {
|
|
36
|
+
actions: [],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default HostItem;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Icon } from 'patternfly-react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { translate as __ } from 'foremanReact/common/I18n';
|
|
5
|
+
|
|
6
|
+
const HostStatus = ({ status }) => {
|
|
7
|
+
switch (status) {
|
|
8
|
+
case 'cancelled':
|
|
9
|
+
return (
|
|
10
|
+
<div>
|
|
11
|
+
<Icon type="pf" name="warning-triangle-o" /> {status}
|
|
12
|
+
</div>
|
|
13
|
+
);
|
|
14
|
+
case 'N/A':
|
|
15
|
+
return (
|
|
16
|
+
<div>
|
|
17
|
+
<Icon type="fa" name="question" /> {status}
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
case 'running':
|
|
21
|
+
return (
|
|
22
|
+
<div>
|
|
23
|
+
<Icon type="pf" name="running" /> {status}
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
case 'planned':
|
|
27
|
+
return (
|
|
28
|
+
<div>
|
|
29
|
+
<Icon type="pf" name="build" /> {status}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
case 'warning':
|
|
33
|
+
case 'error':
|
|
34
|
+
return (
|
|
35
|
+
<div>
|
|
36
|
+
<Icon type="pf" name="error-circle-o" /> {__('failed')}
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
case 'success':
|
|
40
|
+
return (
|
|
41
|
+
<div>
|
|
42
|
+
<Icon type="pf" name="ok" /> {status}
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
default:
|
|
46
|
+
return <span>{status}</span>;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
HostStatus.propTypes = {
|
|
51
|
+
status: PropTypes.string.isRequired,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default HostStatus;
|