Skip to content

Commit

Permalink
feat: Add top-tier icons
Browse files Browse the repository at this point in the history
  • Loading branch information
baumandm committed Aug 2, 2024
1 parent dd50b5d commit e4d8094
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 22 deletions.
2 changes: 1 addition & 1 deletion querybook/server/lib/elasticsearch/search_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def construct_tables_query(
}

if concise:
query["_source"] = ["id", "schema", "name"]
query["_source"] = ["id", "schema", "name", "golden"]

query.update(order_by_fields(sort_key, sort_order))
query.update(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ const TableRow: React.FC<{
onClick={handleLinkClick}
isRow
title={table.displayName}
icon={table.golden === true ? 'Crown' : null}
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { Title } from 'ui/Title/Title';
import { ToggleSwitch } from 'ui/ToggleSwitch/ToggleSwitch';

import './DataTableNavigatorSearch.scss';
import { Icon } from 'ui/Icon/Icon';
import { TopTierCrown } from 'components/TopTierCrown/TopTierCrown';

export const DataTableNavigatorSearch: React.FC<{
queryMetastore: IQueryMetastore;
Expand Down Expand Up @@ -95,15 +97,18 @@ export const DataTableNavigatorSearch: React.FC<{
title="Top Tier"
className="toggle-padding"
>
<ToggleSwitch
checked={searchFilters.golden}
onChange={(checked) =>
updateSearchFilter(
'golden',
checked ? true : null
)
}
/>
<div className="flex-row">
<ToggleSwitch
checked={searchFilters.golden}
onChange={(checked) =>
updateSearchFilter(
'golden',
checked ? true : null
)
}
/>
<TopTierCrown />
</div>
</SearchFilterRow>
<SearchFilterRow title="Schema">
<SearchBar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { Tag } from 'ui/Tag/Tag';
import { ToggleButton } from 'ui/ToggleButton/ToggleButton';

import './DataTableHeader.scss';
import { Icon } from 'ui/Icon/Icon';
import { TopTierCrown } from 'components/TopTierCrown/TopTierCrown';

export interface IDataTableHeader {
table: IDataTable;
Expand Down Expand Up @@ -89,10 +91,15 @@ export const DataTableHeader: React.FunctionComponent<IDataTableHeader> = ({
onClick={updateDataTableGolden}
title={table.golden ? 'Top Tier' : 'Make Top Tier'}
size="small"
icon="Crown"
/>
);
} else if (table.golden) {
featuredBadge = <Tag>Top Tier</Tag>;
featuredBadge = (
<Tag>
Top Tier <TopTierCrown />
</Tag>
);
}

const iconDOM = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { Loader } from 'ui/Loader/Loader';

import { ColumnIcon } from './ColumnIcon';
import { PanelSection, SubPanelSection } from './PanelSection';
import { Icon } from 'ui/Icon/Icon';
import { TopTierCrown } from 'components/TopTierCrown/TopTierCrown';

interface ITablePanelViewProps {
tableId: number;
Expand All @@ -38,7 +40,12 @@ export const TablePanelView: React.FunctionComponent<ITablePanelViewProps> = ({
const overviewSection = (
<PanelSection title="table">
<SubPanelSection title="schema">{schema.name}</SubPanelSection>
<SubPanelSection title="name">{table.name}</SubPanelSection>
<SubPanelSection title="name">
<span className="flex-row">
{table.name}
{table.golden && <TopTierCrown showTooltip={true} />}
</span>
</SubPanelSection>
<SubPanelSection title="description" hideIfNoContent>
{table.description
? (table.description as ContentState).getPlainText()
Expand Down
6 changes: 0 additions & 6 deletions querybook/webapp/components/Search/SearchOverview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@
display: flex;
align-items: center;
}

.crown svg {
color: var(--color-accent);
height: 16px;
stroke-width: 2.5px;
}
}

.Container-content {
Expand Down
3 changes: 2 additions & 1 deletion querybook/webapp/components/Search/SearchOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import { SearchSchemaSelect } from './SearchSchemaSelect';
import { TableSelect } from './TableSelect';

import './SearchOverview.scss';
import { TopTierCrown } from 'components/TopTierCrown/TopTierCrown';

const AIAssistantConfig = PublicConfig.ai_assistant;

Expand Down Expand Up @@ -752,7 +753,7 @@ export const SearchOverview: React.FC<ISearchOverviewProps> = ({
<div className="result-item-golden horizontal-space-between">
<span>
<span>top tier only</span>
<Icon className="crown ml4" name="Crown" />
<TopTierCrown />
</span>
<Checkbox
value={!!searchFilters.golden}
Expand Down
5 changes: 2 additions & 3 deletions querybook/webapp/components/Search/SearchResultItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { Tag } from 'ui/Tag/Tag';
import { SearchResultItemBoardItemAddButton } from './SearchResultItemBoardItemAddButton';

import './SearchResultItem.scss';
import { TopTierCrown } from 'components/TopTierCrown/TopTierCrown';

const HighlightTitle: React.FunctionComponent<{
title: string;
Expand Down Expand Up @@ -379,9 +380,7 @@ export const DataTableItem: React.FunctionComponent<IDataTableItemProps> = ({
);

const goldenIcon = golden ? (
<div className="result-item-golden ml4">
<Icon className="crown" name="Crown" />
</div>
<TopTierCrown showTooltip={true} tooltipPos="right" />
) : null;

const highlightedDescription = (preview.highlight || {}).description;
Expand Down
7 changes: 7 additions & 0 deletions querybook/webapp/components/TopTierCrown/TopTierCrown.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.TopTierCrown {
svg {
color: var(--color-accent);
height: 16px;
stroke-width: 2.5px;
}
}
23 changes: 23 additions & 0 deletions querybook/webapp/components/TopTierCrown/TopTierCrown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';

import './TopTierCrown.scss';
import { Icon } from 'ui/Icon/Icon';

export const TopTierCrown: React.FunctionComponent<{
showTooltip?: boolean;
tooltipPos?: string;
}> = ({ showTooltip = false, tooltipPos = 'down' }) => {
if (showTooltip) {
return (
<span
className="TopTierCrown flex-row"
aria-label="Top Tier"
data-balloon-pos={tooltipPos}
>
<Icon className="ml4" name="Crown" />
</span>
);
} else {
return <Icon className="TopTierCrown ml4" name="Crown" />;
}
};
1 change: 1 addition & 0 deletions querybook/webapp/redux/dataTableSearch/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface ITableSearchResult {
id: number;
schema: string;
name: string;
golden?: boolean;
}

export interface ITableSearchFilters {
Expand Down

0 comments on commit e4d8094

Please sign in to comment.