feat: Dual certificates

desing: Lots of design/css updates
version++
This commit is contained in:
Andras Bacsai
2022-02-17 22:14:06 +01:00
parent 4454287be9
commit bf047e2a3c
32 changed files with 670 additions and 587 deletions

View File

@@ -7,6 +7,7 @@
import { post } from '$lib/api';
import CopyPasswordField from '$lib/components/CopyPasswordField.svelte';
import Explainer from '$lib/components/Explainer.svelte';
import Setting from '$lib/components/Setting.svelte';
import { errorNotification } from '$lib/form';
import { toast } from '@zerodevx/svelte-toast';
import MinIo from './_MinIO.svelte';
@@ -18,6 +19,7 @@
let loading = false;
let loadingVerification = false;
let dualCerts = service.dualCerts;
async function handleSubmit() {
loading = true;
@@ -42,6 +44,17 @@
loadingVerification = false;
}
}
async function changeSettings(name) {
try {
if (name === 'dualCerts') {
dualCerts = !dualCerts;
}
await post(`/services/${id}/settings.json`, { dualCerts });
return toast.push('Settings saved.');
} catch ({ error }) {
return errorNotification(error);
}
}
</script>
<div class="mx-auto max-w-4xl px-6">
@@ -67,10 +80,10 @@
{/if}
</div>
<div class="grid grid-flow-row gap-2 px-10">
<div class="mt-2 grid grid-cols-3 items-center">
<div class="grid grid-flow-row gap-2">
<div class="mt-2 grid grid-cols-2 items-center px-10">
<label for="name">Name</label>
<div class="col-span-2 ">
<div>
<input
readonly={!$session.isAdmin}
name="name"
@@ -81,9 +94,9 @@
</div>
</div>
<div class="grid grid-cols-3 items-center">
<div class="grid grid-cols-2 items-center px-10">
<label for="destination">Destination</label>
<div class="col-span-2">
<div>
{#if service.destinationDockerId}
<div class="no-underline">
<input
@@ -96,9 +109,9 @@
{/if}
</div>
</div>
<div class="grid grid-cols-3">
<div class="grid grid-cols-2 px-10">
<label for="fqdn" class="pt-2">Domain (FQDN)</label>
<div class="col-span-2 ">
<div>
<CopyPasswordField
placeholder="eg: https://analytics.coollabs.io"
readonly={!$session.isAdmin && !isRunning}
@@ -114,6 +127,14 @@
/>
</div>
</div>
<div class="grid grid-cols-2 items-center px-10">
<Setting
bind:setting={dualCerts}
title="Generate SSL for www and non-www?"
description="It will generate certificates for both www and non-www. <br>You need to have <span class='font-bold text-pink-600'>both DNS entries</span> set in advance.<br><br>Service needs to be restarted."
on:click={() => changeSettings('dualCerts')}
/>
</div>
{#if service.type === 'plausibleanalytics'}
<PlausibleAnalytics bind:service {readOnly} />
{:else if service.type === 'minio'}