diff --git a/bootstrap/src/assets/i18n/log/messages_en.json b/bootstrap/src/assets/i18n/log/messages_en.json index e973d6f05..6f221a09b 100644 --- a/bootstrap/src/assets/i18n/log/messages_en.json +++ b/bootstrap/src/assets/i18n/log/messages_en.json @@ -41,6 +41,7 @@ "ZWED5041I":"ectxt=", "ZWED5042I":"dispatcher.invokeAction on context %s", "ZWED5043I":"RESERVED: MVD standalone container requested with pluginId %s", + "ZWED5324I":"RESERVED: The requested Desktop version (%s) is in maintenance mode. To use the newest Desktop version instead, remove the query parameter 'use-v2-desktop'.", "ZWED5000W":"RESERVED: Desktop attempted to change instanceId for iframe instance=%s, message=%s", "ZWED5001W":"pluginWSUri not implemented yet!", @@ -99,4 +100,4 @@ "ZWED5041E":"RESERVED: Plugin type is not present", "ZWED5042E":"RESERVED: Plugin type is not a string", "ZWED5043E":"RESERVED: %s is not a valid semantic version" -} \ No newline at end of file +} diff --git a/bootstrap/src/bootstrap/bootstrap-manager.ts b/bootstrap/src/bootstrap/bootstrap-manager.ts index f98e6e8ab..4731b0113 100644 --- a/bootstrap/src/bootstrap/bootstrap-manager.ts +++ b/bootstrap/src/bootstrap/bootstrap-manager.ts @@ -13,7 +13,6 @@ import { Plugin } from 'zlux-base/plugin-manager/plugin' import { PluginManager } from 'zlux-base/plugin-manager/plugin-manager' import { ZoweZLUXResources } from './rocket-mvd-resources' -import { DSMResources } from './dsm-resources' export class BootstrapManager { private static bootstrapPerformed = false; @@ -22,11 +21,7 @@ export class BootstrapManager { const uriBroker = window['GIZA_ENVIRONMENT']; console.log("ZWED5004I - bootstrapGlobalResources standaloneContainerRequested flag value: ", standaloneContainerRequested); console.log("ZWED5005I - bootstrapGlobalResources GIZA_ENVIRONMENT value: ", uriBroker); - if (standaloneContainerRequested && uriBroker && uriBroker.toUpperCase() === 'DSM') { - window.ZoweZLUX = DSMResources; - } else { - window.ZoweZLUX = ZoweZLUXResources; - } + window.ZoweZLUX = ZoweZLUXResources; } private static bootstrapDesktopPlugin(desktop: ZLUX.Plugin, injectionCallback: (plugin: ZLUX.Plugin) => Promise) { @@ -61,8 +56,18 @@ export class BootstrapManager { console.log(`ZWED5007I - ${desktops.length} desktops available`); console.log('ZWED5008I - desktops: ', desktops); + const searchParams = new URLSearchParams(window.location.search); + const v2Desktop = desktops.filter((desktop)=> { desktop.getIdentifier() == "org.zowe.zlux.ng2desktop" }); + const v3Desktop = desktops.filter((desktop)=> { desktop.getIdentifier() == "org.zowe.zlux.ivydesktop" }); + const useV2Desktop = v2Desktop.length == 1 && searchParams.has("use-v2-desktop") && (searchParams.get("use-v2-desktop") == 'true'); + if (desktops.length == 0) { console.error("ZWED5012E - No desktops available to bootstrap."); + } else if (useV2Desktop) { + console.warn("ZWED5324I - The requested Desktop version (V2) is in maintenance mode. To use the newest Desktop version instead, remove the query parameter 'use-v2-desktop'."); + BootstrapManager.bootstrapDesktopPlugin(v2Desktop[0], injectionCallback); + } else if (v3Desktop.length == 1) { + BootstrapManager.bootstrapDesktopPlugin(v3Desktop[0], injectionCallback); } else { BootstrapManager.bootstrapDesktopPlugin(desktops[0], injectionCallback); } diff --git a/bootstrap/src/bootstrap/dsm-resources.ts b/bootstrap/src/bootstrap/dsm-resources.ts deleted file mode 100644 index d6046d468..000000000 --- a/bootstrap/src/bootstrap/dsm-resources.ts +++ /dev/null @@ -1,60 +0,0 @@ - - -/* - This program and the accompanying materials are - made available under the terms of the Eclipse Public License v2.0 which accompanies - this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html - - SPDX-License-Identifier: EPL-2.0 - - Copyright Contributors to the Zowe Project. -*/ - -import { PluginManager } from 'zlux-base/plugin-manager/plugin-manager' -import { DsmUri } from '../uri/dsm-uri' -import { Dispatcher } from 'zlux-base/dispatcher/dispatcher' -import { Environment } from 'zlux-base/environment/environment' -import { Logger } from '../../../../zlux-shared/src/logging/logger' -import { Registry } from 'zlux-base/registry/registry' -import { ZoweNotificationManager } from 'zlux-base/notification-manager/notification-manager' -import { SimpleGlobalization } from '../i18n/simple-globalization' -// import { VirtualDesktopAdapter } from '../abstract-virtual-desktop/virtual-desktop-adapter' - -let logger = new Logger(); -logger.addDestination(logger.makeDefaultDestination(true,true,true)); - -// component logger -export var bootstrapLogger : ZLUX.ComponentLogger = logger.makeComponentLogger("_zsf.bootstrap"); - -fetch('/ZLUX/plugins/org.zowe.zlux.bootstrap/web/assets/i18n/log/messages_en.json') - .then((response) => { - return response.json(); - }) - .then((myJson) => { - (bootstrapLogger as any)._messages = myJson; - }) - .catch((e) => { - bootstrapLogger.warn("ZWED5000E - Unable to retrieve message resource file: messages_en.json\n", e); - }); - -export class DSMResources { - static pluginManager = PluginManager - static environment:Environment = new Environment(); - static uriBroker:ZLUX.UriBroker = new DsmUri(); - static dispatcher:Dispatcher = new Dispatcher(bootstrapLogger); - static logger:Logger = logger; - static registry:ZLUX.Registry = new Registry(); - static notificationManager:ZoweNotificationManager = new ZoweNotificationManager(); - // currently replaced in plugin-manager.module - static globalization: ZLUX.Globalization = new SimpleGlobalization(); -} - -/* - This program and the accompanying materials are - made available under the terms of the Eclipse Public License v2.0 which accompanies - this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html - - SPDX-License-Identifier: EPL-2.0 - - Copyright Contributors to the Zowe Project. -*/ diff --git a/bootstrap/src/bootstrap/rocket-mvd-resources.ts b/bootstrap/src/bootstrap/rocket-mvd-resources.ts index f3d848a58..9edb2f2d2 100644 --- a/bootstrap/src/bootstrap/rocket-mvd-resources.ts +++ b/bootstrap/src/bootstrap/rocket-mvd-resources.ts @@ -18,7 +18,6 @@ import { Logger } from '../../../../zlux-shared/src/logging/logger' import { Registry } from 'zlux-base/registry/registry' import { ZoweNotificationManager } from 'zlux-base/notification-manager/notification-manager' import { SimpleGlobalization } from '../i18n/simple-globalization' -// import { VirtualDesktopAdapter } from '../abstract-virtual-desktop/virtual-desktop-adapter' // This is the core logger let logger = new Logger(); diff --git a/bootstrap/src/uri/dsm-uri.ts b/bootstrap/src/uri/dsm-uri.ts deleted file mode 100644 index d6e4ed558..000000000 --- a/bootstrap/src/uri/dsm-uri.ts +++ /dev/null @@ -1,187 +0,0 @@ - - -/* - This program and the accompanying materials are - made available under the terms of the Eclipse Public License v2.0 which accompanies - this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html - - SPDX-License-Identifier: EPL-2.0 - - Copyright Contributors to the Zowe Project. -*/ - -import { PluginManager } from 'zlux-base/plugin-manager/plugin-manager' -import { bootstrapLogger } from '../bootstrap/dsm-resources' - -const proxy_path = 'zowe-zlux'; -const proxy_mode = (window.location.pathname.split('/')[1] == proxy_path) ? true : false; - -export class DsmUri implements ZLUX.UriBroker { - - private proxyURL(url: string): string { - return proxy_mode ? `/${proxy_path}${url}` : url; - } - - rasUri(_relativePath: string): string { - return ""; - } - unixFileUri(_route: string, _absPath: string, - _sourceEncodingOrOptions?: string|ZLUX.UnixFileUriOptions, _targetEncoding?: string, - _newName?: string, _forceOverwrite?: boolean, _sessionID?: number, - _lastChunk?: boolean, _responseType?: string, _mode?: string, _recursive?: boolean, - _user?: string, _group?: string, _type?: ZLUX.TagType, _codeset?: number): string { - return ""; - } - omvsSegmentUri(): string { - return `${this.serverRootUri('omvs')}`; - } - datasetContentsUri(_relativePath: string): string { - return ""; - } - VSAMdatasetContentsUri(_relativePath: string, _closeAfter?: boolean): string { - return ""; - } - datasetMetadataHlqUri(_updateCache?: boolean | undefined, _types?: string | undefined, - _workAreaSize?: number | undefined, _resumeName?: string | undefined, _resumeCatalogName?: string | undefined): string { - return ""; - } - datasetMetadataUri(_relativePath: string, _detail?: string | undefined, _types?: string | undefined, - _listMembers?: boolean | undefined, _workAreaSize?: number | undefined, _includeMigrated?: boolean | undefined, - _includeUnprintable?: boolean | undefined, _resumeName?: string | undefined, _resumeCatalogName?: string | undefined, - _addQualifiers?: string | undefined): string { - return ""; - } - datasetCopyUri(_relativePath: string, _newDataset: string) { - return ""; - } - - agentRootUri(_uri: string): string { - return ""; - } - - serverRootUri(_uri: string): string { - return ""; - } - - pluginRootUri(pluginDefinition: ZLUX.Plugin): string { - return this.proxyURL(`/ZLUX/plugins/${pluginDefinition.getIdentifier()}/web/`); - } - - desktopRootUri(): string { - const desktopPlugin = PluginManager.getDesktopPlugin(); - if (desktopPlugin != null) { - return this.pluginServletUri() + `?pluginResourceUri=` + this.pluginRootUri(desktopPlugin); - } else { - throw new Error("ZWED5014E - The desktop plugin has not been bootstrapped"); - } - } - - pluginResourceUri(pluginDefinition: ZLUX.Plugin, relativePath: string): string { - if (relativePath == null) { - relativePath = ""; - } - return this.pluginServletUri()+`?pluginResourceUri=${this.pluginRootUri(pluginDefinition)}/${relativePath}` - } - - pluginIframeUri(pluginDefinition: ZLUX.Plugin, relativePath: string): string { - if (relativePath == null) { - relativePath = ""; - } - return this.pluginServletUri()+`?pluginResourceUri=${this.pluginRootUri(pluginDefinition)}/${relativePath}` - } - - pluginListUri(pluginType?: ZLUX.PluginType, refresh?: boolean): string { - let query; - if (pluginType === undefined) { - query = `plugins?type=all`; - } else { - query = `plugins?type=${pluginType}` - } - if (refresh) { - query += `&refresh=true`; - } - return `${this.serverRootUri(query)}`; - } - - pluginWSUri(pluginDefinition: ZLUX.Plugin, serviceName:string, - relativePath: string, version = "_current"){ - if (relativePath == null) { - relativePath = ""; - } - //const protocol = window.location.protocol; - //const wsProtocol = (protocol === 'https:') ? 'wss:' : 'ws:'; - // return protocol+'://'+host+`/ZLUX/plugins/${pluginDefinition.getIdentifier()}/services/data`+relativePath; - bootstrapLogger.warn("ZWED5001W", pluginDefinition, serviceName, relativePath, version); //console.warn("pluginWSUri not implemented yet!", pluginDefinition, - //serviceName, relativePath, version); - return ""; - } - - /** - * This method should only be used for administrative UI's where the user has sufficient privilege - * to create/modify/delete configs at the group, instance, or site "scopes". End user UI that is consuming configs - * should use plubinConfigUri - * @param pluginDefinition - * @param scope - * @param resourcePath - * @param [resourceName] - */ - pluginConfigForScopeUri(pluginDefinition: ZLUX.Plugin, scope: string, resourcePath:string, resourceName?:string): string { - let name = resourceName ? '?name='+resourceName : ''; - return this.pluginServletUri()+`?pluginRESTUri=/ZLUX/plugins/org.zowe.configjs` - + `/services/data/_current/${pluginDefinition.getIdentifier()}/${scope}/` - + `${resourcePath}${name}`; - } - - /** - Note: This may be unimplemented for /config, and if DSM is equipped for it, should rely on /ZLUX/plugins/org.zowe.configjs/services/data instead - */ - /* Disabled for now, to be re-introduced with role-based access control use - pluginConfigForUserUri(pluginDefinition: ZLUX.Plugin, user:string, resourcePath:string, resourceName?:string) { - let name = resourceName ? '?name='+resourceName : ''; - return this.proxyURL(`/ZLUX/plugins/org.zowe.configjs/services/data/_current` - + `/${pluginDefinition.getIdentifier()}/users/${user}/${resourcePath}${name}`); - } - */ - /** - Note: This may be unimplemented for /config, and if DSM is equipped for it, should rely on /ZLUX/plugins/org.zowe.configjs/services/data instead - */ - /* Disabled for now, to be re-introduced with role-based access control use - pluginConfigForGroupUri(pluginDefinition: ZLUX.Plugin, group:string, resourcePath:string, resourceName?:string) { - let name = resourceName ? '?name='+resourceName : ''; - return this.proxyURL(`/ZLUX/plugins/org.zowe.configjs/services/data/_current` - + `/${pluginDefinition.getIdentifier()}/group/${group}/${resourcePath}${name}`); - } */ - - pluginConfigUri(pluginDefinition: ZLUX.Plugin, resourcePath:string, resourceName?:string) { - return this.pluginConfigForScopeUri(pluginDefinition, "user", resourcePath, resourceName); - } - - pluginRESTUri(plugin:ZLUX.Plugin, serviceName: string, relativePath:string, - version = "_current"){ - if (relativePath == null) { - relativePath = ""; - } - return this.pluginServletUri()+`?pluginRESTUri=/ZLUX/plugins/` - + `${plugin.getIdentifier()}/services/${serviceName}/${version}/${relativePath}`; - } - - private pluginServletUri(){ - return `../dsm/proxy/ZluxProxyServlet`; - } - - userInfoUri(): string { - return this.agentRootUri('user-info'); - } - -} - -/* - This program and the accompanying materials are - made available under the terms of the Eclipse Public License v2.0 which accompanies - this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html - - SPDX-License-Identifier: EPL-2.0 - - Copyright Contributors to the Zowe Project. -*/ - diff --git a/virtual-desktop/pluginDefinition.json b/virtual-desktop/pluginDefinition.json index 4c922c781..a49a8168b 100644 --- a/virtual-desktop/pluginDefinition.json +++ b/virtual-desktop/pluginDefinition.json @@ -1,5 +1,5 @@ { - "identifier": "org.zowe.zlux.ng2desktop", + "identifier": "org.zowe.zlux.ivydesktop", "apiVersion": "2.0.0", "pluginVersion": "0.0.0-zlux.version.replacement", "pluginType": "desktop", diff --git a/virtual-desktop/src/app/shared/logger.ts b/virtual-desktop/src/app/shared/logger.ts index 17940fea0..e92259a16 100644 --- a/virtual-desktop/src/app/shared/logger.ts +++ b/virtual-desktop/src/app/shared/logger.ts @@ -8,7 +8,7 @@ Copyright Contributors to the Zowe Project. */ -const baseLoggerIdentifier = 'org.zowe.zlux.ng2desktop' //the one hardcoded place +const baseLoggerIdentifier = 'org.zowe.zlux.ivydesktop' //the one hardcoded place export var BaseLogger: any = ZoweZLUX.logger.makeComponentLogger(baseLoggerIdentifier); let lang = ZoweZLUX.globalization.getLanguage(); diff --git a/virtual-desktop/src/app/start-url-manager/start-url-manager.service.ts b/virtual-desktop/src/app/start-url-manager/start-url-manager.service.ts index 0537537d1..a83d43ad9 100644 --- a/virtual-desktop/src/app/start-url-manager/start-url-manager.service.ts +++ b/virtual-desktop/src/app/start-url-manager/start-url-manager.service.ts @@ -156,7 +156,7 @@ export class StartURLManager implements MVDHosting.LoginActionInterface { const argumentFormatter = { data: { op: 'deref', source: 'event', path: ['data'] } }; const type = dispatcher.constants.ActionType.Launch; const mode = dispatcher.constants.ActionTargetMode.PluginCreate; - const testAction = dispatcher.makeAction(actionId, actionTitle, mode, type, 'org.zowe.zlux.ng2desktop', argumentFormatter); + const testAction = dispatcher.makeAction(actionId, actionTitle, mode, type, 'org.zowe.zlux.ivydesktop', argumentFormatter); dispatcher.registerAction(testAction); }