This commit is contained in:
Andras Bacsai
2022-10-18 14:45:30 +02:00
parent f1ea01e709
commit 8b83c38127
4 changed files with 28 additions and 29 deletions

View File

@@ -10,7 +10,7 @@ export async function migrateServicesToNewTemplate() {
if (service.type === 'plausibleanalytics' && service.plausibleAnalytics) await plausibleAnalytics(service) if (service.type === 'plausibleanalytics' && service.plausibleAnalytics) await plausibleAnalytics(service)
if (service.type === 'fider' && service.fider) await fider(service) if (service.type === 'fider' && service.fider) await fider(service)
if (service.type === 'minio' && service.minio) await minio(service) if (service.type === 'minio' && service.minio) await minio(service)
if (service.type === 'vscode' && service.vscodeserver) await vscodeserver(service) if (service.type === 'vscodeserver' && service.vscodeserver) await vscodeserver(service)
} }
} catch (error) { } catch (error) {
console.log(error) console.log(error)
@@ -19,7 +19,7 @@ export async function migrateServicesToNewTemplate() {
} }
async function vscodeserver(service: any) { async function vscodeserver(service: any) {
const { password } = service.minio const { password } = service.vscodeserver
const secrets = [ const secrets = [
`PASSWORD@@@${password}`, `PASSWORD@@@${password}`,

View File

@@ -2,12 +2,12 @@ export default [
{ {
"templateVersion": "1.0.0", "templateVersion": "1.0.0",
"serviceDefaultVersion": "4.7.1", "serviceDefaultVersion": "4.7.1",
"name": "codeserver", "name": "vscodeserver",
"displayName": "Code Server", "displayName": "VSCode Server",
"description": "code-server by Coder is VS Code running on a remote server, accessible through the browser.", "description": "vscode-server by Coder is VS Code running on a remote server, accessible through the browser.",
"services": { "services": {
"$$id": { "$$id": {
"name": "Code Server", "name": "VSCode Server",
"documentation": "Taken from https://github.com/coder/code-server/. ", "documentation": "Taken from https://github.com/coder/code-server/. ",
"depends_on": [], "depends_on": [],
"image": "codercom/code-server:$$core_version", "image": "codercom/code-server:$$core_version",
@@ -32,7 +32,10 @@ export default [
"name": "PASSWORD", "name": "PASSWORD",
"label": "Password", "label": "Password",
"defaultValue": "$$generate_password", "defaultValue": "$$generate_password",
"description": "" "description": "",
"extras": {
"isVisibleOnUI": true,
}
} }
] ]
}, },

View File

@@ -129,7 +129,7 @@ export async function parseAndFindServiceTemplates(service: any, workdir?: strin
const description = foundTemplate.variables.find(v => v.name === envKey)?.description const description = foundTemplate.variables.find(v => v.name === envKey)?.description
const defaultValue = foundTemplate.variables.find(v => v.name === envKey)?.defaultValue const defaultValue = foundTemplate.variables.find(v => v.name === envKey)?.defaultValue
const extras = foundTemplate.variables.find(v => v.name === envKey)?.extras const extras = foundTemplate.variables.find(v => v.name === envKey)?.extras
if (envValue.startsWith('$$config')) { if (envValue.startsWith('$$config') || extras?.isVisibleOnUI) {
parsedTemplate[realKey].environment.push( parsedTemplate[realKey].environment.push(
{ name: envKey, value: envValue, label, description, defaultValue, extras } { name: envKey, value: envValue, label, description, defaultValue, extras }
) )

View File

@@ -323,25 +323,10 @@
{:else if $status.service.overallStatus === 'stopped'} {:else if $status.service.overallStatus === 'stopped'}
<button <button
class="btn btn-sm gap-2" class="btn btn-sm gap-2"
class:btn-primary={$status.application.overallStatus !== 'degraded'}
disabled={!$isDeploymentEnabled} disabled={!$isDeploymentEnabled}
on:click={() => startService()} on:click={() => startService()}
> >
{#if $status.application.overallStatus !== 'degraded'} {#if $status.application.overallStatus === 'degraded'}
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M7 4v16l13 -8z" />
</svg>
{:else}
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6" class="w-6 h-6"
@@ -358,12 +343,23 @@
transform="rotate(-45 12 12)" transform="rotate(-45 12 12)"
/> />
</svg> </svg>
{$status.application.statuses.length === 1 ? 'Force Redeploy' : 'Redeploy Stack'}
{:else if $status.application.overallStatus === 'stopped'}
<svg
xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6 text-pink-500"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M7 4v16l13 -8z" />
</svg>
Deploy
{/if} {/if}
{$status.application.overallStatus === 'degraded'
? $status.application.statuses.length === 1
? 'Force Redeploy'
: 'Redeploy Stack'
: 'Deploy'}
</button> </button>
{/if} {/if}
</div> </div>