Fleet UI: Reroute to software details page on add of FMA, VPP, custom pkg (#29336)
This commit is contained in:
@@ -201,6 +201,7 @@ export const createMockSoftwareVersionResponse = (
|
||||
|
||||
const DEFAULT_SOFTWARE_PACKAGE_MOCK: ISoftwarePackage = {
|
||||
name: "TestPackage-1.2.3.pkg",
|
||||
title_id: 2,
|
||||
version: "1.2.3",
|
||||
uploaded_at: "2020-01-01T00:00:00.000Z",
|
||||
install_script: "sudo installer -pkg /temp/FalconSensor-6.44.pkg -target /",
|
||||
@@ -220,7 +221,8 @@ const DEFAULT_SOFTWARE_PACKAGE_MOCK: ISoftwarePackage = {
|
||||
automatic_install_policies: [],
|
||||
last_install: null,
|
||||
last_uninstall: null,
|
||||
package_url: "",
|
||||
url: "https://fakeurl.testpackageurlforfalconapp.fake/test/package",
|
||||
hash_sha256: "abcd1234",
|
||||
labels_include_any: null,
|
||||
labels_exclude_any: null,
|
||||
};
|
||||
|
||||
@@ -84,9 +84,10 @@ export interface ISoftwareAppStoreAppStatus {
|
||||
|
||||
export interface ISoftwarePackage {
|
||||
name: string;
|
||||
title_id: number;
|
||||
last_install: string | null;
|
||||
last_uninstall: string | null;
|
||||
package_url: string;
|
||||
url: string;
|
||||
version: string;
|
||||
uploaded_at: string;
|
||||
install_script: string;
|
||||
|
||||
+10
-2
@@ -167,7 +167,10 @@ const SoftwareAppStoreVpp = ({
|
||||
setIsLoading(true);
|
||||
|
||||
try {
|
||||
await mdmAppleAPI.addVppApp(currentTeamId, formData);
|
||||
const {
|
||||
software_title_id: softwareVppTitleId,
|
||||
} = await mdmAppleAPI.addVppApp(currentTeamId, formData);
|
||||
|
||||
renderFlash(
|
||||
"success",
|
||||
<>
|
||||
@@ -176,7 +179,12 @@ const SoftwareAppStoreVpp = ({
|
||||
{ persistOnPageChange: true }
|
||||
);
|
||||
|
||||
goBackToSoftwareTitles(true);
|
||||
router.push(
|
||||
getPathWithQueryParams(
|
||||
PATHS.SOFTWARE_TITLE_DETAILS(softwareVppTitleId.toString()),
|
||||
{ team_id: currentTeamId }
|
||||
)
|
||||
);
|
||||
} catch (e) {
|
||||
renderFlash("error", getErrorMessage(e));
|
||||
}
|
||||
|
||||
+10
-18
@@ -119,7 +119,9 @@ const SoftwareCustomPackage = ({
|
||||
// Note: This TODO is copied to onSaveSoftwareChanges in EditSoftwareModal
|
||||
// TODO: confirm we are deleting the second sentence (not modifying it) for non-self-service installers
|
||||
try {
|
||||
await softwareAPI.addSoftwarePackage({
|
||||
const {
|
||||
software_package: { title_id: softwarePackageTitleId },
|
||||
} = await softwareAPI.addSoftwarePackage({
|
||||
data: formData,
|
||||
teamId: currentTeamId,
|
||||
onUploadProgress: (progressEvent) => {
|
||||
@@ -130,24 +132,14 @@ const SoftwareCustomPackage = ({
|
||||
},
|
||||
});
|
||||
|
||||
const newQueryParams: QueryParams = { team_id: currentTeamId };
|
||||
if (formData.selfService) {
|
||||
newQueryParams.self_service = true;
|
||||
} else {
|
||||
newQueryParams.available_for_install = true;
|
||||
}
|
||||
const newQueryParams: QueryParams = {
|
||||
team_id: currentTeamId,
|
||||
};
|
||||
router.push(
|
||||
getPathWithQueryParams(PATHS.SOFTWARE_TITLES, newQueryParams)
|
||||
);
|
||||
|
||||
renderFlash(
|
||||
"success",
|
||||
<>
|
||||
<b>{formData.software?.name}</b> successfully added.
|
||||
{formData.selfService
|
||||
? " The end user can install from Fleet Desktop."
|
||||
: ""}
|
||||
</>
|
||||
getPathWithQueryParams(
|
||||
PATHS.SOFTWARE_TITLE_DETAILS(softwarePackageTitleId.toString()),
|
||||
newQueryParams
|
||||
)
|
||||
);
|
||||
} catch (e) {
|
||||
renderFlash("error", getErrorMessage(e));
|
||||
|
||||
+13
-13
@@ -126,6 +126,7 @@ const FleetMaintainedAppDetailsPage = ({
|
||||
|
||||
const handlePageError = useErrorHandler();
|
||||
const { isPremiumTier } = useContext(AppContext);
|
||||
|
||||
const { selectedOsqueryTable, setSelectedOsqueryTable } = useContext(
|
||||
QueryContext
|
||||
);
|
||||
@@ -198,22 +199,21 @@ const FleetMaintainedAppDetailsPage = ({
|
||||
|
||||
setShowAddFleetAppSoftwareModal(true);
|
||||
|
||||
let titleId: number | undefined;
|
||||
try {
|
||||
const res = await softwareAPI.addFleetMaintainedApp(
|
||||
parseInt(teamId, 10),
|
||||
{
|
||||
...formData,
|
||||
appId,
|
||||
}
|
||||
);
|
||||
titleId = res.software_title_id;
|
||||
const {
|
||||
software_title_id: softwareFmaTitleId,
|
||||
} = await softwareAPI.addFleetMaintainedApp(parseInt(teamId, 10), {
|
||||
...formData,
|
||||
appId,
|
||||
});
|
||||
|
||||
router.push(
|
||||
getPathWithQueryParams(PATHS.SOFTWARE_TITLES, {
|
||||
team_id: teamId,
|
||||
available_for_install: true,
|
||||
})
|
||||
getPathWithQueryParams(
|
||||
PATHS.SOFTWARE_TITLE_DETAILS(softwareFmaTitleId.toString()),
|
||||
{
|
||||
team_id: teamId,
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
renderFlash(
|
||||
|
||||
@@ -12,6 +12,7 @@ describe("SoftwareTitleDetailsPage helpers", () => {
|
||||
labels_include_any: null,
|
||||
labels_exclude_any: null,
|
||||
name: "TestPackage.pkg",
|
||||
title_id: 2,
|
||||
version: "1.0.0",
|
||||
self_service: true,
|
||||
uploaded_at: "2021-01-01T00:00:00Z",
|
||||
@@ -28,7 +29,7 @@ describe("SoftwareTitleDetailsPage helpers", () => {
|
||||
automatic_install_policies: [],
|
||||
last_install: null,
|
||||
last_uninstall: null,
|
||||
package_url: "",
|
||||
url: "",
|
||||
},
|
||||
app_store_app: null,
|
||||
source: "apps",
|
||||
|
||||
Reference in New Issue
Block a user