mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 00:49:03 +00:00
Fix issue saving labels (#30126)
# Details This PR fixes an issue where the user is redirected to a 500 error page after saving a new label if they were on the All Teams host page before creating the label. The issue was due to the redirect having `team_id=-1` in it, and the fix is to detect that All Teams is selected and, if so, not set `team_id` in the URL at all. # Checklist <!-- Note that API documentation changes are now addressed by the product design team. --> - [X] Manual QA for all new/changed functionality - [X] For unreleased bug fixes in a release candidate, confirmed that the fix is not expected to adversely impact load test results or alerted the release DRI if additional load testing is needed. # Testing Tested adding a new and dynamic label from All Teams, No team and a custom team. Vids below for "All Team": Before:  After: 
This commit is contained in:
parent
79d5e605ed
commit
7549defa28
2 changed files with 10 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ import { AppContext } from "context/app";
|
|||
import { NotificationContext } from "context/notification";
|
||||
import { getPathWithQueryParams } from "utilities/url";
|
||||
import { IApiError } from "interfaces/errors";
|
||||
import { API_ALL_TEAMS_ID, APP_CONTEXT_ALL_TEAMS_ID } from "interfaces/team";
|
||||
|
||||
import DynamicLabelForm from "pages/labels/components/DynamicLabelForm";
|
||||
import { IDynamicLabelFormData } from "pages/labels/components/DynamicLabelForm/DynamicLabelForm";
|
||||
|
|
@ -38,7 +39,10 @@ const DynamicLabel = ({
|
|||
.then((res) => {
|
||||
router.push(
|
||||
getPathWithQueryParams(PATHS.MANAGE_HOSTS_LABEL(res.label.id), {
|
||||
team_id: currentTeam?.id,
|
||||
team_id:
|
||||
currentTeam?.id === APP_CONTEXT_ALL_TEAMS_ID
|
||||
? API_ALL_TEAMS_ID
|
||||
: currentTeam?.id,
|
||||
})
|
||||
);
|
||||
renderFlash("success", "Label added successfully.");
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { AppContext } from "context/app";
|
|||
import { NotificationContext } from "context/notification";
|
||||
import { getPathWithQueryParams } from "utilities/url";
|
||||
import { IApiError } from "interfaces/errors";
|
||||
import { API_ALL_TEAMS_ID, APP_CONTEXT_ALL_TEAMS_ID } from "interfaces/team";
|
||||
|
||||
import ManualLabelForm from "pages/labels/components/ManualLabelForm";
|
||||
import { IManualLabelFormData } from "pages/labels/components/ManualLabelForm/ManualLabelForm";
|
||||
|
|
@ -29,7 +30,10 @@ const ManualLabel = ({ router }: IManualLabelProps) => {
|
|||
.then((res) => {
|
||||
router.push(
|
||||
getPathWithQueryParams(PATHS.MANAGE_HOSTS_LABEL(res.label.id), {
|
||||
team_id: currentTeam?.id,
|
||||
team_id:
|
||||
currentTeam?.id === APP_CONTEXT_ALL_TEAMS_ID
|
||||
? API_ALL_TEAMS_ID
|
||||
: currentTeam?.id,
|
||||
})
|
||||
);
|
||||
renderFlash("success", "Label added successfully.");
|
||||
|
|
|
|||
Loading…
Reference in a new issue