Skip to content

#4254 task labels#4256

Open
wavehassman wants to merge 14 commits into
developfrom
#4254-task-labels
Open

#4254 task labels#4256
wavehassman wants to merge 14 commits into
developfrom
#4254-task-labels

Conversation

@wavehassman
Copy link
Copy Markdown
Contributor

@wavehassman wavehassman commented May 29, 2026

Changes

Adds a full task labels feature:

  • Adds a TaskLabel model to schema
  • Attaches labels to task creation/editing forms across the task list, calendar, and Gantt views, and displays label pills on task cards
  • In admin tools, admins can manage the available labels
  • A filter was built into the task list page so users can filter tasks by one or more labels.

Test Cases

Setting labels on a task:

  • Successfully sets labels on a task
  • Throws NotFoundException when a label ID does not exist
  • Throws DeletedException when a label is deleted
  • Throws InvalidOrganizationException when a label belongs to a different org

Create task label:

  • Successfully creates a label as admin
  • Throws AccessDeniedException for non-admins

Edit task label:

  • Successfully edits a label as admin
  • Throws AccessDeniedException for non-admins
  • Throws NotFoundException when label doesn't exist
  • Throws DeletedException when label is already deleted
  • Throws InvalidOrganizationException when label belongs to a different org

Delete task label:

  • Successfully deletes a label as admin
  • Throws AccessDeniedException for non-admins
  • Throws NotFoundException when label doesn't exist
  • Throws DeletedException when label is already deleted
  • Throws InvalidOrganizationException when label belongs to a different org

Screenshots

Screenshot 2026-05-31 at 12 13 03 PM Screenshot 2026-05-31 at 12 08 51 PM Screenshot 2026-05-31 at 12 18 17 PM Screenshot 2026-05-31 at 12 09 05 PM Screenshot 2026-05-31 at 12 10 54 PM Screenshot 2026-05-31 at 12 17 41 PM Screenshot 2026-05-31 at 12 12 51 PM Screenshot 2026-05-31 at 12 11 25 PM

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #4254

@wavehassman wavehassman self-assigned this May 29, 2026
@wavehassman wavehassman marked this pull request as draft May 29, 2026 21:23
@wavehassman wavehassman marked this pull request as ready for review May 31, 2026 17:08
@wavehassman wavehassman requested a review from chpy04 May 31, 2026 17:08
}
}

static async getTasksByWbsNumAndLabels(req: Request, res: Response, next: NextFunction) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why would we not just use the existing filter endpoint and add labels to that?

deletedBy: getUserQueryArgs(organizationId),
assignees: getUserQueryArgs(organizationId)
assignees: getUserQueryArgs(organizationId),
labels: true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

select and only include relevant info

deletedBy: getUserQueryArgs(organizationId),
assignees: getUserQueryArgs(organizationId)
assignees: getUserQueryArgs(organizationId),
labels: true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same

* @param organization the organization that the user is currently in
* @returns array of tasks that have at least one matching label
*/
static async getTasksByWbsNumAndLabels(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yeah we should really move the labels part of this to the filters endpoint. Filtering by wbs is a seperate endpoint because that is what we are inherently doing on every page, but that is not the case for labels

import { TaskLabel } from 'shared';
import NERFormModal from '../../../components/NERFormModal';

const COLOR_OPTIONS: { label: string; value: string }[] = [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We do something very similar for the calendar event types, could be worth abstracting

} catch (error: unknown) {
if (error instanceof Error) toast.error(error.message);
}
handleClose();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In general I prefer to only close on success because its very annoying if there is some backend validation the frontend missed and the user has to re open the form and enter the values again

isError: filteredTasksIsError,
error: filteredTasksError
} = useTasksByWbsNumFilteredByLabels(wbsNum, selectedLabelIds);
const { data: taskLabels } = useAllTaskLabels();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

loading iserror error

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.

[Tasks] - Add a Label to Tasks

2 participants