diff --git a/CHANGES.md b/CHANGES.md
index 6738f5b29..ce8065f21 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -34,6 +34,9 @@ New tabs now open on top.
### Fixes
+[#1164](https://github.com/cylc/cylc-ui/pull/1164) -
+Fix the mean run time column in the table view.
+
[#1108](https://github.com/cylc/cylc-ui/pull/1108) -
Tree view: Task outputs are now correctly associated with the jobs that created
them.
diff --git a/src/components/cylc/table/Table.vue b/src/components/cylc/table/Table.vue
index 7714e0b86..207ff3ccb 100644
--- a/src/components/cylc/table/Table.vue
+++ b/src/components/cylc/table/Table.vue
@@ -115,7 +115,7 @@ along with this program. If not, see .
{{ ((item.latestJob || {}).node || {}).submittedTime }} |
{{ ((item.latestJob || {}).node || {}).startedTime }} |
{{ ((item.latestJob || {}).node || {}).finishedTime }} |
- {{ item.task.node.meanElapsedTime }} |
+ {{ dtMean(item.task) }} |
@@ -244,7 +244,7 @@ export default {
},
{
text: 'dT-mean',
- value: 'task.meanElapsedTime',
+ value: 'task.node.task.meanElapsedTime',
sort: (a, b) => parseInt(a ?? 0) - parseInt(b ?? 0)
}
],
@@ -255,6 +255,17 @@ export default {
filteredTasks () {
return this.tasks.filter(({ task }) => matchNode(task.node, this.tasksFilter.name, this.tasksFilter.states))
}
+ },
+ methods: {
+ dtMean (taskNode) {
+ const ret = taskNode.node?.task?.meanElapsedTime
+ if (ret) {
+ return ret.toFixed()
+ }
+ // the meanElapsedTime can be undefined (e.g. task has not run before)
+ // return "undefined" rather than a number for these cases
+ return undefined
+ }
}
}
diff --git a/tests/e2e/specs/table.cy.js b/tests/e2e/specs/table.cy.js
index 4435c76b5..11151712e 100644
--- a/tests/e2e/specs/table.cy.js
+++ b/tests/e2e/specs/table.cy.js
@@ -116,5 +116,29 @@ describe('Table view', () => {
.contains('eventually')
.should('be.visible')
})
+ it('displays and sorts dt-mean', () => {
+ cy.visit('/#/table/one')
+
+ cy
+ // sort dt-mean ascending
+ .get('[aria-label="dT-mean: Not sorted. Activate to sort ascending."] > :nth-child(1)')
+ .click()
+
+ // check 0 is at the top (1st row, 10th column)
+ .get('tbody > :nth-child(1) > :nth-child(10)')
+ .should(($ele) => {
+ expect($ele.text().trim()).equal('') // no value sorted first
+ })
+
+ // sort ft-mean descending
+ .get('.asc > .v-icon > .v-icon__svg > path')
+ .click()
+
+ // check 7 is at the top (1st row, 10th column)
+ .get('tbody > :nth-child(1) > :nth-child(10)')
+ .should(($ele) => {
+ expect($ele.text().trim()).equal('7')
+ })
+ })
})
})