Skip to content

Commit

Permalink
feat: add CREATED status for tasks ICIJ/datashare#1399
Browse files Browse the repository at this point in the history
Co-authored-by: Caroline Desprat <[email protected]>
  • Loading branch information
bamthomas and caro3801 committed Aug 19, 2024
1 parent c5dd78a commit 3dbcb28
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/components/EllipseStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ export default {
return style.getPropertyValue('--light') || '#eee'
},
statusAnimation() {
if (this.statusAsVariant === 'info') {
if (this.variantIsInfo) {
return this.animation
}
return 'default 0 0'
},
statusProgress() {
if (this.statusAsVariant === 'info') {
if (this.variantIsInfo) {
const rounded = Math.round(this.progress)
return Math.max(Math.min(rounded, 100), 0)
}
Expand All @@ -97,8 +97,11 @@ export default {
statusAsVariant() {
return toVariant(this.status)
},
variantIsInfo() {
return this.statusAsVariant === 'info'
},
loading() {
return this.statusAsVariant === 'info' && this.idle
return this.variantIsInfo && this.idle
},
idle() {
return this.progress === null || this.progress <= 0 || this.progress >= 100
Expand Down Expand Up @@ -133,7 +136,7 @@ export default {
:loading="loading"
>
<slot>
<template v-if="statusAsVariant === 'info'">
<template v-if="variantIsInfo">
{{ statusProgressAsPercentage }}
</template>
<template v-else>
Expand Down
3 changes: 2 additions & 1 deletion src/utils/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ export default {
queued: 'info',
running: 'info',
warning: 'warning',
cancelled: 'warning'
cancelled: 'warning',
created: 'info'
},
elasticsearch: {
waitForAnswer: 700,
Expand Down
6 changes: 6 additions & 0 deletions tests/unit/specs/components/EllipseStatus.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ describe('EllipseStatus.vue', () => {
expect(wrapper.vm.statusAsVariant).toBe('info')
})

it('should turn the status "CREATED" into a "info" variant', () => {
const props = { status: 'CREATED' }
const wrapper = shallowMount(EllipseStatus, { plugins, props })
expect(wrapper.vm.statusAsVariant).toBe('info')
})

it('should turn the status "running" into a "info" variant', () => {
const props = { status: 'running' }
const wrapper = shallowMount(EllipseStatus, { plugins, props })
Expand Down

0 comments on commit 3dbcb28

Please sign in to comment.