Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 38 additions & 27 deletions src/components/Insights/JiraTicket/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import copy from "copy-to-clipboard";
import { useEffect, useRef, useState } from "react";
import { useContext, useEffect, useRef, useState } from "react";
import { useTheme } from "styled-components";
import { DefaultTheme } from "styled-components/dist/types";
import { dispatcher } from "../../../dispatcher";
import { getFeatureFlagValue } from "../../../featureFlags";
import { isString } from "../../../typeGuards/isString";
import { FeatureFlag } from "../../../types";
import { downloadFile } from "../../../utils/downloadFile";
import { isValidHttpUrl } from "../../../utils/isValidUrl";
import { sendTrackingEvent } from "../../../utils/sendTrackingEvent";
import { ConfigContext } from "../../common/App/ConfigContext";
import { Button } from "../../common/Button";
import { CircleLoader } from "../../common/CircleLoader";
import { CircleLoaderColors } from "../../common/CircleLoader/types";
Expand Down Expand Up @@ -55,6 +58,12 @@ export const JiraTicket = (props: JiraTicketProps) => {
const [errorMessage, setErrorMessage] = useState<string | null>();
const descriptionContentRef = useRef<HTMLDivElement>(null);
const theme = useTheme();
const config = useContext(ConfigContext);

const isLinkUnlinkInputVisible = getFeatureFlagValue(
config,
FeatureFlag.IS_TICKET_LINK_UNLINK_INPUT_ENABLED
);

const handleCloseButtonClick = () => {
props.onClose();
Expand Down Expand Up @@ -242,32 +251,34 @@ export const JiraTicket = (props: JiraTicketProps) => {
errorMessage={downloadErrorMessage}
/>
)}
<ActionableTextField
key="ticket-link"
value={ticketLink}
placeholder={
"Paste your ticket URL here to link it with this Digma insight"
}
label={"Ticket URL"}
onChange={onTicketLinkChange}
disabled={!!insightTicketLink}
errorMessage={errorMessage}
buttons={
insightTicketLink ? (
<Button key={"unlink-ticket"} onClick={unlinkTicket}>
Unlink
</Button>
) : (
<Button
key={"link-ticket"}
onClick={linkTicket}
disabled={!ticketLink || !!errorMessage}
>
Link
</Button>
)
}
/>
{isLinkUnlinkInputVisible && (
<ActionableTextField
key="ticket-link"
value={ticketLink}
placeholder={
"Paste your ticket URL here to link it with this Digma insight"
}
label={"Ticket URL"}
onChange={onTicketLinkChange}
disabled={!!insightTicketLink}
errorMessage={errorMessage}
buttons={
insightTicketLink ? (
<Button key={"unlink-ticket"} onClick={unlinkTicket}>
Unlink
</Button>
) : (
<Button
key={"link-ticket"}
onClick={linkTicket}
disabled={!ticketLink || !!errorMessage}
>
Link
</Button>
)
}
/>
)}
</s.Container>
);
};
3 changes: 2 additions & 1 deletion src/featureFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const featureFlagMinBackendVersions: Record<FeatureFlag, string> = {
[FeatureFlag.IS_DASHBOARD_CLIENT_SPANS_OVERALL_IMPACT_ENABLED]:
"v0.2.172-alpha.8",
[FeatureFlag.IS_ASSETS_SERVICE_FILTER_VISIBLE]: "v0.2.174",
[FeatureFlag.IS_ASSETS_OVERALL_IMPACT_HIDDEN]: "v0.2.181-alpha.1"
[FeatureFlag.IS_ASSETS_OVERALL_IMPACT_HIDDEN]: "v0.2.181-alpha.1",
[FeatureFlag.IS_TICKET_LINK_UNLINK_INPUT_ENABLED]: "v0.2.200"
};

export const getFeatureFlagValue = (
Expand Down
3 changes: 2 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Duration } from "./globals";
export enum FeatureFlag {
IS_DASHBOARD_CLIENT_SPANS_OVERALL_IMPACT_ENABLED,
IS_ASSETS_SERVICE_FILTER_VISIBLE,
IS_ASSETS_OVERALL_IMPACT_HIDDEN
IS_ASSETS_OVERALL_IMPACT_HIDDEN,
IS_TICKET_LINK_UNLINK_INPUT_ENABLED
}

export enum InsightType {
Expand Down