always show docker account

This commit is contained in:
mbecker20
2023-02-28 03:57:35 +00:00
parent 94949291c2
commit 2c9fc2bad4
2 changed files with 15 additions and 7 deletions

View File

@@ -42,9 +42,7 @@ const Config: Component<{}> = () => {
element: () => (
<Grid class="config-items scroller" placeItems="start center">
<Image />
<Show when={deployment.docker_run_args.image}>
<DockerAccount />
</Show>
<DockerAccount />
<Network />
<Restart />
<Env />

View File

@@ -1,4 +1,4 @@
import { Component, createEffect, createSignal, Show } from "solid-js";
import { Component, createEffect, createSignal } from "solid-js";
import { client } from "../../../../..";
import { ServerStatus } from "../../../../../types";
import { combineClasses } from "../../../../../util/helpers";
@@ -16,6 +16,16 @@ const DockerAccount: Component<{}> = (p) => {
.then(setDockerAccounts);
}
});
const when_none_selected = () => {
if (deployment.build_id) {
return "same as build"
} else {
return "none"
}
}
const accounts = () => {
return [when_none_selected(), ...(dockerAccounts() || [])];
}
return (
<Flex
class={combineClasses("config-item shadow")}
@@ -26,11 +36,11 @@ const DockerAccount: Component<{}> = (p) => {
<h1>docker account</h1>
<Selector
targetClass="blue"
items={["none", ...dockerAccounts()!]}
selected={deployment.docker_run_args.docker_account || "none"}
items={accounts()}
selected={deployment.docker_run_args.docker_account || when_none_selected()}
onSelect={(account) =>
setDeployment("docker_run_args", {
docker_account: account === "none" ? undefined : account,
docker_account: account === when_none_selected() ? undefined : account,
})
}
position="bottom right"