diff --git a/org.jdrupes.vmoperator.vmviewer/src/org/jdrupes/vmoperator/vmviewer/browser/VmViewer-functions.ts b/org.jdrupes.vmoperator.vmviewer/src/org/jdrupes/vmoperator/vmviewer/browser/VmViewer-functions.ts index 1c20d66..a14e83c 100644 --- a/org.jdrupes.vmoperator.vmviewer/src/org/jdrupes/vmoperator/vmviewer/browser/VmViewer-functions.ts +++ b/org.jdrupes.vmoperator.vmviewer/src/org/jdrupes/vmoperator/vmviewer/browser/VmViewer-functions.ts @@ -64,7 +64,16 @@ window.orgJDrupesVmOperatorVmViewer.initPreview = (previewDom: HTMLElement, vmName: "", vmDefinition: {} }); - const vmDef = computed(() => previewApi.vmDefinition); + const configured = computed(() => previewApi.vmDefinition.spec); + const startable = computed(() => previewApi.vmDefinition.spec && + previewApi.vmDefinition.spec.vm.state !== 'Running' + && !previewApi.vmDefinition.running); + const stoppable = computed(() => previewApi.vmDefinition.spec && + previewApi.vmDefinition.spec.vm.state !== 'Stopped' + && previewApi.vmDefinition.running); + const running = computed(() => previewApi.vmDefinition.running); + const permissions = computed(() => previewApi.vmDefinition.spec + ? previewApi.vmDefinition.userPermissions : []); watch(() => previewApi.vmName, (name: string) => { if (name !== "") { @@ -74,51 +83,50 @@ window.orgJDrupesVmOperatorVmViewer.initPreview = (previewDom: HTMLElement, provideApi(previewDom, previewApi); - const vmAction = (vmName: string, action: string) => { + const vmAction = (action: string) => { JGConsole.notifyConletModel(conletId, action); }; - return { localize, resourceBase, vmDef, vmAction }; + return { localize, resourceBase, vmAction, configured, + startable, stoppable, running, permissions }; }, template: ` - - + - + + +
+ - + v-on:click="vmAction('start')"> - + v-on:click="vmAction('stop')"> + v-on:click="vmAction('reset')"> -
` diff --git a/org.jdrupes.vmoperator.vmviewer/src/org/jdrupes/vmoperator/vmviewer/browser/VmViewer-style.scss b/org.jdrupes.vmoperator.vmviewer/src/org/jdrupes/vmoperator/vmviewer/browser/VmViewer-style.scss index c90a45f..6d0654f 100644 --- a/org.jdrupes.vmoperator.vmviewer/src/org/jdrupes/vmoperator/vmviewer/browser/VmViewer-style.scss +++ b/org.jdrupes.vmoperator.vmviewer/src/org/jdrupes/vmoperator/vmviewer/browser/VmViewer-style.scss @@ -61,6 +61,18 @@ .jdrupes-vmoperator-vmviewer-preview-action-list { white-space: nowrap; } + + span.busy::before { + font: normal normal normal 14px/1 ForkAwesome; + font-size: 1.125em; + content: "\f1ce"; + left: 1.45em; + top: 0.7em; + color: var(--info); + position: absolute; + animation: spin 2s linear infinite; + z-index: 100; + } } .jdrupes-vmoperator-vmviewer.jdrupes-vmoperator-vmviewer-edit {