Skip to content

Commit

Permalink
Add column for showing last change.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed Oct 28, 2023
1 parent 8902d08 commit f7ce662
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@
class="fa fa-check" :title="localize('Yes')"></span>
<span v-else-if="key === 'running' && !entry[key]"
class="fa fa-close" :title="localize('No')"></span>
<span v-else-if="key === 'runningConditionSince'"
>{{ shortDateTime(entry[key].toString()) }}</span>
<span v-else-if="key === 'currentRam'"
v-html="formatMemory(entry[key])"></span>
>{{ formatMemory(entry[key]) }}</span>
<span v-else
v-html="controller.breakBeforeDots(entry[key])"></span>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ conletName = VM Viewer

VMsSummary = VMs (running/total)

since = Since
currentCpus = Current CPUs
currentRam = Current RAM
maximumCpus = Maximum CPUs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Last\ hour = Letzte Stunde
Last\ day = Letzter Tag

running = Gestartet
since = Seit
currentCpus = Aktuelle CPUs
currentRam = Akuelles RAM
maximumCpus = Maximale CPUs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ const localize = (key: string) => {
l10nBundles, JGWC.lang(), key);
};

const shortDateTime = (time: Date) => {
// https://stackoverflow.com/questions/63958875/why-do-i-get-rangeerror-date-value-is-not-finite-in-datetimeformat-format-w
return new Intl.DateTimeFormat(JGWC.lang(),
{ dateStyle: "short", timeStyle: "short" }).format(new Date(time));
};

// Cannot be reactive, leads to infinite recursion.
let chartData = new TimeSeries(2);
let chartDateUpdate = ref<Date>(null);
Expand Down Expand Up @@ -99,6 +105,7 @@ window.orgJDrupesVmOperatorVmConlet.initView = (viewDom: HTMLElement,
const controller = reactive(new JGConsole.TableController([
["name", "vmname"],
["running", "running"],
["runningConditionSince", "since"],
["currentCpus", "currentCpus"],
["currentRam", "currentRam"],
["nodeName", "nodeName"]
Expand All @@ -121,7 +128,7 @@ window.orgJDrupesVmOperatorVmConlet.initView = (viewDom: HTMLElement,

return {
controller, vmInfos, filteredData, detailsByName,
localize, formatMemory, vmAction,
localize, shortDateTime, formatMemory, vmAction,
scopedId: (id: string) => { return idScope.scopedId(id); }
};
}
Expand All @@ -140,6 +147,8 @@ JGConsole.registerConletFunction("org.jdrupes.vmoperator.vmconlet.VmConlet",
for (let condition of vmDefinition.status.conditions) {
if (condition.type === "Running") {
vmDefinition.running = condition.status === "True";
vmDefinition.runningConditionSince
= new Date(condition.lastTransitionTime);
break;
}
}
Expand Down

0 comments on commit f7ce662

Please sign in to comment.