saving things

This commit is contained in:
Andras Bacsai
2022-10-21 15:51:32 +02:00
parent 049d5166e8
commit 5d60b5eb8b
12 changed files with 1681 additions and 207 deletions

View File

@@ -93,6 +93,10 @@
}
}
}
async function restartService() {
await stopService();
await startService();
}
async function stopService() {
const sure = confirm($t('database.confirm_stop', { name: service.name }));
if (sure) {
@@ -256,14 +260,14 @@
<button
disabled={!$isDeploymentEnabled}
class="btn btn-sm gap-2"
on:click={() => startService()}
on:click={() => restartService()}
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
@@ -322,12 +326,12 @@
</svg> Stop
</button>
{:else if $status.service.overallStatus === 'stopped'}
<button
class="btn btn-sm gap-2"
disabled={!$isDeploymentEnabled}
on:click={() => startService()}
>
{#if $status.application.overallStatus === 'degraded'}
{#if $status.service.overallStatus === 'degraded'}
<button
class="btn btn-sm gap-2"
disabled={!$isDeploymentEnabled}
on:click={() => restartService()}
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6"
@@ -345,7 +349,13 @@
/>
</svg>
{$status.application.statuses.length === 1 ? 'Force Redeploy' : 'Redeploy Stack'}
{:else if $status.application.overallStatus === 'stopped'}
</button>
{:else if $status.service.overallStatus === 'stopped'}
<button
class="btn btn-sm gap-2"
disabled={!$isDeploymentEnabled}
on:click={() => startService()}
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6 text-pink-500"
@@ -360,8 +370,8 @@
<path d="M7 4v16l13 -8z" />
</svg>
Deploy
{/if}
</button>
</button>
{/if}
{/if}
</div>
</div>

View File

@@ -94,7 +94,7 @@
<form on:submit|preventDefault={() => handleSubmit(service)}>
<button type="submit" class="box-selection relative text-xl font-bold hover:bg-primary">
<!-- <ServiceIcons type={service.name} /> -->
{service.displayName}
{service.name}
</button>
</form>
</div>

View File

@@ -308,6 +308,14 @@
required
/>
</div>
{#each Object.keys(template) as oneService}
{#each template[oneService].environment.filter( (a) => a.name.startsWith('COOLIFY_FQDN_') ) as variable}
<div class="grid grid-cols-2 items-center">
<label class="h-10" for={variable.name}>{variable.label || variable.name}</label>
<input class="w-full" name={variable.name} id={variable.name} value={variable.value} />
</div>
{/each}
{/each}
</div>
{#if forceSave}
<div class="flex-col space-y-2 pt-4 text-center">
@@ -373,6 +381,7 @@
/>
</div>
</div>
<div />
<div>
{#each Object.keys(template) as oneService}
@@ -381,15 +390,18 @@
class:border-b={template[oneService].environment.length > 0}
class:border-coolgray-500={template[oneService].environment.length > 0}
>
<div class="title font-bold pb-3">{template[oneService].name || oneService.replace(`${id}-`,'').replace(id,service.type)}</div>
<div class="title font-bold pb-3 capitalize">
{template[oneService].name ||
oneService.replace(`${id}-`, '').replace(id, service.type)}
</div>
<ServiceStatus id={oneService} />
</div>
<div class="grid grid-flow-row gap-2 px-4">
{#if template[oneService].environment.length > 0}
{#each template[oneService].environment as variable}
{#each template[oneService].environment.filter((a) => !a.name.startsWith('COOLIFY_FQDN_')) as variable}
<div class="grid grid-cols-2 items-center gap-2">
<label class="h-10" for={variable.name}>{variable.label}</label>
<label class="h-10" for={variable.name}>{variable.label || variable.name}</label>
{#if variable.defaultValue === '$$generate_fqdn'}
<input
class="w-full"
@@ -408,6 +420,15 @@
id={variable.name}
value={getDomain(service.fqdn)}
/>
{:else if variable.defaultValue === '$$generate_network'}
<input
class="w-full"
disabled
readonly
name={variable.name}
id={variable.name}
value={service.destinationDocker.network}
/>
{:else if variable.defaultValue === 'true' || variable.defaultValue === 'false'}
{#if variable.value === 'true' || variable.value === 'false'}
<select

View File

@@ -93,8 +93,9 @@
<div class="title font-bold pb-3">Service Logs</div>
</div>
</div>
<div class="grid grid-cols-4 gap-2 lg:gap-8 pb-4">
{#if template}
{#if template}
<div class="grid grid-cols-3 gap-2 lg:gap-8 pb-4">
{#each Object.keys(template) as service}
<button
on:click={() => selectService(service, true)}
@@ -102,11 +103,17 @@
class:bg-coolgray-200={selectedService !== service}
class="w-full rounded p-5 hover:bg-primary font-bold"
>
{service}</button
>
{#if template[service].name}
{template[service].name || ''} <br /><span class="text-xs">({service})</span>
{:else}
<span>{service}</span>
{/if}
</button>
{/each}
{/if}
</div>
</div>
{:else}
<div class="w-full flex justify-center font-bold text-xl">Loading components...</div>
{/if}
{#if selectedService}
<div class="flex flex-row justify-center space-x-2">
@@ -117,12 +124,6 @@
{:else}
<div class="relative w-full">
<div class="flex justify-start sticky space-x-2 pb-2">
{#if loadLogsInterval}
<button id="streaming" class="btn btn-sm bg-transparent border-none loading"
>Streaming logs</button
>
{/if}
<div class="flex-1" />
<button on:click={followBuild} class="btn btn-sm " class:bg-coollabs={followingLogs}>
<svg
xmlns="http://www.w3.org/2000/svg"
@@ -142,6 +143,11 @@
</svg>
{followingLogs ? 'Following Logs...' : 'Follow Logs'}
</button>
{#if loadLogsInterval}
<button id="streaming" class="btn btn-sm bg-transparent border-none loading"
>Streaming logs</button
>
{/if}
</div>
<div
bind:this={logsEl}