foreman_remote_execution 18.0.1 → 18.1.0
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/app/assets/javascripts/foreman_remote_execution/locale/fr/foreman_remote_execution.js +28 -28
- data/app/assets/javascripts/foreman_remote_execution/locale/ja/foreman_remote_execution.js +48 -48
- data/app/assets/javascripts/foreman_remote_execution/locale/ko/foreman_remote_execution.js +29 -29
- data/app/assets/javascripts/foreman_remote_execution/locale/zh_CN/foreman_remote_execution.js +22 -22
- data/app/assets/javascripts/foreman_remote_execution/template_invocation.js +0 -170
- data/app/assets/stylesheets/foreman_remote_execution/job_invocations.scss +0 -6
- data/app/controllers/job_invocations_controller.rb +1 -98
- data/app/helpers/job_invocations_helper.rb +0 -49
- data/app/helpers/remote_execution_helper.rb +23 -123
- data/config/routes.rb +0 -6
- data/lib/foreman_remote_execution/plugin.rb +2 -2
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/locale/foreman_remote_execution.pot +2 -2
- data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/fr/foreman_remote_execution.po +28 -28
- data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ja/foreman_remote_execution.po +48 -48
- data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ko/foreman_remote_execution.po +29 -29
- data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_CN/foreman_remote_execution.po +22 -22
- data/package.json +1 -14
- data/test/functional/job_invocations_controller_test.rb +0 -77
- data/webpack/JobInvocationDetail/JobInvocationConstants.js +5 -0
- data/webpack/JobInvocationDetail/JobInvocationToolbarButtons.js +0 -10
- data/webpack/JobInvocationDetail/TemplateInvocation.js +12 -69
- data/webpack/JobInvocationDetail/TemplateInvocationComponents/OutputCodeBlock.js +94 -72
- data/webpack/JobInvocationDetail/TemplateInvocationHelpers.js +33 -0
- data/webpack/JobInvocationDetail/__tests__/JobInvocationDetailEmptyState.test.js +1 -1
- data/webpack/JobInvocationDetail/__tests__/MainInformation.test.js +0 -6
- data/webpack/JobInvocationDetail/__tests__/OutputCodeBlock.test.js +1 -1
- data/webpack/JobInvocationDetail/__tests__/TableToolbarActions.test.js +1 -1
- data/webpack/JobInvocationDetail/__tests__/TemplateInvocation.test.js +5 -1
- data/webpack/JobInvocationDetail/__tests__/TemplateInvocationHelpers.test.js +94 -0
- data/webpack/JobInvocationDetail/__tests__/TemplateInvocationPolling.test.js +338 -139
- data/webpack/JobInvocationDetail/useTemplateInvocationOutputPolling.js +185 -0
- data/webpack/JobWizard/JobWizardPageRerun.js +0 -10
- data/webpack/JobWizard/__tests__/autofill.test.js +23 -0
- data/webpack/JobWizard/__tests__/integration.test.js +1 -1
- data/webpack/JobWizard/autofill.js +18 -4
- data/webpack/JobWizard/index.js +1 -18
- data/webpack/JobWizard/steps/HostsAndInputs/__tests__/HostsAndInputs.test.js +49 -1
- data/webpack/global_index.js +0 -2
- data/webpack/index.js +0 -15
- data/webpack/react_app/components/RegistrationExtension/__tests__/RexInterface.test.js +1 -1
- metadata +6 -53
- data/app/assets/stylesheets/foreman_remote_execution/modal_window.scss +0 -4
- data/app/helpers/job_invocations_chart_helper.rb +0 -80
- data/app/views/job_invocations/_card_results.html.erb +0 -12
- data/app/views/job_invocations/_card_schedule.html.erb +0 -33
- data/app/views/job_invocations/_card_target_hosts.html.erb +0 -57
- data/app/views/job_invocations/_card_user_input.html.erb +0 -16
- data/app/views/job_invocations/_description_fields.html.erb +0 -4
- data/app/views/job_invocations/_form.html.erb +0 -144
- data/app/views/job_invocations/_preview_hosts_modal.html.erb +0 -15
- data/app/views/job_invocations/_rerun_taxonomies.html.erb +0 -22
- data/app/views/job_invocations/_tab_hosts.html.erb +0 -11
- data/app/views/job_invocations/_tab_overview.html.erb +0 -41
- data/app/views/job_invocations/_tab_preview_templates.html.erb +0 -20
- data/app/views/job_invocations/_user_input.html.erb +0 -21
- data/app/views/job_invocations/new.html.erb +0 -9
- data/app/views/job_invocations/refresh.js.erb +0 -4
- data/app/views/job_invocations/show.html.erb +0 -59
- data/app/views/job_invocations/show.js.erb +0 -12
- data/app/views/job_invocations/show.json.erb +0 -5
- data/test/support/remote_execution_helper.rb +0 -5
- data/webpack/react_app/components/TargetingHosts/TargetingHosts.js +0 -62
- data/webpack/react_app/components/TargetingHosts/TargetingHostsConsts.js +0 -2
- data/webpack/react_app/components/TargetingHosts/TargetingHostsHelpers.js +0 -10
- data/webpack/react_app/components/TargetingHosts/TargetingHostsLabelsRow.js +0 -45
- data/webpack/react_app/components/TargetingHosts/TargetingHostsLabelsRow.scss +0 -30
- data/webpack/react_app/components/TargetingHosts/TargetingHostsPage.js +0 -78
- data/webpack/react_app/components/TargetingHosts/TargetingHostsPage.scss +0 -3
- data/webpack/react_app/components/TargetingHosts/TargetingHostsSelectors.js +0 -25
- data/webpack/react_app/components/TargetingHosts/__tests__/HostItem.test.js +0 -76
- data/webpack/react_app/components/TargetingHosts/__tests__/HostStatus.test.js +0 -6
- data/webpack/react_app/components/TargetingHosts/__tests__/TargetingHosts.test.js +0 -6
- data/webpack/react_app/components/TargetingHosts/__tests__/TargetingHostsPage.test.js +0 -9
- data/webpack/react_app/components/TargetingHosts/__tests__/TargetingHostsSelectors.test.js +0 -31
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/HostStatus.test.js.snap +0 -12
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHosts.test.js.snap +0 -96
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +0 -75
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsSelectors.test.js.snap +0 -16
- data/webpack/react_app/components/TargetingHosts/__tests__/fixtures.js +0 -56
- data/webpack/react_app/components/TargetingHosts/components/HostItem.js +0 -39
- data/webpack/react_app/components/TargetingHosts/components/HostStatus.js +0 -54
- data/webpack/react_app/components/TargetingHosts/index.js +0 -150
- data/webpack/react_app/components/jobInvocations/AggregateStatus/index.js +0 -60
- data/webpack/react_app/components/jobInvocations/AggregateStatus/index.test.js +0 -76
- data/webpack/react_app/components/jobInvocations/index.js +0 -94
- data/webpack/react_app/extend/reducers.js +0 -5
- data/webpack/react_app/redux/actions/jobInvocations/index.js +0 -87
- data/webpack/react_app/redux/consts.js +0 -5
- data/webpack/react_app/redux/reducers/index.js +0 -6
- data/webpack/react_app/redux/reducers/jobInvocations/index.fixtures.js +0 -46
- data/webpack/react_app/redux/reducers/jobInvocations/index.js +0 -34
- data/webpack/react_app/redux/reducers/jobInvocations/index.test.js +0 -43
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
@import 'foremanReact/common/variables';
|
|
2
|
-
|
|
3
|
-
.tasks-labels-row {
|
|
4
|
-
margin: 0;
|
|
5
|
-
padding: 10px;
|
|
6
|
-
|
|
7
|
-
.title {
|
|
8
|
-
font-weight: 600;
|
|
9
|
-
font-size: 13px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.label {
|
|
13
|
-
font-size: 100%;
|
|
14
|
-
margin-left: 5px;
|
|
15
|
-
margin-right: 5px;
|
|
16
|
-
|
|
17
|
-
a {
|
|
18
|
-
padding-left: 10px;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.pficon-close {
|
|
23
|
-
color: $color-pf-white;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.compound-label-pf {
|
|
27
|
-
margin: 10px;
|
|
28
|
-
margin-left: 0;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Grid } from 'patternfly-react';
|
|
4
|
-
|
|
5
|
-
import SearchBar from 'foremanReact/components/SearchBar';
|
|
6
|
-
import Pagination from 'foremanReact/components/Pagination';
|
|
7
|
-
import { getControllerSearchProps } from 'foremanReact/constants';
|
|
8
|
-
import { noop } from 'foremanReact/common/helpers';
|
|
9
|
-
|
|
10
|
-
import TargetingHosts from './TargetingHosts';
|
|
11
|
-
import { TARGETING_HOSTS_AUTOCOMPLETE } from './TargetingHostsConsts';
|
|
12
|
-
import './TargetingHostsPage.scss';
|
|
13
|
-
import TargetingHostsLabelsRow from './TargetingHostsLabelsRow';
|
|
14
|
-
|
|
15
|
-
const TargetingHostsPage = ({
|
|
16
|
-
handleSearch,
|
|
17
|
-
searchQuery,
|
|
18
|
-
statusFilter,
|
|
19
|
-
statusFilterReset,
|
|
20
|
-
apiStatus,
|
|
21
|
-
items,
|
|
22
|
-
totalHosts,
|
|
23
|
-
handlePagination,
|
|
24
|
-
page,
|
|
25
|
-
}) => (
|
|
26
|
-
<div id="targeting_hosts">
|
|
27
|
-
<Grid.Row>
|
|
28
|
-
<Grid.Col md={6}>
|
|
29
|
-
<SearchBar
|
|
30
|
-
onSearch={query => handleSearch(query, statusFilter)}
|
|
31
|
-
data={{
|
|
32
|
-
...getControllerSearchProps('hosts', TARGETING_HOSTS_AUTOCOMPLETE),
|
|
33
|
-
autocomplete: {
|
|
34
|
-
id: TARGETING_HOSTS_AUTOCOMPLETE,
|
|
35
|
-
searchQuery,
|
|
36
|
-
url: '/hosts/auto_complete_search',
|
|
37
|
-
useKeyShortcuts: true,
|
|
38
|
-
},
|
|
39
|
-
}}
|
|
40
|
-
onBookmarkClick={handleSearch}
|
|
41
|
-
/>
|
|
42
|
-
</Grid.Col>
|
|
43
|
-
</Grid.Row>
|
|
44
|
-
<TargetingHostsLabelsRow
|
|
45
|
-
query={statusFilter}
|
|
46
|
-
updateQuery={statusFilterReset}
|
|
47
|
-
/>
|
|
48
|
-
<br />
|
|
49
|
-
<TargetingHosts apiStatus={apiStatus} items={items} />
|
|
50
|
-
<Pagination
|
|
51
|
-
page={page}
|
|
52
|
-
itemCount={totalHosts}
|
|
53
|
-
onChange={args => handlePagination(args)}
|
|
54
|
-
className="targeting-hosts-pagination"
|
|
55
|
-
updateParamsByUrl={false}
|
|
56
|
-
/>
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
TargetingHostsPage.propTypes = {
|
|
61
|
-
handleSearch: PropTypes.func.isRequired,
|
|
62
|
-
searchQuery: PropTypes.string.isRequired,
|
|
63
|
-
apiStatus: PropTypes.string,
|
|
64
|
-
statusFilter: PropTypes.object,
|
|
65
|
-
statusFilterReset: PropTypes.func,
|
|
66
|
-
items: PropTypes.array.isRequired,
|
|
67
|
-
totalHosts: PropTypes.number.isRequired,
|
|
68
|
-
handlePagination: PropTypes.func.isRequired,
|
|
69
|
-
page: PropTypes.number.isRequired,
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
TargetingHostsPage.defaultProps = {
|
|
73
|
-
apiStatus: null,
|
|
74
|
-
statusFilter: {},
|
|
75
|
-
statusFilterReset: noop,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export default TargetingHostsPage;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
selectAPIStatus,
|
|
3
|
-
selectAPIResponse,
|
|
4
|
-
} from 'foremanReact/redux/API/APISelectors';
|
|
5
|
-
import { selectDoesIntervalExist } from 'foremanReact/redux/middlewares/IntervalMiddleware/IntervalSelectors';
|
|
6
|
-
|
|
7
|
-
import { TARGETING_HOSTS } from './TargetingHostsConsts';
|
|
8
|
-
|
|
9
|
-
export const selectItems = state =>
|
|
10
|
-
selectAPIResponse(state, TARGETING_HOSTS).hosts || [];
|
|
11
|
-
|
|
12
|
-
export const selectAutoRefresh = state =>
|
|
13
|
-
selectAPIResponse(state, TARGETING_HOSTS).autoRefresh || '';
|
|
14
|
-
|
|
15
|
-
export const selectApiStatus = state => selectAPIStatus(state, TARGETING_HOSTS);
|
|
16
|
-
export const selectTotalHosts = state =>
|
|
17
|
-
selectAPIResponse(state, TARGETING_HOSTS).total_hosts || 0;
|
|
18
|
-
|
|
19
|
-
export const selectIntervalExists = state =>
|
|
20
|
-
selectDoesIntervalExist(state, TARGETING_HOSTS);
|
|
21
|
-
|
|
22
|
-
const defaultStatusFilter = {};
|
|
23
|
-
export const selectStatusFilter = state =>
|
|
24
|
-
state.foremanRemoteExecutionReducers.jobInvocations
|
|
25
|
-
.jobInvocationStateFilter || defaultStatusFilter;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import userEvent from '@testing-library/user-event';
|
|
4
|
-
import '@testing-library/jest-dom';
|
|
5
|
-
import HostItem from '../components/HostItem';
|
|
6
|
-
import { HostItemFixtures } from './fixtures';
|
|
7
|
-
|
|
8
|
-
jest.unmock('foremanReact/components/common/ActionButtons/ActionButtons');
|
|
9
|
-
|
|
10
|
-
const renderHostItem = props =>
|
|
11
|
-
render(
|
|
12
|
-
<table>
|
|
13
|
-
<tbody>
|
|
14
|
-
<HostItem {...props} />
|
|
15
|
-
</tbody>
|
|
16
|
-
</table>
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
describe('HostItem', () => {
|
|
20
|
-
it('renders the host name as a link with the provided URL', () => {
|
|
21
|
-
renderHostItem(HostItemFixtures.renders);
|
|
22
|
-
|
|
23
|
-
expect(screen.getByRole('link', { name: 'Host1' })).toHaveAttribute(
|
|
24
|
-
'href',
|
|
25
|
-
'/host1'
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('renders the host status', () => {
|
|
30
|
-
renderHostItem(HostItemFixtures.renders);
|
|
31
|
-
|
|
32
|
-
expect(screen.getByText('Succeeded')).toBeInTheDocument();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('renders no action buttons when actions are empty', () => {
|
|
36
|
-
renderHostItem(HostItemFixtures.renders);
|
|
37
|
-
|
|
38
|
-
expect(screen.queryByRole('button')).not.toBeInTheDocument();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it('renders a disabled link when link is not provided', () => {
|
|
42
|
-
renderHostItem({
|
|
43
|
-
...HostItemFixtures.renders,
|
|
44
|
-
link: '',
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
expect(screen.getByRole('link', { name: 'Host1' })).toHaveAttribute(
|
|
48
|
-
'href',
|
|
49
|
-
'#'
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('renders action buttons and calls action on click', async () => {
|
|
54
|
-
const onClick = jest.fn();
|
|
55
|
-
|
|
56
|
-
renderHostItem({
|
|
57
|
-
...HostItemFixtures.renders,
|
|
58
|
-
actions: [{ title: 'View output', action: { onClick } }],
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
await userEvent.click(
|
|
62
|
-
screen.getByRole('button', { name: 'View output' })
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
expect(onClick).toHaveBeenCalledTimes(1);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('renders failed status text for error status', () => {
|
|
69
|
-
renderHostItem({
|
|
70
|
-
...HostItemFixtures.renders,
|
|
71
|
-
status: 'error',
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
expect(screen.getByText('Failed')).toBeInTheDocument();
|
|
75
|
-
});
|
|
76
|
-
});
|
|
@@ -1,6 +0,0 @@
|
|
|
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));
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
-
import TargetingHosts from '../TargetingHosts';
|
|
3
|
-
import { TargetingHostsFixtures } from './fixtures';
|
|
4
|
-
|
|
5
|
-
describe('TargetingHosts', () =>
|
|
6
|
-
testComponentSnapshotsWithFixtures(TargetingHosts, TargetingHostsFixtures));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
|
2
|
-
import TargetingHostsPage from '../TargetingHostsPage';
|
|
3
|
-
import { TargetingHostsPageFixtures } from './fixtures';
|
|
4
|
-
|
|
5
|
-
describe('TargetingHostsPage', () =>
|
|
6
|
-
testComponentSnapshotsWithFixtures(
|
|
7
|
-
TargetingHostsPage,
|
|
8
|
-
TargetingHostsPageFixtures
|
|
9
|
-
));
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
selectItems,
|
|
5
|
-
selectAutoRefresh,
|
|
6
|
-
selectApiStatus,
|
|
7
|
-
selectTotalHosts,
|
|
8
|
-
selectIntervalExists,
|
|
9
|
-
} from '../TargetingHostsSelectors';
|
|
10
|
-
|
|
11
|
-
const state = {
|
|
12
|
-
TARGETING_HOSTS: {
|
|
13
|
-
status: 'RESOLVED',
|
|
14
|
-
response: {
|
|
15
|
-
hosts: [1, 2],
|
|
16
|
-
total_hosts: 2,
|
|
17
|
-
autoRefresh: 'true',
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const fixtures = {
|
|
23
|
-
'should return hosts': () => selectItems(state),
|
|
24
|
-
'should return autoRefresh': () => selectAutoRefresh(state),
|
|
25
|
-
'should return apiStatus': () => selectApiStatus(state),
|
|
26
|
-
'should return totalHosts': () => selectTotalHosts(state),
|
|
27
|
-
'should return intervalExists': () => selectIntervalExists(state),
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
describe('TargetingHostsSelectors', () =>
|
|
31
|
-
testSelectorsSnapshotWithFixtures(fixtures));
|
data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHosts.test.js.snap
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
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
|
-
<HostItem
|
|
37
|
-
actions={Array []}
|
|
38
|
-
key="host2"
|
|
39
|
-
link="/link2"
|
|
40
|
-
name="host2"
|
|
41
|
-
status="success"
|
|
42
|
-
/>
|
|
43
|
-
</tbody>
|
|
44
|
-
</table>
|
|
45
|
-
</div>
|
|
46
|
-
</LoadingState>
|
|
47
|
-
`;
|
|
48
|
-
|
|
49
|
-
exports[`TargetingHosts renders with error 1`] = `
|
|
50
|
-
<Alert
|
|
51
|
-
className=""
|
|
52
|
-
onDismiss={null}
|
|
53
|
-
type="error"
|
|
54
|
-
>
|
|
55
|
-
There was an error while updating the status, try refreshing the page.
|
|
56
|
-
</Alert>
|
|
57
|
-
`;
|
|
58
|
-
|
|
59
|
-
exports[`TargetingHosts renders with loading 1`] = `
|
|
60
|
-
<LoadingState
|
|
61
|
-
additionalClasses=""
|
|
62
|
-
loading={true}
|
|
63
|
-
loadingText="Loading"
|
|
64
|
-
size="lg"
|
|
65
|
-
timeout={300}
|
|
66
|
-
>
|
|
67
|
-
<div>
|
|
68
|
-
<table
|
|
69
|
-
className="table table-bordered table-striped table-hover"
|
|
70
|
-
>
|
|
71
|
-
<thead>
|
|
72
|
-
<tr>
|
|
73
|
-
<th>
|
|
74
|
-
Host
|
|
75
|
-
</th>
|
|
76
|
-
<th>
|
|
77
|
-
Status
|
|
78
|
-
</th>
|
|
79
|
-
<th>
|
|
80
|
-
Actions
|
|
81
|
-
</th>
|
|
82
|
-
</tr>
|
|
83
|
-
</thead>
|
|
84
|
-
<tbody>
|
|
85
|
-
<tr>
|
|
86
|
-
<td
|
|
87
|
-
colSpan="3"
|
|
88
|
-
>
|
|
89
|
-
No hosts found.
|
|
90
|
-
</td>
|
|
91
|
-
</tr>
|
|
92
|
-
</tbody>
|
|
93
|
-
</table>
|
|
94
|
-
</div>
|
|
95
|
-
</LoadingState>
|
|
96
|
-
`;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`TargetingHostsPage renders 1`] = `
|
|
4
|
-
<div
|
|
5
|
-
id="targeting_hosts"
|
|
6
|
-
>
|
|
7
|
-
<Row
|
|
8
|
-
bsClass="row"
|
|
9
|
-
componentClass="div"
|
|
10
|
-
>
|
|
11
|
-
<Col
|
|
12
|
-
bsClass="col"
|
|
13
|
-
componentClass="div"
|
|
14
|
-
md={6}
|
|
15
|
-
>
|
|
16
|
-
<SearchBar
|
|
17
|
-
bookmarksPosition="left"
|
|
18
|
-
data={
|
|
19
|
-
Object {
|
|
20
|
-
"autocomplete": Object {
|
|
21
|
-
"id": "targeting_hosts_search",
|
|
22
|
-
"searchQuery": "",
|
|
23
|
-
"url": "/hosts/auto_complete_search",
|
|
24
|
-
"useKeyShortcuts": true,
|
|
25
|
-
},
|
|
26
|
-
"bookmarks": Object {
|
|
27
|
-
"canCreate": true,
|
|
28
|
-
"documentationUrl": "/links/manual/4.1.5Searching",
|
|
29
|
-
"id": "targeting_hosts_search",
|
|
30
|
-
"url": "/api/bookmarks",
|
|
31
|
-
},
|
|
32
|
-
"controller": "hosts",
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
initialQuery=""
|
|
36
|
-
name={null}
|
|
37
|
-
onBookmarkClick={[Function]}
|
|
38
|
-
onSearch={[Function]}
|
|
39
|
-
onSearchChange={[Function]}
|
|
40
|
-
restrictedSearchQuery={[Function]}
|
|
41
|
-
/>
|
|
42
|
-
</Col>
|
|
43
|
-
</Row>
|
|
44
|
-
<TargetingHostsLabelsRow
|
|
45
|
-
query={Object {}}
|
|
46
|
-
/>
|
|
47
|
-
<br />
|
|
48
|
-
<TargetingHosts
|
|
49
|
-
apiStatus="RESOLVED"
|
|
50
|
-
items={
|
|
51
|
-
Array [
|
|
52
|
-
Object {
|
|
53
|
-
"actions": Array [],
|
|
54
|
-
"link": "/link",
|
|
55
|
-
"name": "host",
|
|
56
|
-
"status": "success",
|
|
57
|
-
},
|
|
58
|
-
Object {
|
|
59
|
-
"actions": Array [],
|
|
60
|
-
"link": "/link2",
|
|
61
|
-
"name": "host2",
|
|
62
|
-
"status": "success",
|
|
63
|
-
},
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
/>
|
|
67
|
-
<Pagination
|
|
68
|
-
className="targeting-hosts-pagination"
|
|
69
|
-
itemCount={1}
|
|
70
|
-
onChange={[Function]}
|
|
71
|
-
page={1}
|
|
72
|
-
updateParamsByUrl={false}
|
|
73
|
-
/>
|
|
74
|
-
</div>
|
|
75
|
-
`;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`TargetingHostsSelectors should return apiStatus 1`] = `"RESOLVED"`;
|
|
4
|
-
|
|
5
|
-
exports[`TargetingHostsSelectors should return autoRefresh 1`] = `"true"`;
|
|
6
|
-
|
|
7
|
-
exports[`TargetingHostsSelectors should return hosts 1`] = `
|
|
8
|
-
Array [
|
|
9
|
-
1,
|
|
10
|
-
2,
|
|
11
|
-
]
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
exports[`TargetingHostsSelectors should return intervalExists 1`] = `false`;
|
|
15
|
-
|
|
16
|
-
exports[`TargetingHostsSelectors should return totalHosts 1`] = `2`;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const items = [
|
|
2
|
-
{
|
|
3
|
-
name: 'host',
|
|
4
|
-
link: '/link',
|
|
5
|
-
status: 'success',
|
|
6
|
-
actions: [],
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
name: 'host2',
|
|
10
|
-
link: '/link2',
|
|
11
|
-
status: 'success',
|
|
12
|
-
actions: [],
|
|
13
|
-
},
|
|
14
|
-
];
|
|
15
|
-
|
|
16
|
-
export const HostItemFixtures = {
|
|
17
|
-
renders: {
|
|
18
|
-
name: 'Host1',
|
|
19
|
-
link: '/host1',
|
|
20
|
-
status: 'success',
|
|
21
|
-
actions: [],
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const HostStatusFixtures = {
|
|
26
|
-
renders: {
|
|
27
|
-
status: 'success',
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const TargetingHostsFixtures = {
|
|
32
|
-
renders: {
|
|
33
|
-
apiStatus: 'RESOLVED',
|
|
34
|
-
items,
|
|
35
|
-
},
|
|
36
|
-
'renders with error': {
|
|
37
|
-
apiStatus: 'ERROR',
|
|
38
|
-
items,
|
|
39
|
-
},
|
|
40
|
-
'renders with loading': {
|
|
41
|
-
apiStatus: 'PENDING',
|
|
42
|
-
items: [],
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export const TargetingHostsPageFixtures = {
|
|
47
|
-
renders: {
|
|
48
|
-
handleSearch: () => {},
|
|
49
|
-
searchQuery: '',
|
|
50
|
-
apiStatus: 'RESOLVED',
|
|
51
|
-
items,
|
|
52
|
-
totalHosts: 1,
|
|
53
|
-
page: 1,
|
|
54
|
-
handlePagination: () => {},
|
|
55
|
-
},
|
|
56
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
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;
|
|
@@ -1,54 +0,0 @@
|
|
|
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" /> {__('Cancelled')}
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
case 'N/A':
|
|
15
|
-
return (
|
|
16
|
-
<div>
|
|
17
|
-
<Icon type="fa" name="question" /> {__('Awaiting start')}
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
case 'running' || 'pending':
|
|
21
|
-
return (
|
|
22
|
-
<div>
|
|
23
|
-
<Icon type="pf" name="running" /> {__('Pending')}
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
case 'planned':
|
|
27
|
-
return (
|
|
28
|
-
<div>
|
|
29
|
-
<Icon type="pf" name="build" /> {__('Scheduled')}
|
|
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" /> {__('Succeeded')}
|
|
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;
|