Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Unreleased bugs) Fleet UI: 20404 edit software feature #22168

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ interface IEditSoftwareModalProps {
teamId: number;
router: InjectedRouter;
software?: any; // TODO
refetchSoftwareTitle: () => void;

onExit: () => void;
setAddedSoftwareToken: (token: string) => void;
Expand All @@ -44,6 +45,7 @@ const EditSoftwareModal = ({
software,
onExit,
setAddedSoftwareToken,
refetchSoftwareTitle,
}: IEditSoftwareModalProps) => {
const { renderFlash } = useContext(NotificationContext);

Expand Down Expand Up @@ -134,18 +136,8 @@ const EditSoftwareModal = ({
: ""}
</>
);
const newQueryParams: QueryParams = { team_id: teamId };
if (formData.selfService) {
newQueryParams.self_service = true;
} else {
newQueryParams.available_for_install = true;
}
// any unique string - triggers SW refetch
setAddedSoftwareToken(`${Date.now()}`);
onExit();
router.push(
`${PATHS.SOFTWARE_TITLES}?${buildQueryStringFromParams(newQueryParams)}`
);
refetchSoftwareTitle();
} catch (e) {
const reason = getErrorReason(e);
if (reason.includes("Fleet couldn't read the version from")) {
Expand Down Expand Up @@ -210,6 +202,7 @@ const EditSoftwareModal = ({
className={editSoftwareModalClasses}
title="Edit software"
onExit={onExit}
width="large"
>
<PackageForm
isEditingSoftware
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ interface ISoftwarePackageCardProps {
softwarePackage?: ISoftwarePackage;
onDelete: () => void;
router: InjectedRouter;
refetchSoftwareTitle: () => void;
}

// NOTE: This component is dependent on having either a software package
Expand All @@ -255,6 +256,7 @@ const SoftwarePackageCard = ({
teamId,
onDelete,
router,
refetchSoftwareTitle,
}: ISoftwarePackageCardProps) => {
const {
isGlobalAdmin,
Expand Down Expand Up @@ -389,6 +391,7 @@ const SoftwarePackageCard = ({
onExit={() => setShowEditSoftwareModal(false)}
router={router}
setAddedSoftwareToken={noop}
refetchSoftwareTitle={refetchSoftwareTitle}
/>
)}
{showDeleteModal && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const SoftwareTitleDetailsPage = ({
teamId={currentTeamId ?? APP_CONTEXT_NO_TEAM_ID}
onDelete={onDeleteInstaller}
router={router}
refetchSoftwareTitle={refetchSoftwareTitle}
/>
);
}
Expand Down
Loading