From c6f685ff23d6f115d0202f3b7df5b7e4fa968e83 Mon Sep 17 00:00:00 2001 From: mbecker20 Date: Mon, 11 Apr 2022 23:27:29 -0700 Subject: [PATCH] copy listener url --- frontend/public/icons/clipboard.svg | 10 ++++++++++ .../components/builds/tabs/git-config/Git.tsx | 1 + .../builds/tabs/git-config/GitConfig.tsx | 20 +++++++++++++++++++ .../deployment/tabs/config/Config.tsx | 20 +++++++++++++++++++ frontend/src/components/util/Icon.tsx | 3 ++- frontend/src/style/index.scss | 11 ++++++++-- frontend/src/util/helpers.ts | 3 +++ 7 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 frontend/public/icons/clipboard.svg diff --git a/frontend/public/icons/clipboard.svg b/frontend/public/icons/clipboard.svg new file mode 100644 index 000000000..4d3477717 --- /dev/null +++ b/frontend/public/icons/clipboard.svg @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/frontend/src/components/builds/tabs/git-config/Git.tsx b/frontend/src/components/builds/tabs/git-config/Git.tsx index 1245fff15..236521188 100644 --- a/frontend/src/components/builds/tabs/git-config/Git.tsx +++ b/frontend/src/components/builds/tabs/git-config/Git.tsx @@ -58,6 +58,7 @@ const Git: Component<{}> = (p) => { /> + ); }; diff --git a/frontend/src/components/builds/tabs/git-config/GitConfig.tsx b/frontend/src/components/builds/tabs/git-config/GitConfig.tsx index 4b2142b60..bbabf9889 100644 --- a/frontend/src/components/builds/tabs/git-config/GitConfig.tsx +++ b/frontend/src/components/builds/tabs/git-config/GitConfig.tsx @@ -1,4 +1,6 @@ import { Component, Show } from "solid-js"; +import { pushNotification, URL } from "../../../.."; +import { copyToClipboard } from "../../../../util/helpers"; import ConfirmButton from "../../../util/ConfirmButton"; import Icon from "../../../util/Icon"; import Flex from "../../../util/layout/Flex"; @@ -10,12 +12,30 @@ import OnClone from "./OnClone"; const GitConfig: Component<{}> = (p) => { const { build, reset, save, userCanUpdate } = useConfig(); + const listenerUrl = () => `${URL}/api/listener/build/${build._id}`; return ( + +

webhook url

+ +
+ {listenerUrl()} +
+ +
+
= (p) => { const { deployment, reset, save, userCanUpdate } = useConfig(); + const listenerUrl = () => `${URL}/api/listener/deployment/${deployment._id}`; return ( @@ -49,6 +52,23 @@ const Config: Component<{}> = (p) => { element: ( + +

webhook url

+ +
+ {listenerUrl()} +
+ +
+
diff --git a/frontend/src/components/util/Icon.tsx b/frontend/src/components/util/Icon.tsx index f77eea065..a1d397661 100644 --- a/frontend/src/components/util/Icon.tsx +++ b/frontend/src/components/util/Icon.tsx @@ -34,7 +34,8 @@ export type IconType = | "cut" | "fullscreen" | "github" - | "edit"; + | "edit" + | "clipboard"; const Icon: Component<{ type: IconType; diff --git a/frontend/src/style/index.scss b/frontend/src/style/index.scss index 1913ec479..823538603 100644 --- a/frontend/src/style/index.scss +++ b/frontend/src/style/index.scss @@ -6,8 +6,8 @@ body { margin: 0; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', - 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", + "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; // font-family: "Chakra Petch", sans-serif; // font-family: "Work Sans", sans-serif; @@ -192,3 +192,10 @@ input::placeholder { background: rgba(252, 234, 222, 0.3); border-radius: 0.25rem; } + +.ellipsis { + width: 100%; + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} diff --git a/frontend/src/util/helpers.ts b/frontend/src/util/helpers.ts index 352237a94..b8ebe5da3 100644 --- a/frontend/src/util/helpers.ts +++ b/frontend/src/util/helpers.ts @@ -104,3 +104,6 @@ export function serverStatusClass( } } +export function copyToClipboard(text: string) { + navigator.clipboard.writeText(text); +}