Skip to content

Commit

Permalink
use unlink icon
Browse files Browse the repository at this point in the history
  • Loading branch information
ciyer committed Oct 8, 2024
1 parent 5fd9c08 commit 1b4de9a
Showing 1 changed file with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
import cx from "classnames";
import { useCallback, useEffect, useState } from "react";
import { Lock, Pencil, Trash, XLg } from "react-bootstrap-icons";
import { Lock, NodeMinus, Pencil, Trash, XLg } from "react-bootstrap-icons";
import { matchPath, useLocation } from "react-router-dom-v5-compat";
import {
Button,
Expand Down Expand Up @@ -279,6 +279,12 @@ export default function DataConnectorActions({
dataConnectorLink?: DataConnectorToProjectLink;
toggleView: () => void;
}) {
const location = useLocation();
const pathMatch = matchPath(
ABSOLUTE_ROUTES.v2.projects.show.root,
location.pathname
);
const removeMode = pathMatch === null ? "delete" : "unlink";
const [isCredentialsOpen, setCredentialsOpen] = useState(false);
const [isDeleteOpen, setIsDeleteOpen] = useState(false);
const [isEditOpen, setIsEditOpen] = useState(false);
Expand Down Expand Up @@ -325,8 +331,17 @@ export default function DataConnectorActions({
Credentials
</DropdownItem>
<DropdownItem data-cy="data-connector-delete" onClick={toggleDelete}>
<Trash className={cx("bi", "me-1")} />
Remove
{removeMode === "delete" ? (
<span>
<Trash className={cx("bi", "me-1")} />
Remove
</span>
) : (
<span>
<NodeMinus className={cx("bi", "me-1")} />
Unlink
</span>
)}
</DropdownItem>
</ButtonWithMenuV2>
<DataConnectorCredentialsModal
Expand Down

0 comments on commit 1b4de9a

Please sign in to comment.