diff --git a/assets/base-style.css b/assets/base-style.css index e882a64..ea74c2f 100644 --- a/assets/base-style.css +++ b/assets/base-style.css @@ -234,7 +234,7 @@ } .base-shape { - height: 2.5rem; + height: 2.25rem; padding: 0.5rem; } diff --git a/assets/style.css b/assets/style.css index a03763e..9e986c1 100644 --- a/assets/style.css +++ b/assets/style.css @@ -70,4 +70,14 @@ html, body, #__nuxt { } .even > .grid-element { background-color: rgb(233, 233, 233); +} + +.label { + background-color: var(--primary-color); + border-radius: 0.25rem; + color: white; + height: 1.75rem; + display: flex; + align-items: center; + padding: 0rem 0.5rem; } \ No newline at end of file diff --git a/classes/monitoring/MonitoringCollection.ts b/classes/monitoring/MonitoringCollection.ts new file mode 100644 index 0000000..23f4a74 --- /dev/null +++ b/classes/monitoring/MonitoringCollection.ts @@ -0,0 +1,27 @@ +export class MonitoringCollection +{ + constructor ( + public id: string, + public name: string, + public configs: MonitoringConfig[] + ) {} + + static get(onSuccess: (collections: MonitoringCollection[]) => void) + { + axios.get(ApiConfig.getHttpBase() + '/monitoring-collections') + .then((response) => { + onSuccess(response.data); + }); + } + + static getById(id: string, onSuccess: (collection: MonitoringCollection) => void) + { + axios.get(ApiConfig.getHttpBase() + '/monitoring-collections/' + id) + .then((response) => { + onSuccess(response.data); + }); + } +} + +import axios from "axios"; +import type { MonitoringConfig } from "./MonitoringConfig"; diff --git a/classes/monitoring/MonitoringConfig.ts b/classes/monitoring/MonitoringConfig.ts new file mode 100644 index 0000000..80e64ab --- /dev/null +++ b/classes/monitoring/MonitoringConfig.ts @@ -0,0 +1,43 @@ +import axios from "axios"; +import { MonitoringTargetConfigCreation } from "./MonitoringTargetConfig"; +import type { MonitoringType } from "./MonitoringType"; + +export class MonitoringConfig +{ + constructor ( + public id: string, + public configName: string, + public type: string, + public interval: string, + public volumeConfig: VolumeConfig + ) {} + + static create(config: MonitoringConfigCreation) + { + axios.post(ApiConfig.getHttpBase() + '/monitorings', config) + .then(() => { + + }); + } +} + +class VolumeConfig +{ + constructor ( + public mountPath: string, + public containerName: string + ) {} +} + +export class MonitoringConfigCreation { + configName?: string; + type?: MonitoringType; + interval?: string; + volumeConfig: VolumeConfigCreation = new VolumeConfigCreation(); + targetConfig: MonitoringTargetConfigCreation = new MonitoringTargetConfigCreation(); +} + +class VolumeConfigCreation { + mountPath?: string + containerName?: string +} diff --git a/classes/monitoring/MonitoringTargetConfig.ts b/classes/monitoring/MonitoringTargetConfig.ts new file mode 100644 index 0000000..bd3c7c9 --- /dev/null +++ b/classes/monitoring/MonitoringTargetConfig.ts @@ -0,0 +1,10 @@ +import type { TargetType } from "./TargetType"; + +export class MonitoringTargetConfigCreation { + type?: TargetType; + namespace?: string; + deploymentName?: string; + statefulSetName?: string; + labelKey?: string; + labelValue?: string; +} \ No newline at end of file diff --git a/classes/monitoring/MonitoringTimeframe.ts b/classes/monitoring/MonitoringTimeframe.ts new file mode 100644 index 0000000..86d804f --- /dev/null +++ b/classes/monitoring/MonitoringTimeframe.ts @@ -0,0 +1,14 @@ +export const enum Timeframe +{ + LAST_10_MINUTES = "LAST_10_MINUTES", + LAST_30_MINUTES = "LAST_30_MINUTES", + LAST_HOUR = "LAST_HOUR", + LAST_3_HOURS = "LAST_3_HOURS", + LAST_6_HOURS = "LAST_6_HOURS", + LAST_12_HOURS = "LAST_12_HOURS", + TODAY = "TODAY", + LAST_24_HOURS = "LAST_24_HOURS", + LAST_7_DAYS = "LAST_7_DAYS", + LAST_30_DAYS = "LAST_30_DAYS", + LAST_90_DAYS = "LAST_90_DAYS" +} \ No newline at end of file diff --git a/classes/monitoring/MonitoringType.ts b/classes/monitoring/MonitoringType.ts new file mode 100644 index 0000000..39b7345 --- /dev/null +++ b/classes/monitoring/MonitoringType.ts @@ -0,0 +1,6 @@ +export enum MonitoringType +{ + VOLUME = "VOLUME", + WORKLOAD = "WORKLOAD", + HEALTHCHECK = "HEALTHCHECK" +} \ No newline at end of file diff --git a/classes/monitoring/TargetType.ts b/classes/monitoring/TargetType.ts new file mode 100644 index 0000000..18a0278 --- /dev/null +++ b/classes/monitoring/TargetType.ts @@ -0,0 +1,6 @@ +export enum TargetType +{ + LABEL = "LABEL", + STATEFUL_SET = "STATEFUL_SET", + DEPLOYENT = "DEPLOYMENT" +} \ No newline at end of file diff --git a/components/LogPopup.vue b/components/LogPopup.vue index d81ba8d..cfcfeab 100644 --- a/components/LogPopup.vue +++ b/components/LogPopup.vue @@ -31,6 +31,10 @@ const emits = defineEmits<{ (e: 'close'): void }>() +function close() { + +} + const scrollComponent = ref(); const logRepo = new LogRepo(); @@ -40,6 +44,9 @@ onMounted(() => { scrollComponent.value.scrollToBottom(); }); }); +onUnmounted(() => { + logRepo.clear(); +}); onMounted(() => { document.addEventListener('keydown', (event) => { diff --git a/components/MonitoringSidebar.vue b/components/MonitoringSidebar.vue new file mode 100644 index 0000000..02055f3 --- /dev/null +++ b/components/MonitoringSidebar.vue @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file diff --git a/components/monitorings/CpuChartConfig.ts b/components/monitorings/CpuChartConfig.ts new file mode 100644 index 0000000..4d845c6 --- /dev/null +++ b/components/monitorings/CpuChartConfig.ts @@ -0,0 +1,55 @@ +import dayjs, { Dayjs } from "dayjs"; + +export function CPU_CHART_CONFIG(from: Date, to: Date) { + const lineColor = '#636363ff'; + return { + type: 'line', + options: { + animation: false, + plugins: { + title: { + text: 'Chart.js Time Scale', + display: true + } + }, + aspectRatio: 2.75, + scales: { + x: { + type: 'time', + time: { + // Luxon format string + tooltipFormat: 'DD.MM' + }, + ticks: { + autoSkip: true, + maxTicksLimit: 6, + align: 'center', + color: lineColor, + callback: function (value: number) { + return dayjs(new Date(value)).format("HH:mm"); + } + }, + min: from, + max: to, + grid: { + color: lineColor, + borderColor: lineColor, + lineWidth: 1 + } + }, + y: { + beginAtZero: true, + ticks: { + stepSize: 20, + color: lineColor, + }, + grid: { + color: lineColor, + borderColor: lineColor, + lineWidth: 1 + } + } + } + } + } +} \ No newline at end of file diff --git a/components/monitorings/MonitoredResource.ts b/components/monitorings/MonitoredResource.ts index de2d557..02c3e9b 100644 --- a/components/monitorings/MonitoredResource.ts +++ b/components/monitorings/MonitoredResource.ts @@ -11,9 +11,14 @@ export class MonitoredResource public jobs: IndexCollection[] ) { } - static getMonitorings(monitoringId: string, onSuccess: (monitoredPod: MonitoredResource[]) => void) + static getMonitorings(monitoringId: string, from: number, to: number, onSuccess: (monitoredPod: MonitoredResource[]) => void) { - axios.get[]>(StringUtils.format("%s/monitorings/%s/jobs", ApiConfig.getHttpBase(), monitoringId)) + axios.get[]>(StringUtils.format("%s/monitorings/%s/jobs", ApiConfig.getHttpBase(), monitoringId), { + params: { + from: from, + to: to + } + }) .then(response => { onSuccess(response.data) }); @@ -43,7 +48,6 @@ export class MonitoredResource data.push(new Data(metrics.average, dayjs.utc(job.timestamp).local().toDate())); } } - console.log(data); return data; } } @@ -52,7 +56,8 @@ export class IndexCollection { constructor ( public metrics: Record, - public timestamp: Date + public timestamp: Date, + public unix: number ) { } } diff --git a/components/monitorings/Period.ts b/components/monitorings/Period.ts new file mode 100644 index 0000000..e9ef138 --- /dev/null +++ b/components/monitorings/Period.ts @@ -0,0 +1,7 @@ +export class Period +{ + constructor ( + public from: number, + public to: number + ) {} +} \ No newline at end of file diff --git a/components/monitorings/TimeframePicker.vue b/components/monitorings/TimeframePicker.vue new file mode 100644 index 0000000..7b3815f --- /dev/null +++ b/components/monitorings/TimeframePicker.vue @@ -0,0 +1,69 @@ + + + + + \ No newline at end of file diff --git a/components/monitorings/VolumeMonitoringPage.vue b/components/monitorings/VolumeMonitoringPage.vue deleted file mode 100644 index 7af79d2..0000000 --- a/components/monitorings/VolumeMonitoringPage.vue +++ /dev/null @@ -1,102 +0,0 @@ - - - - - \ No newline at end of file diff --git a/components/monitorings/cpu/CpuMonitoredPodComponent.vue b/components/monitorings/cpu/CpuMonitoredPodComponent.vue new file mode 100644 index 0000000..94e0e68 --- /dev/null +++ b/components/monitorings/cpu/CpuMonitoredPodComponent.vue @@ -0,0 +1,29 @@ + + + \ No newline at end of file diff --git a/components/monitorings/cpu/CpuMonitoringConfigComponent.vue b/components/monitorings/cpu/CpuMonitoringConfigComponent.vue new file mode 100644 index 0000000..4cb13da --- /dev/null +++ b/components/monitorings/cpu/CpuMonitoringConfigComponent.vue @@ -0,0 +1,32 @@ + + + \ No newline at end of file diff --git a/components/monitorings/memory/ChartConfig.ts b/components/monitorings/memory/ChartConfig.ts index 1552b2a..d9455f3 100644 --- a/components/monitorings/memory/ChartConfig.ts +++ b/components/monitorings/memory/ChartConfig.ts @@ -1,7 +1,8 @@ import { elements } from "chart.js"; import dayjs from "dayjs" -export function MEMORY_CHART_CONFIG() { +export function MEMORY_CHART_CONFIG(from: Date, to: Date) { + const lineColor = '#636363ff'; return { type: 'line', options: { @@ -23,26 +24,28 @@ export function MEMORY_CHART_CONFIG() { autoSkip: true, maxTicksLimit: 6, align: 'center', - color: '#cacacaff', + color: lineColor, callback: function (value: Date) { - return dayjs(value).format("HH:mm"); + return dayjs(new Date(value)).format("HH:mm"); } }, grid: { - color: '#cacacaff', - borderColor: '#cacacaff', + color: lineColor, + borderColor: lineColor, lineWidth: 1 }, + min: from, + max: to, }, y: { beginAtZero: true, ticks: { maxTicksLimit: 6, - color: '#cacacaff' + color: lineColor }, grid: { - color: '#cacacaff', - borderColor: '#cacacaff', + color: lineColor, + borderColor: lineColor, lineWidth: 1 } } diff --git a/components/monitorings/memory/MemoryMonitoredPodComponent.vue b/components/monitorings/memory/MemoryMonitoredPodComponent.vue index bc920a2..49f1b32 100644 --- a/components/monitorings/memory/MemoryMonitoredPodComponent.vue +++ b/components/monitorings/memory/MemoryMonitoredPodComponent.vue @@ -1,28 +1,31 @@ \ No newline at end of file diff --git a/pages/account/monitorings/collections/[collectionId]/add.vue b/pages/account/monitorings/collections/[collectionId]/add.vue new file mode 100644 index 0000000..8e82f87 --- /dev/null +++ b/pages/account/monitorings/collections/[collectionId]/add.vue @@ -0,0 +1,70 @@ + + + + + \ No newline at end of file diff --git a/pages/account/monitorings/collections/[collectionId]/index.vue b/pages/account/monitorings/collections/[collectionId]/index.vue new file mode 100644 index 0000000..46343ba --- /dev/null +++ b/pages/account/monitorings/collections/[collectionId]/index.vue @@ -0,0 +1,40 @@ + + + + + \ No newline at end of file diff --git a/pages/account/monitorings/collections/add.vue b/pages/account/monitorings/collections/add.vue new file mode 100644 index 0000000..542020b --- /dev/null +++ b/pages/account/monitorings/collections/add.vue @@ -0,0 +1,13 @@ + + + + + \ No newline at end of file