summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/api/ipxe.js4
-rw-r--r--server/lib/shell.js14
-rw-r--r--webapp/src/components/IpxeBuilderModuleConfig.vue14
3 files changed, 17 insertions, 15 deletions
diff --git a/server/api/ipxe.js b/server/api/ipxe.js
index 5d95fa2..217cf6c 100644
--- a/server/api/ipxe.js
+++ b/server/api/ipxe.js
@@ -67,9 +67,9 @@ router.get('/:version/build', async (req, res) => {
}
})
-noAuthRouter.get('/:version/stop', async (req, res) => {
+router.get('/:version/cancel', async (req, res) => {
if (req.params.version === 'efi' || req.params.version === 'bios') {
- shell.stopBuilding(req, res)
+ shell.cancelBuilding(req, res)
} else {
res.status(400).send({ status: 'error', msg: 'Unknown ipxe version (' + req.params.version + ')' })
}
diff --git a/server/lib/shell.js b/server/lib/shell.js
index 8d609e4..81d3008 100644
--- a/server/lib/shell.js
+++ b/server/lib/shell.js
@@ -61,19 +61,11 @@ module.exports = {
shell.mv(path.join(__appdir, 'ipxe', 'undionly.kpxe'), path.join(__appdir, 'ipxe', 'ipxe.' + ipxeVersion))
},
- stopBuilding: async function (req, res) {
- // TODO: KILLING IS NOT WORKING.. fml
+ cancelBuilding: async function (req, res) {
const process = make[req.params.version]
- console.log(process)
if (process) {
- console.log('KILLING IT °_°')
- // process.stdin.pause()
- // shell.kill(process.pid, 'SIGINT')
- // const kill = 'kill -2 ' + process.pid
- // console.log(kill)
- // shell.exec(kill)
- // process.kill("SIGINT")
- // child.exec("kill -2 " + process.pid)
+ const kill = 'pkill -P ' + process.pid
+ shell.exec(kill)
}
res.send({ status: 'SUCCESS', data: process })
},
diff --git a/webapp/src/components/IpxeBuilderModuleConfig.vue b/webapp/src/components/IpxeBuilderModuleConfig.vue
index 4909227..874c3ee 100644
--- a/webapp/src/components/IpxeBuilderModuleConfig.vue
+++ b/webapp/src/components/IpxeBuilderModuleConfig.vue
@@ -16,7 +16,8 @@
"buildingIpxe": "Building iPXE ...",
"cleanIpxe": "Clean iPXE",
"cleaningIpxe": "Cleaning iPXE ...",
- "alreadyBuiling": "The iPXE building process not finished"
+ "alreadyBuiling": "The iPXE building process not finished",
+ "cancelIpxe": "Cancel iPXE"
},
"de": {
"efi": "EFI",
@@ -34,7 +35,8 @@
"buildingIpxe": "iPXE wird gebaut ...",
"cleanIpxe": "iPXE aufräumen",
"cleaningIpxe": "iPXE wird aufgeräumt ..",
- "alreadyBuiling": "Der iPXE build-Prozess ist noch nicht abgeschlossen"
+ "alreadyBuiling": "Der iPXE build-Prozess ist noch nicht abgeschlossen",
+ "cancelIpxe": "iPXE stoppen"
}
}
</i18n>
@@ -58,6 +60,7 @@
</v-card>
<div class="text-xs-right">
<v-btn flat color="error" @click="cleanIpxe" :disabled=disableButtons><v-icon left>delete</v-icon>{{ $t('cleanIpxe') }}</v-btn>
+ <v-btn flat color="warning" @click="cancelIpxe" :disabled=!disableButtons><v-icon left>cancel</v-icon>{{ $t('cancelIpxe') }}</v-btn>
<v-btn flat color="primary" @click="buildIpxe" :disabled=disableButtons><v-icon left>gavel</v-icon>{{ $t('buildIpxe') }}</v-btn>
</div>
@@ -194,6 +197,11 @@ export default {
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') })
})
+ },
+ cancelIpxe () {
+ axios.get('/api/ipxe/' + this.ipxeVersion + '/cancel').then(result => {
+ if (result.data.status === 'SUCCESS') this.$snackbar({ color: 'primary', text: this.$tc('cleaningIpxe') }) // TODO:
+ })
}
},
created () {
@@ -213,6 +221,8 @@ export default {
axios.get('/api/ipxe/' + this.ipxeVersion + '/log').then(result => {
var lines = result.data.split('\n')
+ // Limit the log to 500 lines, to prevent lagging
+ lines = lines.slice(-500)
for (var line in lines) {
if (lines[line] === '') continue
var attr = lines[line].split('\t')