mirror of
https://github.com/moghtech/komodo.git
synced 2026-04-30 14:25:22 -05:00
improve confirm menu with copy button
This commit is contained in:
@@ -55,7 +55,7 @@ const Header: Component<{}> = (p) => {
|
|||||||
client.delete_build(params.id);
|
client.delete_build(params.id);
|
||||||
}}
|
}}
|
||||||
class="red"
|
class="red"
|
||||||
title={`delete build | ${build().name}`}
|
title="delete build"
|
||||||
match={build().name}
|
match={build().name}
|
||||||
>
|
>
|
||||||
<Icon type="trash" />
|
<Icon type="trash" />
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { Component, createResource, Show } from "solid-js";
|
import { Component, createResource, Show } from "solid-js";
|
||||||
import { pushNotification, MONITOR_BASE_URL, client } from "../../../..";
|
import { client } from "../../../..";
|
||||||
import { copyToClipboard, getId } from "../../../../util/helpers";
|
import { getId } from "../../../../util/helpers";
|
||||||
import ConfirmButton from "../../../shared/ConfirmButton";
|
import CopyClipboard from "../../../shared/CopyClipboard";
|
||||||
import Icon from "../../../shared/Icon";
|
|
||||||
import Flex from "../../../shared/layout/Flex";
|
import Flex from "../../../shared/layout/Flex";
|
||||||
import Grid from "../../../shared/layout/Grid";
|
import Grid from "../../../shared/layout/Grid";
|
||||||
import Loading from "../../../shared/loading/Loading";
|
import Loading from "../../../shared/loading/Loading";
|
||||||
@@ -31,16 +30,7 @@ const ListenerUrl: Component<{}> = (p) => {
|
|||||||
{listenerUrl()}
|
{listenerUrl()}
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
<ConfirmButton
|
<CopyClipboard copyText={listenerUrl() || ""} copying="url" />
|
||||||
class="blue"
|
|
||||||
onFirstClick={() => {
|
|
||||||
copyToClipboard(listenerUrl() || "");
|
|
||||||
pushNotification("good", "copied url to clipboard");
|
|
||||||
}}
|
|
||||||
confirm={<Icon type="check" />}
|
|
||||||
>
|
|
||||||
<Icon type="clipboard" />
|
|
||||||
</ConfirmButton>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ const Deploy: Component<{ redeploy?: boolean }> = (p) => {
|
|||||||
onConfirm={() => {
|
onConfirm={() => {
|
||||||
client.deploy_container(params.id);
|
client.deploy_container(params.id);
|
||||||
}}
|
}}
|
||||||
title={`redeploy container | ${name()}`}
|
title="redeploy container"
|
||||||
match={name()!}
|
match={name()!}
|
||||||
>
|
>
|
||||||
<Icon type={"reset"} />
|
<Icon type={"reset"} />
|
||||||
@@ -232,7 +232,7 @@ const RemoveContainer = () => {
|
|||||||
onConfirm={() => {
|
onConfirm={() => {
|
||||||
client.remove_container(params.id);
|
client.remove_container(params.id);
|
||||||
}}
|
}}
|
||||||
title={`destroy container | ${name()}`}
|
title="destroy container"
|
||||||
match={name()!}
|
match={name()!}
|
||||||
>
|
>
|
||||||
<Icon type="trash" />
|
<Icon type="trash" />
|
||||||
@@ -298,7 +298,7 @@ const Stop = () => {
|
|||||||
onConfirm={() => {
|
onConfirm={() => {
|
||||||
client.stop_container(params.id);
|
client.stop_container(params.id);
|
||||||
}}
|
}}
|
||||||
title={`stop container | ${name()}`}
|
title="stop container"
|
||||||
match={name()!}
|
match={name()!}
|
||||||
>
|
>
|
||||||
<Icon type="pause" />
|
<Icon type="pause" />
|
||||||
|
|||||||
@@ -88,9 +88,7 @@ const Header: Component<{}> = (p) => {
|
|||||||
client.delete_deployment(params.id);
|
client.delete_deployment(params.id);
|
||||||
}}
|
}}
|
||||||
class="red"
|
class="red"
|
||||||
title={`delete deployment | ${
|
title="delete deployment"
|
||||||
deployment().deployment.name
|
|
||||||
}`}
|
|
||||||
match={deployment().deployment.name}
|
match={deployment().deployment.name}
|
||||||
info={
|
info={
|
||||||
<Show when={deployment().container}>
|
<Show when={deployment().container}>
|
||||||
|
|||||||
@@ -1,22 +1,25 @@
|
|||||||
import { Component, createResource, Show } from "solid-js";
|
import { Component, createResource, Show } from "solid-js";
|
||||||
import { client, pushNotification } from "../../../../..";
|
import { client } from "../../../../..";
|
||||||
import { copyToClipboard, getId } from "../../../../../util/helpers";
|
import { getId } from "../../../../../util/helpers";
|
||||||
import ConfirmButton from "../../../../shared/ConfirmButton";
|
import CopyClipboard from "../../../../shared/CopyClipboard";
|
||||||
import Icon from "../../../../shared/Icon";
|
|
||||||
import Flex from "../../../../shared/layout/Flex";
|
import Flex from "../../../../shared/layout/Flex";
|
||||||
import Grid from "../../../../shared/layout/Grid";
|
import Grid from "../../../../shared/layout/Grid";
|
||||||
import Loading from "../../../../shared/loading/Loading";
|
import Loading from "../../../../shared/loading/Loading";
|
||||||
import { useConfig } from "../Provider";
|
import { useConfig } from "../Provider";
|
||||||
|
|
||||||
const WebhookUrl: Component<{}> = (p) => {
|
const WebhookUrl: Component<{}> = (p) => {
|
||||||
const { deployment } = useConfig();
|
const { deployment } = useConfig();
|
||||||
const [github_base_url] = createResource(() => client.get_github_webhook_base_url());
|
const [github_base_url] = createResource(() =>
|
||||||
const listenerUrl = () => {
|
client.get_github_webhook_base_url()
|
||||||
if (github_base_url()) {
|
);
|
||||||
return `${github_base_url()}/api/listener/deployment/${getId(deployment)}`;
|
const listenerUrl = () => {
|
||||||
}
|
if (github_base_url()) {
|
||||||
}
|
return `${github_base_url()}/api/listener/deployment/${getId(
|
||||||
return (
|
deployment
|
||||||
|
)}`;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return (
|
||||||
<Grid class="config-item shadow">
|
<Grid class="config-item shadow">
|
||||||
<h1>webhook url</h1>
|
<h1>webhook url</h1>
|
||||||
<Flex
|
<Flex
|
||||||
@@ -29,19 +32,10 @@ const WebhookUrl: Component<{}> = (p) => {
|
|||||||
{listenerUrl()}
|
{listenerUrl()}
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
<ConfirmButton
|
<CopyClipboard copyText={listenerUrl() || ""} copying="url" />
|
||||||
class="blue"
|
|
||||||
onFirstClick={() => {
|
|
||||||
copyToClipboard(listenerUrl() || "");
|
|
||||||
pushNotification("good", "copied url to clipboard");
|
|
||||||
}}
|
|
||||||
confirm={<Icon type="check" />}
|
|
||||||
>
|
|
||||||
<Icon type="clipboard" />
|
|
||||||
</ConfirmButton>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default WebhookUrl;
|
export default WebhookUrl;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ const Header: Component<{}> = (p) => {
|
|||||||
client.delete_server(params.id);
|
client.delete_server(params.id);
|
||||||
}}
|
}}
|
||||||
class="red"
|
class="red"
|
||||||
title={`delete server | ${server().server.name}`}
|
title="delete server"
|
||||||
match={server().server.name}
|
match={server().server.name}
|
||||||
info={
|
info={
|
||||||
<div style={{ opacity: 0.7 }}>
|
<div style={{ opacity: 0.7 }}>
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import { Component, createSignal, JSX } from "solid-js";
|
|||||||
import { pushNotification } from "../..";
|
import { pushNotification } from "../..";
|
||||||
import { useToggle } from "../../util/hooks";
|
import { useToggle } from "../../util/hooks";
|
||||||
import ConfirmButton from "./ConfirmButton";
|
import ConfirmButton from "./ConfirmButton";
|
||||||
|
import CopyClipboard from "./CopyClipboard";
|
||||||
import Input from "./Input";
|
import Input from "./Input";
|
||||||
|
import Flex from "./layout/Flex";
|
||||||
import Grid from "./layout/Grid";
|
import Grid from "./layout/Grid";
|
||||||
import CenterMenu from "./menu/CenterMenu";
|
import CenterMenu from "./menu/CenterMenu";
|
||||||
|
|
||||||
@@ -22,6 +24,12 @@ const ConfirmMenuButton: Component<{
|
|||||||
show={show}
|
show={show}
|
||||||
toggleShow={toggleShow}
|
toggleShow={toggleShow}
|
||||||
title={p.title}
|
title={p.title}
|
||||||
|
leftOfX={() => (
|
||||||
|
<Flex alignItems="center" justifyContent="space-between" style={{ width: "100%" }}>
|
||||||
|
<h1>{p.match}</h1>
|
||||||
|
<CopyClipboard copyText={p.match} copying="name" />
|
||||||
|
</Flex>
|
||||||
|
)}
|
||||||
targetClass={p.class}
|
targetClass={p.class}
|
||||||
target={p.children}
|
target={p.children}
|
||||||
content={() => (
|
content={() => (
|
||||||
|
|||||||
22
frontend/src/components/shared/CopyClipboard.tsx
Normal file
22
frontend/src/components/shared/CopyClipboard.tsx
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { Component } from "solid-js";
|
||||||
|
import { pushNotification } from "../..";
|
||||||
|
import { copyToClipboard } from "../../util/helpers";
|
||||||
|
import ConfirmButton from "./ConfirmButton";
|
||||||
|
import Icon from "./Icon";
|
||||||
|
|
||||||
|
const CopyClipboard: Component<{ copyText: string; copying?: string; }> = (p) => {
|
||||||
|
return (
|
||||||
|
<ConfirmButton
|
||||||
|
class="blue"
|
||||||
|
onFirstClick={() => {
|
||||||
|
copyToClipboard(p.copyText);
|
||||||
|
pushNotification("good", `copied ${p.copying || "text"} to clipboard`);
|
||||||
|
}}
|
||||||
|
confirm={<Icon type="check" />}
|
||||||
|
>
|
||||||
|
<Icon type="clipboard" />
|
||||||
|
</ConfirmButton>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CopyClipboard;
|
||||||
@@ -68,7 +68,7 @@ const Child: Component<{
|
|||||||
return (
|
return (
|
||||||
<Grid
|
<Grid
|
||||||
class={combineClasses(s.CenterMenuContainer)}
|
class={combineClasses(s.CenterMenuContainer)}
|
||||||
onClick={(e) => {
|
onPointerDown={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
p.toggleShow();
|
p.toggleShow();
|
||||||
}}
|
}}
|
||||||
@@ -78,6 +78,7 @@ const Child: Component<{
|
|||||||
class={combineClasses(s.Menu, "shadow")}
|
class={combineClasses(s.Menu, "shadow")}
|
||||||
style={{ padding: (p.padding as any) || "1rem", ...p.style }}
|
style={{ padding: (p.padding as any) || "1rem", ...p.style }}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
onPointerDown={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
<Flex
|
<Flex
|
||||||
class={s.CenterMenuHeader}
|
class={s.CenterMenuHeader}
|
||||||
@@ -85,7 +86,7 @@ const Child: Component<{
|
|||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
>
|
>
|
||||||
<div class={s.CenterMenuTitle}>{p.title}</div>
|
<h1>{p.title}</h1>
|
||||||
<Flex alignItems="center">
|
<Flex alignItems="center">
|
||||||
{p.leftOfX && p.leftOfX()}
|
{p.leftOfX && p.leftOfX()}
|
||||||
<button class="red" onClick={p.toggleShow}>
|
<button class="red" onClick={p.toggleShow}>
|
||||||
|
|||||||
@@ -142,11 +142,6 @@ $anim-time: 350ms;
|
|||||||
background-color: rgba(0, 0, 0, 0.4);
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.CenterMenuTitle {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.SelectorItem:hover {
|
.SelectorItem:hover {
|
||||||
background-color: c.$lightgrey;
|
background-color: c.$lightgrey;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user