-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17353 from itisAliRH/history-refactors
History refactors
- Loading branch information
Showing
41 changed files
with
1,438 additions
and
1,208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
119 changes: 57 additions & 62 deletions
119
client/src/components/History/Content/Collection/CollectionDescription.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
client/src/components/History/Content/Collection/CollectionProgress.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { getLocalVue } from "@tests/jest/helpers"; | ||
import { mount } from "@vue/test-utils"; | ||
import flushPromises from "flush-promises"; | ||
|
||
import { JobStateSummary } from "./JobStateSummary"; | ||
|
||
import CollectionProgress from "./CollectionProgress.vue"; | ||
|
||
const localVue = getLocalVue(); | ||
|
||
async function mountComponent(dsc: object) { | ||
const jobStateSummary = new JobStateSummary(dsc); | ||
|
||
const wrapper = mount(CollectionProgress as object, { | ||
propsData: { | ||
summary: jobStateSummary, | ||
}, | ||
localVue, | ||
}); | ||
|
||
await flushPromises(); | ||
|
||
return wrapper; | ||
} | ||
|
||
describe("CollectionProgress", () => { | ||
it("should display the correct number of items", async () => { | ||
const dsc = { job_state_summary: { all_jobs: 3, running: 3 }, populated_state: {} }; | ||
|
||
const wrapper = await mountComponent(dsc); | ||
|
||
expect(wrapper.find(".progress").find(".bg-warning").attributes("aria-valuenow")).toBe("3"); | ||
}); | ||
|
||
it("should correctly display states", async () => { | ||
const dsc = { job_state_summary: { all_jobs: 5, running: 3, failed: 1, ok: 1 }, populated_state: {} }; | ||
|
||
const wrapper = await mountComponent(dsc); | ||
|
||
expect(wrapper.find(".progress").find(".bg-warning").attributes("aria-valuenow")).toBe("3"); | ||
expect(wrapper.find(".progress").find(".bg-success").attributes("aria-valuenow")).toBe("1"); | ||
expect(wrapper.find(".progress").find(".bg-danger").attributes("aria-valuenow")).toBe("1"); | ||
}); | ||
|
||
it("should update as dataset states change", async () => { | ||
const dsc = { job_state_summary: { all_jobs: 3, running: 3, ok: 0 }, populated_state: {} }; | ||
|
||
const wrapper = await mountComponent(dsc); | ||
|
||
expect(wrapper.find(".progress").find(".bg-warning").attributes("aria-valuenow")).toBe("3"); | ||
|
||
dsc["job_state_summary"]["ok"] = 2; | ||
dsc["job_state_summary"]["running"] = 1; | ||
|
||
await wrapper.setProps({ summary: new JobStateSummary(dsc) }); | ||
|
||
expect(wrapper.find(".progress").find(".bg-warning").attributes("aria-valuenow")).toBe("1"); | ||
expect(wrapper.find(".progress").find(".bg-success").attributes("aria-valuenow")).toBe("2"); | ||
}); | ||
|
||
it("should be visible when all jobs are queued", async () => { | ||
const dsc = { job_state_summary: { all_jobs: 3, queued: 3 }, populated_state: {} }; | ||
|
||
const wrapper = await mountComponent(dsc); | ||
|
||
expect(wrapper.find(".progress").find(".bg-secondary").attributes("aria-valuenow")).toBe("3"); | ||
}); | ||
}); |
31 changes: 16 additions & 15 deletions
31
client/src/components/History/Content/Collection/CollectionProgress.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
<!-- Job state progress bar for a collection. There's another similar component | ||
at components/JobStates/CollectionJobStates but it relies on the backbone data | ||
model, so probably has to go eventually.--> | ||
<script setup lang="ts"> | ||
import { JobStateSummary } from "./JobStateSummary"; | ||
|
||
interface Props { | ||
summary: JobStateSummary; | ||
} | ||
|
||
defineProps<Props>(); | ||
</script> | ||
|
||
<template> | ||
<div class="collection-progress"> | ||
<b-progress v-if="!summary.isTerminal" :max="summary.jobCount"> | ||
<b-progress-bar | ||
<BProgress v-if="!summary.isTerminal" :max="summary.jobCount"> | ||
<BProgressBar | ||
v-if="summary.errorCount" | ||
v-b-tooltip.hover="summary.errorCountText" | ||
:value="summary.errorCount" | ||
variant="danger" /> | ||
<b-progress-bar | ||
<BProgressBar | ||
v-if="summary.okCount" | ||
v-b-tooltip.hover="summary.okCountText" | ||
:value="summary.okCount" | ||
variant="success" /> | ||
<b-progress-bar | ||
<BProgressBar | ||
v-if="summary.runningCount" | ||
v-b-tooltip.hover="summary.runningCountText" | ||
:value="summary.runningCount" | ||
variant="warning" /> | ||
<b-progress-bar | ||
<BProgressBar | ||
v-if="summary.waitingCount" | ||
v-b-tooltip.hover="summary.waitingCountText" | ||
:value="summary.waitingCount" | ||
variant="secondary" /> | ||
</b-progress> | ||
</BProgress> | ||
</div> | ||
</template> | ||
<script> | ||
import { JobStateSummary } from "./JobStateSummary"; | ||
|
||
export default { | ||
props: { | ||
summary: { type: JobStateSummary, required: true }, | ||
}, | ||
}; | ||
</script> |
Oops, something went wrong.