foreman_remote_execution 13.2.4 → 13.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_remote_execution/locale/de/foreman_remote_execution.js +77 -77
  3. data/app/assets/javascripts/foreman_remote_execution/locale/en/foreman_remote_execution.js +2 -1667
  4. data/app/assets/javascripts/foreman_remote_execution/locale/en_GB/foreman_remote_execution.js +7 -7
  5. data/app/assets/javascripts/foreman_remote_execution/locale/es/foreman_remote_execution.js +33 -33
  6. data/app/assets/javascripts/foreman_remote_execution/locale/fr/foreman_remote_execution.js +131 -131
  7. data/app/assets/javascripts/foreman_remote_execution/locale/ja/foreman_remote_execution.js +131 -131
  8. data/app/assets/javascripts/foreman_remote_execution/locale/ka/foreman_remote_execution.js +38 -38
  9. data/app/assets/javascripts/foreman_remote_execution/locale/ko/foreman_remote_execution.js +16 -16
  10. data/app/assets/javascripts/foreman_remote_execution/locale/pt_BR/foreman_remote_execution.js +33 -33
  11. data/app/assets/javascripts/foreman_remote_execution/locale/ru/foreman_remote_execution.js +7 -7
  12. data/app/assets/javascripts/foreman_remote_execution/locale/zh_CN/foreman_remote_execution.js +134 -134
  13. data/app/assets/javascripts/foreman_remote_execution/locale/zh_TW/foreman_remote_execution.js +6 -6
  14. data/lib/foreman_remote_execution/version.rb +1 -1
  15. data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  16. data/locale/de/foreman_remote_execution.po +81 -80
  17. data/locale/en/foreman_remote_execution.po +0 -1675
  18. data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  19. data/locale/en_GB/foreman_remote_execution.po +7 -7
  20. data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  21. data/locale/es/foreman_remote_execution.po +33 -33
  22. data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  23. data/locale/fr/foreman_remote_execution.po +132 -132
  24. data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  25. data/locale/ja/foreman_remote_execution.po +131 -131
  26. data/locale/ka/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  27. data/locale/ka/foreman_remote_execution.po +38 -38
  28. data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  29. data/locale/ko/foreman_remote_execution.po +16 -16
  30. data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  31. data/locale/pt_BR/foreman_remote_execution.po +33 -33
  32. data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  33. data/locale/ru/foreman_remote_execution.po +7 -7
  34. data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  35. data/locale/zh_CN/foreman_remote_execution.po +136 -134
  36. data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
  37. data/locale/zh_TW/foreman_remote_execution.po +6 -6
  38. data/webpack/JobWizard/JobWizardPageRerun.js +80 -16
  39. data/webpack/JobWizard/JobWizardSelectors.js +7 -0
  40. data/webpack/JobWizard/__tests__/fixtures.js +6 -0
  41. data/webpack/JobWizard/steps/ReviewDetails/ReviewDetails.test.js +2 -1
  42. metadata +2 -2
@@ -5,11 +5,11 @@
5
5
  # Translators:
6
6
  msgid ""
7
7
  msgstr ""
8
- "Project-Id-Version: foreman_remote_execution 9.0.1\n"
8
+ "Project-Id-Version: foreman_remote_execution 14.0.0\n"
9
9
  "Report-Msgid-Bugs-To: \n"
10
10
  "PO-Revision-Date: 2016-02-15 13:54+0000\n"
11
11
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12
- "Language-Team: Chinese (Taiwan) (http://www.transifex.com/foreman/foreman/lang"
12
+ "Language-Team: Chinese (Taiwan) (http://app.transifex.com/foreman/foreman/lang"
13
13
  "uage/zh_TW/)\n"
14
14
  "MIME-Version: 1.0\n"
15
15
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -86,7 +86,7 @@ msgid "Abort Job"
86
86
  msgstr ""
87
87
 
88
88
  msgid "Access denied"
89
- msgstr ""
89
+ msgstr "拒絕存取"
90
90
 
91
91
  msgid "Actions"
92
92
  msgstr "動作"
@@ -137,7 +137,7 @@ msgid "Awaiting start"
137
137
  msgstr ""
138
138
 
139
139
  msgid "Back"
140
- msgstr ""
140
+ msgstr "上一步"
141
141
 
142
142
  msgid "Back to Job"
143
143
  msgstr "回到工作"
@@ -776,7 +776,7 @@ msgid "New UI"
776
776
  msgstr ""
777
777
 
778
778
  msgid "Next"
779
- msgstr ""
779
+ msgstr "下一步"
780
780
 
781
781
  msgid "No (override)"
782
782
  msgstr ""
@@ -1555,7 +1555,7 @@ msgid "You are not allowed to see the currently assigned template. Saving the fo
1555
1555
  msgstr "您不能看到目前指定的範本。現在儲存表單會取消指定範本。"
1556
1556
 
