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.

<!-- Note that API documentation changes are now addressed by the
product design team. -->

- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
This commit is contained in:
Roberto Dip 2024-09-25 11:14:51 -03:00 committed by GitHub
parent 839106c572
commit adf3ad6214
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 2 deletions

View file

@ -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();
});
});

View file

@ -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;