summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorJannik Schönartz2020-08-31 19:33:34 +0200
committerJannik Schönartz2020-08-31 19:33:34 +0200
commit5fbd058f8ac7e13d1593dde996715cf534edec8b (patch)
tree2c80b3e025d8855adfc0fe233c447e211066caca /webapp
parent[server/embedded-script] Move the bas wallpaper to a later point in the process (diff)
downloadbas-5fbd058f8ac7e13d1593dde996715cf534edec8b.tar.gz
bas-5fbd058f8ac7e13d1593dde996715cf534edec8b.tar.xz
bas-5fbd058f8ac7e13d1593dde996715cf534edec8b.zip
npm install needed [ipxe builder] Rework to link directorys instead of single files
Diffstat (limited to 'webapp')
-rw-r--r--webapp/src/components/IpxeBuilderModule.vue2
-rw-r--r--webapp/src/components/IpxeBuilderModuleConfig.vue95
-rw-r--r--webapp/src/config/store.js4
-rw-r--r--webapp/src/store/ipxe.js26
4 files changed, 123 insertions, 4 deletions
diff --git a/webapp/src/components/IpxeBuilderModule.vue b/webapp/src/components/IpxeBuilderModule.vue
index c98912e..ba61a69 100644
--- a/webapp/src/components/IpxeBuilderModule.vue
+++ b/webapp/src/components/IpxeBuilderModule.vue
@@ -13,7 +13,7 @@
<v-container fill-height>
<v-layout>
<v-flex xl10 offset-xl1 lg12>
- <v-card class="tabbar-card">
+ <v-card class="tabbar-card" style="z-index: 5;">
<v-tabs v-model="tabs" grow :dark="tabsDark" :background-color="tabsColor" :slider-color="tabsSliderColor" hide-slider>
<v-tab><v-icon class="tabbar-tabicon">memory</v-icon>{{ $t('ipxe') }}</v-tab>
</v-tabs>
diff --git a/webapp/src/components/IpxeBuilderModuleConfig.vue b/webapp/src/components/IpxeBuilderModuleConfig.vue
index fc6b2ff..1537d3a 100644
--- a/webapp/src/components/IpxeBuilderModuleConfig.vue
+++ b/webapp/src/components/IpxeBuilderModuleConfig.vue
@@ -3,6 +3,7 @@
"en": {
"alreadyBuiling": "The iPXE building process not finished",
"bios": "BIOS",
+ "boot": "Boot Process",
"branchName": "Branch Name",
"buildingIpxe": "Building iPXE ...",
"buildIpxe": "Build iPXE",
@@ -24,11 +25,14 @@
"scripts": "Scripts",
"scriptSaved": "Embedded script saved successfully",
"scrollDown": "Go to the bottom",
+ "successDeleteBuild": "Successfully deleted IPXE build.",
+ "successSetAsDefault": "Successfully set IPXE build as default.",
"trust": "Embedded certificate (TRUST=)"
},
"de": {
"alreadyBuiling": "Der iPXE build-Prozess ist noch nicht abgeschlossen",
"bios": "BIOS",
+ "boot": "Boot Prozess",
"branchName": "Branch Name",
"buildingIpxe": "iPXE wird gebaut ...",
"buildIpxe": "iPXE bauen",
@@ -50,6 +54,8 @@
"scripts": "Skripte",
"scriptSaved": "Eingebettetes Skript wurde erfolgreich gespeichert",
"scrollDown": "Gehe nach unten",
+ "successDeleteBuild": "IPXE-Build erfolgreich gelöscht.",
+ "successSetAsDefault": "IPXE-Build erfolgreich als Standard gesetzt.",
"trust": "Eingebettetes Zertifikat (TRUST=)"
}
}
@@ -166,6 +172,63 @@
</v-card-text>
</v-card>
+ <v-subheader>{{ $t('boot') }}
+ <v-spacer></v-spacer>
+ <v-btn icon :loading="loadingBuilds" @click="loadBuilds" class=""><v-icon>refresh</v-icon></v-btn>
+ </v-subheader>
+ <v-card class="" ref="" style="">
+ <v-list two-line>
+ <v-list-item v-for="(build, index) in builds" :key="index">
+
+ <v-list-item-action>
+ <v-tooltip top v-if="build.selected">
+ <template #activator="{ on }">
+ <v-icon v-on="on" color="success" style="width: 36px">flag</v-icon>
+ </template>
+ <span>{{ $t('selectedConfig') }}</span>
+ </v-tooltip>
+ <v-btn v-else icon @click.stop="setAsDefault(build.name)">
+ <v-icon style="opacity: 0.2">outlined_flag</v-icon>
+ </v-btn>
+ </v-list-item-action>
+ <v-list-item-action>
+ <v-btn v-if="build.edit" :key="build.edit" @click="renameBuild(build)" icon><v-icon color="primary">done</v-icon></v-btn>
+ <v-btn v-else @click="editBuild(build)" icon><v-icon color="primary">edit</v-icon></v-btn>
+ </v-list-item-action>
+
+ <v-list-item-content>
+ <v-list-item-title v-if="build.edit">
+ <v-text-field v-model="build.name" class="info-text pa-0"></v-text-field>
+ </v-list-item-title>
+ <v-list-item-title v-else><span class="info-text">{{ build.name }}</span></v-list-item-title>
+ </v-list-item-content>
+
+ <v-list-item-action class="">
+ <v-menu :close-on-content-click="false" offset-y>
+ <template #activator="{ on }">
+ <v-btn icon v-on="on" color="primary">
+ <v-icon>list</v-icon>
+ </v-btn>
+ </template>
+ <template #default>
+ <v-card><v-card-text>
+
+ <table v-for="(child, i) in build.children" :key="i">
+ <tr v-for="(file, j) in child.children" :key="j"><td>{{ child.name }}/{{ file.name }}</td></tr>
+ </table>
+ </v-card-text></v-card>
+ </template>
+ </v-menu>
+
+ </v-list-item-action>
+
+ <v-list-item-action class="delete">
+ <v-btn @click="deleteBuild(build.name)" icon><v-icon color="error">delete</v-icon></v-btn>
+ </v-list-item-action>
+ </v-list-item>
+ </v-list>
+ </v-card>
+
<v-subheader>{{ $t('output') }}</v-subheader>
<!--
<v-card v-on:wheel="manualScroll">
@@ -256,7 +319,7 @@
</template>
<script>
-import { mapGetters } from 'vuex'
+import { mapGetters, mapState, mapActions } from 'vuex'
export default {
name: 'IpxeBuilderModuleConfig',
@@ -282,9 +345,11 @@ export default {
}
},
computed: {
- ...mapGetters(['tabsDark', 'tabsColor', 'tabsSliderColor'])
+ ...mapGetters(['tabsDark', 'tabsColor', 'tabsSliderColor']),
+ ...mapState('ipxe', ['builds', 'loadingBuilds'])
},
methods: {
+ ...mapActions('ipxe', ['loadBuilds']),
createTarget (list) {
const index = list.length - 1
if (this.allowCustomTargets && this.targets.indexOf(list[index]) === -1) this.targets.push(list[index])
@@ -351,6 +416,30 @@ export default {
this.$http.post('/api/ipxe/config', data).then(response => {
this.editParametersMode = false
})
+ },
+ async setAsDefault (buildname) {
+ const response = await this.$http.post('/api/ipxe/builds/', { build: buildname })
+ if (response.data.error) this.$snackbar({ text: response.data.error, color: 'error', timeout: 2000 })
+ else this.$snackbar({ text: this.$t('successSetAsDefault'), color: 'success', timeout: 2000 })
+ this.$store.dispatch('ipxe/loadBuilds')
+ },
+ async deleteBuild (buildname) {
+ await this.$http.delete('/api/ipxe/builds/' + encodeURI(buildname))
+ this.$snackbar({ text: this.$t('successDeleteBuild'), color: 'success', timeout: 2000 })
+ this.$store.dispatch('ipxe/loadBuilds')
+ },
+ async renameBuild (build) {
+ build.edit = false
+ this.$forceUpdate()
+ const response = await this.$http.post('/api/ipxe/builds/' + encodeURI(build.originname), { name: build.name })
+
+ if (response.error) this.$snackbar({ text: this.$t(''), color: 'error', timeout: 2000 })
+ else this.$snackbar({ text: this.$t('successRenameBuild'), color: 'success', timeout: 2000 })
+ this.$store.dispatch('ipxe/loadBuilds')
+ },
+ editBuild (build) {
+ build.edit = true
+ this.$forceUpdate()
}
},
created () {
@@ -392,6 +481,8 @@ export default {
// this.$socket.on('inProgress', inProgress => {
// this.disableButtons = inProgress
// })
+
+ this.$store.dispatch('ipxe/loadBuilds')
},
updated () {
if (this.autoscroll) {
diff --git a/webapp/src/config/store.js b/webapp/src/config/store.js
index 3f49600..81c283e 100644
--- a/webapp/src/config/store.js
+++ b/webapp/src/config/store.js
@@ -7,6 +7,7 @@ import permissions from '@/store/permissions'
import users from '@/store/users'
import events from '@/store/events'
import log from '@/store/log'
+import ipxe from '@/store/ipxe'
export default {
notifications,
@@ -17,5 +18,6 @@ export default {
permissions,
users,
events,
- log
+ log,
+ ipxe
}
diff --git a/webapp/src/store/ipxe.js b/webapp/src/store/ipxe.js
new file mode 100644
index 0000000..a18ec6f
--- /dev/null
+++ b/webapp/src/store/ipxe.js
@@ -0,0 +1,26 @@
+import axios from 'axios'
+
+export default {
+ namespaced: true,
+ state: {
+ builds: [],
+ loadingBuilds: false
+ },
+ mutations: {
+ setBuilds (state, builds) { state.builds = builds },
+ setLoadingBuilds (state, loadingBuilds) { state.loadingBuilds = loadingBuilds }
+ },
+ actions: {
+ loadBuilds (context) {
+ context.commit('setLoadingBuilds', true)
+ axios.get('/api/ipxe/builds').then(response => {
+ let builds = response.data
+ for (let build in builds) {
+ builds[build].originname = builds[build].name
+ }
+ context.commit('setBuilds', response.data)
+ setTimeout(() => context.commit('setLoadingBuilds', false), 500)
+ })
+ }
+ }
+}