From 4cbb65a5cb65569a5b60722b570a55eea3bf30a9 Mon Sep 17 00:00:00 2001 From: Rares Mardare Date: Mon, 12 Sep 2022 16:57:37 +0300 Subject: [PATCH] pick hostname from onCallApiUrl --- .../components/SourceCode/SourceCode.module.scss | 4 ---- .../src/components/SourceCode/SourceCode.tsx | 8 +++----- .../containers/ApiTokenSettings/ApiTokenForm.tsx | 13 +++++++++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/grafana-plugin/src/components/SourceCode/SourceCode.module.scss b/grafana-plugin/src/components/SourceCode/SourceCode.module.scss index fc7c3b9f..a926c09d 100644 --- a/grafana-plugin/src/components/SourceCode/SourceCode.module.scss +++ b/grafana-plugin/src/components/SourceCode/SourceCode.module.scss @@ -21,10 +21,6 @@ right: 15px; opacity: 0; transition: opacity 0.2s ease; - - &--top { - top: 6px; - } } pre { diff --git a/grafana-plugin/src/components/SourceCode/SourceCode.tsx b/grafana-plugin/src/components/SourceCode/SourceCode.tsx index 61fc2202..da4f8838 100644 --- a/grafana-plugin/src/components/SourceCode/SourceCode.tsx +++ b/grafana-plugin/src/components/SourceCode/SourceCode.tsx @@ -13,12 +13,11 @@ const cx = cn.bind(styles); interface SourceCodeProps { noMaxHeight?: boolean; showCopyToClipboard?: boolean; - isButtonTopPositioned?: boolean; children?: any; } const SourceCode: FC = (props) => { - const { children, isButtonTopPositioned = false, noMaxHeight = false, showCopyToClipboard = true } = props; + const { children, noMaxHeight = false, showCopyToClipboard = true } = props; return (
@@ -30,10 +29,9 @@ const SourceCode: FC = (props) => { }} > @@ -91,18 +94,20 @@ const ApiTokenForm = observer((props: TokenCreationModalProps) => { } function renderCurlExample() { - if (!token) return null; + if (!token) { + return null; + } return ( - {getCurlExample(token)} + {getCurlExample(token)} ); } }); function getCurlExample(token) { - return `curl -H "Authorization: ${token}" ${document.location.origin}/api/v1/escalation_chains`; + return `curl -H "Authorization: ${token}" ${getItem('onCallApiUrl')}/api/internal/v1/alert_receive_channels`; } export default ApiTokenForm;