mirror of
https://github.com/moghtech/komodo.git
synced 2026-05-04 06:48:27 -05:00
improve confirm menu with copy button
This commit is contained in:
@@ -1,22 +1,25 @@
|
||||
import { Component, createResource, Show } from "solid-js";
|
||||
import { client, pushNotification } from "../../../../..";
|
||||
import { copyToClipboard, getId } from "../../../../../util/helpers";
|
||||
import ConfirmButton from "../../../../shared/ConfirmButton";
|
||||
import Icon from "../../../../shared/Icon";
|
||||
import { client } from "../../../../..";
|
||||
import { getId } from "../../../../../util/helpers";
|
||||
import CopyClipboard from "../../../../shared/CopyClipboard";
|
||||
import Flex from "../../../../shared/layout/Flex";
|
||||
import Grid from "../../../../shared/layout/Grid";
|
||||
import Loading from "../../../../shared/loading/Loading";
|
||||
import { useConfig } from "../Provider";
|
||||
|
||||
const WebhookUrl: Component<{}> = (p) => {
|
||||
const { deployment } = useConfig();
|
||||
const [github_base_url] = createResource(() => client.get_github_webhook_base_url());
|
||||
const listenerUrl = () => {
|
||||
if (github_base_url()) {
|
||||
return `${github_base_url()}/api/listener/deployment/${getId(deployment)}`;
|
||||
}
|
||||
}
|
||||
return (
|
||||
const { deployment } = useConfig();
|
||||
const [github_base_url] = createResource(() =>
|
||||
client.get_github_webhook_base_url()
|
||||
);
|
||||
const listenerUrl = () => {
|
||||
if (github_base_url()) {
|
||||
return `${github_base_url()}/api/listener/deployment/${getId(
|
||||
deployment
|
||||
)}`;
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Grid class="config-item shadow">
|
||||
<h1>webhook url</h1>
|
||||
<Flex
|
||||
@@ -29,19 +32,10 @@ const WebhookUrl: Component<{}> = (p) => {
|
||||
{listenerUrl()}
|
||||
</div>
|
||||
</Show>
|
||||
<ConfirmButton
|
||||
class="blue"
|
||||
onFirstClick={() => {
|
||||
copyToClipboard(listenerUrl() || "");
|
||||
pushNotification("good", "copied url to clipboard");
|
||||
}}
|
||||
confirm={<Icon type="check" />}
|
||||
>
|
||||
<Icon type="clipboard" />
|
||||
</ConfirmButton>
|
||||
<CopyClipboard copyText={listenerUrl() || ""} copying="url" />
|
||||
</Flex>
|
||||
</Grid>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
export default WebhookUrl;
|
||||
export default WebhookUrl;
|
||||
|
||||
Reference in New Issue
Block a user