Skip to content

Commit

Permalink
More updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sclaxton committed May 30, 2024
1 parent 3728c40 commit af67195
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ function FilterSetCreateForm({
onChange={(e) => {
e.persist();
const newFilterSet = { ...filterSet, description: e.target.value };
console.log(newFilterSet);
if (isFilterSetSaved(newFilterSet)) {
console.log(newFilterSet);
setFilterSet(newFilterSet);
}
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ function FilterSetUpdateForm({
placeholder='Describe the Filter Set (optional)'
value={filterSet.description}
onChange={(e) => {
console.log(e);
e.persist();
const newFilterSet = { ...filterSet, description: e.target.value };
if (isFilterSetSaved(newFilterSet)) {
Expand Down
16 changes: 12 additions & 4 deletions src/GuppyDataExplorer/ExplorerFilterSetWorkspace/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,19 @@ function ExplorerFilterSetWorkspace({
/** @param {SavedExplorerFilterSet} deleted */
const handleDelete = useCallback(async (deleted) => {
try {
let workspaceId;
for (const [id, filterSet] of Object.entries(workspace.all)) {
if (filterSet.id === deleted.id) {
workspaceId = id;
break;
}
}
await dispatch(deleteFilterSet(deleted));
workspace.remove(deleted.id);
workspace.remove(workspaceId);
} finally {
closeActionForm();
}
}, []);
}, [workspace]);

/**
* @param {SavedExplorerFilterSet} loaded
Expand All @@ -147,11 +154,12 @@ function ExplorerFilterSetWorkspace({
} else {
let existingActiveId;

for (const [id, filterSet] of Object.entries(workspace.all))
for (const [id, filterSet] of Object.entries(workspace.all)) {
if (filterSet.id === loaded.id) {
existingActiveId = id;
break;
}
}

const nextActiveId = existingActiveId ?? newWorkspaceId;

Expand Down Expand Up @@ -337,7 +345,7 @@ function ExplorerFilterSetWorkspace({
<MenuItem id="DUPLICATE">Duplicate</MenuItem>
<MenuItem id="COMBINE">Combine with...</MenuItem>
<MenuItem id="SAVE">{savedFilterSet ? 'Update saved' : 'Save'}</MenuItem>
<MenuItem id="UNSAVE">Unsave and remove</MenuItem>
<MenuItem id="DELETE">Unsave and remove</MenuItem>
<MenuItem id="REVERT">Revert to saved</MenuItem>
<MenuItem id="SHARE">Share</MenuItem>
</Menu>
Expand Down

0 comments on commit af67195

Please sign in to comment.