Skip to content

Commit

Permalink
feat: add setting to exclude filters from personalization
Browse files Browse the repository at this point in the history
  • Loading branch information
r0b1n committed Jan 8, 2025
1 parent cc88b77 commit df0c9d6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/pluggableWidgets/datagrid-web/src/Datagrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const Container = observer((props: Props): ReactElement => {
onClickTrigger: props.onClickTrigger,
onClick: props.onClick
});
useOnResetFiltersEvent(props.rootStore.staticInfo.name, props.rootStore.staticInfo.filtersChannelName);
useOnResetFiltersEvent(rootStore.staticInfo.name, rootStore.staticInfo.filtersChannelName);

const visibleColumnsCount = selectActionHelper.showCheckboxColumn
? columnsStore.visibleColumns.length + 1
Expand Down
4 changes: 4 additions & 0 deletions packages/pluggableWidgets/datagrid-web/src/Datagrid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@
<caption>On change</caption>
<description />
</property>
<property key="storeFiltersInPersonalization" type="boolean" defaultValue="true">
<caption>Store filters</caption>
<description />
</property>
</propertyGroup>
</propertyGroup>
<propertyGroup caption="Grid wide filtering">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ describe("Datagrid", () => {
filterList: [],
configurationStorageType: "attribute",
configurationAttribute: undefined,
loadingType: "spinner"
loadingType: "spinner",
storeFiltersInPersonalization: true
};
const user = userEvent.setup();
let renderCount = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class GridPersonalizationStore {
private readonly gridName: string;
private readonly gridColumnsHash: string;
private readonly schemaVersion: GridPersonalizationStorageSettings["schemaVersion"] = 2;
private readonly storeFilters: boolean;

private storage: PersonalizationStorage;

Expand All @@ -30,6 +31,7 @@ export class GridPersonalizationStore {
) {
this.gridName = props.name;
this.gridColumnsHash = getHash(this.columnsStore._allColumns, this.gridName);
this.storeFilters = props.storeFiltersInPersonalization;

makeObservable<GridPersonalizationStore, "applySettings">(this, {
settings: computed,
Expand Down Expand Up @@ -134,8 +136,8 @@ export class GridPersonalizationStore {
this.gridName,
this.gridColumnsHash,
this.columnsStore.columnSettings,
this.columnsStore.filterSettings,
this.headerFilters.settings
this.storeFilters ? this.columnsStore.filterSettings : new Map(),
this.storeFilters ? this.headerFilters.settings : new Map()
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export interface DatagridContainerProps {
columnsHidable: boolean;
configurationStorageType: ConfigurationStorageTypeEnum;
configurationAttribute?: EditableValue<string>;
storeFiltersInPersonalization: boolean;
filterList: FilterListType[];
filtersPlaceholder?: ReactNode;
filterSectionTitle?: DynamicValue<string>;
Expand Down Expand Up @@ -177,6 +178,7 @@ export interface DatagridPreviewProps {
configurationStorageType: ConfigurationStorageTypeEnum;
configurationAttribute: string;
onConfigurationChange: {} | null;
storeFiltersInPersonalization: boolean;
filterList: FilterListPreviewType[];
filtersPlaceholder: { widgetCount: number; renderer: ComponentType<{ children: ReactNode; caption?: string }> };
filterSectionTitle: string;
Expand Down

0 comments on commit df0c9d6

Please sign in to comment.