feat: add custom version/tag

This commit is contained in:
Andras Bacsai
2023-04-18 14:46:40 +02:00
parent 7cfe98d988
commit 29fa421945

View File

@@ -43,6 +43,7 @@
return true; return true;
} }
}); });
let customVersion: string;
$: isDisabled = $: isDisabled =
!$appSession.isAdmin || !$appSession.isAdmin ||
$status.service.overallStatus === 'degraded' || $status.service.overallStatus === 'degraded' ||
@@ -111,6 +112,7 @@
setLocation(service); setLocation(service);
forceSave = false; forceSave = false;
$isDeploymentEnabled = checkIfDeploymentEnabledServices(service); $isDeploymentEnabled = checkIfDeploymentEnabledServices(service);
customVersion = null;
return addToast({ return addToast({
message: 'Configuration saved.', message: 'Configuration saved.',
type: 'success' type: 'success'
@@ -196,26 +198,12 @@
async function selectTag(event: any) { async function selectTag(event: any) {
service.version = event.detail.value; service.version = event.detail.value;
} }
async function setCustomVersion() {
service.version = customVersion;
}
onMount(async () => { onMount(async () => {
if (browser && window.location.hostname === 'demo.coolify.io' && !service.fqdn) { if (browser && window.location.hostname === 'demo.coolify.io' && !service.fqdn) {
service.fqdn = `http://${cuid()}.demo.coolify.io`; service.fqdn = `http://${cuid()}.demo.coolify.io`;
// if (service.type === 'wordpress') {
// service.wordpress.mysqlDatabase = 'db';
// }
// if (service.type === 'plausibleanalytics') {
// service.plausibleAnalytics.email = 'noreply@demo.com';
// service.plausibleAnalytics.username = 'admin';
// }
// if (service.type === 'minio') {
// service.minio.apiFqdn = `http://${cuid()}.demo.coolify.io`;
// }
// if (service.type === 'ghost') {
// service.ghost.mariadbDatabase = 'db';
// }
// if (service.type === 'fider') {
// service.fider.emailNoreply = 'noreply@demo.com';
// }
// await handleSubmit();
} }
}); });
</script> </script>
@@ -224,7 +212,7 @@
<form id="saveForm" on:submit|preventDefault={handleSubmit}> <form id="saveForm" on:submit|preventDefault={handleSubmit}>
<div class="mx-auto w-full"> <div class="mx-auto w-full">
<div class="flex flex-row border-b border-coolgray-500 mb-6 space-x-2"> <div class="flex flex-row border-b border-coolgray-500 mb-6 space-x-2">
<div class="title font-bold pb-3 ">General</div> <div class="title font-bold pb-3">General</div>
{#if $appSession.isAdmin} {#if $appSession.isAdmin}
<button <button
type="submit" type="submit"
@@ -289,6 +277,7 @@
</div> </div>
<div class="grid grid-cols-2 items-center"> <div class="grid grid-cols-2 items-center">
<label for="version">Version / Tag</label> <label for="version">Version / Tag</label>
<div class="flex gap-2">
{#if tags.tags?.length > 0} {#if tags.tags?.length > 0}
<div class="custom-select-wrapper w-full"> <div class="custom-select-wrapper w-full">
<Select <Select
@@ -303,9 +292,11 @@
isClearable={false} isClearable={false}
/> />
</div> </div>
{:else} {:else}
<input class="w-full border-red-500" disabled placeholder="Error getting tags..." /> <input class="w-full border-red-500" disabled placeholder="Error getting tags..." />
{/if} {/if}
<input class="w-full" placeholder="Custom version" on:change={setCustomVersion} bind:value={customVersion} />
</div>
</div> </div>
<div class="grid grid-cols-2 items-center"> <div class="grid grid-cols-2 items-center">