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

Feature/respect hidden attribute from h5 #260

Merged
merged 4 commits into from
Oct 9, 2023
Merged
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
1 change: 1 addition & 0 deletions renumics/spotlight/data_source/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ColumnMetadata:

nullable: bool
editable: bool
hidden: bool = False
description: Optional[str] = None
tags: List[str] = dataclasses.field(default_factory=list)

Expand Down
2 changes: 2 additions & 0 deletions renumics/spotlight_plugins/core/api/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Column(BaseModel):
name: str
editable: bool
optional: bool
hidden: bool
role: str
values: List[Any]
description: Optional[str]
Expand Down Expand Up @@ -79,6 +80,7 @@ def get_table(request: Request) -> ORJSONResponse:
values=values,
editable=meta.editable,
optional=meta.nullable,
hidden=meta.hidden,
role=dtype.name,
categories=dtype.categories if dtypes.is_category_dtype(dtype) else None,
description=meta.description,
Expand Down
1 change: 1 addition & 0 deletions renumics/spotlight_plugins/core/hdf5_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def get_column_metadata(self, column_name: str) -> ColumnMetadata:
return ColumnMetadata(
nullable=attributes.get("optional", False),
editable=attributes.get("editable", True),
hidden=attributes.get("hidden", False),
description=attributes.get("description"),
tags=attributes.get("tags", []),
)
Expand Down
9 changes: 9 additions & 0 deletions src/client/models/Column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ export interface Column {
* @memberof Column
*/
optional: boolean;
/**
*
* @type {boolean}
* @memberof Column
*/
hidden: boolean;
/**
*
* @type {string}
Expand Down Expand Up @@ -77,6 +83,7 @@ export function instanceOfColumn(value: object): boolean {
isInstance = isInstance && 'name' in value;
isInstance = isInstance && 'editable' in value;
isInstance = isInstance && 'optional' in value;
isInstance = isInstance && 'hidden' in value;
isInstance = isInstance && 'role' in value;
isInstance = isInstance && 'values' in value;

Expand All @@ -95,6 +102,7 @@ export function ColumnFromJSONTyped(json: any, ignoreDiscriminator: boolean): Co
name: json['name'],
editable: json['editable'],
optional: json['optional'],
hidden: json['hidden'],
role: json['role'],
values: json['values'],
description: !exists(json, 'description') ? undefined : json['description'],
Expand All @@ -114,6 +122,7 @@ export function ColumnToJSON(value?: Column | null): any {
name: value.name,
editable: value.editable,
optional: value.optional,
hidden: value.hidden,
role: value.role,
values: value.values,
description: value.description,
Expand Down
14 changes: 7 additions & 7 deletions src/client/models/DataIssue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ export interface DataIssue {
* @type {string}
* @memberof DataIssue
*/
severity?: DataIssueSeverityEnum;
title: string;
/**
*
* @type {string}
* @type {Array<number>}
* @memberof DataIssue
*/
title: string;
rows: Array<number>;
/**
*
* @type {Array<number>}
* @type {string}
* @memberof DataIssue
*/
rows: Array<number>;
severity?: DataIssueSeverityEnum;
/**
*
* @type {Array<string>}
Expand Down Expand Up @@ -85,9 +85,9 @@ export function DataIssueFromJSONTyped(
return json;
}
return {
severity: !exists(json, 'severity') ? undefined : json['severity'],
title: json['title'],
rows: json['rows'],
severity: !exists(json, 'severity') ? undefined : json['severity'],
columns: !exists(json, 'columns') ? undefined : json['columns'],
description: !exists(json, 'description') ? undefined : json['description'],
};
Expand All @@ -101,9 +101,9 @@ export function DataIssueToJSON(value?: DataIssue | null): any {
return null;
}
return {
severity: value.severity,
title: value.title,
rows: value.rows,
severity: value.severity,
columns: value.columns,
description: value.description,
};
Expand Down
1 change: 1 addition & 0 deletions src/stores/dataset/columnFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export function makeColumn(column: Column, index: number): DataColumn {
type: makeDatatype(column),
editable: column.editable,
optional: column.optional,
hidden: column.hidden,
description: column.description ?? '',
tags: _.uniq(column.tags),
};
Expand Down
1 change: 1 addition & 0 deletions src/types/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface DataColumn {
type: datatypes.DataType;
editable: boolean;
optional: boolean;
hidden: boolean;
description: string;
tags: string[];
}
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/DataGrid/DataGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const columnsSelector = (d: Dataset) => d.columns;
const columnVisibleByDefault = (column: DataColumn) =>
['float', 'int', 'bool', 'str', 'datetime', 'Category', 'Window'].includes(
column.type.kind
) && !column.name.startsWith('__');
) && !column.hidden;

const DataGrid: Widget = () => {
const headerGrid = useRef<Grid>(null);
Expand Down
3 changes: 1 addition & 2 deletions src/widgets/Inspector/dataContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ const selectedIndicesSelector = (d: Dataset) => d.selectedIndices;

// column types that should be visible by default
const columnVisibleByDefault = (column: DataColumn) =>
['Mesh', 'Sequence1D', 'Image'].includes(column.type.kind) &&
!column.name.startsWith('__');
['Mesh', 'Sequence1D', 'Image'].includes(column.type.kind);

export const DataProvider: FunctionComponent<{ children: React.ReactNode }> = ({
children,
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/Inspector/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const StoreProvider = ({ children }: ProviderProps): JSX.Element => {
const allColumns = useDataset((d) => d.columns);
const lenses = useComponentsStore((d) => d.lensesByKey);
const defaultLenses = useMemo(() => {
const defaultColumns = allColumns.filter((c) => c.type.binary);
const defaultColumns = allColumns.filter((c) => c.type.binary && !c.hidden);
return _.compact(
defaultColumns.map((column) => {
const lens = Object.values(lenses).filter((lens) =>
Expand Down
Loading