Open
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In both proposal and dataset tables, the previous fallback to store-derived default columns has been removed; consider preserving a fallback (e.g. to
defaultStoreColumns/defaultTableColumns.columns) whenappConfigdoes not define default list settings to avoid regressions or runtime issues. - You are casting
defaultConfigColumnstoTableColumn[]without checking forundefinedin both components; it would be safer to guard against missing config before callingconvertSavedColumnsor provide a sensible default array. - The
console.log("Dataset ngOnInit", ...)inDatasetTableComponentlooks like leftover debug logging and should be removed or routed through the application's logging mechanism.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In both proposal and dataset tables, the previous fallback to store-derived default columns has been removed; consider preserving a fallback (e.g. to `defaultStoreColumns` / `defaultTableColumns.columns`) when `appConfig` does not define default list settings to avoid regressions or runtime issues.
- You are casting `defaultConfigColumns` to `TableColumn[]` without checking for `undefined` in both components; it would be safer to guard against missing config before calling `convertSavedColumns` or provide a sensible default array.
- The `console.log("Dataset ngOnInit", ...)` in `DatasetTableComponent` looks like leftover debug logging and should be removed or routed through the application's logging mechanism.
## Individual Comments
### Comment 1
<location> `src/app/proposals/proposal-table/proposal-table.component.ts:130-131` </location>
<code_context>
const tableSort = this.getTableSort();
const paginationConfig = this.getTablePaginationConfig(count);
+ const defaultConfigColumns =
+ this.appConfig?.defaultDatasetsListSettings?.columns;
+
</code_context>
<issue_to_address>
**issue (bug_risk):** Guard against missing or empty defaultConfigColumns before converting
Previously, missing/empty config columns fell back to `defaultStoreColumns`. Now `defaultConfigColumns` is passed straight into `convertSavedColumns` and cast to `TableColumn[]`, so an undefined/empty value could cause runtime errors or an empty table. Please either preserve the earlier fallback (e.g., to `userConfigColumns` or another default) or explicitly handle `!Array.isArray(defaultConfigColumns)` / `!defaultConfigColumns.length` before calling `convertSavedColumns`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Comment on lines
+130
to
131
| const defaultConfigColumns = | ||
| this.appConfig?.defaultProposalsListSettings?.columns; |
Contributor
There was a problem hiding this comment.
issue (bug_risk): Guard against missing or empty defaultConfigColumns before converting
Previously, missing/empty config columns fell back to defaultStoreColumns. Now defaultConfigColumns is passed straight into convertSavedColumns and cast to TableColumn[], so an undefined/empty value could cause runtime errors or an empty table. Please either preserve the earlier fallback (e.g., to userConfigColumns or another default) or explicitly handle !Array.isArray(defaultConfigColumns) / !defaultConfigColumns.length before calling convertSavedColumns.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR enables the user to reload the default settings for datasets and proposals list tables, by selecting table settings menu -> default settings.
Once the default setting option is selected, the table columns will revert back to the defaults configured by the site admin and also the user settings are updated to contain the defaults.
Motivation
This PR is motivated by a better UX and to allow users to revert back to the default view configured by the site admin based to facility policies and to better show the data
Changes:
Please provide a list of the changes implemented by this PR
Tests included
Documentation
official documentation info
If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included
Backend version
Summary by Sourcery
Enable table columns in proposal and dataset lists to be reset to admin-defined defaults and persist those defaults to user settings.
New Features:
Enhancements: