From 5212c9c8e2448bc8ef57c4f87b99ff59092afae0 Mon Sep 17 00:00:00 2001
From: Anton Kulyk <kuliks.anton@gmail.com>
Date: Wed, 31 Aug 2022 18:28:35 +0100
Subject: [PATCH] Remove `ActionsLinkingControl` (#25133)

---
 .../dashboard/components/DashCard.jsx         | 20 ------
 .../components/ActionsLinkingControl.tsx      | 66 -------------------
 2 files changed, 86 deletions(-)
 delete mode 100644 frontend/src/metabase/writeback/components/ActionsLinkingControl.tsx

diff --git a/frontend/src/metabase/dashboard/components/DashCard.jsx b/frontend/src/metabase/dashboard/components/DashCard.jsx
index a154b2b08c1..e2b1d81c811 100644
--- a/frontend/src/metabase/dashboard/components/DashCard.jsx
+++ b/frontend/src/metabase/dashboard/components/DashCard.jsx
@@ -27,8 +27,6 @@ import DashCardParameterMapper from "./DashCardParameterMapper";
 import { IS_EMBED_PREVIEW } from "metabase/lib/embed";
 import { getClickBehaviorDescription } from "metabase/lib/click-behavior";
 
-import ActionsLinkingControl from "metabase/writeback/components/ActionsLinkingControl";
-
 import cx from "classnames";
 import _ from "underscore";
 import { getIn } from "icepick";
@@ -213,9 +211,6 @@ export default class DashCard extends Component {
               hasError={!!errorMessage}
               onRemove={onRemove}
               onAddSeries={onAddSeries}
-              onUpdateVisualizationSettings={
-                this.props.onUpdateVisualizationSettings
-              }
               onReplaceAllVisualizationSettings={
                 this.props.onReplaceAllVisualizationSettings
               }
@@ -225,7 +220,6 @@ export default class DashCard extends Component {
               isPreviewing={this.state.isPreviewingCard}
               onPreviewToggle={this.handlePreviewToggle}
               dashboard={dashboard}
-              metadata={metadata}
             />
           </DashboardCardActionsPanel>
         ) : null}
@@ -355,13 +349,11 @@ const DashCardActionButtons = ({
   hasError,
   onRemove,
   onAddSeries,
-  onUpdateVisualizationSettings,
   onReplaceAllVisualizationSettings,
   showClickBehaviorSidebar,
   onPreviewToggle,
   isPreviewing,
   dashboard,
-  metadata,
 }) => {
   const buttons = [];
 
@@ -415,18 +407,6 @@ const DashCardActionButtons = ({
     }
   }
 
-  if (card.display === "actions") {
-    buttons.push(
-      <ActionsLinkingControl
-        key="connect-actions"
-        card={card}
-        dashboard={dashboard}
-        metadata={metadata}
-        onUpdateVisualizationSettings={onUpdateVisualizationSettings}
-      />,
-    );
-  }
-
   return (
     <span className="flex align-center text-medium" style={{ lineHeight: 1 }}>
       {buttons}
diff --git a/frontend/src/metabase/writeback/components/ActionsLinkingControl.tsx b/frontend/src/metabase/writeback/components/ActionsLinkingControl.tsx
deleted file mode 100644
index e72a7601106..00000000000
--- a/frontend/src/metabase/writeback/components/ActionsLinkingControl.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import React from "react";
-import { t } from "ttag";
-
-import Icon from "metabase/components/Icon";
-import PopoverWithTrigger from "metabase/components/PopoverWithTrigger";
-import Tooltip from "metabase/components/Tooltip";
-import SelectList from "metabase/components/SelectList";
-
-import * as Q_DEPRECATED from "metabase/lib/query";
-
-import { SavedCard, StructuredDatasetQuery } from "metabase-types/types/Card";
-import { DashboardWithCards, DashCard } from "metabase-types/types/Dashboard";
-
-type StructuredQuerySavedCard = SavedCard<StructuredDatasetQuery>;
-type StructuredQueryDashCard = DashCard<StructuredQuerySavedCard>;
-
-interface Props {
-  card: DashCard;
-  dashboard: DashboardWithCards;
-  onUpdateVisualizationSettings: (settings: Record<string, unknown>) => void;
-}
-
-function ActionsLinkingControl({
-  card,
-  dashboard,
-  onUpdateVisualizationSettings,
-}: Props) {
-  const connectedDashCardId =
-    card.visualization_settings["actions.linked_card"];
-
-  const suitableDashCards = dashboard.ordered_cards.filter(
-    dashCard =>
-      Q_DEPRECATED.isStructured(dashCard.card.dataset_query) &&
-      !dashCard.isAdded, // only show dash cards that have a stable ID already
-  ) as StructuredQueryDashCard[];
-
-  return (
-    <PopoverWithTrigger
-      triggerElement={
-        <Tooltip tooltip={t`Connect table`}>
-          <Icon name="bolt" size={16} />
-        </Tooltip>
-      }
-    >
-      <SelectList>
-        {suitableDashCards.map(dashCard => (
-          // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-          // @ts-ignore
-          <SelectList.Item
-            key={dashCard.id}
-            name={dashCard.card.name}
-            icon="table"
-            isSelected={dashCard.id === connectedDashCardId}
-            onSelect={() =>
-              onUpdateVisualizationSettings({
-                "actions.linked_card": dashCard.id,
-              })
-            }
-          />
-        ))}
-      </SelectList>
-    </PopoverWithTrigger>
-  );
-}
-
-export default ActionsLinkingControl;
-- 
GitLab