Skip to content

Commit

Permalink
save renamed filter
Browse files Browse the repository at this point in the history
  • Loading branch information
heswell committed Dec 15, 2023
1 parent d373904 commit 823f9fb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export class TickingArrayDataSource extends ArrayDataSource {
columnName: string,
value: VuuRowDataItemType
): Promise<true> {
console.log(`applyEdit ${columnName} ${value}`);
const key = row[metadataKeys.KEY];
this.#table?.update(key, columnName, value);
return Promise.resolve(true);
Expand Down
20 changes: 19 additions & 1 deletion vuu-ui/packages/vuu-filters/src/filter-bar/useFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ export const useFilters = ({
const { module, table } = tableSchema.table;
const key = `${module}:${table}`;
if (savedFilters) {
console.log("TODO add filter to exisitng store", {
console.log("add filter to existing store ... ", {
savedFilters,
});
if (savedFilters[key]) {
console.log("add filter to existing filters for this table ... ");
if (savedFilters[key].findIndex((f) => f.name === name) !== -1) {
console.log("We already have a filter by that name, replace it ");

saveApplicationSettings(
{
...savedFilters,
Expand All @@ -53,6 +56,21 @@ export const useFilters = ({
},
"filters"
);
} else if (
name !== undefined &&
filter?.name !== undefined &&
filter?.name !== name &&
savedFilters[key].findIndex((f) => f.name === filter.name) !== -1
) {
saveApplicationSettings(
{
...savedFilters,
[key]: savedFilters[key].map((f) =>
f.name === filter.name ? { ...filter, name } : f
),
},
"filters"
);
} else {
saveApplicationSettings(
{
Expand Down

0 comments on commit 823f9fb

Please sign in to comment.