Skip to content

Commit

Permalink
Log view: don't query files in job log mode when no ID given
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie committed Feb 15, 2024
1 parent 5e395d4 commit 90fcb77
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/views/Log.vue
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,6 @@ export const getDefaultFile = (logFiles) => {
return null // rather than undefined
}

const getFileLabel = (id) => id ? `No log files for ${id}` : 'Enter a task/job ID'

class Results {
constructor () {
/** @type {string[]} */
Expand Down Expand Up @@ -448,6 +446,10 @@ export default {
// if reset===true then the this.file will be reset
// otherwise it will be left alone

if (!this.id) {
this.handleNoLogFiles()
return
}
// update the list of log files
this.fileLabel = 'Updating available files...'
this.fileDisabled = true
Expand All @@ -461,8 +463,7 @@ export default {
} catch (err) {
// the query failed
console.warn(err)
this.fileLabel = getFileLabel(this.id)
this.fileDisabled = true
this.handleNoLogFiles()
return
}
const logFiles = result.data.logFiles?.files ?? []
Expand All @@ -484,11 +485,14 @@ export default {
this.fileDisabled = false
this.logFiles = logFiles
} else {
this.fileLabel = getFileLabel(this.id)
this.fileDisabled = true
this.logFiles = []
this.handleNoLogFiles()
}
}
},
handleNoLogFiles () {
this.fileLabel = this.id ? `No log files for ${this.id}` : 'Enter a task/job ID'
this.fileDisabled = true
this.logFiles = []
},
},

watch: {
Expand Down

0 comments on commit 90fcb77

Please sign in to comment.