Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

table: fix dt-mean #1164

Merged
merged 2 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

[#1167](https://github.com/cylc/cylc-ui/pull/1168) - Prevent mutations menu
jumping when expanded.

Expand Down
15 changes: 13 additions & 2 deletions src/components/cylc/table/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<td>{{ ((item.latestJob || {}).node || {}).submittedTime }}</td>
<td>{{ ((item.latestJob || {}).node || {}).startedTime }}</td>
<td>{{ ((item.latestJob || {}).node || {}).finishedTime }}</td>
<td>{{ item.task.node.meanElapsedTime }}</td>
<td>{{ dtMean(item.task) }}</td>
</tr>
</template>
<template v-slot:expanded-item="{ item }">
Expand Down Expand Up @@ -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)
}
],
Expand All @@ -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) {
oliver-sanders marked this conversation as resolved.
Show resolved Hide resolved
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
}
}
}
</script>
24 changes: 24 additions & 0 deletions tests/e2e/specs/table.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})
})
})