Skip to content

feat: add configurable default tab for proposal details page#2206

Open
abdimo101 wants to merge 2 commits intomasterfrom
default-proposal-tab-config
Open

feat: add configurable default tab for proposal details page#2206
abdimo101 wants to merge 2 commits intomasterfrom
default-proposal-tab-config

Conversation

@abdimo101
Copy link
Member

@abdimo101 abdimo101 commented Feb 2, 2026

Description

This PR adds a new config defaultTab that contains for now property proposal which allows users to set which tab should be displayed by default when viewing a proposal details page. The config accepts values like "details", "datasets", "relatedProposals" or "logbook". If not specified or if the given value is invalid, it will default to "details".

Motivation

Background on use case, changes needed

Fixes:

Please provide a list of the fixes implemented in this PR

  • Items added

Changes:

Please provide a list of the changes implemented by this PR

  • changes made

Tests included

  • Included for each change/fix?
  • Passing? (Merge will not be approved unless this is checked)

Documentation

  • swagger documentation updated [required]
  • official documentation updated [nice-to-have]

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

  • Does it require a specific version of the backend
  • which version of the backend is required:

Summary by Sourcery

Add support for configuring the default tab shown on the proposal details page and cover it with end-to-end tests.

New Features:

  • Introduce a configurable defaultProposalTab setting to control which tab is initially selected on the proposal details page.

Tests:

  • Add Cypress end-to-end test to verify that the configured default proposal tab is selected by default.

@abdimo101 abdimo101 requested a review from a team as a code owner February 2, 2026 10:56
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The tabIndexMap key type and defaultProposalTab?: string are both untyped strings; consider tightening this to a string union (e.g. 'details' | 'datasets' | 'relatedProposals' | 'logbook') to catch invalid config values at compile time.
  • The tabIndexMap with hard-coded indices can easily get out of sync if tab order changes; consider deriving indices from the template (e.g. via an enum or a single source of truth for tab definitions) rather than maintaining a separate map.
  • The Cypress test asserts using ng-reflect-selected-index, which is an internal Angular implementation detail; it would be more robust to assert the active tab via visible text or CSS classes (e.g. using mat-tab-label and checking for the mat-tab-label-active class).
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `tabIndexMap` key type and `defaultProposalTab?: string` are both untyped strings; consider tightening this to a string union (e.g. `'details' | 'datasets' | 'relatedProposals' | 'logbook'`) to catch invalid config values at compile time.
- The `tabIndexMap` with hard-coded indices can easily get out of sync if tab order changes; consider deriving indices from the template (e.g. via an enum or a single source of truth for tab definitions) rather than maintaining a separate map.
- The Cypress test asserts using `ng-reflect-selected-index`, which is an internal Angular implementation detail; it would be more robust to assert the active tab via visible text or CSS classes (e.g. using `mat-tab-label` and checking for the `mat-tab-label-active` class).

## Individual Comments

### Comment 1
<location> `src/app/app-config.service.ts:165` </location>
<code_context>
   checkBoxFilterClickTrigger?: boolean;
   hideEmptyMetadataTable?: boolean;
   ingestorComponent?: IngestorComponentConfig;
+  defaultProposalTab?: string;
 }

</code_context>

<issue_to_address>
**suggestion:** Narrow `defaultProposalTab` to a string-literal union to ensure only supported tabs are configured.

Since `defaultProposalTab` is typed as a plain `string`, invalid values won’t be caught until runtime and you’re relying on `resetTabs`’s fallback behavior. Consider restricting this to a union of the supported tabs (e.g. `defaultProposalTab?: 'details' | 'datasets' | 'relatedProposals' | 'logbook'`, or a type derived from `tabIndexMap`) so misconfigurations are caught at compile time and stay aligned with the component logic.

Suggested implementation:

```typescript
  checkBoxFilterClickTrigger?: boolean;
  hideEmptyMetadataTable?: boolean;
  ingestorComponent?: IngestorComponentConfig;
  defaultProposalTab?: 'details' | 'datasets' | 'relatedProposals' | 'logbook';
}

```

If there is a centralized source of truth for tab keys (e.g. a `tabIndexMap` or `type ProposalTab = keyof typeof tabIndexMap`), consider:
1. Extracting a reusable type, e.g. `type ProposalTab = keyof typeof tabIndexMap;`
2. Updating this property to `defaultProposalTab?: ProposalTab;`
This will ensure the config type stays automatically aligned if tabs are added or renamed.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@abdimo101 abdimo101 requested a review from Junjiequan February 2, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant