diff --git a/assets/base-style.css b/assets/base-style.css index 1941c57..991e01a 100644 --- a/assets/base-style.css +++ b/assets/base-style.css @@ -133,7 +133,7 @@ } .tile, *[class^='tile-'], *[class*=' tile-'] { - background-color: var(--background-color); + background-color: #ebebeb; border-radius: 0.25rem; overflow: hidden; width: 100%; diff --git a/classes/Deployment.ts b/classes/Deployment.ts new file mode 100644 index 0000000..c1b1cf8 --- /dev/null +++ b/classes/Deployment.ts @@ -0,0 +1,12 @@ +import type { Metadata } from "./Metadata"; + +export class Deployment +{ + metadata?: Metadata; + spec?: DeploymentSpec; +} + +export class DeploymentSpec +{ + replicas?: number; +} \ No newline at end of file diff --git a/components/RescaleDeploymentPopup.vue b/components/RescaleDeploymentPopup.vue new file mode 100644 index 0000000..e0e4dbf --- /dev/null +++ b/components/RescaleDeploymentPopup.vue @@ -0,0 +1,62 @@ + + + + + \ No newline at end of file diff --git a/components/Sidebar.vue b/components/Sidebar.vue index aec2fa8..0f51f97 100644 --- a/components/Sidebar.vue +++ b/components/Sidebar.vue @@ -6,6 +6,7 @@ Nodes Ingresses Services + Deployments Pods
diff --git a/components/SmallPopupTemplate.vue b/components/SmallPopupTemplate.vue new file mode 100644 index 0000000..5ef0cd2 --- /dev/null +++ b/components/SmallPopupTemplate.vue @@ -0,0 +1,61 @@ + + + + + \ No newline at end of file diff --git a/components/deployments/DeploymentComponent.vue b/components/deployments/DeploymentComponent.vue new file mode 100644 index 0000000..b26fbf0 --- /dev/null +++ b/components/deployments/DeploymentComponent.vue @@ -0,0 +1,25 @@ + + + \ No newline at end of file diff --git a/pages/dashboard/deployments.vue b/pages/dashboard/deployments.vue index 27e0f69..1b36e0d 100644 --- a/pages/dashboard/deployments.vue +++ b/pages/dashboard/deployments.vue @@ -1,3 +1,50 @@ \ No newline at end of file +
+
+

Name

+

Namespace

+

Replicas

+

Aktionen

+
+ +
+ + + + + \ No newline at end of file diff --git a/requests/deployments.ts b/requests/deployments.ts new file mode 100644 index 0000000..26a43e8 --- /dev/null +++ b/requests/deployments.ts @@ -0,0 +1,49 @@ +import axios from "axios"; +import type { Deployment } from "~/classes/Deployment"; + +export function getDeployments(namespace: string | undefined, onSuccess: (deployments: Deployment[]) => void) +{ + axios.get(useRuntimeConfig().public.apiBase + '/deployments', { + headers: { + Authorization: "Bearer " + requireToken() + }, + params: getParams(namespace) + }) + .then((response) => { + onSuccess(response.data); + }) + .catch(); +} + +export function rescaleDeployment(deployment: Deployment | undefined, replicaCount: number, onSuccess: () => void) +{ + if(deployment == null || deployment.metadata == null) + { + throw new Error("Deployment or metadata cannot be null"); + } + if(deployment.metadata.name == null || deployment.metadata.namespace == null) + { + throw new Error("Name or namespace cannot be null"); + } + axios.patch(useRuntimeConfig().public.apiBase + '/deployments/' + deployment.metadata.namespace + "/" + deployment.metadata.name, replicaCount, { + headers: { + Authorization: "Bearer " + requireToken(), + "Content-Type": "text/plain" + } + }) + .then(() => { + onSuccess(); + }) + .catch(); +} + +function getParams(namespace: string | undefined) +{ + if(namespace != undefined) + { + return { + namespace: namespace + } + } + return undefined; +} \ No newline at end of file