From 93ec7b0f2b2d8c8535e8d62b446a2f2eff68c78d Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 17 Feb 2025 17:10:16 +0100 Subject: [PATCH] more work on new domains --- src/lib/components/index.ts | 1 + src/lib/constants.ts | 1 + .../domains/deleteDomainModal.svelte | 18 +- .../domain-[domain]/certificates/+page.svelte | 129 +++++++++++++ .../domain-[domain]/certificates/+page.ts | 59 +++++- .../deleteCertificateModal.svelte | 40 ++++ .../domains/domain-[domain]/settings/+page.ts | 3 +- .../domains/empty-domain-dark.svg | 173 ------------------ .../domains/empty-domain-light.svg | 173 ------------------ .../domains/deleteDomainModal.svelte | 20 +- 10 files changed, 251 insertions(+), 366 deletions(-) create mode 100644 src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/+page.svelte create mode 100644 src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/deleteCertificateModal.svelte delete mode 100644 src/routes/(console)/organization-[organization]/domains/empty-domain-dark.svg delete mode 100644 src/routes/(console)/organization-[organization]/domains/empty-domain-light.svg diff --git a/src/lib/components/index.ts b/src/lib/components/index.ts index 80f6a9178..d301cae03 100644 --- a/src/lib/components/index.ts +++ b/src/lib/components/index.ts @@ -81,3 +81,4 @@ export { default as Navbar } from './navbar.svelte'; export { default as Breadcrumbs } from './breadcrumbs.svelte'; export { default as Sidebar } from './sidebar.svelte'; export { default as BottomSheet } from './bottom-sheet/index'; +export { default as Confirm } from './confirm.svelte'; diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 006aa82d4..e91d89a57 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -46,6 +46,7 @@ export enum Dependencies { KEY = 'dependency:key', KEYS = 'dependency:keys', DOMAINS = 'dependency:domains', + DOMAIN = 'dependency:domains', WEBHOOK = 'dependency:webhook', WEBHOOKS = 'dependency:webhooks', MIGRATIONS = 'dependency:migrations', diff --git a/src/routes/(console)/organization-[organization]/domains/deleteDomainModal.svelte b/src/routes/(console)/organization-[organization]/domains/deleteDomainModal.svelte index 02f66f2fb..56b5d9b9f 100644 --- a/src/routes/(console)/organization-[organization]/domains/deleteDomainModal.svelte +++ b/src/routes/(console)/organization-[organization]/domains/deleteDomainModal.svelte @@ -1,5 +1,4 @@ - + {#if selectedDomain}

Are you sure you want to delete {selectedDomain.domain}? You will no longer be @@ -49,4 +47,4 @@ - + diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/+page.svelte b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/+page.svelte new file mode 100644 index 000000000..d00616c77 --- /dev/null +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/+page.svelte @@ -0,0 +1,129 @@ + + + + + + + + {#if data.certificates.total} + + + ID + Renewal + Expiry date + + + {#each data.certificates.certificates as certificate} + + + {certificate.$id} + + + {certificate.autoRenewal ? 'Auto' : ''} + {certificate.renewAt ? toLocaleDateTime(certificate.renewAt) : '-'} + + {certificate?.expiresAt ?? '-'} + + + + + + + + + { + e.preventDefault(); + selectedCertificate = certificate; + showAdvancedInfo = true; + toggle(e); + }}> + Advanced information + + { + e.preventDefault(); + selectedCertificate = certificate; + showDelete = true; + toggle(e); + }}> + Delete + + + + + + + + {/each} + + + + {:else if data?.search} + + + + + + {:else} + + + + + + + + {/if} + diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/+page.ts b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/+page.ts index bda6b7bdc..dbe25f057 100644 --- a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/+page.ts +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/+page.ts @@ -1,9 +1,62 @@ -import { Dependencies } from '$lib/constants'; +import { PAGE_LIMIT, Dependencies } from '$lib/constants'; +import { getSearch, pageToOffset, getLimit, getPage } from '$lib/helpers/load'; -export const load = async ({ parent, depends }) => { +export const load = async ({ parent, depends, url, route }) => { depends(Dependencies.DOMAINS); + const page = getPage(url); + const limit = getLimit(url, route, PAGE_LIMIT); + const offset = pageToOffset(page, limit); + const search = getSearch(url); const { domain } = await parent(); + + //TODO: fetch certificates return { - domain + domain, + certificates: mockCertificates, + offset, + limit, + search }; }; + +const mockCertificates = { + total: 3, + certificates: [ + { + $id: 'cert_123abc', + domain: 'example.com', + renewAt: '2023-01-15T10:30:00Z', + autoRenewal: true, + issuedAt: '2023-01-15T10:30:00Z', + expiresAt: '2024-01-15T10:30:00Z', + issuer: "Let's Encrypt", + status: 'active', + type: 'SSL/TLS', + algorithm: 'RSA 2048' + }, + { + $id: 'cert_456def', + domain: '*.example.com', + renewAt: '2023-03-20T14:15:00Z', + autoRenewal: false, + issuedAt: '2023-03-20T14:15:00Z', + expiresAt: '2024-03-20T14:15:00Z', + issuer: "Let's Encrypt", + status: 'active', + type: 'SSL/TLS', + algorithm: 'RSA 2048' + }, + { + $id: 'cert_789ghi', + domain: 'api.example.com', + renewAt: '2023-06-01T09:00:00Z', + autoRenewal: false, + issuedAt: '2023-06-01T09:00:00Z', + expiresAt: '2023-12-01T09:00:00Z', + issuer: "Let's Encrypt", + status: 'expired', + type: 'SSL/TLS', + algorithm: 'RSA 2048' + } + ] +}; diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/deleteCertificateModal.svelte b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/deleteCertificateModal.svelte new file mode 100644 index 000000000..a2a3f4c4b --- /dev/null +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/certificates/deleteCertificateModal.svelte @@ -0,0 +1,40 @@ + + + + + Are you sure you want to delete SSL certificate? This action is irreversible. + + + + + + diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.ts b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.ts index da699ec41..54b6037ea 100644 --- a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.ts +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.ts @@ -1,4 +1,5 @@ import { Dependencies } from '$lib/constants'; +import type { OrganizationList } from '$lib/stores/organization.js'; import { sdk } from '$lib/stores/sdk'; export const load = async ({ parent, depends }) => { @@ -6,6 +7,6 @@ export const load = async ({ parent, depends }) => { const { domain } = await parent(); return { domain, - organizations: await sdk.forConsole.teams.list() + organizations: (await sdk.forConsole.teams.list()) as OrganizationList }; }; diff --git a/src/routes/(console)/organization-[organization]/domains/empty-domain-dark.svg b/src/routes/(console)/organization-[organization]/domains/empty-domain-dark.svg deleted file mode 100644 index 71d19454d..000000000 --- a/src/routes/(console)/organization-[organization]/domains/empty-domain-dark.svg +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/routes/(console)/organization-[organization]/domains/empty-domain-light.svg b/src/routes/(console)/organization-[organization]/domains/empty-domain-light.svg deleted file mode 100644 index 71d19454d..000000000 --- a/src/routes/(console)/organization-[organization]/domains/empty-domain-light.svg +++ /dev/null @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/routes/(console)/project-[project]/sites/site-[site]/domains/deleteDomainModal.svelte b/src/routes/(console)/project-[project]/sites/site-[site]/domains/deleteDomainModal.svelte index 22a035b4e..37d8c9b19 100644 --- a/src/routes/(console)/project-[project]/sites/site-[site]/domains/deleteDomainModal.svelte +++ b/src/routes/(console)/project-[project]/sites/site-[site]/domains/deleteDomainModal.svelte @@ -1,5 +1,4 @@ - - Are you sure you want to delete {selectedDomain.domain}? You will no longer be able to - execute your function by visiting this domain. + + {#if selectedDomain} +

+ Are you sure you want to delete {selectedDomain.domain}? You will no longer be + able to execute your function by visiting this domain. +

+ {/if} + + + +