Skip to content

Commit 59156c1

Browse files
committed
Merge branch 'master' into renovate/analysis-view-packages
2 parents 490370b + 4819c6c commit 59156c1

File tree

17 files changed

+2015
-417
lines changed

17 files changed

+2015
-417
lines changed

.yarn/releases/yarn-4.5.3.cjs renamed to .yarn/releases/yarn-4.6.0.cjs

Lines changed: 287 additions & 287 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ networkSettings:
1010

1111
nodeLinker: node-modules
1212

13-
yarnPath: .yarn/releases/yarn-4.5.3.cjs
13+
yarnPath: .yarn/releases/yarn-4.6.0.cjs

changes.d/1886.feat.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added an info view to display task information including metadata, prerequisites and outputs.

cypress/component/info.cy.js

Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
/**
2+
* Copyright (C) NIWA & British Crown (Met Office) & Contributors.
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
import InfoComponent from '@/components/cylc/Info.vue'
19+
import { Tokens } from '@/utils/uid'
20+
21+
const DESCRIPTION = `Lorem ipsum dolor sit amet, consectetur adipiscing elit.
22+
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
23+
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi.
24+
`
25+
const TOKENS = new Tokens('~user/workflow//1234/foo')
26+
const TASK = {
27+
id: TOKENS.id,
28+
name: TOKENS.task,
29+
tokens: TOKENS,
30+
node: {
31+
state: 'running',
32+
task: {
33+
meta: {
34+
title: 'My Foo',
35+
description: DESCRIPTION,
36+
URL: 'https://cylc.org',
37+
customMeta: {
38+
answer: '42',
39+
question: 'mutually exclusive',
40+
}
41+
}
42+
},
43+
prerequisites: [
44+
{
45+
satisfied: false,
46+
expression: '(c0 & c1) | c2',
47+
conditions: [
48+
{
49+
taskId: 'a',
50+
message: 'succeeded',
51+
reqState: 'succeeded',
52+
exprAlias: 'c0',
53+
satisfied: true,
54+
},
55+
{
56+
taskId: 'b',
57+
message: 'custom message',
58+
reqState: 'custom_output',
59+
exprAlias: 'c1',
60+
satisfied: false,
61+
},
62+
{
63+
taskId: 'a',
64+
message: 'expired',
65+
reqState: 'expired',
66+
exprAlias: 'c2',
67+
satisfied: false,
68+
},
69+
],
70+
},
71+
{
72+
satisfied: true,
73+
expression: 'c0',
74+
conditions: [
75+
{
76+
taskId: 'x',
77+
message: 'succeeded',
78+
reqState: 'succeeded',
79+
exprAlias: 'c0',
80+
satisfied: true,
81+
},
82+
],
83+
},
84+
],
85+
outputs: [
86+
{
87+
label: 'started',
88+
message: 'started',
89+
satisfied: true,
90+
},
91+
{
92+
label: 'succeeded',
93+
message: 'succeeded',
94+
satisfied: false,
95+
},
96+
{
97+
label: 'failed',
98+
message: 'failed',
99+
satisfied: false,
100+
},
101+
{
102+
label: 'x',
103+
message: 'xxx',
104+
satisfied: true,
105+
}
106+
],
107+
runtime: {
108+
completion: '(succeeded and x) or failed'
109+
}
110+
},
111+
children: [
112+
{
113+
id: TOKENS.clone({ job: '01' }).id,
114+
tokens: TOKENS.clone({ job: '01' }),
115+
name: '01',
116+
node: {
117+
state: 'failed'
118+
}
119+
},
120+
{
121+
id: TOKENS.clone({ job: '02' }).id,
122+
tokens: TOKENS.clone({ job: '02' }),
123+
name: '02',
124+
node: {
125+
state: 'succeeded'
126+
}
127+
},
128+
],
129+
}
130+
131+
describe('Info component', () => {
132+
it('displays task information', () => {
133+
cy.vmount(InfoComponent, {
134+
props: {
135+
task: TASK,
136+
class: 'job_theme--default',
137+
// NOTE: expand all sections by default
138+
panelExpansion: [0, 1, 2, 3],
139+
}
140+
})
141+
142+
// there should be a task icon (running)
143+
cy.get('.c-graph-node .c8-task.running').should('be.visible')
144+
145+
// and two job icons (succeeded & failed)
146+
cy.get('.c-graph-node .c-job').should('have.length', 2)
147+
.get('.c-graph-node .c-job .failed').should('be.visible')
148+
.get('.c-graph-node .c-job .succeeded').should('be.visible')
149+
150+
// the metadata panel
151+
cy.get('.metadata-panel.v-expansion-panel--active').should('be.visible')
152+
.contains('My Foo')
153+
.get('.metadata-panel') // the description should be displayed
154+
.contains(/Lorem ipsum dolor sit amet.*/)
155+
.get('.metadata-panel a:first') // the URL should be an anchor
156+
.should('have.attr', 'href', 'https://cylc.org')
157+
.contains(/^https:\/\/cylc.org$/)
158+
159+
// the prerequisites panel
160+
cy.get('.prerequisites-panel.v-expansion-panel--active').should('be.visible')
161+
.find('.prerequisite-alias.condition')
162+
.should('have.length', 6)
163+
.then((selector) => {
164+
expect(selector[0].innerText).to.equal('(0 & 1) | 2')
165+
expect(selector[0]).to.not.have.class('satisfied')
166+
167+
expect(selector[1].innerText).to.equal('0 a:succeeded')
168+
expect(selector[1]).to.have.class('satisfied')
169+
170+
expect(selector[2].innerText).to.equal('1 b:custom_output')
171+
expect(selector[2]).to.not.have.class('satisfied')
172+
173+
expect(selector[3].innerText).to.equal('2 a:expired')
174+
expect(selector[3]).to.not.have.class('satisfied')
175+
176+
expect(selector[4].innerText).to.equal('0')
177+
expect(selector[4]).to.have.class('satisfied')
178+
179+
expect(selector[5].innerText).to.equal('0 x:succeeded')
180+
expect(selector[5]).to.have.class('satisfied')
181+
})
182+
183+
// the outputs panel
184+
cy.get('.outputs-panel.v-expansion-panel--active').should('be.visible')
185+
.find('.condition')
186+
.should('have.length', 4)
187+
.then((selector) => {
188+
expect(selector[0]).to.contain('started')
189+
expect(selector[0].classList.toString()).to.equal('condition satisfied')
190+
191+
expect(selector[1]).to.contain('succeeded')
192+
expect(selector[1].classList.toString()).to.equal('condition')
193+
194+
expect(selector[2]).to.contain('failed')
195+
expect(selector[2].classList.toString()).to.equal('condition')
196+
197+
expect(selector[3]).to.contain('x')
198+
expect(selector[3].classList.toString()).to.equal('condition satisfied')
199+
})
200+
201+
// the completion panel
202+
cy.get('.completion-panel.v-expansion-panel--active').should('be.visible')
203+
.find('.condition')
204+
.should('have.length', 5)
205+
.then((selector) => {
206+
expect(selector[0]).to.contain('(')
207+
expect(selector[0].classList.toString()).to.equal('condition blank')
208+
209+
expect(selector[1]).to.contain('succeeded')
210+
expect(selector[1].classList.toString()).to.equal('condition')
211+
212+
expect(selector[2]).to.contain('and x')
213+
expect(selector[2].classList.toString()).to.equal('condition satisfied')
214+
215+
expect(selector[3]).to.contain(')')
216+
expect(selector[3].classList.toString()).to.equal('condition blank')
217+
218+
expect(selector[4]).to.contain('or failed')
219+
expect(selector[4].classList.toString()).to.equal('condition')
220+
})
221+
})
222+
223+
it('should expand sections as intended', () => {
224+
const spy = cy.spy()
225+
cy.vmount(InfoComponent, {
226+
props: {
227+
task: TASK,
228+
class: 'job_theme--default'
229+
},
230+
listeners: {
231+
'update:panelExpansion': spy,
232+
}
233+
}).as('wrapper')
234+
235+
// ONLY the metadata panel should be expanded by default
236+
cy.get('.v-expansion-panel--active')
237+
.should('have.length', 1)
238+
.should('have.class', 'metadata-panel')
239+
240+
// the update:panelExpansion event should be emitted when a panel is
241+
// expanded/collapsed
242+
cy.get('.prerequisites-panel')
243+
.find('button')
244+
.should('be.visible')
245+
.click({ force: true })
246+
.get('@wrapper').then(({ wrapper }) => {
247+
expect(
248+
wrapper.emitted('update:panelExpansion')[0][0]
249+
).to.deep.equal([0, 1])
250+
})
251+
})
252+
253+
it('should work for a task with no data', () => {
254+
// ensure the component can be mounted without errors for empty states
255+
// i.e. no metadata, prerequisites, outputs or jobs
256+
const tokens = new Tokens('~user/workflow//1234/foo')
257+
const task = {
258+
id: tokens.id,
259+
name: tokens.task,
260+
tokens,
261+
node: {
262+
task: {
263+
meta: {
264+
customMeta: {}
265+
}
266+
},
267+
prerequisites: [],
268+
outputs: [],
269+
},
270+
children: [],
271+
}
272+
273+
cy.vmount(InfoComponent, {
274+
props: {
275+
task,
276+
class: 'job_theme--default',
277+
// NOTE: expand all sections by default
278+
panelExpansion: [0, 1, 2],
279+
}
280+
})
281+
})
282+
})

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@
2424
"test": "vitest run && yarn run serve cy:run"
2525
},
2626
"dependencies": {
27-
"@apollo/client": "3.11.9",
27+
"@apollo/client": "3.12.4",
2828
"@hpcc-js/wasm": "2.22.3",
2929
"@lumino/default-theme": "2.1.7",
3030
"@lumino/widgets": "2.5.0",
3131
"@mdi/js": "7.4.47",
32-
"@vueuse/core": "11.2.0",
32+
"@vueuse/core": "11.3.0",
3333
"apexcharts": "3.54.1",
3434
"axios": "1.7.8",
3535
"dedent": "1.5.3",
3636
"enumify": "2.0.0",
3737
"graphiql": "3.7.2",
38-
"graphql": "16.9.0",
38+
"graphql": "16.10.0",
3939
"graphql-tag": "2.12.6",
4040
"lodash-es": "4.17.21",
4141
"markdown-it": "14.1.0",
@@ -50,17 +50,17 @@
5050
"vue-router": "4.5.0",
5151
"vue-the-mask": "0.11.1",
5252
"vue3-apexcharts": "1.8.0",
53-
"vuetify": "3.7.4",
53+
"vuetify": "3.7.6",
5454
"vuex": "4.1.0"
5555
},
5656
"devDependencies": {
5757
"@cypress/code-coverage": "3.13.8",
5858
"@vitejs/plugin-vue": "5.2.1",
59-
"@vitest/coverage-istanbul": "2.1.6",
59+
"@vitest/coverage-istanbul": "2.1.8",
6060
"@vue/test-utils": "2.4.6",
6161
"concurrently": "9.1.0",
6262
"cross-fetch": "4.0.0",
63-
"cypress": "13.16.0",
63+
"cypress": "13.16.1",
6464
"cypress-vite": "1.5.0",
6565
"eslint": "8.57.1",
6666
"eslint-config-standard": "17.1.0",
@@ -82,11 +82,11 @@
8282
"sass-embedded": "1.81.0",
8383
"sinon": "19.0.2",
8484
"standard": "17.1.2",
85-
"vite": "6.0.1",
85+
"vite": "6.0.3",
8686
"vite-plugin-eslint": "1.8.1",
8787
"vite-plugin-istanbul": "6.0.2",
8888
"vite-plugin-vuetify": "2.0.4",
89-
"vitest": "2.1.6"
89+
"vitest": "2.1.8"
9090
},
9191
"peerDependenciesMeta": {
9292
"react": {
@@ -99,5 +99,5 @@
9999
"bugs": {
100100
"url": "https://github.com/cylc/cylc-ui/issues"
101101
},
102-
"packageManager": "yarn@4.5.3"
102+
"packageManager": "yarn@4.6.0"
103103
}

0 commit comments

Comments
 (0)