/* * Copyright 2020 EPAM Systems * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import React, { useEffect, useState } from "react"; import { Icons, LinkButton, Modal, useCloseModal, } from "@drill4j/ui-kit"; import { copyToClipboard } from "@drill4j/common-utils"; import "twin.macro"; import { getTestsToRunURL, TestsToRunUrl } from "components"; import { KEY_METRICS_EVENT_NAMES, sendKeyMetricsEvent } from "common/analytic"; import { useAdminConnection, useAgentRouteParams } from "hooks"; import { AnalyticsInfo } from "types"; export const GetRecommendedTestsModal = () => { const { agentId = "", pluginId = "" } = useAgentRouteParams(); const [copied, setCopied] = useState(false); useEffect(() => { const timeout = setTimeout(() => setCopied(false), 5000); copied && timeout; return () => clearTimeout(timeout); }, [copied]); const closeModal = useCloseModal(); const { isAnalyticsDisabled } = useAdminConnection("/api/analytics/info") || {}; return ( Get Recommended Tests These are recommendations for this build updates only.
Use this Curl in your command line to get JSON:
{ copyToClipboard(getTestsToRunURL(agentId, pluginId, "Agent")); setCopied(true); !isAnalyticsDisabled && sendKeyMetricsEvent({ name: KEY_METRICS_EVENT_NAMES.CLICK_ON_COPY_TO_CLIPBOARD_BUTTON, }); }} data-test="get-suggested-tests-modal:copy-to-clipboard-button" > {copied ? (
Copied
) : (
Copy to Clipboard
)}
); };