Skip to content

Commit

Permalink
table: fix dt-mean
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Dec 12, 2022
1 parent 6eed60f commit 4920b6f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ for number of tasks per page.

### 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.
Expand Down
11 changes: 9 additions & 2 deletions src/components/cylc/table/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,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 @@ -298,7 +298,7 @@ export default {
},
{
text: 'dT-mean',
value: 'task.meanElapsedTime',
value: 'task.node.task.meanElapsedTime',
sort: (a, b) => parseInt(a ?? 0) - parseInt(b ?? 0)
}
],
Expand Down Expand Up @@ -372,6 +372,13 @@ export default {
// I don't really like this, but we need to somehow force the 'change detection' to run again once the clear has taken place
this.tasksFilter.name = null
this.$refs.filterNameInput.$el.querySelector('input').dispatchEvent(new Event('keyup'))
},
dtMean (taskNode) {
const ret = taskNode.node?.task?.meanElapsedTime
if (ret) {
return ret.toFixed()
}
return undefined
}
}
}
Expand Down
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')
})
})
})
})

0 comments on commit 4920b6f

Please sign in to comment.