Skip to content

Commit 2be228e

Browse files
Change: Show status information for container tasks and reports
Container tasks now show "processing" when uploading reports or creating assets and show "interrupted" when upload is interrupted. Reports show "uploading" during upload and "interrupted" if upload is interrupted.
1 parent 161cc7b commit 2be228e

File tree

4 files changed

+57
-2
lines changed

4 files changed

+57
-2
lines changed

src/gmp/models/task.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const TASK_STATUS = {
6464
interrupted: 'Interrupted',
6565
container: 'Container',
6666
uploading: 'Uploading',
67+
uploadinginterrupted: 'Uploading Interrupted',
6768
processing: 'Processing',
6869
done: 'Done',
6970
};
@@ -84,6 +85,7 @@ const TASK_STATUS_TRANSLATIONS = {
8485
Done: _l('Done'),
8586
Queued: _l('Queued'),
8687
Processing: _l('Processing'),
88+
'Uploading Interrupted': _l('Interrupted'),
8789
};
8890
/* eslint-disable quote-props */
8991

src/web/pages/reports/row.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ const Row = ({
106106
if (isDefined(task)) {
107107
if (task.isContainer()) {
108108
status =
109-
status === TASK_STATUS.running
109+
status === TASK_STATUS.interrupted
110+
? TASK_STATUS.uploadinginterrupted
111+
: status === TASK_STATUS.running || status === TASK_STATUS.processing
110112
? TASK_STATUS.uploading
111113
: TASK_STATUS.container;
112114
}

src/web/pages/tasks/__tests__/status.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,46 @@ describe('Task Status tests', () => {
114114
expect(detailslink).toHaveTextContent('Container');
115115
expect(detailslink).toHaveAttribute('href', '/report/42');
116116
});
117+
118+
test('should render container with status interrupted', () => {
119+
const task = Task.fromElement({
120+
status: TASK_STATUS.interrupted,
121+
permissions: {permission: [{name: 'everything'}]},
122+
});
123+
124+
const {render} = rendererWith({capabilities: caps});
125+
const {getByTestId} = render(<Status task={task} />);
126+
127+
const bar = getByTestId('progressbar-box');
128+
expect(bar).toHaveAttribute('title', TASK_STATUS.interrupted);
129+
expect(bar).toHaveTextContent(TASK_STATUS.interrupted);
130+
});
131+
132+
test('should render running container task as processing', () => {
133+
const task = Task.fromElement({
134+
status: TASK_STATUS.running,
135+
permissions: {permission: [{name: 'everything'}]},
136+
});
137+
138+
const {render} = rendererWith({capabilities: caps});
139+
const {getByTestId} = render(<Status task={task} />);
140+
141+
const bar = getByTestId('progressbar-box');
142+
expect(bar).toHaveAttribute('title', TASK_STATUS.processing);
143+
expect(bar).toHaveTextContent(TASK_STATUS.processing);
144+
});
145+
146+
test('should render processing container task as processing', () => {
147+
const task = Task.fromElement({
148+
status: TASK_STATUS.processing,
149+
permissions: {permission: [{name: 'everything'}]},
150+
});
151+
152+
const {render} = rendererWith({capabilities: caps});
153+
const {getByTestId} = render(<Status task={task} />);
154+
155+
const bar = getByTestId('progressbar-box');
156+
expect(bar).toHaveAttribute('title', TASK_STATUS.processing);
157+
expect(bar).toHaveTextContent(TASK_STATUS.processing);
158+
});
117159
});

src/web/pages/tasks/status.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,16 @@ const TaskStatus = ({task, links = true}) => {
4949
return (
5050
<StyledDetailsLink type="report" id={report_id} textOnly={!links}>
5151
<StatusBar
52-
status={task.isContainer() ? TASK_STATUS.container : task.status}
52+
status={
53+
task.isContainer()
54+
? task.status === TASK_STATUS.interrupted
55+
? TASK_STATUS.uploadinginterrupted
56+
: task.status === TASK_STATUS.running ||
57+
task.status === TASK_STATUS.processing
58+
? TASK_STATUS.processing
59+
: TASK_STATUS.container
60+
: task.status
61+
}
5362
progress={task.progress}
5463
/>
5564
</StyledDetailsLink>

0 commit comments

Comments
 (0)