From adf3ad6214cc568329f3b1a8f1bee7f21bfb2d57 Mon Sep 17 00:00:00 2001 From: Roberto Dip Date: Wed, 25 Sep 2024 11:14:51 -0300 Subject: [PATCH] allow to install VPP apps without scripts (#22365) for #22352 # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Added/updated tests - [x] Manual QA for all new/changed functionality --- .../Software/HostSoftwareTableConfig.tests.tsx | 17 +++++++++++++++++ .../cards/Software/HostSoftwareTableConfig.tsx | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/frontend/pages/hosts/details/cards/Software/HostSoftwareTableConfig.tests.tsx b/frontend/pages/hosts/details/cards/Software/HostSoftwareTableConfig.tests.tsx index aa14172c86..68c7a854d9 100644 --- a/frontend/pages/hosts/details/cards/Software/HostSoftwareTableConfig.tests.tsx +++ b/frontend/pages/hosts/details/cards/Software/HostSoftwareTableConfig.tests.tsx @@ -80,4 +80,21 @@ describe("generateActions", () => { const actions = generateActions(props); expect(actions.find((a) => a.value === "uninstall")).toBeUndefined(); }); + + it("allows to install VPP apps even if scripts are disabled", () => { + const props: generateActionsProps = { + ...defaultProps, + hostScriptsEnabled: false, + app_store_app: { + app_store_id: "1", + self_service: false, + icon_url: "", + version: "", + last_install: { command_uuid: "", installed_at: "" }, + }, + }; + const actions = generateActions(props); + expect(actions.find((a) => a.value === "install")?.disabled).toBe(false); + expect(actions.find((a) => a.value === "uninstall")).toBeUndefined(); + }); }); diff --git a/frontend/pages/hosts/details/cards/Software/HostSoftwareTableConfig.tsx b/frontend/pages/hosts/details/cards/Software/HostSoftwareTableConfig.tsx index 53256f50bf..c6a07ce7fa 100644 --- a/frontend/pages/hosts/details/cards/Software/HostSoftwareTableConfig.tsx +++ b/frontend/pages/hosts/details/cards/Software/HostSoftwareTableConfig.tsx @@ -94,8 +94,9 @@ export const generateActions = ({ actions.splice(indexUninstallAction, 1); actions.splice(indexInstallAction, 1); } else { - // if host's scripts are disabled, disable install/uninstall with tooltip - if (!hostScriptsEnabled) { + // if host's scripts are disabled, and this isn't a VPP app, disable + // install/uninstall with tooltip + if (!hostScriptsEnabled && !app_store_app) { actions[indexInstallAction].disabled = true; actions[indexUninstallAction].disabled = true;