Skip to content

Add multi-tag filtering to planning dashboard with optimized test suite#1315

Merged
renemadsen merged 11 commits intomasterfrom
copilot/add-tag-dropdown-to-filters
Feb 5, 2026
Merged

Add multi-tag filtering to planning dashboard with optimized test suite#1315
renemadsen merged 11 commits intomasterfrom
copilot/add-tag-dropdown-to-filters

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Implements tag-based filtering for the time planning dashboard, allowing users to filter assigned sites by selecting one or more tags. Multiple tag selection uses AND logic.

Frontend Changes

  • Added mtx-select dropdown with [multiple]="true" to planning container component
  • Loads available tags via getAvailableTags() service method
  • Passes tagIds array in TimePlanningsRequestModel
  • Type-safe implementation with number[] for tag IDs
// Component now tracks selected tags and reloads on change
selectedTagIds: number[] = [];

onTagsChanged(tagIds: number[]) {
  this.selectedTagIds = tagIds;
  this.getPlannings();
}

Backend Changes

  • Extended TimePlanningPlanningRequestModel with List<int> TagIds property
  • Filters assigned sites by querying AssignedSiteManagingTags with GroupBy to enforce AND semantics:
var assignedSiteIdsWithAllTags = await dbContext.AssignedSiteManagingTags
    .Where(x => model.TagIds.Contains(x.TagId))
    .GroupBy(x => x.AssignedSiteId)
    .Where(g => g.Select(x => x.TagId).Distinct().Count() == model.TagIds.Count)
    .Select(g => g.Key)
    .ToListAsync();

Test Suite

Cypress E2E (folder 'n')

  • Tag creation using mat-icon discovery pattern from folder 'm'
  • Tag assignment to sites with proper dropdown reopening for multi-select
  • Dashboard filtering validation for single and multiple tags
  • Added required SQL snapshots and infrastructure files

Test Optimizations

  • Cypress viewport increased to 2560x1440 to prevent element visibility issues
  • C# tests configured for parallel execution via test.runsettings:
    • MaxCpuCount=0 (use all cores)
    • NumberOfTestWorkers=-1 (auto-scale workers)
  • Updated both workflow files to use --settings parameter

Technical Notes

  • Tag filtering uses AND logic: selecting Tag-A and Tag-B shows only sites with both tags
  • Test parallelization expected to reduce C# test execution time by 2-4x
  • Matrix includes 'n' test folder in both master and PR workflows
Original prompt

This section details on the original issue you should resolve

<issue_title>Add tag dropdown to filters</issue_title>
<issue_description>In order for the user to be able to filter plannings shown by tags on the eform-client/src/app/plugins/modules/time-planning-pn/components/plannings/time-plannings-container/time-plannings-container.component.html

  1. We need a dropdown that is listing all tags as provided through https://github.com/microting/eform-angular-timeplanning-plugin/blob/master/eform-client/src/app/plugins/modules/time-planning-pn/services/time-planning-pn-settings.service.ts#L98
  2. It should be mtx-select with multi = true
  3. Add the filtering on tags to existing C# code and update tests to make sure the new filtering is working
  4. Add cypress e2e tests for testing the filtering in the new folder "n"
    4.1 It is required to navigate to /advanced/sites create 5 different tags following the patteren the "m" folder
    4.2. On the same /advanced/sites the test needs to assign each of the created tags to 5 different sites and also assign 1 of the tags to all of the sites
    4.3. Navigate to the time planning dashboard and see that all assignedSites are shown
    4.4. Select one of the tags in the filter and validate that only the assignedSites with that tag is shown
    4.5. Repeat the above for each of the tags
    4.6. Then select 2 tags and validate that only the assignedDite which have both tags assigned in 4.2</issue_description>

