Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: DH-16865: Fix spinner on empty partitions list #1953

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 5 additions & 123 deletions packages/iris-grid/src/EmptyIrisGridModel.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,21 @@
/* eslint class-methods-use-this: "off" */
import {
GridRange,
ModelIndex,
MoveOperation,
VisibleIndex,
} from '@deephaven/grid';
import { ModelIndex, MoveOperation } from '@deephaven/grid';
import { dh as DhType } from '@deephaven/jsapi-types';
import { ColumnName, Formatter } from '@deephaven/jsapi-utils';
import { EMPTY_ARRAY, EMPTY_MAP } from '@deephaven/utils';
import IrisGridModel from './IrisGridModel';
import ColumnHeaderGroup from './ColumnHeaderGroup';
import {
PendingDataErrorMap,
PendingDataMap,
UITotalsTableConfig,
} from './CommonTypes';
import { UITotalsTableConfig } from './CommonTypes';
import IrisGridSchemaModelTemplate from './IrisGridSchemaModelTemplate';

class EmptyIrisGridModel extends IrisGridModel {
class EmptyIrisGridModel extends IrisGridSchemaModelTemplate {
constructor(dh: typeof DhType, formatter = new Formatter(dh)) {
super(dh);

this.modelFormatter = formatter;
}

modelFormatter: Formatter;

get rowCount(): number {
return 0;
super(dh, []);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to pass the formatter through.

Suggested change
super(dh, []);
super(dh, [], formatter);

That being said, it's not like this really needs a formatter since it's an empty grid, but 🤷

}

get columnCount(): number {
return 0;
}

textForCell(column: number, row: number): string {
return '';
}

textForColumnHeader(column: ModelIndex, depth?: number): string | undefined {
return undefined;
}
Expand Down Expand Up @@ -65,17 +44,6 @@ class EmptyIrisGridModel extends IrisGridModel {
return EMPTY_ARRAY;
}

formatForCell(
column: ModelIndex,
row: ModelIndex
): DhType.Format | undefined {
return undefined;
}

valueForCell(column: ModelIndex, row: ModelIndex): unknown {
return undefined;
}

get filter(): readonly DhType.FilterCondition[] {
return EMPTY_ARRAY;
}
Expand All @@ -96,22 +64,6 @@ class EmptyIrisGridModel extends IrisGridModel {
return EMPTY_ARRAY;
}

get formatter(): Formatter {
return this.modelFormatter;
}

set formatter(formatter: Formatter) {
this.modelFormatter = formatter;
}

displayString(
value: unknown,
columnType: string,
columnName?: ColumnName
): string {
return '';
}

get sort(): readonly DhType.Sort[] {
return EMPTY_ARRAY;
}
Expand Down Expand Up @@ -168,76 +120,6 @@ class EmptyIrisGridModel extends IrisGridModel {
// No-op
}

get pendingDataMap(): PendingDataMap {
return EMPTY_MAP;
}

set pendingDataMap(map: PendingDataMap) {
// No-op
}

get pendingRowCount(): number {
return 0;
}

set pendingRowCount(count: number) {
// No-op
}

get pendingDataErrors(): PendingDataErrorMap {
return EMPTY_MAP;
}

commitPending(): Promise<void> {
return Promise.resolve();
}

setViewport(
top: VisibleIndex,
bottom: VisibleIndex,
columns?: DhType.Column[]
): void {
// No-op
}

snapshot(ranges: readonly GridRange[]): Promise<readonly unknown[][]> {
return Promise.resolve([]);
}

textSnapshot(
ranges: readonly GridRange[],
includeHeaders?: boolean,
formatValue?: (
value: unknown,
column: DhType.Column,
row?: DhType.Row
) => string
): Promise<string> {
return Promise.resolve('');
}

valuesTable(
columns: DhType.Column | readonly DhType.Column[]
): Promise<DhType.Table> {
throw new Error('Method not implemented.');
}

delete(ranges: readonly GridRange[]): Promise<void> {
return Promise.resolve();
}

seekRow(
startRow: number,
column: DhType.Column,
valueType: unknown,
value: unknown,
insensitive?: boolean,
contains?: boolean,
isBackwards?: boolean
): Promise<number> {
return Promise.resolve(0);
}

get columnHeaderGroups(): readonly ColumnHeaderGroup[] {
return EMPTY_ARRAY;
}
Expand Down
Loading
Loading