The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
chore: drop unused files (#63500)
Uladzimir Havenchyk323e6f382355
diff --git a/enterprise/frontend/src/embedding-sdk-bundle/hooks/private/use-translated-collection-id.ts b/enterprise/frontend/src/embedding-sdk-bundle/hooks/private/use-translated-collection-id.tsdeleted file mode 100644index 7f7bb3382b6..00000000000--- a/enterprise/frontend/src/embedding-sdk-bundle/hooks/private/use-translated-collection-id.ts+++ /dev/null@@ -1,29 +0,0 @@-import { isValidId } from "embedding-sdk-bundle/lib/is-valid-collection-id";-import { getCollectionIdSlugFromReference } from "embedding-sdk-bundle/store/collections";-import type { SdkCollectionId } from "embedding-sdk-bundle/types/collection";-import { useValidatedEntityId } from "metabase/lib/entity-id/hooks/use-validated-entity-id";-import { useSelector } from "metabase/lib/redux";-import type { State } from "metabase-types/store";--export const useTranslatedCollectionId = ({- id: initialCollectionId,-}: {- id?: SdkCollectionId;-}) => {- const { id, isLoading, isError } = useValidatedEntityId({- type: "collection",- id: initialCollectionId,- });-- const initId = !isLoading && (id ?? initialCollectionId);-- const translatedCollectionId = useSelector((state: State) =>- initId ? getCollectionIdSlugFromReference(state, initId) : undefined,- );-- return {- id: isValidId(translatedCollectionId) ? translatedCollectionId : undefined,- isLoading,- isError,- };-};diff --git a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/modals/DeleteRowConfirmationModal.tsx b/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/modals/DeleteRowConfirmationModal.tsxdeleted file mode 100644index c7281a2f1e7..00000000000--- a/enterprise/frontend/src/metabase-enterprise/table-editing/table-edit/modals/DeleteRowConfirmationModal.tsx+++ /dev/null@@ -1,32 +0,0 @@-import { t } from "ttag";--import { Button, Group, Modal } from "metabase/ui";--type DeleteRowConfirmationModalProps = {- isLoading: boolean;- onConfirm: () => void;- onCancel: () => void;-};-export function DeleteRowConfirmationModal({- onConfirm,- onCancel,- isLoading,-}: DeleteRowConfirmationModalProps) {- return (- <Modal size="md" title={t`Delete this record?`} opened onClose={onCancel}>- <Group justify="flex-end" mt="xl">- <Button variant="subtle" onClick={onCancel}>- {t`Cancel`}- </Button>- <Button- variant="filled"- color="danger"- onClick={onConfirm}- loading={isLoading}- >- {t`Delete record`}- </Button>- </Group>- </Modal>- );-}diff --git a/enterprise/frontend/src/metabase-enterprise/transforms/components/QueryEditor/EditorBody/hooks.ts b/enterprise/frontend/src/metabase-enterprise/transforms/components/QueryEditor/EditorBody/hooks.tsdeleted file mode 100644index e69de29bb2d..00000000000diff --git a/frontend/src/metabase/admin/settings/components/widgets/GroupMappingsWidget/SettingToggle.tsx b/frontend/src/metabase/admin/settings/components/widgets/GroupMappingsWidget/SettingToggle.tsxdeleted file mode 100644index 6ceb59db319..00000000000--- a/frontend/src/metabase/admin/settings/components/widgets/GroupMappingsWidget/SettingToggle.tsx+++ /dev/null@@ -1,56 +0,0 @@-import cx from "classnames";-import type { ReactNode } from "react";-import { t } from "ttag";--import Toggle from "metabase/common/components/Toggle";-import CS from "metabase/css/core/index.css";-import { Tooltip } from "metabase/ui";--import type { SettingElement } from "../../../types";--type SettingToggleProps = {- disabled: boolean;- hideLabel: boolean;- id: string;- setting: SettingElement;- tooltip: ReactNode;- onChange: ((value: boolean) => void) | undefined;- onChangeSetting?: unknown;- reloadSettings?: unknown;- settingValues?: unknown;-};--export const SettingToggle = ({- disabled,- hideLabel,- id,- setting,- tooltip,- onChange,- // the following three props were being spread into the 'div', causing- // unknown prop errors so we're just keeping them here- onChangeSetting,- reloadSettings,- settingValues,- ...props-}: SettingToggleProps) => {- const value = setting.value == null ? setting.default : setting.value;- const on = value === true || value === "true";- return (- <div {...props} className={cx(CS.flex, CS.alignCenter, CS.pt1)}>- <Tooltip label={tooltip} disabled={!tooltip}>- <Toggle- id={id}- value={on}- onChange={!disabled ? () => onChange?.(!on) : undefined}- disabled={disabled}- />- </Tooltip>- {!hideLabel && (- <span className={cx(CS.textBold, CS.mx1)}>- {on ? t`Enabled` : t`Disabled`}- </span>- )}- </div>- );-};diff --git a/frontend/src/metabase/admin/settings/types.ts b/frontend/src/metabase/admin/settings/types.tsdeleted file mode 100644index 2a8faebf6fd..00000000000--- a/frontend/src/metabase/admin/settings/types.ts+++ /dev/null@@ -1,46 +0,0 @@-import type { ComponentType } from "react";--import type {- SettingDefinition,- SettingKey,- SettingValue,- Settings,-} from "metabase-types/api";--export type SettingElement<Key extends SettingKey = SettingKey> =- SettingDefinition<Key> & {- tab?: string;- display_name?: string;- type?: string;- note?: string;- searchProp?: string;- placeholder?: string;- options?: { value: SettingValue<Key>; name: string }[];- originalValue?: SettingValue<Key>;- defaultValue?: SettingValue<Key>;- required?: boolean;- autoFocus?: boolean;- showActualValue?: boolean;- allowValueCollection?: boolean;- noHeader?: boolean;- disableDefaultUpdate?: boolean;- validations?: [string, string][];- widget?: ComponentType<any>;- warningMessage?: string;- postUpdateActions?: VoidFunction[];- getProps?: (setting: SettingDefinition<Key>) => Record<string, any>;- getHidden?: (- settingValues: Settings,- derivedSettingValues: Settings,- ) => boolean;- onChanged?: (- oldValue: SettingValue<Key> | null,- newValue: SettingValue<Key> | null,- settingsValues: Settings,- handleChangeSetting: (key: Key, value: SettingValue<Key>) => void,- ) => void;- onBeforeChanged?: (- oldValue: SettingValue<Key> | null,- newValue: SettingValue<Key> | null,- ) => void;- };diff --git a/frontend/src/metabase/databases/components/DatabaseHostnameSectionField/DatabaseHostameSectionField.styled.tsx b/frontend/src/metabase/databases/components/DatabaseHostnameSectionField/DatabaseHostameSectionField.styled.tsxdeleted file mode 100644index 66cbda43851..00000000000--- a/frontend/src/metabase/databases/components/DatabaseHostnameSectionField/DatabaseHostameSectionField.styled.tsx+++ /dev/null@@ -1,15 +0,0 @@-// eslint-disable-next-line no-restricted-imports-import styled from "@emotion/styled";--import Button from "metabase/common/components/Button";--export const SectionButton = styled(Button)`- color: var(--mb-color-brand);- padding: 0;- border: none;- border-radius: 0;-- &:hover {- background-color: transparent;- }-`;diff --git a/frontend/src/metabase/detail-view/components/Header/utils.ts b/frontend/src/metabase/detail-view/components/Header/utils.tsdeleted file mode 100644index ec308901f5c..00000000000--- a/frontend/src/metabase/detail-view/components/Header/utils.ts+++ /dev/null@@ -1,19 +0,0 @@-import type { Table } from "metabase-types/api";--export const getEntityIcon = (entityType?: Table["entity_type"]) => {- switch (entityType) {- case "entity/UserTable":- return "person";- case "entity/CompanyTable":- return "globe";- case "entity/TransactionTable":- return "index";- case "entity/SubscriptionTable":- return "sync";- case "entity/ProductTable":- case "entity/EventTable":- case "entity/GenericTable":- default:- return "document";- }-};diff --git a/frontend/src/metabase/home/components/EmbedHomepage/Badge.ts b/frontend/src/metabase/home/components/EmbedHomepage/Badge.tsdeleted file mode 100644index 3423b0205e9..00000000000--- a/frontend/src/metabase/home/components/EmbedHomepage/Badge.ts+++ /dev/null@@ -1,44 +0,0 @@-// eslint-disable-next-line no-restricted-imports-import styled from "@emotion/styled";--import type { MantineSize } from "metabase/ui";--type BadgeColor = "brand" | "gray";--const COLOR_VARIANTS = {- brand: {- color: "var(--mb-color-text-white)",- background: "var(--mb-color-brand)",- },- gray: {- color: "var(--mb-color-text-primary)",- /* eslint-disable no-restricted-syntax -- we should find a way to use semantic colors here */- background: "var(--mb-base-color-gray-20)",- },-};--/**- * @deprecated use Badge from metabase/ui- */-export const Badge = styled.span<{- color: BadgeColor;- uppercase?: boolean;- px?: MantineSize;- py?: MantineSize;- fz?: MantineSize;-}>`- padding: ${({ px, py, theme }) => {- const paddingY = py ? theme.spacing[py] : "0";- const paddingX = px ? theme.spacing[px] : "4px";- return `${paddingY} ${paddingX}`;- }};- display: inline-block;- line-height: 1rem;- font-size: ${({ fz, theme }) => (fz ? theme.fontSizes[fz] : "0.625rem")};- font-weight: 700;- border-radius: 4px;- text-transform: ${(props) =>- (props.uppercase ?? true) ? "uppercase" : "none"};- color: ${({ color }) => COLOR_VARIANTS[color].color};- background: ${({ color }) => COLOR_VARIANTS[color].background};-`;diff --git a/frontend/src/metabase/lib/cookies.js b/frontend/src/metabase/lib/cookies.jsdeleted file mode 100644index 94d48c58fed..00000000000--- a/frontend/src/metabase/lib/cookies.js+++ /dev/null@@ -1,2 +0,0 @@-// METABASE_SESSION_COOKIE is only used for e2e tests. In normal usage cookie is set automatically by login endpoints-export const METABASE_SESSION_COOKIE = "metabase.SESSION";diff --git a/frontend/src/metabase/lib/entity-id/hooks/use-validated-entity-id.ts b/frontend/src/metabase/lib/entity-id/hooks/use-validated-entity-id.tsdeleted file mode 100644index 9073e215360..00000000000--- a/frontend/src/metabase/lib/entity-id/hooks/use-validated-entity-id.ts+++ /dev/null@@ -1,86 +0,0 @@-import { useMemo } from "react";-import _ from "underscore";--import { skipToken } from "metabase/api";-import { useTranslateEntityIdQuery } from "metabase/api/entity-id";-import { isBaseEntityID } from "metabase-types/api/entity-id";--import type {- SUPPORTED_ENTITIES,- ValidatedEntityIdProps,- ValidatedEntityIdReturned,-} from "../types";--/**- * A hook that validates and potentially translates an entity ID.- *- * If the hook is loading, then `null` is returned.- * If the ID is a valid NanoID and the translation is successful, the translated ID is returned.- * Otherwise, the original ID is returned.- *- * @param {Object} params - The parameters for the hook.- * @param {EntityType} params.type - The type of the entity (e.g., 'card', 'dashboard', etc.).- * @param {string | number | null | undefined} params.id - The ID to validate and potentially translate.- *- */-export const useValidatedEntityId = <- TEntity extends keyof SUPPORTED_ENTITIES,- TReturnedId = SUPPORTED_ENTITIES[TEntity],->({- type,- id,-}: ValidatedEntityIdProps<TEntity>): ValidatedEntityIdReturned<- TEntity,- TReturnedId-> => {- const isEntityId = isBaseEntityID(id);- const {- data: entity_ids,- isError,- isFetching,- } = useTranslateEntityIdQuery(- id && isEntityId- ? {- [type]: [id],- }- : skipToken,- );-- return useMemo(() => {- if (_.isNumber(id)) {- // no need to translate anything if the id is already not a entity id- return {- id: id as TReturnedId,- isLoading: false,- isError: false,- } as const;- }-- if (isFetching) {- return {- id: null,- isLoading: true,- isError: false,- } as const;- }-- if (!isEntityId || isError) {- return {- id: null,- isLoading: false,- isError: true,- } as const;- }-- if (entity_ids && entity_ids[id]?.status === "ok") {- return {- id: entity_ids[id].id as TReturnedId,- isLoading: false,- isError: false,- } as const;- }-- // something went wrong, either entity_ids is empty or the translation failed- return { id: null, isLoading: false, isError: true } as const;- }, [isEntityId, isFetching, isError, entity_ids, id]);-};diff --git a/frontend/src/metabase/lib/entity-id/types.ts b/frontend/src/metabase/lib/entity-id/types.tsdeleted file mode 100644index d8f1dc04294..00000000000--- a/frontend/src/metabase/lib/entity-id/types.ts+++ /dev/null@@ -1,30 +0,0 @@-import type {- BaseEntityId,- CardId,- CollectionId,- DashboardId,-} from "metabase-types/api";--export type SUPPORTED_ENTITIES = {- dashboard: DashboardId;- card: CardId;- collection: CollectionId;-};--export type ValidatedEntityIdProps<- TEntity extends keyof SUPPORTED_ENTITIES = keyof SUPPORTED_ENTITIES,-> = {- type: TEntity;- id: BaseEntityId | string | number | null | undefined;-};--export type ValidatedEntityIdReturned<- TEntity extends keyof SUPPORTED_ENTITIES,- TReturnedId = SUPPORTED_ENTITIES[TEntity] | null,-> =- | { id: TReturnedId; isLoading?: false; isError: false }- | {- id: null;- isLoading?: boolean;- isError: boolean;- };diff --git a/frontend/src/metabase/metabot-v3/selectors.ts b/frontend/src/metabase/metabot-v3/selectors.tsdeleted file mode 100644index 5f951d80d9f..00000000000--- a/frontend/src/metabase/metabot-v3/selectors.ts+++ /dev/null@@ -1,64 +0,0 @@-import { createSelector } from "@reduxjs/toolkit";-import _ from "underscore";--import {- getRawSeries,- getTransformedSeries,- getVisualizationSettings,-} from "metabase/query_builder/selectors";-import { keyForSingleSeries } from "metabase/visualizations/lib/settings/series";-import type { ComputedVisualizationSettings } from "metabase/visualizations/types";--/**- * This selector hydrates the visualization settings with default values for the series, column, and other settings.- * This is used to provide a more accurate context to the LLM when changing settings.- */-export const getVisualizationMetabotContext = createSelector(- [getTransformedSeries, getRawSeries, getVisualizationSettings],- (transformedSeries, rawSeries, visualizationSettings) => {- const hydratedVisualizationSettings: ComputedVisualizationSettings = {- ...visualizationSettings,- };-- if (typeof hydratedVisualizationSettings.series === "function") {- const seriesSettings: ComputedVisualizationSettings["series_settings"] =- {};- transformedSeries.forEach((series) => {- seriesSettings[keyForSingleSeries(series)] =- hydratedVisualizationSettings.series(series);- });- hydratedVisualizationSettings.series_settings = seriesSettings;- }-- if (typeof hydratedVisualizationSettings.column === "function") {- const columnSettings: ComputedVisualizationSettings["column_settings"] = {- ...hydratedVisualizationSettings.column_settings,- };- rawSeries.forEach((series) => {- series.data.cols.forEach((col) => {- const columnSetting = hydratedVisualizationSettings.column?.(col);-- if (columnSetting) {- // Use column name as key instead of column key because LLMs are bad with stringified json keys like `["name","column_name"]`- columnSettings[col.name] = {- ...columnSetting,- // Remove unnecessary properties from column objects- column: _.pick(columnSetting.column, [- "name",- "display_name",- "effective_type",- "base_type",- "database_type",- "semantic_type",- ]),- };- }- });- });-- hydratedVisualizationSettings.column_settings = columnSettings;- }-- return hydratedVisualizationSettings;- },-);diff --git a/frontend/src/metabase/querying/expressions/tokenizer/types.ts b/frontend/src/metabase/querying/expressions/tokenizer/types.tsdeleted file mode 100644index e69de29bb2d..00000000000diff --git a/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailWrapper.styled.tsx b/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailWrapper.styled.tsxdeleted file mode 100644index 5f626af36f8..00000000000--- a/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailWrapper.styled.tsx+++ /dev/null@@ -1,47 +0,0 @@-// eslint-disable-next-line no-restricted-imports-import styled from "@emotion/styled";--import Modal from "metabase/common/components/Modal";-import { breakpointMinMedium } from "metabase/styled-components/theme/media-queries";--import { ObjectDetailBodyWrapper } from "./ObjectDetailBody.styled";-import { ObjectDetailContainer } from "./ObjectDetailView.styled";-import { ObjectDetailsTable } from "./ObjectDetailsTable.styled";-import { ObjectRelationships } from "./ObjectRelationships.styled";--export const RootModal = styled(Modal)`- ${ObjectDetailContainer} {- overflow: hidden;- ${breakpointMinMedium} {- width: ${({ wide }) => (wide ? "64rem" : "48rem")};- max-width: 95vw;- }-- max-height: 95vh;- width: 95vw;- border: 1px solid var(--mb-color-border);- border-radius: 0.5rem;- }-- ${ObjectDetailBodyWrapper} {- ${breakpointMinMedium} {- display: flex;- height: calc(80vh - 4rem);- }-- max-height: calc(100vh - 8rem);- }-- ${ObjectDetailsTable} {- ${breakpointMinMedium} {- max-height: calc(80vh - 4rem);- }- }-- ${ObjectRelationships} {- ${breakpointMinMedium} {- flex: 0 0 33.3333%;- max-height: calc(80vh - 4rem);- }- }-`;diff --git a/frontend/src/metabase/visualizations/lib/get-dashboard-image.ts b/frontend/src/metabase/visualizations/lib/get-dashboard-image.tsdeleted file mode 100644index 9b066e3cb21..00000000000--- a/frontend/src/metabase/visualizations/lib/get-dashboard-image.ts+++ /dev/null@@ -1,88 +0,0 @@-import { DASHBOARD_HEADER_PARAMETERS_PDF_EXPORT_NODE_ID } from "metabase/dashboard/constants";--import { SAVING_DOM_IMAGE_CLASS } from "./image-exports";-const PARAMETERS_MARGIN_BOTTOM = 12;--export const getChartImage = async (- selector: string,-): Promise<File | undefined> => {- const chartRoot = document.querySelector(selector) as HTMLElement;-- const { default: html2canvas } = await import("html2canvas-pro");- const canvas = await html2canvas(chartRoot, {- useCORS: true,- onclone: (_doc: Document, node: HTMLElement) => {- node.classList.add(SAVING_DOM_IMAGE_CLASS);- },- });-- return new Promise<File | undefined>((resolve) => {- canvas.toBlob((blob) => {- if (blob) {- const file = new File([blob], "chart.png", { type: "image/png" });- resolve(file);- } else {- resolve(undefined);- }- }, "image/png");- });-};--export const getDashboardImage = async (- selector: string,-): Promise<File | undefined> => {- const dashboardRoot = document.querySelector(selector);- const gridNode = dashboardRoot?.querySelector(".react-grid-layout");-- if (!gridNode || !(gridNode instanceof HTMLElement)) {- console.warn("No dashboard content found", selector);- return undefined as any;- }-- const parametersNode = dashboardRoot- ?.querySelector(`#${DASHBOARD_HEADER_PARAMETERS_PDF_EXPORT_NODE_ID}`)- ?.cloneNode(true);-- let parametersHeight = 0;- if (parametersNode instanceof HTMLElement) {- gridNode.append(parametersNode);- parametersNode.style.cssText = `margin-bottom: ${PARAMETERS_MARGIN_BOTTOM}px`;- parametersHeight =- parametersNode.getBoundingClientRect().height + PARAMETERS_MARGIN_BOTTOM;- gridNode.removeChild(parametersNode);- }-- const verticalOffset = parametersHeight;- const contentWidth = gridNode.offsetWidth;- const contentHeight = gridNode.offsetHeight + verticalOffset;-- const backgroundColor = getComputedStyle(document.documentElement)- .getPropertyValue("--mb-color-bg-dashboard")- .trim();-- const { default: html2canvas } = await import("html2canvas-pro");- const canvas = await html2canvas(gridNode, {- height: contentHeight,- width: contentWidth,- useCORS: true,- onclone: (_doc: Document, node: HTMLElement) => {- node.classList.add(SAVING_DOM_IMAGE_CLASS);- node.style.height = `${contentHeight}px`;- node.style.backgroundColor = backgroundColor;- if (parametersNode instanceof HTMLElement) {- node.insertBefore(parametersNode, node.firstChild);- }- },- });-- return new Promise<File | undefined>((resolve) => {- canvas.toBlob((blob) => {- if (blob) {- const file = new File([blob], "dashboard.png", { type: "image/png" });- resolve(file);- } else {- resolve(undefined);- }- }, "image/png");- });-};