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

View File

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

View File

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

View File

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

View File

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

View File

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