Commit b0c22b54 authored by Illya Klymov's avatar Illya Klymov

Add CREATED status support

parent a54340a9
...@@ -7,6 +7,7 @@ export const STATUSES = { ...@@ -7,6 +7,7 @@ export const STATUSES = {
FINISHED: 'finished', FINISHED: 'finished',
FAILED: 'failed', FAILED: 'failed',
SCHEDULED: 'scheduled', SCHEDULED: 'scheduled',
CREATED: 'created',
STARTED: 'started', STARTED: 'started',
NONE: 'none', NONE: 'none',
SCHEDULING: 'scheduling', SCHEDULING: 'scheduling',
...@@ -23,6 +24,11 @@ const STATUS_MAP = { ...@@ -23,6 +24,11 @@ const STATUS_MAP = {
text: __('Failed'), text: __('Failed'),
textClass: 'text-danger', textClass: 'text-danger',
}, },
[STATUSES.CREATED]: {
icon: 'pending',
text: __('Scheduled'),
textClass: 'text-warning',
},
[STATUSES.SCHEDULED]: { [STATUSES.SCHEDULED]: {
icon: 'pending', icon: 'pending',
text: __('Scheduled'), text: __('Scheduled'),
......
...@@ -93,8 +93,8 @@ export class SourceGroupsManager { ...@@ -93,8 +93,8 @@ export class SourceGroupsManager {
}, DEBOUNCE_INTERVAL); }, DEBOUNCE_INTERVAL);
startImport({ group, importId }) { startImport({ group, importId }) {
this.setImportStatus(group, STATUSES.CREATED);
this.saveImportState(importId, group); this.saveImportState(importId, group);
this.setImportStatus(group, STATUSES.STARTED);
} }
setImportStatus(group, status) { setImportStatus(group, status) {
......
...@@ -262,14 +262,14 @@ describe('Bulk import resolvers', () => { ...@@ -262,14 +262,14 @@ describe('Bulk import resolvers', () => {
expect(intermediateResults[0].status).toBe(STATUSES.SCHEDULING); expect(intermediateResults[0].status).toBe(STATUSES.SCHEDULING);
}); });
it('sets group status to STARTED when request completes', async () => { it('sets import status to CREATED when request completes', async () => {
axiosMockAdapter.onPost(FAKE_ENDPOINTS.createBulkImport).reply(httpStatus.OK, { id: 1 }); axiosMockAdapter.onPost(FAKE_ENDPOINTS.createBulkImport).reply(httpStatus.OK, { id: 1 });
await client.mutate({ await client.mutate({
mutation: importGroupMutation, mutation: importGroupMutation,
variables: { sourceGroupId: GROUP_ID }, variables: { sourceGroupId: GROUP_ID },
}); });
expect(results[0].status).toBe(STATUSES.STARTED); expect(results[0].status).toBe(STATUSES.CREATED);
}); });
it('resets status to NONE if request fails', async () => { it('resets status to NONE if request fails', async () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment