-
- Storage Size:
- {initialValue?.storage_mb}MB
-
+
+
+
General Information
+
+ Name:
+ {initialValue?.name}
+ {#if sys_info?.connector === ConnectorType.Kubernetes}
+ Namespace:
+ {initialValue?.namespace}
+ {/if}
+ Version:
+ {initialValue?.version}
+ Replicas:
+ {initialValue?.replicas}
+
+
+
+
+
Resources (per replica)
+
+ Memory Request:
+ {initialValue?.resources.memory_request_mb} MB
+ Memory Limit:
+ {initialValue?.resources.memory_limit_mb} MB
+ CPU Request:
+ {initialValue?.resources.cpu_request_millicores}m
+ CPU Limit:
+ {initialValue?.resources.cpu_limit_millicores}m
+ {#if sys_info?.connector === ConnectorType.Kubernetes}
+ Storage Size:
+ {initialValue?.resources.storage_mb} MB
+ {/if}
+
+
+
+
+
Connection
+
+ External Access:
+ {initialValue?.connection.external_access
+ ? 'Enabled'
+ : 'Disabled'}
+ SSL:
+ {initialValue?.connection.ssl_enabled ? 'Enabled' : 'Disabled'}
+ {#if initialValue?.connection.ssl_enabled}
+ Cert Source:
+ {initialValue?.connection.ssl_cert.type}
+ Key Source:
+ {initialValue?.connection.ssl_key.type}
+ Custom CA:
+ {initialValue?.connection.ca_enabled
+ ? 'Enabled'
+ : 'Disabled'}
+ {#if initialValue?.connection.ca_enabled}
+ CA Source:
+ {initialValue?.connection.ssl_ca.type}
+ {/if}
+ {/if}
+
+
+
+
+
Backup Configuration
+
+ Backups:
+ {initialValue?.backup.enabled ? 'Enabled' : 'Disabled'}
+ {#if initialValue?.backup.enabled}
+ Schedule:
+ {initialValue?.backup.schedule}
+ Retention:
+ {initialValue?.backup.retention_days} days
+ Location:
+ {initialValue?.backup.storage_location || 'Default'}
+ {/if}
+
+
+
+
+
Monitoring
+
+ Monitoring:
+ {initialValue?.monitoring.enabled ? 'Enabled' : 'Disabled'}
+ {#if initialValue?.monitoring.enabled}
+ {#if sys_info?.connector === ConnectorType.Kubernetes}
+ Deploy Resources:
+ {initialValue?.monitoring.deploy_monitoring ? 'Yes' : 'No'}
+ {/if}
+ External Access:
+ {initialValue?.monitoring.external_access
+ ? 'Enabled'
+ : 'Disabled'}
+ {/if}
+
+
+
+
+
Advanced
+
+ Allow Alter System:
+ {initialValue?.advanced.allow_alter_system ? 'Yes' : 'No'}
+ {#if initialValue?.advanced.extra_params && Object.keys(initialValue.advanced.extra_params).length > 0}
+ Extra Params:
+
+ {Object.entries(initialValue.advanced.extra_params)
+ .map(([k, v]) => `${k}=${v}`)
+ .join(', ')}
+
+ {/if}
+
+
-
diff --git a/frontend/src/routes/deployments/postgres/create/schema.svelte.ts b/frontend/src/routes/deployments/postgres/create/schema.svelte.ts
index f4d673f..9a1f897 100644
--- a/frontend/src/routes/deployments/postgres/create/schema.svelte.ts
+++ b/frontend/src/routes/deployments/postgres/create/schema.svelte.ts
@@ -1,4 +1,12 @@
-import type { CreateDeployment } from '$lib/backend/postgres.svelte';
+import type {
+ CreateDeployment,
+ CreateDeploymentAdvanced,
+ CreateDeploymentBackup,
+ CreateDeploymentConnection,
+ CreateDeploymentMonitoring,
+ CreateDeploymentResources,
+ SslFile
+} from '$lib/backend/postgres.svelte';
import type { FormRecord } from 'positron-components/components/form';
import z from 'zod';
@@ -23,17 +31,124 @@ export enum PostgresVersion {
V18 = '18'
}
-export const reformatData = (data: FormRecord): CreateDeployment => {
- let storage_size = data.storage_size as number;
- let storage_size_unit = (data.storage_size_unit as string[])[0];
- let storage_mb = Math.ceil(
- (storage_size * (units as Record
)[storage_size_unit]) /
- (1000 * 1000)
- );
+export const reformatData = async (
+ data: FormRecord
+): Promise => {
+ const getUnit = (key: string) => (data[key] as string[])[0];
+ const calcMb = (amountKey: string, unitKey: string) => {
+ const amount = data[amountKey] as number;
+ const unit = getUnit(unitKey);
+ return Math.ceil(
+ (amount * (units as Record)[unit]) / (1000 * 1000)
+ );
+ };
+
+ const resources: CreateDeploymentResources = {
+ storage_mb: calcMb('storage_size', 'storage_size_unit'),
+ memory_request_mb: calcMb(
+ 'memory_request_size',
+ 'memory_request_size_unit'
+ ),
+ memory_limit_mb: calcMb('memory_limit_size', 'memory_limit_size_unit'),
+ cpu_request_millicores: data.cpu_request as number,
+ cpu_limit_millicores: data.cpu_limit as number
+ };
+
+ const backup: CreateDeploymentBackup = data.backups_enabled
+ ? {
+ enabled: true,
+ schedule: data.backup_schedule as string,
+ retention_days: data.backup_retention as number,
+ storage_location: data.backup_storage_location as string
+ }
+ : { enabled: false };
+
+ const formatSsl = async (prefix: string): Promise => {
+ const source = (data[`${prefix}_source`] as CertSource[])[0];
+ switch (source) {
+ case CertSource.Text:
+ return {
+ type: CertSource.Text,
+ content: data[`${prefix}_text`] as string
+ };
+ case CertSource.File:
+ let file = data[`${prefix}_file`] as File;
+ let content = await file.text();
+
+ return { type: CertSource.Text, content };
+ case CertSource.Reference:
+ return {
+ type: CertSource.Reference,
+ ref_name: data[`${prefix}_ref_name`] as string,
+ ref_key: data[`${prefix}_ref_key`] as string
+ };
+ case CertSource.HostFilePath:
+ return {
+ type: CertSource.HostFilePath,
+ host_file_path: data[`${prefix}_host_file_path`] as string
+ };
+ case CertSource.Auto:
+ return { type: CertSource.Auto };
+ }
+ };
+
+ let connection: CreateDeploymentConnection = {
+ external_access: data.external_access as boolean,
+ ssl_enabled: false
+ };
+
+ if (data.ssl_enabled) {
+ const ssl_cert = await formatSsl('ssl_cert');
+ const ssl_key = await formatSsl('ssl_key');
+
+ let caPart: { ca_enabled: false } | { ca_enabled: true; ssl_ca: SslFile } =
+ { ca_enabled: false };
+ if (data.ssl_ca_enabled) {
+ caPart = { ca_enabled: true, ssl_ca: await formatSsl('ssl_ca') };
+ }
+
+ connection = {
+ external_access: data.external_access as boolean,
+ ssl_enabled: true,
+ ssl_cert,
+ ssl_key,
+ ...caPart
+ };
+ }
+
+ const monitoring: CreateDeploymentMonitoring = data.monitoring_enabled
+ ? {
+ enabled: true,
+ external_access: data.monitoring_external_access as boolean,
+ deploy_monitoring: data.deploy_monitoring_resources as boolean
+ }
+ : { enabled: false };
+
+ const advanced: CreateDeploymentAdvanced = {
+ allow_alter_system: data.allow_alter_system as boolean,
+ extra_params: (data.extra_database_parameters as string)
+ .split(',')
+ .filter((p) => p.trim().length > 0)
+ .reduce(
+ (acc, curr) => {
+ const [k, v] = curr.split('=');
+ if (k && v) acc[k.trim()] = v.trim();
+ return acc;
+ },
+ {} as Record
+ )
+ };
return {
name: data.name as string,
- storage_mb
+ namespace: data.namespace as string,
+ version: (data.version as PostgresVersion[])[0],
+ replicas: data.replicas as number,
+ resources,
+ backup,
+ connection,
+ monitoring,
+ advanced
};
};
@@ -190,7 +305,7 @@ export const connection = z
export const monitoring = z.object({
monitoring_enabled: z.boolean().default(false),
- external_access: z.boolean().default(false),
+ monitoring_external_access: z.boolean().default(false),
deploy_monitoring_resources: z.boolean().default(true)
});
From 47b675dcc66b8e188067a75ea5f42974ed8b9f94 Mon Sep 17 00:00:00 2001
From: GitHub Action
Date: Thu, 20 Nov 2025 14:03:00 +0000
Subject: [PATCH 12/15] Fix code style issues with Prettier
---
frontend/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/package.json b/frontend/package.json
index 8f7728c..ac0587f 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -53,4 +53,4 @@
"lightningcss-linux-x64-gnu": "^1.30.1",
"lightningcss-win32-x64-msvc": "^1.30.1"
}
-}
\ No newline at end of file
+}
From 2e6673cbd60f3aaa93e1e4a856aecbd819a0ee42 Mon Sep 17 00:00:00 2001
From: ProfiiDev <92174452+Profiidev@users.noreply.github.com>
Date: Thu, 20 Nov 2025 17:09:42 +0100
Subject: [PATCH 13/15] fix: use textarea for larger inputs
---
.../src/lib/components/form/FormArea.svelte | 41 +++++++++++++++++++
.../postgres/create/Advanced.svelte | 7 ++--
.../postgres/create/SslFile.svelte | 6 +--
.../postgres/create/schema.svelte.ts | 26 ++++++++++--
4 files changed, 70 insertions(+), 10 deletions(-)
create mode 100644 frontend/src/lib/components/form/FormArea.svelte
diff --git a/frontend/src/lib/components/form/FormArea.svelte b/frontend/src/lib/components/form/FormArea.svelte
new file mode 100644
index 0000000..342531e
--- /dev/null
+++ b/frontend/src/lib/components/form/FormArea.svelte
@@ -0,0 +1,41 @@
+
+
+
+
+ {#snippet children({ props })}
+ {label}
+
+ {/snippet}
+
+
+
diff --git a/frontend/src/routes/deployments/postgres/create/Advanced.svelte b/frontend/src/routes/deployments/postgres/create/Advanced.svelte
index b3920e2..abcedd5 100644
--- a/frontend/src/routes/deployments/postgres/create/Advanced.svelte
+++ b/frontend/src/routes/deployments/postgres/create/Advanced.svelte
@@ -1,12 +1,12 @@