1557
1557
  msgid "You are not authorized to perform this action."
1558
- msgstr ""
1558
+ msgstr "您未經許可執行這項動作。"
1559
1559
 
1560
1560
  msgid "You have %s results to display. Showing first %s results"
1561
1561
  msgstr ""
@@ -1,16 +1,33 @@
1
+ import React, { useState, useEffect } from 'react';
1
2
  import PropTypes from 'prop-types';
2
- import React from 'react';
3
3
  import URI from 'urijs';
4
- import { Alert, Button, Divider, Skeleton } from '@patternfly/react-core';
4
+ import { useDispatch, useSelector } from 'react-redux';
5
+ import {
6
+ Alert,
7
+ Divider,
8
+ Skeleton,
9
+ Button,
10
+ Title,
11
+ EmptyState,
12
+ EmptyStateVariant,
13
+ EmptyStateIcon,
14
+ EmptyStateBody,
15
+ } from '@patternfly/react-core';
16
+ import { ExclamationCircleIcon } from '@patternfly/react-icons';
17
+ import { global_palette_red_200 as exclamationColor } from '@patternfly/react-tokens';
18
+ import { get } from 'foremanReact/redux/API';
19
+ import { sprintf, translate as __ } from 'foremanReact/common/I18n';
20
+ import PageLayout from 'foremanReact/routes/common/PageLayout/PageLayout';
21
+ import { STATUS } from 'foremanReact/constants';
5
22
  import {
6
23
  useForemanLocation,
7
24
  useForemanOrganization,
8
25
  } from 'foremanReact/Root/Context/ForemanContext';
9
- import { translate as __, sprintf } from 'foremanReact/common/I18n';
10
- import { useAPI } from 'foremanReact/common/hooks/API/APIHooks';
11
- import { STATUS } from 'foremanReact/constants';
12
- import PageLayout from 'foremanReact/routes/common/PageLayout/PageLayout';
13
26
  import { JobWizard } from './JobWizard';
27
+ import {
28
+ selectRerunJobInvocationResponse,
29
+ selectRerunJobInvocationStatus,
30
+ } from './JobWizardSelectors';
14
31
  import { JOB_API_KEY } from './JobWizardConstants';
15
32
 
