Feature/web gui (#12)

Basic GUI functions (start/stop).
This commit is contained in:
Michael N. Lipp 2023-10-21 22:16:10 +02:00 committed by GitHub
parent 6491742eb0
commit ae3941707a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 12225 additions and 514 deletions

View file

@ -0,0 +1 @@
org.jdrupes.vmoperator.vmconlet.VmConletFactory

View file

@ -0,0 +1,31 @@
/*
* Moodle Tools Console
* Copyright (C) 2022 Michael N. Lipp
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses/>.
*/
"use strict";
const l10nBundles = new Map();
let entries = null;
// <#list supportedLanguages() as l>
entries = new Map();
l10nBundles.set("${l.locale.toLanguageTag()}", entries);
// <#list l.l10nBundle.keys as key>
entries.set("${key}", "${l.l10nBundle.getString(key)}");
// </#list>
// </#list>
export default l10nBundles;

View file

@ -0,0 +1,5 @@
<div class="jdrupes-vmoperator-vmconlet jdrupes-vmoperator-vmconlet-preview"
data-jgwc-on-load="orgJDrupesVmOperatorVmConlet.initPreview"
data-jgwc-on-unload="JGConsole.jgwc.unmountVueApps">
<div>Preview</div>
</div>

View file

@ -0,0 +1,84 @@
<div class="jdrupes-vmoperator-vmconlet jdrupes-vmoperator-vmconlet-view"
data-jgwc-on-load="orgJDrupesVmOperatorVmConlet.initView"
data-jgwc-on-unload="JGConsole.jgwc.unmountVueApps">
<div class="jdrupes-vmoperator-vmconlet-view-search">
<form>
<label class="form__label--horizontal">
<span>{{ localize("Filter") }}</span>
<input type="text" class="form__input-text--with-remove"
v-on:input="controller.updateFilter($event)">
<span role="button" tabindex="0" class="fa fa-remove"
v-on:click="controller.clearFilter($event)"></span>
</label>
</form>
</div>
<table
class="table--basic--striped jdrupes-vmoperator-vmconlet-view-table">
<thead>
<tr>
<th v-for="key in controller.keys"
class="sortable" v-on:click="controller.sortBy(key)">
{{ localize(controller.label(key)) }}<span v-if="controller.sortedByAsc(key)"
role="button" tabindex="0">&#x25B2;</span><span
v-if="controller.sortedByDesc(key)" role="button"
tabindex="0">&#x25BC;</span>
</th>
<th>
{{ localize("vmActions") }}
</th>
</tr>
</thead>
<tbody>
<template v-for="(entry, rowIndex) in filteredData">
<tr :class="[(rowIndex % 2) ? 'odd' : 'even']"
:aria-expanded="(entry.name in detailsByName) ? 'true' : 'false'">
<td v-for="key in controller.keys"
v-bind:title="key == 'name' ? entry['name']: false"
v-bind:rowspan="(key == 'name') && $aash.isDisclosed(scopedId(rowIndex)) ? 2 : false">
<aash-disclosure-button v-if="key === 'name'" :type="'div'"
:id-ref="scopedId(rowIndex)">
<span v-html="controller.breakBeforeDots(entry[key])"></span>
</aash-disclosure-button>
<span v-else-if="key === 'running'"
v-html="localize(entry[key] ? 'Yes' : 'No')"></span>
<span v-else-if="key === 'currentRam'"
v-html="formatMemory(BigInt(entry[key]))"></span>
<span v-else
v-html="controller.breakBeforeDots(entry[key])"></span>
</td>
<td class="jdrupes-vmoperator-vmconlet-view-action-list">
<span role="button" v-if="!entry['running']"
tabindex="0" class="fa fa-play" :title="localize('Start VM')"
v-on:click="vmAction(entry.name, 'start')"></span>
<span role="button" v-if="entry['running']"
tabindex="0" class="fa fa-stop" :title="localize('Stop VM')"
v-on:click="vmAction(entry.name, 'stop')"></span>
</td>
</tr>
<tr :id="scopedId(rowIndex)" v-if="$aash.isDisclosed(scopedId(rowIndex))"
:class="[(rowIndex % 2) ? 'odd' : 'even']">
<td colspan="4" class="details">
<table class="table--basic table--basic--autoStriped">
<tr>
<td>{{ localize("maximumCpus") }}</td>
<td>{{ entry.spec.vm.maximumCpus }}</td>
</tr>
<tr>
<td>{{ localize("requestedCpus") }}</td>
<td>{{ entry.spec.vm.maximumCpus }}</td>
</tr>
<tr>
<td>{{ localize("maximumRam") }}</td>
<td>{{ formatMemory(BigInt(entry.spec.vm.maximumRam)) }}</td>
</tr>
<tr>
<td>{{ localize("requestedRam") }}</td>
<td>{{ formatMemory(BigInt(entry.spec.vm.maximumRam)) }}</td>
</tr>
</table>
</td>
</tr>
</template>
</tbody>
</table>
</div>

View file

@ -0,0 +1,11 @@
conletName = VM Viewer
currentCpus = Current CPUs
currentRam = Current RAM
maximumCpus = Maximum CPUs
maximumRam = Maximum RAM
requestedCpus = Requested CPUs
requestedRam = Requested RAM
running = Running
vmActions = Actions
vmname = Name

View file

@ -0,0 +1,17 @@
conletName = VM Anzeige
running = Gestartet
currentCpus = Aktuelle CPUs
currentRam = Akuelles RAM
maximumCpus = Maximale CPUs
maximumRam = Maximales RAM
requestedCpus = Angeforderte CPUs
requestedRam = Angefordertes RAM
vmActions = Aktionen
vmname = Name
Start\ VM = VM Starten
Stop\ VM = VM Anhalten
Yes = Ja
No = Nein