Skip to content

Commit 6b3a9f0

Browse files
log: change query interface and change form inputs
* Unify the `workflow` and `task` arguments into `id`. * Add a workflow/job toggle to switch between workflow and job logs. * Switch to using watchers and debounce for log file requests. * Remove the search/update button by subscribing reactively. * Add a button for refreshing the log file list. * Use the ViewToolbar for presenting options. * Use a skeleton component for the loading state. * Disable the log file input when the file list is loading.
1 parent 41b79ab commit 6b3a9f0

File tree

13 files changed

+3001
-2260
lines changed

13 files changed

+3001
-2260
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
@@ -15,6 +15,11 @@ ones in. -->
1515

1616
### Enhancements
1717

18+
[#1275](https://github.com/cylc/cylc-ui/pull/1275) -
19+
Various improvements to the log view including the ability to view prior
20+
job submissions, workflow log files and the connection status of the
21+
log file subscription.
22+
1823
[#1187](https://github.com/cylc/cylc-ui/pull/1187) - Improved the workflow
1924
filtering menu in the sidebar.
2025

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ describe('graph node component', () => {
9595
propsData: { task, jobs }
9696
}
9797
)
98-
// there should be 4 jobs
98+
// there should be 4 jobs (8 svg nodes)
9999
cy.get('.c-graph-node:last .jobs')
100100
.children()
101-
.should('have.length', 4)
101+
.should('have.length', 8)
102102
// there shouldn't be a job overflow indicator
103103
cy.get('.c-graph-node:last .job-overflow').should('not.exist')
104104

@@ -120,10 +120,10 @@ describe('graph node component', () => {
120120
propsData: { task, jobs, maxJobs: 4 }
121121
}
122122
)
123-
// there should be <maxJobs> jobs
123+
// there should be <maxJobs> jobs (<maxJobs * 2 svg nodes)
124124
cy.get('.c-graph-node:last .jobs')
125125
.children()
126-
.should('have.length', 4)
126+
.should('have.length', 8)
127127
// there should be a job overflow indicator with the number of overflow jobs
128128
cy.get('.c-graph-node:last .job-overflow')
129129
.should('exist')

src/components/cylc/cylcObject/Menu.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,7 @@ export default {
269269
{
270270
viewName: 'Log',
271271
initialOptions: {
272-
workflow: this.node.tokens.workflow,
273-
task: this.node.tokens.relative_id,
274-
file: 'job.out'
272+
tokens: this.node.tokens
275273
}
276274
}
277275
)

src/components/cylc/log/Log.vue

Lines changed: 4 additions & 3 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><code><span v-for="(log, index) in computedLogs" :key="index">{{log}}</span></code></pre>
20+
<pre><span v-for="(log, index) in computedLogs" :key="index">{{log}}</span></pre>
2121
</div>
2222
</template>
2323

@@ -28,7 +28,6 @@ export default {
2828
props: {
2929
placeholder: {
3030
type: String,
31-
default: 'Waiting for logs',
3231
required: false
3332
},
3433
timestamps: {
@@ -52,8 +51,10 @@ export default {
5251
if (!this.timestamps) {
5352
return this.updateLogs()
5453
} else return this.logs
55-
} else {
54+
} else if (this.placeholder) {
5655
return [this.placeholder]
56+
} else {
57+
return []
5758
}
5859
}
5960
},

src/mixins/subscriptionComponent.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,29 @@ export default {
3434
subscriptionMixin
3535
],
3636
beforeMount () {
37-
this.$workflowService.subscribe(this)
38-
this.$workflowService.startSubscriptions()
37+
if (this.query) {
38+
this.$workflowService.subscribe(this)
39+
this.$workflowService.startSubscriptions()
40+
}
3941
},
4042
beforeDestroy () {
41-
this.$workflowService.unsubscribe(this)
43+
this._updateQuery(null, this.query)
44+
},
45+
methods: {
46+
_updateQuery (newVal, oldVal) {
47+
if (oldVal) {
48+
this.$workflowService.unsubscribe(this)
49+
}
50+
if (newVal) {
51+
this.$workflowService.subscribe(this)
52+
this.$workflowService.startSubscriptions()
53+
}
54+
}
4255
},
4356
watch: {
44-
query () {
57+
query (newVal, oldVal) {
4558
// if the query changes, unsubscribe & re-subscribe
46-
this.$workflowService.unsubscribe(this)
47-
this.$workflowService.subscribe(this)
48-
this.$workflowService.startSubscriptions()
59+
this._updateQuery(newVal, oldVal)
4960
}
5061
}
5162
}

src/services/mock/json/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@ const userProfile = require('./userprofile.json')
2020
const taskProxy = require('./taskProxy.json')
2121
const familyProxy = require('./familyProxy.json')
2222
const App = require('./App')
23+
const LogData = require('./logData.json')
24+
const LogFiles = require('./logFiles.json')
2325

2426
module.exports = {
2527
IntrospectionQuery,
2628
taskProxy,
2729
familyProxy,
2830
userProfile,
31+
LogData,
32+
LogFiles,
2933
App,
3034
Workflow: App
3135
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"logs": {
3+
"connected": true,
4+
"path": "my-host:/path/to/the/log/file/note/these/paths/get/really/log/NN/job.out",
5+
"lines": [
6+
"one\n",
7+
"two\n",
8+
"three\n",
9+
"four\n",
10+
"five\n"
11+
]
12+
}
13+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"data": {
3+
"logFiles": {
4+
"files": [
5+
"job.out",
6+
"job.err",
7+
"job"
8+
]
9+
}
10+
}
11+
}

src/utils/uid.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ class Tokens {
194194
let task
195195
let job
196196

197+
if (id === null) {
198+
throw new Error(`Invalid ID ${id}`)
199+
}
200+
197201
// try to match relative ID (the leading // is implicit)
198202
if (relative) {
199203
match = `//${id}`.match(RELATIVE_ID)

0 commit comments

Comments
 (0)