Add pkg/harvester components + shell portings - 1

Signed-off-by: Francesco Torchia <francesco.torchia@suse.com>
This commit is contained in:
Francesco Torchia
2024-10-23 17:00:46 +02:00
parent f8408469f7
commit 4f2688f6ab
265 changed files with 42316 additions and 82 deletions
@@ -0,0 +1,53 @@
<script>
import { HCI } from '../../../../../types';
import SerialConsole from '../../../../../components/SerialConsole';
import Loading from '@shell/components/Loading';
export default {
components: { SerialConsole, Loading },
async fetch() {
this.rows = await this.$store.dispatch('harvester/findAll', { type: HCI.VMI });
},
data() {
return { uid: this.$route.params.uid };
},
computed: {
vmi() {
const vmiList = this.$store.getters['harvester/all'](HCI.VMI) || [];
const vmi = vmiList.find( (VMI) => {
return VMI?.metadata?.ownerReferences?.[0]?.uid === this.uid;
});
return vmi;
},
},
mounted() {
window.addEventListener('beforeunload', () => {
this.$refs.serialConsole.close();
});
},
head() {
return { title: this.vmi?.metadata?.name };
},
};
</script>
<template>
<Loading v-if="$fetchState.pending" />
<SerialConsole
v-else
ref="serialConsole"
v-model="vmi"
/>
</template>
<style lang="scss" scoped>
body, #__nuxt, #__layout, main {
height: 100%;
}
</style>
@@ -0,0 +1,55 @@
<script>
import { HCI } from '../../../../../types';
import NovncConsoleWrapper from '../../../../../components/novnc/NovncConsoleWrapper.vue';
import Loading from '@shell/components/Loading';
export default {
components: { NovncConsoleWrapper, Loading },
async fetch() {
this.rows = await this.$store.dispatch('harvester/findAll', { type: HCI.VMI });
},
data() {
return { uid: this.$route.params.uid };
},
computed: {
vmi() {
const vmiList = this.$store.getters['harvester/all'](HCI.VMI) || [];
const vmi = vmiList.find( (VMI) => {
return VMI?.metadata?.ownerReferences?.[0]?.uid === this.uid;
});
return vmi;
},
},
mounted() {
window.addEventListener('beforeunload', () => {
this.$refs.console.close();
});
},
head() {
return { title: this.vmi?.metadata?.name };
},
};
</script>
<template>
<Loading v-if="$fetchState.pending" />
<NovncConsoleWrapper
v-else
ref="console"
v-model="vmi"
class="novnc-wrapper"
/>
</template>
<style>
HTML, BODY, MAIN, #__nuxt, #__layout, #app, .vm-console, .vm-console > DIV, .vm-console > DIV > DIV {
height: 100%;
}
</style>