Skip to content

Commit 9fe9115

Browse files
authored
fix: connection badges and triggers copy buttons display (#1430)
## Description ## Linear Ticket ## What type of PR is this? (check all applicable) - [ ] πŸ’‘ (feat) - A new feature (non-breaking change which adds functionality) - [ ] πŸ”„ (refactor) - Code Refactoring - A code change that neither fixes a bug nor adds a feature - [ ] 🐞 (fix) - Bug Fix (non-breaking change which fixes an issue) - [ ] 🏎 (perf) - Optimization - [ ] πŸ“„ (docs) - Documentation - Documentation only changes - [ ] πŸ“„ (test) - Tests - Adding missing tests or correcting existing tests - [ ] βš™οΈ (ci) - Continuous Integrations - Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) - [ ] β˜‘οΈ (chore) - Chores - Other changes that don't modify src or test files - [ ] ↩️ (revert) - Reverts - Reverts a previous commit(s). <!-- For a timely review/response, please avoid force-pushing additional commits if your PR already received reviews or comments. Before submitting a Pull Request, please ensure you've done the following: - πŸ‘·β€β™€οΈ Create small PRs. In most cases this will be possible. - βœ… Provide tests for your changes. - πŸ“ Use descriptive commit messages (as described below). - πŸ“— Update any related documentation and include any relevant screenshots. Commit Message Structure (all lower-case): <type>(optional ticket number): <description> [optional body] -->
1 parent fde25d0 commit 9fe9115

File tree

12 files changed

+57
-138
lines changed

12 files changed

+57
-138
lines changed

β€Žpackage-lock.jsonβ€Ž

Lines changed: 0 additions & 93 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žsrc/components/molecules/connectionTableStatus.tsxβ€Ž

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ import { ConnectionStatusType } from "@type/models";
99
export const ConnectionTableStatus = ({ status }: { status: ConnectionStatusType }) => {
1010
const { t } = useTranslation("tabs");
1111
const connectionTableStatusClass = {
12-
[ConnectionStatus.error]: "text-red",
13-
[ConnectionStatus.ok]: "text-green-800",
14-
[ConnectionStatus.unspecified]: "text-blue-500",
15-
[ConnectionStatus.warning]: "text-yellow-500",
12+
[ConnectionStatus.error]: "text-red hover:bg-red/10",
13+
[ConnectionStatus.ok]: "text-green-800 hover:bg-green-800/10",
14+
[ConnectionStatus.unspecified]: "text-blue-500 hover:bg-blue-500/10",
15+
[ConnectionStatus.warning]: "text-yellow-500 hover:bg-yellow-500/10",
16+
[ConnectionStatus.init_required]: "text-orange-500 hover:bg-orange-500/10",
1617
};
17-
const baseClass = cn("inline", connectionTableStatusClass[ConnectionStatus[status]]);
18+
const baseClass = cn(
19+
"flex w-[6.8rem] items-center justify-center rounded-md border border-gray-800 px-2 py-0.5 text-xs text-white",
20+
connectionTableStatusClass[ConnectionStatus[status]]
21+
);
1822
const statusName = t(`connections.table.statuses.${status}`);
1923

2024
return (

β€Žsrc/components/molecules/copyButton.tsxβ€Ž

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ export const CopyButton = forwardRef<
2020
{
2121
ariaLabel?: string;
2222
buttonText?: string;
23+
buttonTextClassName?: string;
2324
className?: string;
2425
dataTestId?: string;
2526
iconClassName?: string;
27+
id?: string;
2628
size?: Extract<SystemSizes, "xs" | "sm" | "md">;
2729
successMessage?: string;
2830
tabIndex?: number;
@@ -42,6 +44,8 @@ export const CopyButton = forwardRef<
4244
text,
4345
title,
4446
buttonText,
47+
buttonTextClassName,
48+
id,
4549
},
4650
ref
4751
) => {
@@ -87,11 +91,13 @@ export const CopyButton = forwardRef<
8791

8892
const ariaLabelText = ariaLabel || t("copyButtonText", { text: ariaLabel }) || "";
8993
const titleText = t("copyButtonTextTitle", { text: title }) || ariaLabelText;
94+
const buttonTextClass = cn("text-white", buttonTextClassName);
9095
return (
9196
<Button
9297
ariaLabel={ariaLabelText}
9398
className={copyButtonStyle}
9499
data-testid={dataTestId}
100+
id={id}
95101
onClick={(event) => {
96102
event.stopPropagation();
97103
copyTextToClipboard(text);
@@ -103,7 +109,7 @@ export const CopyButton = forwardRef<
103109
valueText={text}
104110
>
105111
<CopyIcon className={copyButtonIconStyle} />
106-
{buttonText ? <div className="text-white">{buttonText}</div> : null}
112+
{buttonText ? <div className={buttonTextClass}>{buttonText}</div> : null}
107113
</Button>
108114
);
109115
}

β€Žsrc/components/organisms/configuration/connections/connections.tsxβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,8 @@ export const Connections = ({ isLoading }: ConnectionsProps) => {
169169
const items: ConnectionItem[] = (connections || []).map((connection) => ({
170170
id: connection.connectionId,
171171
name: connection.name || connection.integrationId || "",
172-
errorMessage: connection.status === "ok" ? undefined : connection.statusInfoMessage,
172+
statusInfoMessage: connection.statusInfoMessage,
173+
status: connection.status,
173174
icon: connection.logo,
174175
integration: connection.integrationUniqueName as (typeof Integrations)[keyof typeof Integrations],
175176
}));

β€Žsrc/components/organisms/configuration/connectionsSectionList.tsxβ€Ž

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ConnectionsSectionListProps } from "@interfaces/components";
66
import { cn, generateItemIds } from "@src/utilities";
77

88
import { Button, IconSvg } from "@components/atoms";
9-
import { Accordion, AddButton } from "@components/molecules";
9+
import { Accordion, AddButton, ConnectionTableStatus } from "@components/molecules";
1010
import { PopoverContent, PopoverTrigger, PopoverWrapper } from "@components/molecules/popover";
1111

1212
import { ChevronDownIcon, ChevronUpIcon, TrashIcon } from "@assets/image/icons";
@@ -53,8 +53,8 @@ export const ConnectionsSectionList = ({
5353
{isLoading ? (
5454
<ConfigurationSkeletonLoader />
5555
) : items && items.length > 0 ? (
56-
items.map(({ id, icon, name, errorMessage, integration }) => {
57-
const hasError = !!errorMessage;
56+
items.map(({ id, icon, name, statusInfoMessage, status, integration }) => {
57+
const shouldShowTooltip = status !== "ok" && statusInfoMessage;
5858
const configureButtonClass = cn(
5959
"group my-0.5 mr-1 size-5 border-none p-0 hover:bg-transparent"
6060
);
@@ -90,38 +90,33 @@ export const ConnectionsSectionList = ({
9090
className="ml-2.5 flex w-2/5 text-white sm:w-1/4 xl:w-1/2 2xl:w-[65%]"
9191
id={connectionDisplayId}
9292
>
93-
<ConnectionItemDisplay item={{ id, icon, name, integration }} />
93+
<ConnectionItemDisplay item={{ id, icon, name, status, integration }} />
9494
</div>
9595

9696
<div className="flex-1" />
9797

98-
{hasError ? (
98+
{shouldShowTooltip ? (
9999
<PopoverWrapper interactionType="hover" placement="top">
100100
<PopoverTrigger>
101101
<div className="flex w-fit items-center gap-0">
102-
<Button
103-
ariaLabel={`Fix connection error: ${errorMessage}`}
104-
className="w-[6.8rem] justify-center rounded-md border border-gray-800 bg-transparent px-2 py-0.5 text-xs text-error hover:brightness-90"
105-
onClick={() => actions.configure.onClick(id)}
106-
title={`Fix connection error: ${errorMessage}`}
107-
>
108-
Init
109-
</Button>
102+
<ConnectionTableStatus status={status} />
110103
</div>
111104
</PopoverTrigger>
112105
<PopoverContent className="h-6 max-w-md break-all border border-gray-700 bg-gray-900 p-1 text-xs text-white">
113-
Initialize connection
106+
{statusInfoMessage}
114107
</PopoverContent>
115108
</PopoverWrapper>
116-
) : null}
109+
) : (
110+
<ConnectionTableStatus status={status} />
111+
)}
117112
<div className="relative z-10 flex items-center gap-1" id={actionsContainerId}>
118113
{actions.showEvents ? (
119114
<PopoverWrapper interactionType="hover" placement="top">
120115
<PopoverTrigger>
121116
<Button
122117
ariaLabel={actions.showEvents.ariaLabel}
123118
className="group mx-1 size-6 border-none p-1 hover:bg-transparent"
124-
disabled={hasError}
119+
disabled={status !== "ok"}
125120
id={showEventsButtonId}
126121
onClick={(e) => {
127122
e.stopPropagation();

β€Žsrc/components/organisms/configuration/triggersSectionList.tsxβ€Ž

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ export const TriggersSectionList = ({
2525
accordionKey,
2626
isLoading,
2727
}: TriggersSectionListProps) => {
28+
const copyButtonClassName =
29+
"group flex h-6 w-[6.8rem] items-center justify-center rounded-md border border-gray-800 bg-transparent stroke-white px-2 py-0.5 hover:bg-transparent hover:stroke-green-800";
30+
const copyButtonTextClassName = "text-xs text-white group-hover:text-green-800";
2831
return (
2932
<Accordion
3033
accordionKey={accordionKey}
@@ -100,22 +103,18 @@ export const TriggersSectionList = ({
100103
<PopoverWrapper interactionType="hover" placement="top">
101104
<PopoverTrigger>
102105
<div className="flex items-center gap-0">
103-
<span
104-
className="flex h-6 w-[6.8rem] items-center justify-center rounded-md border border-gray-800 bg-transparent px-2 py-0.5 text-xs text-white hover:brightness-90"
105-
id={webhookUrlButtonId}
106-
title={webhookUrl}
107-
>
108-
<CopyButton
109-
ariaLabel={`Copy ${name} webhook URL`}
110-
className="stroke-white hover:bg-transparent hover:stroke-green-800"
111-
dataTestId={`copy-${name}-webhook-url`}
112-
iconClassName="stroke-[0.5]"
113-
size="xs"
114-
text={webhookUrl}
115-
title={`Copy ${name} webhook URL`}
116-
/>
117-
URL
118-
</span>
106+
<CopyButton
107+
ariaLabel={`Copy ${name} webhook URL`}
108+
buttonText="URL"
109+
buttonTextClassName={copyButtonTextClassName}
110+
className={copyButtonClassName}
111+
dataTestId={`copy-${name}-webhook-url`}
112+
iconClassName="stroke-[0.5]"
113+
id={webhookUrlButtonId! as string}
114+
size="xs"
115+
text={webhookUrl}
116+
title={`Copy ${name} webhook URL`}
117+
/>
119118
</div>
120119
</PopoverTrigger>
121120
<PopoverContent className="max-w-md break-all border border-gray-700 bg-gray-900 p-1 text-xs text-white">

β€Žsrc/enums/components/connection.enum.tsβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import {
4040
} from "@assets/image/icons/connections";
4141

4242
export enum ConnectionStatus {
43+
// eslint-disable-next-line @typescript-eslint/naming-convention
44+
init_required = 4,
4345
error = 3,
4446
ok = 1,
4547
unspecified = 0,

β€Žsrc/interfaces/components/configurationSection.interface.tsβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import React from "react";
33
import { FrontendProjectValidationProps } from ".";
44
import { Integrations } from "@src/enums/components";
55
import { ProjectValidationLevel } from "@src/types";
6+
import { ConnectionStatusType } from "@src/types/models";
67

78
export interface VariableItem {
89
description?: string;
@@ -15,7 +16,8 @@ export interface VariableItem {
1516
export interface ConnectionItem {
1617
id: string;
1718
name: string;
18-
errorMessage?: string;
19+
statusInfoMessage?: string;
20+
status: ConnectionStatusType;
1921
icon?: React.ComponentType<React.SVGProps<SVGSVGElement>>;
2022
integration: (typeof Integrations)[keyof typeof Integrations];
2123
}

β€Žsrc/locales/en/services/translation.jsonβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"noMatchingIntegrationDetailsProjectAndConnection": "No matching integration for the connection found. Connection name: {{connectionName}}, connection ID: {{connectionId}}, project ID: {{projectId}}, integration ID: {{integrationId}}",
5555
"lastPrintForSessionLog": "The session has finished with {{sessionState}} state",
5656
"intergrationsNotFoundExtendedForConnection": "Intergrations for connection not found, connection ID: {{connectionId}}",
57-
"intergrationsNotFoundExtended": "Intergrations for project not found,, project ID: {{projectId}}",
58-
"intergrationsNotFoundExtendedError": "Couldn't fetch intergrations, project ID: {{projectId}}, error: {{error}}",
57+
"intergrationsNotFoundExtended": "Intergrations for project not found, project ID: {{projectId}}",
58+
"intergrationsNotFoundExtendedError": "Couldn't fetch intergrations, error: {{error}}",
5959
"multipleEnvironments": "Multiple environments found, please reload the page",
6060
"multipleEnvironmentsFoundExtended": "Multiple environments found, project ID: {{projectId}}",
6161
"projectNotCreated": "There was an issue creating the project",

0 commit comments

Comments
Β (0)