Skip to content
Snippets Groups Projects
Unverified Commit d76dc232 authored by shaun's avatar shaun Committed by GitHub
Browse files

Fix boolean icons in SQL query editor (#31538)


* Fetch field icon from dimension instead of semantic_type (#28622)

* simplify field.dimension().icon() → field.icon()

* resync tooltip to reflect non-semantic icon

* add ts-ignore to iconName with justification

* Updating eslint rules to allow importing types to metabase-lib

* Revert "Updating eslint rules to allow importing types to metabase-lib"

This reverts commit 1b6aca4362a7ca530046466bc9c1bfc02d5b116c.

---------

Co-authored-by: default avatarAbdul Aziz Ali <abdulazizali@acm.org>
Co-authored-by: default avatarNick Fitzpatrick <nickfitz.582@gmail.com>
parent 75b6d921
No related branches found
No related tags found
No related merge requests found
import { t, ngettext, msgid } from "ttag";
import { getSemanticTypeIcon } from "metabase/lib/schema_metadata";
import type { IconName } from "metabase/core/components/Icon";
import Field from "metabase-lib/metadata/Field";
import {
NodeListItemLink,
......@@ -29,14 +29,16 @@ const FieldList = ({ fields, onFieldClick }: FieldListProps) => (
</NodeListTitleText>
</NodeListTitle>
{fields.map(field => {
const tooltip = field.semantic_type ? null : t`Unknown type`;
// field.icon() cannot be annotated to return IconName
// because metabase-lib cannot import from metabase.
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const iconName: IconName = field.icon();
const tooltip = iconName === "unknown" ? t`Unknown type` : null;
return (
<li key={field.getUniqueId()}>
<NodeListItemLink onClick={() => onFieldClick(field)}>
<NodeListItemIcon
name={getSemanticTypeIcon(field.semantic_type, "warning")}
tooltip={tooltip}
/>
<NodeListItemIcon name={iconName} tooltip={tooltip} />
<NodeListItemName>{field.name}</NodeListItemName>
</NodeListItemLink>
</li>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment