Skip to content

Commit cab8345

Browse files
Merge pull request #1303 from cylc/1.6.x-deconflict
1.6.x -> master (log view improvements)
2 parents 846f292 + a3cb342 commit cab8345

File tree

23 files changed

+777
-189
lines changed

23 files changed

+777
-189
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.DS_Store
22
node_modules/
3+
node_modules
34
/dist/
45
/docs/jsdoc/
56

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ Upgraded Vue and Vuetify frameworks to v3.
2323

2424
### Enhancements
2525

26+
[#1275](https://github.com/cylc/cylc-ui/pull/1275) -
27+
Various improvements to the log view including the ability to view prior
28+
job submissions, workflow log files and the connection status of the
29+
log file subscription.
30+
2631
[#1187](https://github.com/cylc/cylc-ui/pull/1187) - Improved the workflow
2732
filtering menu in the sidebar.
2833

cypress/component/cylc-graph-node.cy.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ describe('graph node component', () => {
8787
props: { task, jobs }
8888
}
8989
)
90-
// there should be 4 jobs
90+
// there should be 4 jobs (8 svg nodes)
9191
cy.get('.c-graph-node:last .jobs')
9292
.children()
93-
.should('have.length', 4)
93+
.should('have.length', 8)
9494
// there shouldn't be a job overflow indicator
9595
cy.get('.c-graph-node:last .job-overflow').should('not.exist')
9696

@@ -112,10 +112,10 @@ describe('graph node component', () => {
112112
props: { task, jobs, maxJobs: 4 }
113113
}
114114
)
115-
// there should be <maxJobs> jobs
115+
// there should be <maxJobs> jobs (<maxJobs * 2 svg nodes)
116116
cy.get('.c-graph-node:last .jobs')
117117
.children()
118-
.should('have.length', 4)
118+
.should('have.length', 8)
119119
// there should be a job overflow indicator with the number of overflow jobs
120120
cy.get('.c-graph-node:last .job-overflow')
121121
.should('exist')

src/components/cylc/GraphNode.vue

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
7777
scale(${ (index === 0) ? mostRecentJobScale : '1' })
7878
`"
7979
>
80-
<job
81-
:svg="true"
82-
:status="job.node.state"
80+
<symbol
81+
:id="`${nodeID}-${index}`"
82+
viewBox="0 0 100 100"
83+
:class="`job_theme--${jobTheme}`"
84+
>
85+
<!--
86+
Use a "symbol" for job nodes in order to make them clickable.
87+
The job theme must be set on the "symbol" for styling to work.
88+
-->
89+
<job
90+
:svg="true"
91+
:status="job.node.state"
92+
/>
93+
</symbol>
94+
<use
95+
:href="`#${nodeID}-${index}`"
96+
width="100" height="100"
97+
v-cylc-object="job"
8398
/>
8499
</g>
85100
<!-- overflow indicator if there are surplus jobs -->
@@ -130,6 +145,9 @@ export default {
130145
// the size of the most recent job icon relative to any previos jobs
131146
default: 1.2,
132147
required: false
148+
},
149+
jobTheme: {
150+
required: true
133151
}
134152
},
135153
computed: {

src/components/cylc/cylcObject/Menu.vue

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,19 +267,16 @@ export default {
267267
},
268268
openDialog (mutation) {
269269
if (mutation.name === 'log') {
270-
this.showMenu = false
271270
this.$eventBus.emit(
272271
'add-view',
273272
{
274-
275273
viewName: 'Log',
276274
initialOptions: {
277-
workflow: this.node.tokens.workflow,
278-
task: this.node.tokens.relative_id,
279-
file: 'job.out'
275+
tokens: this.node.tokens
280276
}
281277
}
282278
)
279+
this.showMenu = false
283280
return
284281
}
285282

src/components/cylc/log/Log.vue

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
<template>
1919
<div>
20-
<pre><span v-for="(log, index) in logs" :key="index">{{log}}</span></pre>
20+
<pre><span v-for="(log, index) in computedLogs" :key="index">{{log}}</span></pre>
2121
</div>
2222
</template>
2323

@@ -28,21 +28,49 @@ export default {
2828
props: {
2929
placeholder: {
3030
type: String,
31-
default: 'Waiting for logs',
3231
required: false
3332
},
33+
timestamps: {
34+
type: Boolean,
35+
required: false,
36+
default: true
37+
},
3438
logs: {
3539
type: Array,
3640
required: true
3741
}
3842
},
43+
data () {
44+
return {
45+
match: ''
46+
}
47+
},
3948
computed: {
4049
computedLogs () {
4150
if (this.logs.length > 0) {
42-
return this.logs
43-
} else {
51+
if (!this.timestamps) {
52+
return this.updateLogs()
53+
} else return this.logs
54+
} else if (this.placeholder) {
4455
return [this.placeholder]
56+
} else {
57+
return []
58+
}
59+
}
60+
},
61+
methods: {
62+
updateLogs () {
63+
return this.logs.map((logLine) => {
64+
return this.stripTimestamp(logLine)
65+
})
66+
},
67+
stripTimestamp (logLine) {
68+
const regex = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:Z|[+-][\d:]+)?\s(.*\s*)/
69+
this.match = logLine.match(regex)
70+
if (this.match) {
71+
return this.match[1]
4572
}
73+
return logLine
4674
}
4775
}
4876
}

src/components/cylc/log/index.js

Whitespace-only changes.

src/graphql/queries.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,26 @@ ${WORKFLOW_DATA_FRAGMENT}
202202
* @type {DocumentNode}
203203
*/
204204
const LOGS_SUBSCRIPTION = gql`
205-
subscription LogData ($workflowName: ID, $task: String, $file: String) {
205+
subscription LogData ($workflowName: ID, $task: String!, $file: String!) {
206206
logs (workflow: $workflowName, task:$task, file: $file) {
207207
lines
208208
}
209209
}
210210
`
211211

212+
/**
213+
* Query used to retrieve available log files for the Log view.
214+
*
215+
* @type {DocumentNode}
216+
*/
217+
const LOG_FILE_QUERY = gql`
218+
query LogFiles($workflowName: ID, $task: String!) {
219+
logFiles(workflow: $workflowName, task: $task) {
220+
files
221+
}
222+
}
223+
`
224+
212225
/**
213226
* Query used to retrieve data for the WorkflowsTable view.
214227
*
@@ -391,6 +404,7 @@ ${JOB_DATA_FRAGMENT}
391404
`
392405

393406
export {
407+
LOG_FILE_QUERY,
394408
GSCAN_DELTAS_SUBSCRIPTION,
395409
DASHBOARD_DELTAS_SUBSCRIPTION,
396410
LOGS_SUBSCRIPTION,

src/mixins/subscriptionComponent.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,29 @@ export default {
4040
this._uid = `${uniqueId()}_${this.$options.name}`
4141
},
4242
beforeMount () {
43-
this.$workflowService.subscribe(this)
44-
this.$workflowService.startSubscriptions()
43+
if (this.query) {
44+
this.$workflowService.subscribe(this)
45+
this.$workflowService.startSubscriptions()
46+
}
4547
},
4648
beforeUnmount () {
47-
this.$workflowService.unsubscribe(this)
49+
this._updateQuery(null, this.query)
50+
},
51+
methods: {
52+
_updateQuery (newQuery, oldQuery) {
53+
if (oldQuery) {
54+
this.$workflowService.unsubscribe(oldQuery, this._uid)
55+
}
56+
if (newQuery) {
57+
this.$workflowService.subscribe(this)
58+
this.$workflowService.startSubscriptions()
59+
}
60+
}
4861
},
4962
watch: {
50-
query () {
63+
query (newVal, oldVal) {
5164
// if the query changes, unsubscribe & re-subscribe
52-
this.$workflowService.unsubscribe(this)
53-
this.$workflowService.subscribe(this)
54-
this.$workflowService.startSubscriptions()
65+
this._updateQuery(newVal, oldVal)
5566
}
5667
}
5768
}

src/router/paths.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,16 @@ export default [
123123
showSidebar: false
124124
},
125125
props: true
126+
},
127+
{
128+
path: '/log/:workflowName(.*)',
129+
view: 'Log',
130+
name: 'log',
131+
meta: {
132+
layout: 'default',
133+
toolbar: true,
134+
showSidebar: false
135+
},
136+
props: true
126137
}
127138
]

0 commit comments

Comments
 (0)