summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/IpxeBuilderModuleConfig.vue
diff options
context:
space:
mode:
authorJannik Schönartz2019-01-31 05:39:40 +0100
committerJannik Schönartz2019-01-31 05:39:40 +0100
commitab83a69b71edb684e13ac4eb8db5dbaf8f20aac9 (patch)
tree1f1514792171e0a2dcba034234a7dfeebb95ef49 /webapp/src/components/IpxeBuilderModuleConfig.vue
parent[backends] Fixed offset-y depricated errors (diff)
downloadbas-ab83a69b71edb684e13ac4eb8db5dbaf8f20aac9.tar.gz
bas-ab83a69b71edb684e13ac4eb8db5dbaf8f20aac9.tar.xz
bas-ab83a69b71edb684e13ac4eb8db5dbaf8f20aac9.zip
[ipxe builder] Disable building/cleaning if a build process is already running
Diffstat (limited to 'webapp/src/components/IpxeBuilderModuleConfig.vue')
-rw-r--r--webapp/src/components/IpxeBuilderModuleConfig.vue46
1 files changed, 34 insertions, 12 deletions
diff --git a/webapp/src/components/IpxeBuilderModuleConfig.vue b/webapp/src/components/IpxeBuilderModuleConfig.vue
index e4f619a..4909227 100644
--- a/webapp/src/components/IpxeBuilderModuleConfig.vue
+++ b/webapp/src/components/IpxeBuilderModuleConfig.vue
@@ -15,7 +15,8 @@
"consoleSaved": "console.h saved successfully",
"buildingIpxe": "Building iPXE ...",
"cleanIpxe": "Clean iPXE",
- "cleaningIpxe": "Cleaning iPXE ..."
+ "cleaningIpxe": "Cleaning iPXE ...",
+ "alreadyBuiling": "The iPXE building process not finished"
},
"de": {
"efi": "EFI",
@@ -32,7 +33,8 @@
"consoleSaved": "console.h wurde erfolgreich gespeichert",
"buildingIpxe": "iPXE wird gebaut ...",
"cleanIpxe": "iPXE aufräumen",
- "cleaningIpxe": "iPXE wird aufgeräumt .."
+ "cleaningIpxe": "iPXE wird aufgeräumt ..",
+ "alreadyBuiling": "Der iPXE build-Prozess ist noch nicht abgeschlossen"
}
}
</i18n>
@@ -41,14 +43,22 @@
<div>
<v-subheader>{{ $t('ipxe') }}</v-subheader>
- <v-card style="padding-left: 24px;padding-right: 24px; padding-top: 12px; padding-bottom: 12px; height: 50vh; overflow: auto;" ref="log">
+ <v-card style="height: 588px;" ref="log">
+ <RecycleScroller :items="log" :item-height="21" style="height: 100%;">
+ <div slot-scope="{ item }" style="height: 21px;">
+ <pre :class="item.status + '--text'" style="margin-bottom: 0px"><span>{{ item.date }} {{ item.msg }}</span></pre>
+ </div>
+ </RecycleScroller>
+
+ <!--
+ <v-card style="padding-left: 24px;padding-right: 24px; padding-top: 12px; padding-bottom: 12px; height: 50vh; overflow: auto;" ref="log">
<template v-for="(entry, index) in log">
<pre :class="entry.status + '--text'" style="margin-bottom: 0px" :key="index"><span>{{ entry.date }} {{ entry.msg }}</span></pre>
- </template>
+ </template>-->
</v-card>
<div class="text-xs-right">
- <v-btn flat color="error" @click="cleanIpxe"><v-icon left>delete</v-icon>{{ $t('cleanIpxe') }}</v-btn>
- <v-btn flat color="primary" @click="buildIpxe"><v-icon left>gavel</v-icon>{{ $t('buildIpxe') }}</v-btn>
+ <v-btn flat color="error" @click="cleanIpxe" :disabled=disableButtons><v-icon left>delete</v-icon>{{ $t('cleanIpxe') }}</v-btn>
+ <v-btn flat color="primary" @click="buildIpxe" :disabled=disableButtons><v-icon left>gavel</v-icon>{{ $t('buildIpxe') }}</v-btn>
</div>
<v-subheader></v-subheader>
@@ -138,7 +148,8 @@ export default {
certificateExpanded: null,
generalExpanded: null,
consoleExpanded: null,
- log: []
+ log: [],
+ disableButtons: false
}
},
computed: {
@@ -174,12 +185,14 @@ export default {
},
buildIpxe () {
axios.get('/api/ipxe/' + this.ipxeVersion + '/build').then(result => {
- this.$snackbar({ color: 'primary', text: this.$tc('buildingIpxe') })
+ if (result.data.status === 'SUCCESS') this.$snackbar({ color: 'primary', text: this.$tc('buildingIpxe') })
+ else if (result.data.status === 'ALREADY_BUILDING') this.$snackbar({ color: 'error', text: this.$tc('alreadyBuiling') })
})
},
cleanIpxe () {
axios.get('/api/ipxe/' + this.ipxeVersion + '/clean').then(result => {
- this.$snackbar({ color: 'primary', text: this.$tc('cleaningIpxe') })
+ if (result.data.status === 'SUCCESS') this.$snackbar({ color: 'primary', text: this.$tc('cleaningIpxe') })
+ else if (result.data.status === 'ALREADY_BUILDING') this.$snackbar({ color: 'error', text: this.$tc('alreadyBuiling') })
})
}
},
@@ -203,17 +216,26 @@ export default {
for (var line in lines) {
if (lines[line] === '') continue
var attr = lines[line].split('\t')
- this.log.push({ date: attr[0], status: attr[1], msg: attr[2] })
+ this.log.push({ id: this.log.length, date: attr[0], status: attr[1], msg: attr[2] })
}
})
// Socket io event listeners
this.$socket.on(this.ipxeVersion + ' log', entry => {
- this.log.push({ msg: entry.msg, status: entry.status, date: entry.date })
+ this.log.push({ id: this.log.length, msg: entry.msg, status: entry.status, date: entry.date })
+ })
+
+ // Disable the buttons if a building process is running.
+ axios.get('/api/ipxe/' + this.ipxeVersion + '/status').then(result => {
+ this.disableButtons = result.data.data
+ })
+
+ this.$socket.on(this.ipxeVersion + ' inProgress', inProgress => {
+ this.disableButtons = inProgress
})
},
updated () {
- this.$refs.log.$el.scrollTop = this.$refs.log.$el.scrollHeight
+ this.$refs.log.$el.firstElementChild.scrollTop = this.$refs.log.$el.firstElementChild.scrollHeight
}
}
</script>