@forge/cli
14.1.0-next.19-experimental-fd0ebbc14.1.0-next.32
out/command-line/controller/global-install-controller.js~
out/command-line/controller/global-install-controller.jsModified+10−22
Index: package/out/command-line/controller/global-install-controller.js
===================================================================
--- package/out/command-line/controller/global-install-controller.js
+++ package/out/command-line/controller/global-install-controller.js
@@ -20,9 +20,12 @@
this.installUnitClient = installUnitClient;
this.installationService = installationService;
this.supportedProductsService = supportedProductsService;
}
- async run({ appId, environment, nonInteractive, unitId, product, site }) {
+ async run({ appId, environment, nonInteractive, unitId, majorVersionId, licenseOverride, overrides, product, site }) {
+ if ((product || site) && !unitId) {
+ throw new cli_shared_1.UserError(cli_shared_1.Text.install.global.error.connectRequiresUnit);
+ }
const environmentType = await this.assertDeployed(appId, environment);
const isNonInteractive = nonInteractive || Boolean(unitId);
const target = await this.resolveTarget(unitId, isNonInteractive);
if (isNonInteractive && (product || site)) {
@@ -31,14 +34,12 @@
}
const existingInstallationId = await this.installUnitClient.getUnitInstallationId(appId, environment, target.unitId);
if (existingInstallationId) {
this.view.showAlreadyInstalled(target);
- const alreadyLinkedProducts = await this.installUnitClient.getLinkedConnectionProducts(appId, existingInstallationId);
await this.linkConnections({
environment,
installationId: existingInstallationId,
- nonInteractive: isNonInteractive,
- alreadyLinkedProducts
+ nonInteractive: isNonInteractive
});
return;
}
this.view.showInstallConfirmation(target);
@@ -48,8 +49,11 @@
const { installationId } = await this.view.runInstall(() => this.installUnitClient.installAppIntoUnit({
appId,
environmentKey: environment,
unitId: target.unitId,
+ majorVersionId,
+ licenseOverride,
+ overrides,
environmentType
}));
this.view.showInstallSuccess(environment, target);
await this.linkConnections({ environment, installationId, nonInteractive: isNonInteractive });
@@ -128,44 +132,28 @@
}
this.view.showSelectUnitOverview();
return { unit: await this.view.selectUnit(units), onlyUnit };
}
- async linkConnections({ environment, installationId, nonInteractive, alreadyLinkedProducts = [] }) {
+ async linkConnections({ environment, installationId, nonInteractive }) {
if (nonInteractive) {
return;
}
- const linkedSet = new Set(alreadyLinkedProducts.map((product) => product.toLowerCase()));
- const options = LINKABLE_CONNECTIONS.map((connection) => ({
- ...connection,
- linked: linkedSet.has(connection.product.toLowerCase())
- }));
- if (options.every((option) => option.linked)) {
- return;
- }
if (!(await this.view.confirmConnect(false))) {
return;
}
if (!installationId) {
throw new cli_shared_1.UserError(cli_shared_1.Text.install.global.error.noInstallationId);
}
for (;;) {
- const selected = await this.view.selectConnection(options);
- if (selected.linked) {
- this.view.showAlreadyLinked(selected.product);
- continue;
- }
+ const selected = await this.view.selectConnection(LINKABLE_CONNECTIONS);
const kind = selected.kind;
const target = await this.view.promptForConnectionTarget(kind);
const url = this.supportedProductsService.validateSite(this.normalizeTarget(kind, target), selected.product);
this.view.showConnectConfirmation(selected.product, kind);
if (!(await this.view.confirmContinueConnect())) {
continue;
}
await this.performLink(environment, installationId, selected.product, kind, url);
- selected.linked = true;
- if (options.every((option) => option.linked)) {
- break;
- }
if (!(await this.view.confirmConnect(true))) {
break;
}
}