16
33
  const JobWizardPageRerun = ({
@@ -19,6 +36,7 @@ const JobWizardPageRerun = ({
19
36
  },
20
37
  location: { search },
21
38
  }) => {
39
+ const dispatch = useDispatch();
22
40
  const uri = new URI(search);
23
41
  const { failed_only: failedOnly } = uri.search(true);
24
42
  const { succeeded_only: succeededOnly } = uri.search(true);
@@ -28,11 +46,6 @@ const JobWizardPageRerun = ({
28
46
  } else if (succeededOnly) {
29
47
  queryParams = '&succeeded_only=1';
30
48
  }
31
- const { response, status } = useAPI(
32
- 'get',
33
- `/ui_job_wizard/job_invocation?id=${id}${queryParams}`,
34
- JOB_API_KEY
35
- );
36
49
  const title = __('Run job');
37
50
  const breadcrumbOptions = {
38
51
  breadcrumbItems: [
@@ -41,11 +54,55 @@ const JobWizardPageRerun = ({
41
54
  ],
42
55
  };
43
56
 
44
- const jobOrganization = response.job_organization;
45
- const jobLocation = response.job_location;
57
+ const [errorMessage, setErrorMessage] = useState('');
58
+ const jobInvocationResponse = useSelector(selectRerunJobInvocationResponse);
59
+ const jobInvocationStatus = useSelector(selectRerunJobInvocationStatus);
60
+ const jobOrganization = jobInvocationResponse.job_organization;
61
+ const jobLocation = jobInvocationResponse.job_location;
46
62
  const currentOrganization = useForemanOrganization();
47
63
  const currentLocation = useForemanLocation();
48
64
 
65
+ const emptyStateLarge = (
66
+ <EmptyState variant={EmptyStateVariant.large}>
67
+ <EmptyStateIcon
68
+ icon={ExclamationCircleIcon}
69
+ color={exclamationColor.value}
70
+ />
71
+ <Title ouiaId="job-wizard-empty-state-header" headingLevel="h4" size="lg">
72
+ {__('Unable to run job')}
73
+ </Title>
74
+ <EmptyStateBody>{sprintf(errorMessage)}</EmptyStateBody>
75
+ <Button
76
+ ouiaId="job-wizard-run-job-button"
77
+ component="a"
78
+ href="/job_invocations/new"
79
+ variant="primary"
80
+ >
81
+ {__('Create job')}
82
+ </Button>
83
+ </EmptyState>
84
+ );
85
+
86
+ useEffect(() => {
87
+ let isMounted = true;
88
+ if (id !== undefined) {
89
+ dispatch(
90
+ get({
91
+ key: JOB_API_KEY,
92
+ url: `/ui_job_wizard/job_invocation?id=${id}${queryParams}`,
93
+ handleError: ({ response }) => {
94
+ if (isMounted) {
95
+ setErrorMessage(response?.data?.error?.message);
96
+ }
97
+ },
98
+ })
99
+ );
100
+ }
101
+ return () => {
102
+ isMounted = false;
103
+ };
104
+ }, [dispatch, id, failedOnly, queryParams]);
105
+
49
106
  return (
50
107
  <PageLayout
51
108
  header={title}
@@ -66,14 +123,16 @@ const JobWizardPageRerun = ({
66
123
  <React.Fragment>
67
124
  <Divider component="div" />
68
125
  </React.Fragment>
69
- {!status || status === STATUS.PENDING ? (
126
+ {jobInvocationStatus === STATUS.ERROR && emptyStateLarge}
127
+ {(!jobInvocationStatus || jobInvocationStatus === STATUS.PENDING) && (
70
128
  <div style={{ height: '400px' }}>
71
129
  <Skeleton
72
130
  height="100%"
73
131
  screenreaderText="Loading large rectangle contents"
74
132
  />
75
133
  </div>
76
- ) : (
134
+ )}
135
+ {jobInvocationStatus === STATUS.RESOLVED && (
77
136
  <React.Fragment>
78
137
  {jobOrganization?.id !== currentOrganization?.id && (
79
138
  <Alert
@@ -107,7 +166,12 @@ const JobWizardPageRerun = ({
107
166
  )}
108
167
  <Divider component="div" />
109
168
  <JobWizard
110
- rerunData={{ ...response?.job, inputs: response?.inputs } || null}
169
+ rerunData={
170
+ {
171
+ ...jobInvocationResponse?.job,
172
+ inputs: jobInvocationResponse?.inputs,
173
+ } || null
174
+ }
111
175
  />
112
176
  </React.Fragment>
113
177
  )}
@@ -14,8 +14,15 @@ import {
14
14
  JOB_TEMPLATE,
15
15
  HOSTS_API,
16
16
  JOB_INVOCATION,
17
+ JOB_API_KEY,
17
18
  } from './JobWizardConstants';
18
19
 
20
+ export const selectRerunJobInvocationResponse = state =>
21
+ selectAPIResponse(state, JOB_API_KEY) || {};
22
+
23
+ export const selectRerunJobInvocationStatus = state =>
24
+ selectAPIStatus(state, JOB_API_KEY);
25
+
19
26
  export const selectJobTemplatesStatus = state =>
20
27
  selectAPIStatus(state, JOB_TEMPLATES);
21
28
 
@@ -114,6 +114,8 @@ export const jobCategories = ['Services', 'Ansible Commands', 'Puppet'];
114
114
 
115
115
  export const testSetup = (selectors, api) => {
116
116
  jest.spyOn(api, 'get');
117
+ jest.spyOn(selectors, 'selectRerunJobInvocationResponse');
118
+ jest.spyOn(selectors, 'selectRerunJobInvocationStatus');
117
119
  jest.spyOn(selectors, 'selectJobTemplate');
118
120
  jest.spyOn(selectors, 'selectJobTemplates');
119
121
  jest.spyOn(selectors, 'selectJobCategories');
@@ -123,6 +125,10 @@ export const testSetup = (selectors, api) => {
123
125
 
124
126
  jest.spyOn(selectors, 'selectTemplateInputs');
125
127
  jest.spyOn(selectors, 'selectAdvancedTemplateInputs');
128
+ selectors.selectRerunJobInvocationResponse.mockImplementation(
129
+ () => jobInvocation
130
+ );
131
+ selectors.selectRerunJobInvocationStatus.mockImplementation(() => 'RESOLVED');
126
132
  selectors.selectWithKatello.mockImplementation(() => true);
127
133
  selectors.selectTemplateInputs.mockImplementation(
128
134
  () => jobTemplateResponse.template_inputs
@@ -14,16 +14,17 @@ import {
14
14
  jobInvocation,
15
15
  } from '../../__tests__/fixtures';
16
16
 
17
+ jest.useFakeTimers();
17
18
  const store = testSetup(selectors, api);
18
19
  mockApi(api);
19
20
  jest.spyOn(APIHooks, 'useAPI');
21
+ store.dispatch = jest.fn();
20
22
  APIHooks.useAPI.mockImplementation((action, url) => {
21
23
  if (url === '/ui_job_wizard/job_invocation?id=57') {
22
24
  return { response: jobInvocation, status: 'RESOLVED' };
23
25
  }
24
26
  return {};
25
27
  });
26
- jest.useFakeTimers();
27
28
 
28
29
  describe('ReviewDetails', () => {
29
30
  it('should call goToStepByName function when StepButton is clicked', async () => {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_remote_execution
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.2.4
4
+ version: 13.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Foreman Remote Execution team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-01 00:00:00.000000000 Z
11
+ date: 2024-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface