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

Lumino adv tree #9

Closed
Closed
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
23 changes: 19 additions & 4 deletions src/views/Tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ import gql from 'graphql-tag'
import { getPageTitle } from '@/utils/index'
import graphqlMixin from '@/mixins/graphql'
import subscriptionComponentMixin from '@/mixins/subscriptionComponent'
import {
initialOptions,
useInitialOptions
} from '@/utils/initialOptions'
import SubscriptionQuery from '@/model/SubscriptionQuery.model'
import TaskFilter from '@/components/cylc/TaskFilter.vue'
import TreeComponent from '@/components/cylc/tree/Tree.vue'
import { matchID, matchState } from '@/components/cylc/common/filter'
import { ref } from 'vue'

const QUERY = gql`
subscription Workflow ($workflowId: ID) {
Expand Down Expand Up @@ -216,12 +221,22 @@ export default {
}
},

props: { initialOptions },

setup (props, { emit }) {
/**
* The job id input and selected task filter state.
* @type {import('vue').Ref<Object>}
*/
const tasksFilter = useInitialOptions('tasksFilter', { props, emit }, ref({ id: null, states: null }))

return {
tasksFilter
}
},

data: () => ({
expandAll: null,
tasksFilter: {
id: null,
states: null,
},
}),

computed: {
Expand Down
24 changes: 24 additions & 0 deletions tests/e2e/specs/tree.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,30 @@ describe('Tree view', () => {
.should('have.length', 1)
.contains('retrying')
})
it('remembers job ID and file when switching between workflows', () => {
cy.visit('/#/workspace/one')
cy
.get('.node-data-task')
.contains('failed')
.should('be.visible')
cy
.get('[data-cy=filter-id]')
.type('i')
cy
.get('[data-cy="filter task state"]')
.click()
.get('.v-list-item')
.contains(TaskState.WAITING.name)
.click({ force: true })
// Navigate away
cy.visit('/#/')
cy.title().should('eq', 'Cylc UI | Dashboard')
// Navigate back
cy.visit('/#/workspace/one')
.get('.node-data-task:visible')
.should('have.length', 1)
.contains('retrying')
})
})

describe('Expand/collapse all buttons', () => {
Expand Down