forked from github-starred/komodo
rename deployments
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, createResource, Show } from "solid-js";
|
||||
import { Component, createResource, createSignal, Show } from "solid-js";
|
||||
import { useAppState } from "../../state/StateProvider";
|
||||
import { useUser } from "../../state/UserProvider";
|
||||
import {
|
||||
@@ -19,6 +19,8 @@ import { A, useParams } from "@solidjs/router";
|
||||
import { client } from "../..";
|
||||
import CopyMenu from "../CopyMenu";
|
||||
import ConfirmMenuButton from "../shared/ConfirmMenuButton";
|
||||
import Loading from "../shared/loading/Loading";
|
||||
import { AutofocusInput } from "../shared/Input";
|
||||
|
||||
const Header: Component<{}> = (p) => {
|
||||
const { deployments, servers, builds } = useAppState();
|
||||
@@ -71,6 +73,8 @@ const Header: Component<{}> = (p) => {
|
||||
return "unknown";
|
||||
}
|
||||
};
|
||||
const [editingName, setEditingName] = createSignal(false);
|
||||
const [updatingName, setUpdatingName] = createSignal(false);
|
||||
return (
|
||||
<>
|
||||
<Grid
|
||||
@@ -87,7 +91,34 @@ const Header: Component<{}> = (p) => {
|
||||
>
|
||||
<Flex alignItems="center" justifyContent="space-between">
|
||||
<Flex alignItems="center">
|
||||
<h1>{deployment()!.deployment.name}</h1>
|
||||
<Show
|
||||
when={editingName()}
|
||||
fallback={
|
||||
<button
|
||||
onClick={() => setEditingName(true)}
|
||||
style={{ padding: 0 }}
|
||||
>
|
||||
<h1>{deployment()!.deployment.name}</h1>
|
||||
</button>
|
||||
}
|
||||
>
|
||||
<Show
|
||||
when={!updatingName()}
|
||||
fallback={<Loading type="three-dot" />}
|
||||
>
|
||||
<AutofocusInput
|
||||
value={deployment().deployment.name}
|
||||
placeholder={deployment().deployment.name}
|
||||
onEnter={async (new_name) => {
|
||||
setUpdatingName(true);
|
||||
await client.rename_deployment(params.id, new_name);
|
||||
setEditingName(false);
|
||||
setUpdatingName(false);
|
||||
}}
|
||||
onBlur={() => setEditingName(false)}
|
||||
/>
|
||||
</Show>
|
||||
</Show>
|
||||
<div style={{ opacity: 0.7 }}>{image()}</div>
|
||||
</Flex>
|
||||
<Show when={userCanUpdate()}>
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ServerButton:hover {
|
||||
background-color: rgba(c.$lightblue, 0.5);
|
||||
}
|
||||
// .ServerButton:hover {
|
||||
// background-color: rgba(c.$lightblue, 0.5);
|
||||
// }
|
||||
|
||||
.Deployments {
|
||||
background-color: c.$lightgrey;
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
Show,
|
||||
Switch,
|
||||
} from "solid-js";
|
||||
import { client, MAX_PAGE_WIDTH } from "../..";
|
||||
import { client } from "../..";
|
||||
import { SystemProcess, SystemStats } from "../../types";
|
||||
import { convert_timelength_to_ms } from "../../util/helpers";
|
||||
import { useLocalStorage } from "../../util/hooks";
|
||||
|
||||
@@ -110,6 +110,11 @@ async function handleMessage(
|
||||
const deployment = await client.get_deployment(update.target.id!);
|
||||
deployments.update(deployment);
|
||||
}
|
||||
} else if (update.operation === Operation.RenameDeployment) {
|
||||
if (update.status === UpdateStatus.Complete) {
|
||||
const deployment = await client.get_deployment(update.target.id!);
|
||||
deployments.update(deployment);
|
||||
}
|
||||
} else if (
|
||||
[
|
||||
Operation.DeployContainer,
|
||||
|
||||
Reference in New Issue
Block a user