Skip to content

fix: hide archived/blocked projects from list, timer and time-entry dropdowns#193

Merged
EdiWeeks merged 4 commits into
mainfrom
fix/191-hide-archived-projects
May 5, 2026
Merged

fix: hide archived/blocked projects from list, timer and time-entry dropdowns#193
EdiWeeks merged 4 commits into
mainfrom
fix/191-hide-archived-projects

Conversation

@EdiWeeks
Copy link
Copy Markdown
Contributor

@EdiWeeks EdiWeeks commented Apr 30, 2026

Summary

  • Maps BC's blocked enum to Thyme's archived status; hides archived projects from the project list by default and from the timer / time-entry dropdowns.
  • Uses the blocked field exposed by the latest Thyme BC Extension on the /projects endpoint (no dual-API workaround).
  • Normalises BC OData's "_x0020_" serialization of the not-blocked sentinel back to a real space at the boundary in bcClient, so downstream code can use the documented enum (' ' | 'Posting' | 'All').
  • Removes the now-redundant BCStandardProject type and bcClient.getBlockedProjectNumbers().

Requires

  • The latest Thyme BC Extension installed in the target BC environment (older versions don't expose blocked on /projects).

Test plan

  • Project list hides archived projects by default.
  • Selecting the "Archived" status filter shows them.
  • Start Timer modal: archived projects are not in the project dropdown.
  • Time Entry modal: archived projects are not in the project dropdown.
  • Project details page still loads correctly for non-archived projects.
  • DevTools Network tab shows only one call to /projects (no dual-API merge).

Fixes #191

🤖 Generated with Claude Code

EdiWeeks and others added 2 commits April 30, 2026 08:51
…oject list

- Add BCStandardProject type and getBlockedProjectNumbers() to fetch blocked
  status from standard BC v2.0 API
- Merge blocked status into project mapping (extension API may not expose it)
- Map blocked projects to 'archived' status
- Filter archived projects from ProjectList by default (status filter = 'all')
- Filter to active-only in StartTimerModal and TimeEntryModal dropdowns

Closes #191

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Thyme BC Extension now exposes the 'blocked' enum on the /projects
endpoint, so the parallel call to BC's standard /projects API just to
collect blocked-project numbers is no longer needed.

- BCProject.blocked is now the BC enum (' ' | 'Posting' | 'All') instead
  of boolean. The standalone BCStandardProject type is removed.
- bcClient.getBlockedProjectNumbers() and the dual-API merge in
  projectService.getProjects / projectDetailsService.getProjectDetails
  are removed.
- BC OData JSON serializes the leading-space sentinel as the literal
  string '_x0020_' (XML-escape for U+0020). Normalize it back to ' ' at
  the boundary in bcClient so consumers can use the documented enum.
- isBlocked check becomes 'blocked && blocked !== " "', catching both
  'Posting' and 'All' as archived.

Requires the latest Thyme BC Extension to be installed in the BC env;
older extension versions don't expose the blocked field on /projects.
@EdiWeeks EdiWeeks changed the title fix: Hide archived/blocked projects (#191) fix: hide archived/blocked projects from list, timer and time-entry dropdowns May 5, 2026
@EdiWeeks EdiWeeks marked this pull request as ready for review May 5, 2026 13:49
Copilot AI review requested due to automatic review settings May 5, 2026 13:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Thyme’s Business Central project handling so BC’s blocked state is treated as Thyme’s archived status, then uses that status to hide archived projects across the main project-selection surfaces.

Changes:

  • Adds blocked to the BC project model and normalizes BC’s _x0020_ sentinel back to the documented not-blocked enum value.
  • Maps blocked BC projects to Thyme’s archived status in both project list and project details services.
  • Hides archived projects by default in the project list and removes non-active projects from timer/time-entry project pickers.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/types/index.ts Extends BCProject with the new blocked field.
src/services/bc/projectService.ts Maps BC blocked/completed status into Thyme project status.
src/services/bc/projectDetailsService.ts Applies the same archived-status mapping for project details.
src/services/bc/bcClient.ts Normalizes BC OData blocked values when reading projects.
src/components/timesheet/TimeEntryModal.tsx Filters time-entry project choices down to active projects.
src/components/timer/StartTimerModal.tsx Filters timer project choices down to active projects.
src/components/projects/ProjectList.tsx Hides archived projects from the default list view unless explicitly filtered in.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/projects/ProjectList.tsx
Comment thread src/components/timesheet/TimeEntryModal.tsx
Comment thread src/components/timesheet/TimeEntryModal.tsx Outdated
Comment thread src/services/bc/projectService.ts
- ProjectList: rename the "All Status" filter option to "Active &
  Completed" so the user sees that the default view excludes archived.
- TimeEntryModal: derive customer and project dropdowns from a single
  `availableProjects` list (active projects, plus the entry's current
  project when editing). This fixes two bugs:
  * if a customer's projects were all archived, the customer still
    appeared in the customer dropdown but selecting them yielded an
    empty project list;
  * reopening an entry whose project had since been archived dropped
    the original project from the dropdown.
- projectService: log a one-time console warning if no project in the
  response carries a `blocked` field — signals the Thyme BC Extension
  is older than the version that exposes the field, and the hide-
  archived feature won't apply until it's upgraded.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@EdiWeeks EdiWeeks requested a review from BenGWeeks May 5, 2026 14:08
@EdiWeeks EdiWeeks merged commit ccfaf6b into main May 5, 2026
4 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.

[BUG] Archived projects should not be visible

3 participants