mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-11-06 02:25:07 +01:00
adapt frontend for new uiConfig keys, add nodeOverview mutation
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
/* State Init */
|
||||
let message = $state({ msg: "", target: "", color: "#d63384" });
|
||||
let displayMessage = $state(false);
|
||||
let cbmode = $state(ccconfig?.plot_general_colorblindMode || false);
|
||||
let cbmode = $state(ccconfig?.plotConfiguration_colorblindMode || false);
|
||||
|
||||
/* Functions */
|
||||
async function handleSettingSubmit(event, setting) {
|
||||
@@ -38,7 +38,7 @@
|
||||
const res = await fetch(form.action, { method: "POST", body: formData });
|
||||
if (res.ok) {
|
||||
let text = await res.text();
|
||||
if (formData.get("key") === "plot_general_colorblindMode") {
|
||||
if (formData.get("key") === "plotConfiguration_colorblindMode") {
|
||||
cbmode = JSON.parse(formData.get("value"));
|
||||
}
|
||||
popMessage(text, target, "#048109");
|
||||
|
||||
@@ -69,10 +69,10 @@
|
||||
method="post"
|
||||
action="/frontend/configuration/"
|
||||
onsubmit={(e) => handleSettingSubmit(e, "#node-paging-form", "npag")}>
|
||||
<input type="hidden" name="key" value="node_list_usePaging" />
|
||||
<input type="hidden" name="key" value="nodeList_usePaging" />
|
||||
<div class="mb-3">
|
||||
<div>
|
||||
{#if config?.node_list_usePaging}
|
||||
{#if config?.nodeList_usePaging}
|
||||
<input type="radio" id="nodes-true-checked" name="value" value="true" checked />
|
||||
{:else}
|
||||
<input type="radio" id="nodes-true" name="value" value="true" />
|
||||
@@ -80,7 +80,7 @@
|
||||
<label for="nodes-true">Paging with selectable count of nodes.</label>
|
||||
</div>
|
||||
<div>
|
||||
{#if config?.node_list_usePaging}
|
||||
{#if config?.nodeList_usePaging}
|
||||
<input type="radio" id="nodes-false" name="value" value="false" />
|
||||
{:else}
|
||||
<input type="radio" id="nodes-false-checked" name="value" value="false" checked />
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
} = $props();
|
||||
|
||||
/* State Init */
|
||||
let activeRow = $state(JSON.stringify(config?.plot_general_colorscheme));
|
||||
let activeRow = $state(JSON.stringify(config?.plotConfiguration_colorScheme));
|
||||
|
||||
/* Const Init */
|
||||
const colorschemes = {
|
||||
const colorSchemes = {
|
||||
Default: [
|
||||
"#00bfff",
|
||||
"#0000ff",
|
||||
@@ -266,7 +266,7 @@
|
||||
|
||||
// https://personal.sron.nl/~pault/
|
||||
// https://tsitsul.in/blog/coloropt/
|
||||
const cvdschemes = {
|
||||
const cvdSchemes = {
|
||||
HighContrast: [
|
||||
"rgb(221,170,51)",
|
||||
"rgb(187,85,102)",
|
||||
@@ -344,11 +344,11 @@
|
||||
</div>
|
||||
{/if}
|
||||
</CardTitle>
|
||||
<input type="hidden" name="key" value="plot_general_colorscheme" />
|
||||
<input type="hidden" name="key" value="plotConfiguration_colorScheme" />
|
||||
<Table hover>
|
||||
<tbody>
|
||||
{#key activeRow}
|
||||
{#each Object.entries(cbmode ? cvdschemes : colorschemes) as [name, rgbrow]}
|
||||
{#each Object.entries(cbmode ? cvdSchemes : colorSchemes) as [name, rgbrow]}
|
||||
<tr>
|
||||
<th scope="col">{name}</th>
|
||||
<td>
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
</CardTitle>
|
||||
<input type="hidden" name="key" value="plot_general_lineWidth" />
|
||||
<input type="hidden" name="key" value="plotConfiguration_lineWidth" />
|
||||
<div class="mb-3">
|
||||
<label for="value" class="form-label">Line Width</label>
|
||||
<input
|
||||
@@ -64,7 +64,7 @@
|
||||
id="lwvalue"
|
||||
name="value"
|
||||
aria-describedby="lineWidthHelp"
|
||||
value={config.plot_general_lineWidth}
|
||||
value={config.plotConfiguration_lineWidth}
|
||||
min="1"
|
||||
/>
|
||||
<div id="lineWidthHelp" class="form-text">
|
||||
@@ -102,7 +102,7 @@
|
||||
</div>
|
||||
{/if}
|
||||
</CardTitle>
|
||||
<input type="hidden" name="key" value="plot_view_plotsPerRow" />
|
||||
<input type="hidden" name="key" value="plotConfiguration_plotsPerRow" />
|
||||
<div class="mb-3">
|
||||
<label for="value" class="form-label">Plots per Row</label>
|
||||
<input
|
||||
@@ -111,7 +111,7 @@
|
||||
id="pprvalue"
|
||||
name="value"
|
||||
aria-describedby="plotsperrowHelp"
|
||||
value={config.plot_view_plotsPerRow}
|
||||
value={config.plotConfiguration_plotsPerRow}
|
||||
min="1"
|
||||
/>
|
||||
<div id="plotsperrowHelp" class="form-text">
|
||||
@@ -150,10 +150,10 @@
|
||||
</div>
|
||||
{/if}
|
||||
</CardTitle>
|
||||
<input type="hidden" name="key" value="plot_general_colorBackground" />
|
||||
<input type="hidden" name="key" value="plotConfiguration_colorBackground" />
|
||||
<div class="mb-3">
|
||||
<div>
|
||||
{#if config.plot_general_colorBackground}
|
||||
{#if config.plotConfiguration_colorBackground}
|
||||
<input type="radio" id="colb-true-checked" name="value" value="true" checked />
|
||||
{:else}
|
||||
<input type="radio" id="colb-true" name="value" value="true" />
|
||||
@@ -161,7 +161,7 @@
|
||||
<label for="true">Yes</label>
|
||||
</div>
|
||||
<div>
|
||||
{#if config.plot_general_colorBackground}
|
||||
{#if config.plotConfiguration_colorBackground}
|
||||
<input type="radio" id="colb-false" name="value" value="false" />
|
||||
{:else}
|
||||
<input type="radio" id="colb-false-checked" name="value" value="false" checked />
|
||||
@@ -196,10 +196,10 @@
|
||||
</div>
|
||||
{/if}
|
||||
</CardTitle>
|
||||
<input type="hidden" name="key" value="plot_general_colorblindMode" />
|
||||
<input type="hidden" name="key" value="plotConfiguration_colorblindMode" />
|
||||
<div class="mb-3">
|
||||
<div>
|
||||
{#if config?.plot_general_colorblindMode}
|
||||
{#if config?.plotConfiguration_colorblindMode}
|
||||
<input type="radio" id="cbm-true-checked" name="value" value="true" checked />
|
||||
{:else}
|
||||
<input type="radio" id="cbm-true" name="value" value="true" />
|
||||
@@ -207,7 +207,7 @@
|
||||
<label for="true">Yes</label>
|
||||
</div>
|
||||
<div>
|
||||
{#if config?.plot_general_colorblindMode}
|
||||
{#if config?.plotConfiguration_colorblindMode}
|
||||
<input type="radio" id="cbm-false" name="value" value="false" />
|
||||
{:else}
|
||||
<input type="radio" id="cbm-false-checked" name="value" value="false" checked />
|
||||
|
||||
@@ -104,10 +104,10 @@
|
||||
>
|
||||
</div>{/if}
|
||||
</CardTitle>
|
||||
<input type="hidden" name="key" value="job_list_usePaging" />
|
||||
<input type="hidden" name="key" value="jobList_usePaging" />
|
||||
<div class="mb-3">
|
||||
<div>
|
||||
{#if config?.job_list_usePaging}
|
||||
{#if config?.jobList_usePaging}
|
||||
<input type="radio" id="true-checked" name="value" value="true" checked />
|
||||
{:else}
|
||||
<input type="radio" id="true" name="value" value="true" />
|
||||
@@ -115,7 +115,7 @@
|
||||
<label for="true">Paging with selectable count of jobs.</label>
|
||||
</div>
|
||||
<div>
|
||||
{#if config?.job_list_usePaging}
|
||||
{#if config?.jobList_usePaging}
|
||||
<input type="radio" id="false" name="value" value="false" />
|
||||
{:else}
|
||||
<input type="radio" id="false-checked" name="value" value="false" checked />
|
||||
|
||||
Reference in New Issue
Block a user