+
.
*/
+@use "sass:list";
+
/* css namespace for job element */
$cjob: ".c-job .job rect";
-
#{$cjob} {
/* if no job status display nothing */
fill: transparent;
stroke: transparent;
}
-.c-job {
- .job {
- vertical-align: middle;
- /* scale the icon to the font-size */
- width: 1em;
- height: 1em;
- }
+.c-job .job {
+ /* scale the icon to the font-size */
+ width: 1em;
+ height: 1em;
}
-@mixin job_theme($theme) {
- @if $theme == "default" {
- $teal: rgb(109,213,194);
- $blue: rgb(106,164,241);
- $green: rgb(81,175,81);
- $red: rgb(207,72,72);
- $pink: rgb(190,106,192);
-
- #{$cjob} {
- &.submitted {
- fill: $teal;
- stroke: $teal;
- }
-
- &.running {
- fill: $blue;
- stroke: $blue;
- }
-
- &.succeeded {
- fill: $green;
- stroke: $green;
- }
-
- &.failed {
- fill: $red;
- stroke: $red;
- }
-
- &.submit-failed {
- fill: $pink;
- stroke: $pink;
- }
- }
- } @else if $theme == "greyscale" {
- $light: rgb(208,208,208);
- $medium: rgb(133,133,133);
- $dark: rgb(0,0,0);
-
- #{$cjob} {
- &.submitted {
- fill: transparent;
- stroke: $light;
- }
-
- &.running {
- fill: $light;
- stroke: $light;
- }
-
- &.succeeded {
- fill: $medium;
- stroke: $medium;
- }
-
- &.failed {
- fill: $dark;
- stroke: $dark;
- }
-
- &.submit-failed {
- fill: transparent;
- stroke: $dark;
- }
- }
- } @else if $theme == "colour_blind" {
- $grey: rgb(152,152,152);
- $success: rgb(108,218,255);
- $error: rgb(146,0,0);
-
- #{$cjob} {
- &.submitted {
- fill: transparent;
- stroke: $grey;
- }
-
- &.running {
- fill: $grey;
- stroke: $grey;
- }
-
- &.succeeded {
- fill: $success;
- stroke: $success;
- }
-
- &.failed {
- fill: $error;
- stroke: $error;
- }
-
- &.submit-failed {
- fill: transparent;
- stroke: $error;
- }
- }
- }
+.task-state-badge {
+ font-size: 0.7em;
+ $height: 1.8em;
+ height: $height;
+ min-width: $height;
+ border-radius: $height;
+ border: 0.2em solid;
+ margin: 0 0.1em;
+ line-height: normal;
}
-@each $theme in "default", "greyscale", "colour_blind" {
+$teal: rgb(109,213,194);
+$blue: rgb(106,164,241);
+$green: rgb(81,175,81);
+$red: rgb(207,72,72);
+$pink: rgb(190,106,192);
+
+$light: rgb(208,208,208);
+$medium: rgb(133,133,133);
+$dark: rgb(0,0,0);
+
+$grey: rgb(152,152,152);
+$success: rgb(108,218,255);
+$error: rgb(146,0,0);
+
+// Mapping of job themes to job states to (fill, outline, text) colors
+$themes: (
+ "default": (
+ "submitted": ($teal, $teal, white),
+ "running": ($blue, $blue, white),
+ "succeeded": ($green, $green, white),
+ "failed": ($red, $red, white),
+ "submit-failed": ($pink, $pink, white),
+ ),
+ "greyscale": (
+ "submitted": (transparent, $light, black),
+ "running": ($light, $light, black),
+ "succeeded": ($medium, $medium, white),
+ "failed": ($dark, $dark, white),
+ "submit-failed": (transparent, $dark, black),
+ ),
+ "colour_blind": (
+ "submitted": (transparent, $grey, black),
+ "running": ($grey, $grey, white),
+ "succeeded": ($success, $success, black),
+ "failed": ($error, $error, white),
+ "submit-failed": (transparent, $error, black),
+ ),
+);
+
+@each $theme, $state_map in $themes {
.job_theme--#{$theme} {
&, // job theme as configured by the top-level application
&.job_theme_override {
// if overridden elsewhere the new value should take priority
// (this allows us to override the theme in the user profile)
- @include job_theme($theme);
+ @each $state, $colors in $state_map {
+ #{$cjob}.#{$state} {
+ fill: list.nth($colors, 1);
+ stroke: list.nth($colors, 2);
+ }
+ .task-state-badge.#{$state} {
+ background-color: list.nth($colors, 1);
+ border-color: list.nth($colors, 2);
+ color: list.nth($colors, 3);
+ }
+ }
}
}
}
diff --git a/tests/e2e/specs/gscan.cy.js b/tests/e2e/specs/gscan.cy.js
index b764f64ef..d9efa8ef8 100644
--- a/tests/e2e/specs/gscan.cy.js
+++ b/tests/e2e/specs/gscan.cy.js
@@ -106,7 +106,7 @@ describe('GScan component', () => {
cy.get('[data-cy="filter task state"]')
.click()
.get('.v-select__content')
- .contains('.v-list-item', 'succeed')
+ .contains('.v-list-item', 'succeeded')
.click({ force: true })
cy.get('.c-treeitem:visible')
.should('have.length', 1)
@@ -171,6 +171,27 @@ describe('GScan component', () => {
})
})
+ describe('Task state badges', () => {
+ it('collates task states up the tree', () => {
+ cy.get('.c-gscan')
+ .find('[data-node-name="other/multi"]').as('parent')
+ .find('.node:first .task-state-badge')
+ .should('have.length', 1)
+ .should('have.class', 'running')
+ .contains('3')
+ // child run2 contributes the running tasks
+ cy.get('@parent').find('[data-node-name="run2"] .task-state-badge')
+ .should('have.length', 1)
+ .should('have.class', 'running')
+ .contains('3')
+ // but child run1 is stopped and so doesn't contribute
+ cy.get('@parent').find('[data-node-name="run1"] .task-state-badge')
+ .should('have.length', 1)
+ .should('have.class', 'failed')
+ .contains('1')
+ })
+ })
+
describe('Warnings', () => {
it('collates warnings up the tree', () => {
// NOTE: Log events may be duplicated in offline-mode due to the way the
diff --git a/tests/e2e/specs/userprofile.cy.js b/tests/e2e/specs/userprofile.cy.js
index 4fa560d33..68b8ffb20 100644
--- a/tests/e2e/specs/userprofile.cy.js
+++ b/tests/e2e/specs/userprofile.cy.js
@@ -66,19 +66,19 @@ describe('User Profile', () => {
}
})
- it('Sets the job theme', () => {
+ it('Sets the task/job theme', () => {
cy.get('#input-job-theme-default')
.click({ force: true })
- // set the job theme to normal
- cy.get('.c-gscan:first .c-job:first rect:first')
- .should('have.css', 'fill')
+ // set the theme to normal
+ cy.get('.c-gscan .task-state-badge.running').as('taskBadge')
+ .should('have.css', 'background-color')
.then(($fill1) => {
- // set the job theme to greyscale
+ // set the theme to greyscale
cy.get('#input-job-theme-greyscale')
.click({ force: true })
- cy.get('.c-gscan:first .c-job:first rect:first')
- .should('have.css', 'fill')
- // make sure that the job has changed colour
+ cy.get('@taskBadge')
+ .should('have.css', 'background-color')
+ // make sure that the task state badge has changed colour
.then(($fill2) => {
expect($fill1).not.to.equal($fill2)
})
diff --git a/tests/unit/components/cylc/tree/treeitem.vue.spec.js b/tests/unit/components/cylc/tree/treeitem.vue.spec.js
index 168f94277..b7ca95c48 100644
--- a/tests/unit/components/cylc/tree/treeitem.vue.spec.js
+++ b/tests/unit/components/cylc/tree/treeitem.vue.spec.js
@@ -151,13 +151,12 @@ describe('GScanTreeItem', () => {
filteredOutNodesCache: new WeakMap(),
}
})
- it('combines all descendant tasks', () => {
- expect(wrapper.vm.descendantTaskInfo.latestTasks.submitted.length).to.equal(10)
- expect(wrapper.vm.descendantTaskInfo.latestTasks.running.length).to.equal(10)
+ it('does not combine descendant latest state tasks', () => {
+ expect(wrapper.vm.statesInfo.latestTasks).to.deep.equal({})
})
it('combines all descendant task totals', () => {
- expect(wrapper.vm.descendantTaskInfo.stateTotals.submitted).to.equal(5)
- expect(wrapper.vm.descendantTaskInfo.stateTotals.running).to.equal(12)
+ expect(wrapper.vm.statesInfo.stateTotals.submitted).to.equal(5)
+ expect(wrapper.vm.statesInfo.stateTotals.running).to.equal(12)
})
it('collapses to the lowest only-child', () => {
expect(wrapper.vm.node.id).to.equal('~cylc/double/mid')