<agent_instructions>use the github actions workflow and update the pull request/push step accordingly.
Build C# and run angular unit tests before committing, for bare minimum tests. e2e and C# tests takes 10+ minutes to run.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits February 5, 2026 05:19
- Updated TimePlanningsRequestModel to include tagIds
- Added tag dropdown UI component with multi-select
- Implemented backend filtering by tags (AND logic)
- Created Cypress e2e tests in folder 'n'

Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
- Added System.Collections.Generic using statement
- Updated component spec to include getAvailableTags mock
- Added unit tests for tag filtering functionality

Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
- Use take(1) operator to prevent memory leak in getAvailableTags subscription
- Remove unused variables in Cypress test file

Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
- Remove unnecessary subscription variable for getAvailableTags
- Add proper type annotation (number[]) to onTagsChanged
- Use BASE_URL constant in Cypress tests instead of hardcoded values

Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
Copilot AI changed the title [WIP] Add tag dropdown to filters in planning module Add tag filtering to planning dashboard Feb 5, 2026
Copilot AI requested a review from renemadsen February 5, 2026 05:25
- Updated dotnet-core-master.yml to include 'n' in test matrix
- Updated dotnet-core-pr.yml to include 'n' in test matrix
- Ensures new tag filtering e2e tests will run in CI

Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
Copilot AI changed the title Add tag filtering to planning dashboard Add folder 'n' to GitHub Actions test matrix Feb 5, 2026
- Added SQL database files (420_SDK.sql and 420_eform-angular-time-planning-plugin.sql)
- Added activate-plugin.spec.cy.ts
- Added assert-true.spec.cy.ts
- Rewrote tag-filtering.spec.cy.ts to follow exact pattern from 'm' folder for tag creation
- Tag creation now uses the same mat-icon discovery and input field detection as 'm' folder
- Creates 5 tags using the proven pattern that works in 'm' folder

Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
Copilot AI changed the title Add folder 'n' to GitHub Actions test matrix Fix Cypress test structure in folder 'n' to match working pattern from folder 'm' Feb 5, 2026
it('should assign tags to sites', () => {
cy.task('log', '[Tag Filter Tests] Assigning tags to sites...');
// TODO: Implement tag assignment to sites
// This would follow a similar pattern to the 'm' folder test
Copy link
Member

Choose a reason for hiding this comment

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

@copilot implement this step.

  1. navigate to the advanced/sites
    1.1 click the action menu for 1. site in list
    1.2 click the edit button
    1.3 enter 2 tags into the tag field with id "tagSelector" and selct the tags
    1.4 intercept put to api/sites
    1.5 click the "save" button with id "siteEditSaveBtn"
    1.5 wait for put call to finish
    1.6 wait for spinner to disapear, look at existing patteren in m test folder
  2. repeat for 5 sites with different tag combination for usage in further tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented in commit f6ff1b4.

The test now:

  1. Navigates to /advanced/sites for each of 5 sites
  2. Clicks action menu and edit button (#editSiteBtn)
  3. Selects tags using #tagSelector field
  4. Intercepts PUT to api/sites
  5. Clicks save button (#siteEditSaveBtn)
  6. Waits for API call completion and spinner to disappear

Tag combinations assigned:

  • Site 1: Tag-A + Tag-B
  • Site 2: Tag-A + Tag-C
  • Site 3: Tag-A + Tag-D
  • Site 4: Tag-A + Tag-E
  • Site 5: Tag-A + Tag-B + Tag-C (for testing multi-tag AND filtering)

Following the user's instructions:
- Navigate to /advanced/sites for each site
- Click action menu for site in list
- Click edit button (#editSiteBtn)
- Select tags using #tagSelector field
- Intercept PUT to api/sites
- Click save button (#siteEditSaveBtn)
- Wait for API call and spinner to disappear

Assigns specific tag combinations to 5 sites:
- Site 1: Tag-A, Tag-B
- Site 2: Tag-A, Tag-C
- Site 3: Tag-A, Tag-D
- Site 4: Tag-A, Tag-E
- Site 5: Tag-A, Tag-B, Tag-C (for multi-tag filter testing)

Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
combination.tags.forEach((tagName, tagIdx) => {
cy.task('log', `[Tag Filter Tests] Selecting tag: ${tagName}`);
cy.get('.ng-option').contains(tagName).click();
cy.wait(200);
Copy link
Member

Choose a reason for hiding this comment

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

@copilot if there needs to be selected more than the first tag, then this needs to executed again, for the .ng-options to be visible:
cy.get('#tagSelector').scrollIntoView().should('be.visible').click();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in commit 7cbe75a. Moved the #tagSelector click inside the forEach loop so the dropdown is reopened before selecting each tag, ensuring .ng-option elements remain visible for multi-tag selection.

Moved the dropdown click inside the forEach loop so that for each tag selection,
the dropdown is reopened to make .ng-option elements visible. This ensures
multiple tags can be selected properly when assigning more than one tag to a site.

Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
Added viewportWidth: 2560 and viewportHeight: 1440 to cypress.config.ts
to prevent tests from failing due to small Chrome view size.

Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
Copilot AI changed the title Fix Cypress test structure in folder 'n' to match working pattern from folder 'm' Update Cypress viewport to 2560x1440 for test stability Feb 5, 2026
Added test.runsettings file with parallel test configuration:
- MaxCpuCount=0 (use all available processors)
- NumberOfTestWorkers=-1 (automatic worker count based on CPU cores)

Updated both workflow files (dotnet-core-master.yml and dotnet-core-pr.yml)
to use the runsettings file via --settings parameter.

This will significantly speed up C# test execution by running tests in parallel.

Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
Copilot AI changed the title Update Cypress viewport to 2560x1440 for test stability Add multi-tag filtering to planning dashboard with optimized test suite Feb 5, 2026
@renemadsen renemadsen marked this pull request as ready for review February 5, 2026 12:17
@renemadsen renemadsen merged commit 9ac887a into master Feb 5, 2026
18 checks passed
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.

Add tag dropdown to filters

2 participants