cleanup routes, cleanup root components

This commit is contained in:
Christoph Kluge
2025-12-15 15:10:10 +01:00
parent c5aff1a2ca
commit d56b0e93db
6 changed files with 21 additions and 43 deletions

View File

@@ -120,11 +120,6 @@ func setupClusterStatusRoute(i InfoType, r *http.Request) InfoType {
i["id"] = vars["cluster"] i["id"] = vars["cluster"]
i["cluster"] = vars["cluster"] i["cluster"] = vars["cluster"]
i["displayType"] = "DASHBOARD" i["displayType"] = "DASHBOARD"
from, to := r.URL.Query().Get("from"), r.URL.Query().Get("to")
if from != "" || to != "" {
i["from"] = from
i["to"] = to
}
return i return i
} }
@@ -133,11 +128,6 @@ func setupClusterDetailRoute(i InfoType, r *http.Request) InfoType {
i["id"] = vars["cluster"] i["id"] = vars["cluster"]
i["cluster"] = vars["cluster"] i["cluster"] = vars["cluster"]
i["displayType"] = "DETAILS" i["displayType"] = "DETAILS"
from, to := r.URL.Query().Get("from"), r.URL.Query().Get("to")
if from != "" || to != "" {
i["from"] = from
i["to"] = to
}
return i return i
} }
@@ -145,12 +135,7 @@ func setupDashboardRoute(i InfoType, r *http.Request) InfoType {
vars := mux.Vars(r) vars := mux.Vars(r)
i["id"] = vars["cluster"] i["id"] = vars["cluster"]
i["cluster"] = vars["cluster"] i["cluster"] = vars["cluster"]
i["displayType"] = "PUBLIC" i["displayType"] = "PUBLIC" // Used in Main Template
from, to := r.URL.Query().Get("from"), r.URL.Query().Get("to")
if from != "" || to != "" {
i["from"] = from
i["to"] = to
}
return i return i
} }

View File

@@ -6,9 +6,9 @@
--> -->
<script> <script>
import { // import {
getContext // getContext
} from "svelte" // } from "svelte"
import { import {
queryStore, queryStore,
gql, gql,
@@ -45,7 +45,7 @@
/*Const Init */ /*Const Init */
const { query: initq } = init(); const { query: initq } = init();
const client = getContextClient(); const client = getContextClient();
const useCbColors = getContext("cc-config")?.plotConfiguration_colorblindMode || false // const useCbColors = getContext("cc-config")?.plotConfiguration_colorblindMode || false
/* States */ /* States */
let from = $state(new Date(Date.now() - (5 * 60 * 1000))); let from = $state(new Date(Date.now() - (5 * 60 * 1000)));

View File

@@ -3,6 +3,7 @@
Properties: Properties:
- `presetCluster String`: The cluster to show status information for - `presetCluster String`: The cluster to show status information for
- `displayType String`: The type of status component to render
--> -->
<script> <script>
@@ -10,6 +11,7 @@
Row, Row,
Col, Col,
Card, Card,
CardBody
} from "@sveltestrap/sveltestrap"; } from "@sveltestrap/sveltestrap";
import DashDetails from "./status/DashDetails.svelte"; import DashDetails from "./status/DashDetails.svelte";
@@ -20,29 +22,20 @@
presetCluster, presetCluster,
displayType displayType
} = $props(); } = $props();
/*Const Init */
const displayStatusDetail = (displayType === 'DETAILS');
</script> </script>
<!-- <Row cols={1} class="mb-2"> {#if displayType === 'DETAILS'}
<Col> <DashDetails {presetCluster}/>
<h3 class="mb-0">Current Status of Cluster "{presetCluster.charAt(0).toUpperCase() + presetCluster.slice(1)}"</h3> {:else if displayType === 'DASHBOARD'}
</Col> <DashInternal {presetCluster}/>
</Row> --> {:else}
{#if displayType !== "DASHBOARD" && displayType !== "DETAILS"}
<Row> <Row>
<Col> <Col>
<Card body color="danger">Unknown displayList type! </Card> <Card color="danger">
<CardBody>
Unknown DisplayType for Status View!
</CardBody>
</Card>
</Col> </Col>
</Row> </Row>
{:else}
{#if displayStatusDetail}
<!-- ROW2-1: Node Overview (Grid Included)-->
<DashDetails {presetCluster}/>
{:else}
<!-- ROW2-2: Node List (Grid Included)-->
<DashInternal {presetCluster}/>
{/if}
{/if} {/if}

View File

@@ -5,7 +5,7 @@ import DashPublic from './DashPublic.root.svelte'
mount(DashPublic, { mount(DashPublic, {
target: document.getElementById('svelte-app'), target: document.getElementById('svelte-app'),
props: { props: {
presetCluster: infos.cluster, presetCluster: presetCluster,
}, },
context: new Map([ context: new Map([
['cc-config', clusterCockpitConfig] ['cc-config', clusterCockpitConfig]

View File

@@ -27,13 +27,13 @@
<main> <main>
<div class="container"> <div class="container">
{{block "content-public" .}} {{block "content-public" .}}
Whoops, you should not see this... [MAIN] Whoops, you should not see this... [PUBLIC]
{{end}} {{end}}
</div> </div>
</main> </main>
{{block "javascript-public" .}} {{block "javascript-public" .}}
Whoops, you should not see this... [JS] Whoops, you should not see this... [JS PUBLIC]
{{end}} {{end}}
{{else}} {{else}}

View File

@@ -7,7 +7,7 @@
{{end}} {{end}}
{{define "javascript-public"}} {{define "javascript-public"}}
<script> <script>
const infos = {{ .Infos }}; const presetCluster = {{ .Infos.cluster }};
const clusterCockpitConfig = {{ .Config }}; const clusterCockpitConfig = {{ .Config }};
</script> </script>
<script src='/build/dashpublic.js'></script> <script src='/build/dashpublic.js'></script>