From 15d709be3da379f946d0f0b70b88a7eeacd82245 Mon Sep 17 00:00:00 2001 From: Tony Zhou Date: Sat, 28 Jan 2023 02:18:22 -0500 Subject: [PATCH 1/9] chunk1 --- packages/chart/src/ChartModelFactory.ts | 2 +- packages/chart/src/ChartUtils.ts | 19 ++++---- packages/code-studio/src/main/WidgetUtils.ts | 3 +- .../src/ChartBuilderPlugin.tsx | 3 +- packages/iris-grid/src/IrisGridUtils.ts | 45 ++++++++++--------- 5 files changed, 37 insertions(+), 35 deletions(-) diff --git a/packages/chart/src/ChartModelFactory.ts b/packages/chart/src/ChartModelFactory.ts index 635f68e0c5..cb61dcc7df 100644 --- a/packages/chart/src/ChartModelFactory.ts +++ b/packages/chart/src/ChartModelFactory.ts @@ -78,7 +78,7 @@ class ChartModelFactory { * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel */ static async makeModel( - settings: Record | undefined, + settings: ChartModelSettings | undefined, figure: Figure, theme = ChartTheme ): Promise { diff --git a/packages/chart/src/ChartUtils.ts b/packages/chart/src/ChartUtils.ts index 8ba5b825ca..7286b503e0 100644 --- a/packages/chart/src/ChartUtils.ts +++ b/packages/chart/src/ChartUtils.ts @@ -37,9 +37,9 @@ import ChartTheme from './ChartTheme'; export interface ChartModelSettings { hiddenSeries?: string[]; - type: keyof SeriesPlotStyle; - series: string[]; - xAxis: string; + type?: keyof SeriesPlotStyle; + series?: string[]; + xAxis?: string; title?: string; } @@ -1707,10 +1707,13 @@ class ChartUtils { */ static hydrateSettings( settings: ChartModelSettings - ): Omit & { type: SeriesPlotStyle } { + ): Omit & { type?: SeriesPlotStyle } { return { ...settings, - type: dh.plot.SeriesPlotStyle[settings.type], + type: + settings.type != null + ? dh.plot.SeriesPlotStyle[settings.type] + : undefined, }; } @@ -1718,7 +1721,7 @@ class ChartUtils { const { series, xAxis, - title = `${series.join(', ')} by ${xAxis}`, + title = `${(series ?? []).join(', ')} by ${xAxis}`, } = settings; return title; @@ -1774,13 +1777,13 @@ class ChartUtils { { chartType: `${dh.plot.ChartType.XY}`, axes: [xAxis, yAxis], - series: series.map(name => ({ + series: (series ?? []).map(name => ({ plotStyle: `${type}`, name, dataSources: [ { type: `${dh.plot.SourceType.X}`, - columnName: settingsAxis, + columnName: settingsAxis ?? '', axis: xAxis, table, }, diff --git a/packages/code-studio/src/main/WidgetUtils.ts b/packages/code-studio/src/main/WidgetUtils.ts index 5fa9d4e9ee..4d0216e434 100644 --- a/packages/code-studio/src/main/WidgetUtils.ts +++ b/packages/code-studio/src/main/WidgetUtils.ts @@ -67,8 +67,7 @@ export const createChartModel = async ( }; const figure = await connection.getObject(definition); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return ChartModelFactory.makeModel(settings as any, figure); + return ChartModelFactory.makeModel(settings, figure); } const definition = { diff --git a/packages/dashboard-core-plugins/src/ChartBuilderPlugin.tsx b/packages/dashboard-core-plugins/src/ChartBuilderPlugin.tsx index c3795edc2f..b08bccbda7 100644 --- a/packages/dashboard-core-plugins/src/ChartBuilderPlugin.tsx +++ b/packages/dashboard-core-plugins/src/ChartBuilderPlugin.tsx @@ -45,8 +45,7 @@ export function ChartBuilderPlugin( }) => { const { settings } = metadata; const makeModel = () => - // eslint-disable-next-line @typescript-eslint/no-explicit-any - ChartModelFactory.makeModelFromSettings(settings as any, table); + ChartModelFactory.makeModelFromSettings(settings, table); const title = ChartUtils.titleFromSettings(settings); const config = { diff --git a/packages/iris-grid/src/IrisGridUtils.ts b/packages/iris-grid/src/IrisGridUtils.ts index a270751725..aaf61ccc04 100644 --- a/packages/iris-grid/src/IrisGridUtils.ts +++ b/packages/iris-grid/src/IrisGridUtils.ts @@ -77,6 +77,28 @@ type HydratedIrisGridState = Pick< metrics: Pick; }; +export interface TableSettings { + quickFilters?: [ + number, + { + text: string; + } + ][]; + advancedFilters?: [ + number, + { + options: AdvancedFilterOptions; + } + ][]; + inputFilters?: InputFilter[]; + sorts?: { + column: ModelIndex; + isAbs: boolean; + direction: SortDirection; + }[]; + partition?: unknown; + partitionColumn?: ColumnName; +} export interface DehydratedIrisGridState { advancedFilters: [ number, @@ -865,28 +887,7 @@ class IrisGridUtils { */ static applyTableSettings( table: Table, - tableSettings: { - quickFilters?: [ - number, - { - text: string; - } - ][]; - advancedFilters?: [ - number, - { - options: AdvancedFilterOptions; - } - ][]; - inputFilters?: InputFilter[]; - sorts?: { - column: ModelIndex; - isAbs: boolean; - direction: SortDirection; - }[]; - partition?: unknown; - partitionColumn?: ColumnName; - }, + tableSettings: TableSettings, timeZone: string ): void { const { columns } = table; From d1fa63a8db8ba31bdf610f411c63136613744960 Mon Sep 17 00:00:00 2001 From: Tony Zhou Date: Tue, 31 Jan 2023 21:04:47 -0500 Subject: [PATCH 2/9] updated selectors with generic types --- packages/code-studio/src/redux/selectors.ts | 12 +- packages/components/src/LoadingOverlay.tsx | 4 +- packages/jsapi-shim/src/dh.types.ts | 2 +- packages/redux/src/selectors.ts | 165 +++++++++++--------- 4 files changed, 104 insertions(+), 79 deletions(-) diff --git a/packages/code-studio/src/redux/selectors.ts b/packages/code-studio/src/redux/selectors.ts index a479237204..235e60fa39 100644 --- a/packages/code-studio/src/redux/selectors.ts +++ b/packages/code-studio/src/redux/selectors.ts @@ -1,4 +1,4 @@ -import { RootState, ServerConfigValues } from '@deephaven/redux'; +import { RootState } from '@deephaven/redux'; import LayoutStorage from '../storage/LayoutStorage'; /** @@ -6,13 +6,15 @@ import LayoutStorage from '../storage/LayoutStorage'; * @param store The redux store * @returns The layout storage instance */ -export const getLayoutStorage = (store: RootState): LayoutStorage => - store.layoutStorage as LayoutStorage; +export const getLayoutStorage = ( + store: State +): LayoutStorage => store.layoutStorage as LayoutStorage; /** * Get the configuration values of the server * @param store The redux store * @returns The layout storage instance */ -export const getServerConfigValues = (store: RootState): ServerConfigValues => - store.serverConfigValues; +export const getServerConfigValues = ( + store: State +): State['serverConfigValues'] => store.serverConfigValues; diff --git a/packages/components/src/LoadingOverlay.tsx b/packages/components/src/LoadingOverlay.tsx index ae0dd98aa8..3966d75ec0 100644 --- a/packages/components/src/LoadingOverlay.tsx +++ b/packages/components/src/LoadingOverlay.tsx @@ -8,8 +8,8 @@ import LoadingSpinner from './LoadingSpinner'; import './LoadingOverlay.scss'; type LoadingOverlayProps = { - isLoaded: boolean; - isLoading: boolean; + isLoaded?: boolean; + isLoading?: boolean; errorMessage: string | null; 'data-testid'?: string; }; diff --git a/packages/jsapi-shim/src/dh.types.ts b/packages/jsapi-shim/src/dh.types.ts index b70c902ac5..bd358a5dc2 100644 --- a/packages/jsapi-shim/src/dh.types.ts +++ b/packages/jsapi-shim/src/dh.types.ts @@ -281,7 +281,7 @@ export interface Figure extends Evented { readonly EVENT_SERIES_ADDED: string; /** Given a client-created figure descriptor, generate a figure that can be subscribed to */ - create(figure: Partial): Figure; + create(figure: Partial): Promise
; readonly title: string; readonly titleFont: string; diff --git a/packages/redux/src/selectors.ts b/packages/redux/src/selectors.ts index 941b3ced64..1436d025b2 100644 --- a/packages/redux/src/selectors.ts +++ b/packages/redux/src/selectors.ts @@ -1,90 +1,113 @@ -import type { - RootState, - User, - Storage, - Workspace, - WorkspaceSettings, -} from './store'; +import type { RootState, Storage, WorkspaceSettings } from './store'; const EMPTY_OBJECT = Object.freeze({}); const EMPTY_MAP: ReadonlyMap = new Map(); -type Selector = (state: RootState) => R; - +export type Selector = (store: State) => R; // User -export const getUser: Selector = store => store.user; +export const getUser = ( + store: State +): State['user'] => store.user; -export const getUserName: Selector = store => getUser(store).name; +export const getUserName = ( + store: State +): State['user']['name'] => getUser(store).name; -export const getUserGroups: Selector = store => - getUser(store).groups; +export const getUserGroups = ( + store: State +): State['user']['groups'] => getUser(store).groups; // Storage -export const getStorage: Selector = store => store.storage; +export const getStorage = ( + store: State +): State['storage'] => store.storage; -export const getCommandHistoryStorage: Selector< - Storage['commandHistoryStorage'] -> = store => getStorage(store).commandHistoryStorage; +export const getCommandHistoryStorage = ( + store: State +): State['storage']['commandHistoryStorage'] => + getStorage(store).commandHistoryStorage; -export const getFileStorage: Selector = store => - getStorage(store).fileStorage; +export const getFileStorage = ( + store: State +): State['storage']['fileStorage'] => getStorage(store).fileStorage; -export const getWorkspaceStorage: Selector< - Storage['workspaceStorage'] -> = store => getStorage(store).workspaceStorage; +export const getWorkspaceStorage = ( + store: State +): Storage['workspaceStorage'] => getStorage(store).workspaceStorage; // Workspace -export const getWorkspace: Selector = store => store.workspace; +export const getWorkspace = ( + store: State +): RootState['workspace'] => store.workspace; // Settings -export const getSettings: Selector = store => +export const getSettings = ( + store: State +): RootState['workspace']['data']['settings'] => getWorkspace(store).data.settings; -export const getDefaultDateTimeFormat: Selector< - WorkspaceSettings['defaultDateTimeFormat'] -> = store => getSettings(store).defaultDateTimeFormat; - -export const getDefaultDecimalFormatOptions: Selector< - WorkspaceSettings['defaultDecimalFormatOptions'] -> = store => getSettings(store).defaultDecimalFormatOptions ?? EMPTY_OBJECT; - -export const getDefaultIntegerFormatOptions: Selector< - WorkspaceSettings['defaultIntegerFormatOptions'] -> = store => getSettings(store).defaultIntegerFormatOptions ?? EMPTY_OBJECT; - -export const getFormatter: Selector = store => - getSettings(store).formatter; - -export const getTimeZone: Selector = store => - getSettings(store).timeZone; - -export const getShowTimeZone: Selector< - WorkspaceSettings['showTimeZone'] -> = store => getSettings(store).showTimeZone; - -export const getShowTSeparator: Selector< - WorkspaceSettings['showTSeparator'] -> = store => getSettings(store).showTSeparator; - -export const getTruncateNumbersWithPound: Selector< - WorkspaceSettings['truncateNumbersWithPound'] -> = store => getSettings(store).truncateNumbersWithPound; - -export const getDisableMoveConfirmation: Selector< - WorkspaceSettings['disableMoveConfirmation'] -> = store => getSettings(store).disableMoveConfirmation || false; - -export const getShortcutOverrides: Selector< - WorkspaceSettings['shortcutOverrides'] -> = store => getSettings(store).shortcutOverrides; - -export const getDefaultNotebookSettings: Selector< - WorkspaceSettings['defaultNotebookSettings'] -> = store => getSettings(store).defaultNotebookSettings ?? EMPTY_OBJECT; - -export const getActiveTool: Selector = store => - store.activeTool; - -export const getPlugins: Selector = store => - store.plugins ?? EMPTY_MAP; +export const getDefaultDateTimeFormat = ( + store: State +): WorkspaceSettings['defaultDateTimeFormat'] => + getSettings(store).defaultDateTimeFormat; + +export const getDefaultDecimalFormatOptions = < + State extends RootState = RootState +>( + store: State +): WorkspaceSettings['defaultDecimalFormatOptions'] => + getSettings(store).defaultDecimalFormatOptions ?? EMPTY_OBJECT; + +export const getDefaultIntegerFormatOptions = < + State extends RootState = RootState +>( + store: State +): WorkspaceSettings['defaultIntegerFormatOptions'] => + getSettings(store).defaultIntegerFormatOptions ?? EMPTY_OBJECT; + +export const getFormatter = ( + store: State +): WorkspaceSettings['formatter'] => getSettings(store).formatter; + +export const getTimeZone = ( + store: State +): WorkspaceSettings['timeZone'] => getSettings(store).timeZone; + +export const getShowTimeZone = ( + store: State +): WorkspaceSettings['showTimeZone'] => getSettings(store).showTimeZone; + +export const getShowTSeparator = ( + store: State +): WorkspaceSettings['showTSeparator'] => getSettings(store).showTSeparator; + +export const getTruncateNumbersWithPound = < + State extends RootState = RootState +>( + store: State +): WorkspaceSettings['truncateNumbersWithPound'] => + getSettings(store).truncateNumbersWithPound; + +export const getDisableMoveConfirmation = ( + store: State +): WorkspaceSettings['disableMoveConfirmation'] => + getSettings(store).disableMoveConfirmation || false; + +export const getShortcutOverrides = ( + store: State +): WorkspaceSettings['shortcutOverrides'] => + getSettings(store).shortcutOverrides; + +export const getDefaultNotebookSettings = ( + store: State +): WorkspaceSettings['defaultNotebookSettings'] => + getSettings(store).defaultNotebookSettings ?? EMPTY_OBJECT; + +export const getActiveTool = ( + store: State +): RootState['activeTool'] => store.activeTool; + +export const getPlugins = ( + store: State +): RootState['plugins'] => store.plugins ?? EMPTY_MAP; From b0313c93e4565628cc6fca550ca20d0e6e4e733a Mon Sep 17 00:00:00 2001 From: Tony Zhou Date: Fri, 10 Feb 2023 14:36:21 -0500 Subject: [PATCH 3/9] removed a few cast --- .../code-studio/src/settings/ColumnSpecificSectionContent.tsx | 3 +-- packages/code-studio/src/settings/SettingsUtils.tsx | 2 +- packages/components/src/navigation/MenuItem.tsx | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/code-studio/src/settings/ColumnSpecificSectionContent.tsx b/packages/code-studio/src/settings/ColumnSpecificSectionContent.tsx index 525af78bf9..a518616311 100644 --- a/packages/code-studio/src/settings/ColumnSpecificSectionContent.tsx +++ b/packages/code-studio/src/settings/ColumnSpecificSectionContent.tsx @@ -248,8 +248,7 @@ export class ColumnSpecificSectionContent extends PureComponent< isNewRule: true, }; return { - formatSettings: - formatSettings != null ? [...formatSettings, newFormat] : [newFormat], + formatSettings: [...formatSettings, newFormat], formatRulesChanged: true, }; }); diff --git a/packages/code-studio/src/settings/SettingsUtils.tsx b/packages/code-studio/src/settings/SettingsUtils.tsx index bb0a1c86de..cf7b19d7c4 100644 --- a/packages/code-studio/src/settings/SettingsUtils.tsx +++ b/packages/code-studio/src/settings/SettingsUtils.tsx @@ -16,7 +16,7 @@ export type FormatOption = { export type FormatterItem = { columnType: string; columnName: string; - format: Partial; + format: TableColumnFormat | Record; id?: number; isNewRule?: boolean; }; diff --git a/packages/components/src/navigation/MenuItem.tsx b/packages/components/src/navigation/MenuItem.tsx index 7529a6393e..aaac926f87 100644 --- a/packages/components/src/navigation/MenuItem.tsx +++ b/packages/components/src/navigation/MenuItem.tsx @@ -22,7 +22,7 @@ function isSwitchMenuItemType(item: MenuItemDef): item is SwitchMenuItemDef { } export type MenuItemProps = { - item: MenuItemDef; + item: MenuItemDef | SwitchMenuItemDef; onSelect?: () => void; 'data-testid'?: string; }; From a746253ddb040bc020c52af23cc67e4b810cc621 Mon Sep 17 00:00:00 2001 From: Tony Zhou Date: Thu, 2 Mar 2023 10:54:01 -0500 Subject: [PATCH 4/9] type mismatch --- packages/iris-grid/src/IrisGridUtils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/iris-grid/src/IrisGridUtils.ts b/packages/iris-grid/src/IrisGridUtils.ts index cd7ec8a4cb..76a611fe7e 100644 --- a/packages/iris-grid/src/IrisGridUtils.ts +++ b/packages/iris-grid/src/IrisGridUtils.ts @@ -76,20 +76,20 @@ type HydratedIrisGridState = Pick< }; export interface TableSettings { - quickFilters?: [ + quickFilters?: readonly [ number, { text: string; } ][]; - advancedFilters?: [ + advancedFilters?: readonly [ number, { options: AdvancedFilterOptions; } ][]; - inputFilters?: InputFilter[]; - sorts?: { + inputFilters?: readonly InputFilter[]; + sorts?: readonly { column: ModelIndex; isAbs: boolean; direction: SortDirection; From 5f51b82ba457f6acc5c2742437ddf8ba48957099 Mon Sep 17 00:00:00 2001 From: Tony Zhou Date: Tue, 7 Mar 2023 15:32:02 -0500 Subject: [PATCH 5/9] requeted changes --- .../src/settings/SettingsUtils.tsx | 2 +- .../components/src/navigation/MenuItem.tsx | 2 +- packages/iris-grid/src/IrisGridUtils.ts | 31 ++++++------------- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/packages/code-studio/src/settings/SettingsUtils.tsx b/packages/code-studio/src/settings/SettingsUtils.tsx index cf7b19d7c4..bb0a1c86de 100644 --- a/packages/code-studio/src/settings/SettingsUtils.tsx +++ b/packages/code-studio/src/settings/SettingsUtils.tsx @@ -16,7 +16,7 @@ export type FormatOption = { export type FormatterItem = { columnType: string; columnName: string; - format: TableColumnFormat | Record; + format: Partial; id?: number; isNewRule?: boolean; }; diff --git a/packages/components/src/navigation/MenuItem.tsx b/packages/components/src/navigation/MenuItem.tsx index aaac926f87..7529a6393e 100644 --- a/packages/components/src/navigation/MenuItem.tsx +++ b/packages/components/src/navigation/MenuItem.tsx @@ -22,7 +22,7 @@ function isSwitchMenuItemType(item: MenuItemDef): item is SwitchMenuItemDef { } export type MenuItemProps = { - item: MenuItemDef | SwitchMenuItemDef; + item: MenuItemDef; onSelect?: () => void; 'data-testid'?: string; }; diff --git a/packages/iris-grid/src/IrisGridUtils.ts b/packages/iris-grid/src/IrisGridUtils.ts index 76a611fe7e..6aad79d4e2 100644 --- a/packages/iris-grid/src/IrisGridUtils.ts +++ b/packages/iris-grid/src/IrisGridUtils.ts @@ -75,28 +75,6 @@ type HydratedIrisGridState = Pick< metrics: Pick; }; -export interface TableSettings { - quickFilters?: readonly [ - number, - { - text: string; - } - ][]; - advancedFilters?: readonly [ - number, - { - options: AdvancedFilterOptions; - } - ][]; - inputFilters?: readonly InputFilter[]; - sorts?: readonly { - column: ModelIndex; - isAbs: boolean; - direction: SortDirection; - }[]; - partition?: unknown; - partitionColumn?: ColumnName; -} export type DehydratedPendingDataMap = [number, { data: [string, T][] }][]; export type DehydratedAdvancedFilter = [ @@ -125,6 +103,15 @@ export type DehydratedSort = { direction: SortDirection; }; +export interface TableSettings { + quickFilters?: readonly DehydratedQuickFilter[]; + advancedFilters?: readonly DehydratedAdvancedFilter[]; + inputFilters?: readonly InputFilter[]; + sorts?: readonly DehydratedSort[]; + partition?: unknown; + partitionColumn?: ColumnName; +} + export interface DehydratedIrisGridState { advancedFilters: readonly DehydratedAdvancedFilter[]; aggregationSettings: AggregationSettings; From 77dd82fd0e8df2673ab82485b524f964ca918e5a Mon Sep 17 00:00:00 2001 From: Tony Zhou Date: Tue, 7 Mar 2023 15:35:57 -0500 Subject: [PATCH 6/9] removed formattingRule cast --- .../src/settings/FormattingSectionContent.tsx | 3 +-- packages/code-studio/src/settings/SettingsUtils.tsx | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/code-studio/src/settings/FormattingSectionContent.tsx b/packages/code-studio/src/settings/FormattingSectionContent.tsx index 7ba47ec4ff..0aaef95a45 100644 --- a/packages/code-studio/src/settings/FormattingSectionContent.tsx +++ b/packages/code-studio/src/settings/FormattingSectionContent.tsx @@ -15,7 +15,6 @@ import { IntegerColumnFormatter, DecimalColumnFormatter, TableUtils, - FormattingRule, } from '@deephaven/jsapi-utils'; import Log from '@deephaven/log'; import { @@ -363,7 +362,7 @@ export class FormattingSectionContent extends PureComponent< const { settings, saveSettings } = this.props; const newSettings: WorkspaceSettings = { ...settings, - formatter: formatter as FormattingRule[], + formatter, defaultDateTimeFormat, showTimeZone, showTSeparator, diff --git a/packages/code-studio/src/settings/SettingsUtils.tsx b/packages/code-studio/src/settings/SettingsUtils.tsx index bb0a1c86de..a2a0be4691 100644 --- a/packages/code-studio/src/settings/SettingsUtils.tsx +++ b/packages/code-studio/src/settings/SettingsUtils.tsx @@ -4,6 +4,7 @@ import { IntegerColumnFormatter, DecimalColumnFormatter, TableColumnFormat, + FormattingRule, } from '@deephaven/jsapi-utils'; import Log from '@deephaven/log'; @@ -92,13 +93,15 @@ export function isValidFormat( } export function removeFormatRuleExtraProps( - item: FormatterItem -): Omit { + item: FormattingRule & { id?: number; isNewRule?: boolean } +): FormattingRule { const { id, isNewRule, ...rest } = item; return rest; } -export function isFormatRuleValidForSave(rule: FormatterItem): boolean { +export function isFormatRuleValidForSave( + rule: FormatterItem +): rule is T { return ( isValidColumnName(rule.columnName) && isValidFormat(rule.columnType, rule.format) From 51ad5c592b86e6b2669fa2e043fd93524de7034f Mon Sep 17 00:00:00 2001 From: Tony Zhou Date: Fri, 10 Mar 2023 20:08:18 -0500 Subject: [PATCH 7/9] made FOrmatterItem type better --- .../code-studio/src/settings/SettingsUtils.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/code-studio/src/settings/SettingsUtils.tsx b/packages/code-studio/src/settings/SettingsUtils.tsx index a2a0be4691..db069bd9e1 100644 --- a/packages/code-studio/src/settings/SettingsUtils.tsx +++ b/packages/code-studio/src/settings/SettingsUtils.tsx @@ -14,14 +14,15 @@ export type FormatOption = { defaultFormatString?: string; }; -export type FormatterItem = { - columnType: string; - columnName: string; - format: Partial; +export type ValidFormatterItem = FormattingRule & { id?: number; isNewRule?: boolean; }; +export type FormatterItem = Omit & { + format: Partial; +}; + function isFormatStringFormat( format: Partial ): format is Pick { @@ -93,15 +94,15 @@ export function isValidFormat( } export function removeFormatRuleExtraProps( - item: FormattingRule & { id?: number; isNewRule?: boolean } + item: ValidFormatterItem ): FormattingRule { const { id, isNewRule, ...rest } = item; return rest; } -export function isFormatRuleValidForSave( +export function isFormatRuleValidForSave( rule: FormatterItem -): rule is T { +): rule is ValidFormatterItem { return ( isValidColumnName(rule.columnName) && isValidFormat(rule.columnType, rule.format) From 818a8ae2da284a2fcfc61adc88db0ba1d20e8756 Mon Sep 17 00:00:00 2001 From: Tony Zhou Date: Sat, 11 Mar 2023 00:49:47 -0500 Subject: [PATCH 8/9] fake --- packages/dashboard/src/layout/LayoutUtils.ts | 5 ++++- packages/iris-grid/src/IrisGrid.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/dashboard/src/layout/LayoutUtils.ts b/packages/dashboard/src/layout/LayoutUtils.ts index 869881286f..b1382116c8 100644 --- a/packages/dashboard/src/layout/LayoutUtils.ts +++ b/packages/dashboard/src/layout/LayoutUtils.ts @@ -80,7 +80,10 @@ class LayoutUtils { * @param config Tab config to match * @returns True if the tab is active */ - static isActiveTab(root: ContentItem, config: Config): boolean { + static isActiveTab( + root: ContentItem, + config: Partial + ): boolean { const stack = LayoutUtils.getStackForRoot(root, config, false); if (!stack) { log.error('Could not find stack for config', config); diff --git a/packages/iris-grid/src/IrisGrid.tsx b/packages/iris-grid/src/IrisGrid.tsx index 7acccd5c89..10d0c2e13c 100644 --- a/packages/iris-grid/src/IrisGrid.tsx +++ b/packages/iris-grid/src/IrisGrid.tsx @@ -2481,7 +2481,7 @@ export class IrisGrid extends Component { return canToggleSearch; } - toggleSearchBar(): void { + toggleSearchBar(): string { const { showSearchBar } = this.state; if (!this.isTableSearchAvailable()) { return; From b958c9dd9437334e784fda5e21a77f9cdae35b22 Mon Sep 17 00:00:00 2001 From: Tony Zhou Date: Sat, 11 Mar 2023 00:52:38 -0500 Subject: [PATCH 9/9] removed fake --- packages/iris-grid/src/IrisGrid.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/iris-grid/src/IrisGrid.tsx b/packages/iris-grid/src/IrisGrid.tsx index 10d0c2e13c..7acccd5c89 100644 --- a/packages/iris-grid/src/IrisGrid.tsx +++ b/packages/iris-grid/src/IrisGrid.tsx @@ -2481,7 +2481,7 @@ export class IrisGrid extends Component { return canToggleSearch; } - toggleSearchBar(): string { + toggleSearchBar(): void { const { showSearchBar } = this.state; if (!this.isTableSearchAvailable()) { return;