diff --git a/.tool-versions b/.tool-versions index 8505c76c..f4132be9 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -bun 1.1.42 -nodejs 22.12.0 +bun 1.2.2 +nodejs 22.14.0 diff --git a/bun.lockb b/bun.lockb index e3297d31..356de890 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 01b944a0..38177352 100644 --- a/package.json +++ b/package.json @@ -12,27 +12,27 @@ "lint": "eslint ." }, "devDependencies": { - "@nomimono/nomimono-css": "^0.4.25", - "@sveltejs/adapter-cloudflare": "^4.9.0", - "@sveltejs/adapter-node": "^5.2.11", - "@sveltejs/kit": "=2.11.1", - "@typescript-eslint/eslint-plugin": "^8.18.0", - "@typescript-eslint/parser": "^8.18.0", + "@nomimono/nomimono-css": "^0.6.0", + "@sveltejs/adapter-cloudflare": "^5.0.2", + "@sveltejs/adapter-node": "^5.2.12", + "@sveltejs/kit": "=2.17.1", + "@typescript-eslint/eslint-plugin": "^8.24.0", + "@typescript-eslint/parser": "^8.24.0", "clipboard": "^2.0.11", "dayjs": "^1.11.13", - "eslint": "^9.17.0", + "eslint": "^9.20.1", "eslint-plugin-svelte": "^2.46.1", "global": "^4.4.0", "gravatar-url": "^4.0.1", - "highcharts": "^11.4.8", + "highcharts": "=11.4.8", "js-cookie": "^3.0.5", - "sass": "^1.83.0", - "svelte": "^4.2.19", - "svelte-check": "^4.1.1", + "sass": "^1.84.0", + "svelte": "^5.19.10", + "svelte-check": "^4.1.4", "svelte-eslint-parser": "^0.43.0", "svelte-preprocess": "^6.0.3", - "sweetalert2": "^11.14.5", - "typescript": "~5.7.2", + "sweetalert2": "^11.16.0", + "typescript": "~5.7.3", "valid-url": "^1.0.9" }, "type": "module" diff --git a/src/global.d.ts b/src/global.d.ts deleted file mode 100644 index 92ebb190..00000000 --- a/src/global.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module 'svelte/elements' { - export interface SvelteWindowAttributes { - 'on:sidebar:toggle'?: () => void - } -} - -export {} diff --git a/src/lib/components/Chart.svelte b/src/lib/components/Chart.svelte index dfe82cad..5a9d5896 100644 --- a/src/lib/components/Chart.svelte +++ b/src/lib/components/Chart.svelte @@ -4,23 +4,27 @@ import * as hc from '$lib/hc' import { browser } from '$app/environment' - /** @type {string} */ - export let title - - /** @type {string} */ - export let unit - /** @typedef {Object} Series */ /** @property {string} prefix */ /** @property {Array} lines */ /** @property {string?} dashStyle */ /** @property {string?} color */ - /** @type {Series[]} */ - export let series - - /** @type {'line' | 'spline'} */ - export let type = 'line' + /** + * @typedef {Object} Props + * @property {string} title + * @property {string} unit + * @property {Series[]} series + * @property {'line' | 'spline'} [type] + */ + + /** @type {Props} */ + const { + title, + unit, + series, + type = 'line' + } = $props() /** @type {HTMLDivElement} */ let el @@ -53,13 +57,6 @@ } }) - $: { - if (series?.length === 0) clear() - series?.forEach((s) => { - update(s.prefix, s.lines, s.dashStyle, s.color) - }) - chart?.redraw() - } function update (name, lines, dashStyle, color) { if (!browser || !chart) return @@ -108,6 +105,14 @@ } return v } + + $effect(() => { + if (series?.length === 0) clear() + series?.forEach((s) => { + update(s.prefix, s.lines, s.dashStyle, s.color) + }) + chart?.redraw() + })
diff --git a/src/lib/components/DeploymentStatusIcon.svelte b/src/lib/components/DeploymentStatusIcon.svelte index feed8b6a..901c00eb 100644 --- a/src/lib/components/DeploymentStatusIcon.svelte +++ b/src/lib/components/DeploymentStatusIcon.svelte @@ -2,17 +2,21 @@ import { browser } from '$app/environment' import { onDestroy } from 'svelte' - /** @type {Api.DeploymentAction} */ - export let action - - /** @type {Api.DeploymentStatus} */ - export let status - - /** @type {string} */ - export let url + /** + * @typedef {Object} Props + * @property {Api.DeploymentAction} action + * @property {Api.DeploymentStatus} status + * @property {string} url + * @property {Api.DeploymentType} type + */ - /** @type {Api.DeploymentType} */ - export let type + /** @type {Props} */ + const { + action, + status, + url, + type + } = $props() const statusIconClass = { pending: 'fa-solid fa-spinner-third fa-spin', @@ -22,21 +26,10 @@ } /** @type {Api.PodStatus | null} */ - let podStatus + let podStatus = $state(null) /** @type {string} */ - let iconClass - - $: { - status - url - action - browser && fetchPodStatus() - } - $: { - podStatus - iconClass = getIconClass() - } + let iconClass = $state('') /** * @returns {string} @@ -93,6 +86,16 @@ destroyed = true fetchPodStatusTimeout && clearTimeout(fetchPodStatusTimeout) }) + $effect(() => { + status + url + action + browser && fetchPodStatus() + }) + $effect(() => { + podStatus + iconClass = getIconClass() + }) diff --git a/src/lib/components/ErrorRow.svelte b/src/lib/components/ErrorRow.svelte index 321292d7..a7ef4d2b 100644 --- a/src/lib/components/ErrorRow.svelte +++ b/src/lib/components/ErrorRow.svelte @@ -1,16 +1,24 @@ {#if error} -| URL | ++ + {`https://${deployment.url}`} + + + + + | +||
| Internal URL | ++ http://{deployment.internalUrl} + + + + | +||
| Address | +{deployment.address}:{deployment.nodePort} | +||
| URL | +Internal Address | - - {`https://${deployment.url}`} - - + {deployment.internalAddress}:{deployment.port} + | |
| Internal URL | +Type | - http://{deployment.internalUrl} - - - + {format.deploymentType(deployment.type)} + {#if deployment.internal} + (Internal) + {/if} | |
| Address | -{deployment.address}:{deployment.nodePort} | -||
| Internal Address | +Location | - {deployment.internalAddress}:{deployment.port} - + {deployment.location} + | |
| Type | -- {format.deploymentType(deployment.type)} - {#if deployment.internal} - (Internal) - {/if} - | -||
| Location | -- {deployment.location} - - - - | -||
| Image | -- {deployment.image} - - - - | -||
| Port | -{deployment.port}{deployment.protocol ? `:${deployment.protocol}` : ''} | -||
| Port | -{deployment.port}:{deployment.nodePort} | +Image | ++ {deployment.image} + + + + |
| Port | +{deployment.port}{deployment.protocol ? `:${deployment.protocol}` : ''} | +||
| Port | +{deployment.port}:{deployment.nodePort} | +||
| Disk | ++ {#if deployment.disk} + {deployment.disk.name} + (mount: {deployment.disk.mountPath || '-'}, sub: {deployment.disk.subPath || '-'}) + {:else} + - + {/if} + | +||
| Disk | +Replicas | - {#if deployment.disk} - {deployment.disk.name} - (mount: {deployment.disk.mountPath || '-'}, sub: {deployment.disk.subPath || '-'}) + {#if deployment.minReplicas > 0} + {#if deployment.minReplicas === deployment.maxReplicas} + {deployment.minReplicas} + {:else} + {deployment.minReplicas} - {deployment.maxReplicas} + {/if} {:else} - {/if} | |
| Replicas | -- {#if deployment.minReplicas > 0} - {#if deployment.minReplicas === deployment.maxReplicas} - {deployment.minReplicas} - {:else} - {deployment.minReplicas} - {deployment.maxReplicas} - {/if} - {:else} - - - {/if} - | -||
| Schedule | +{deployment.schedule} | +||
| Schedule | -{deployment.schedule} | +Command | +{deployment.command.join(' ') || '-'} |
| Command | -{deployment.command.join(' ') || '-'} | -||
| Args | -{deployment.args.join(' ') || '-'} | -||
| Pull Secret | -{deployment.pullSecret || '-'} | -||
| Workload Identity | -{deployment.workloadIdentity || '-'} | +Args | +{deployment.args.join(' ') || '-'} |
| CPU limited | -{format.cpuLimited(deployment.resources.limits.cpu)} | -||
| Memory allocated | -{format.memory(deployment.resources.requests.memory)} | -||
| Sidecars | -{deployment.sidecars?.length || 0} | -||
| Deployed At | -{format.datetime(deployment.createdAt)} | -||
| Deployed By | -{deployment.createdBy} | -||
| Allocated Price | -{deployment.allocatedPrice.toLocaleString(undefined, { maximumFractionDigits: 2 })} THB/month/replica | -||
| Pull Secret | +{deployment.pullSecret || '-'} | +||
| Workload Identity | +{deployment.workloadIdentity || '-'} | +||
| CPU limited | +{format.cpuLimited(deployment.resources.limits.cpu)} | +||
| Memory allocated | +{format.memory(deployment.resources.requests.memory)} | +||
| Sidecars | +{deployment.sidecars?.length || 0} | +||
| Deployed At | +{format.datetime(deployment.createdAt)} | +||
| Deployed By | +{deployment.createdBy} | +||
| Allocated Price | +{deployment.allocatedPrice.toLocaleString(undefined, { maximumFractionDigits: 2 })} THB/month/replica | +