From 81bc98eee5120ad4dc913aa76fd1d62070081c4b Mon Sep 17 00:00:00 2001 From: Oleksii Orel Date: Mon, 6 May 2019 19:10:54 +0300 Subject: [PATCH 1/3] CHE-12917 add the unsupported workspace version error mark Signed-off-by: Oleksii Orel --- .../e2e/stacks/list-stacks/list-stack.mock.js | 1 - .../stack-details/stack-details.mock.js | 2 - ...agnostics-workspace-start-check.factory.ts | 1 - .../list-organization-workspaces.html | 2 +- .../app/stacks/stack-details/stack.spec.ts | 1 - .../workspace-item.controller.ts | 22 ++- .../workspace-item/workspace-item.html | 4 +- .../workspace-status-button.directive.spec.ts | 1 - .../machine-selector/machine-selector.html | 2 +- .../workspace-details.controller.ts | 29 ++- .../workspace-details.directive.spec.ts | 8 +- .../workspace-details/workspace-details.html | 9 +- .../workspace-details/workspace-details.styl | 6 + .../workspace-machines.controller.ts | 4 +- .../workspace-machines.html | 2 +- .../workspace-ssh/workspace-details-ssh.html | 2 +- .../app/workspaces/workspaces.service.spec.ts | 167 ++++++++++++++++++ .../src/app/workspaces/workspaces.service.ts | 45 ++++- .../compose-environment-manager.spec.ts | 14 +- .../docker-file-environment-manager.spec.ts | 14 -- .../docker-image-environment-manager.spec.ts | 8 +- .../kubernetes-environment-manager.spec.ts | 16 +- .../api/workspace/che-workspace.factory.ts | 29 ++- dashboard/src/components/typings/che.d.ts | 6 + 24 files changed, 298 insertions(+), 97 deletions(-) create mode 100644 dashboard/src/app/workspaces/workspaces.service.spec.ts diff --git a/dashboard/e2e/stacks/list-stacks/list-stack.mock.js b/dashboard/e2e/stacks/list-stacks/list-stack.mock.js index 883aa6793bf..b7d36d5e916 100644 --- a/dashboard/e2e/stacks/list-stacks/list-stack.mock.js +++ b/dashboard/e2e/stacks/list-stacks/list-stack.mock.js @@ -27,7 +27,6 @@ exports.listStacksTheeEntries = function () { 'machines': { 'dev-machine': { 'servers': {}, - 'installers': ['org.eclipse.che.exec', 'org.eclipse.che.terminal', 'org.eclipse.che.ws-agent', 'org.eclipse.che.ssh'], 'attributes': {'memoryLimitBytes': '2147483648'} } }, 'recipe': {'content': 'codenvy/node', 'type': 'dockerimage'} diff --git a/dashboard/e2e/stacks/stack-details/stack-details.mock.js b/dashboard/e2e/stacks/stack-details/stack-details.mock.js index 0dc7ab6618b..579d4fa85f9 100644 --- a/dashboard/e2e/stacks/stack-details/stack-details.mock.js +++ b/dashboard/e2e/stacks/stack-details/stack-details.mock.js @@ -24,7 +24,6 @@ exports.dockerimageStack = function () { 'machines': { 'dev-machine': { 'servers': {}, - 'installers': ['org.eclipse.che.exec', 'org.eclipse.che.terminal', 'org.eclipse.che.ws-agent', 'org.eclipse.che.ssh'], 'attributes': {'memoryLimitBytes': '2147483648'} } }, 'recipe': {'content': 'eclipse/node', 'type': 'dockerimage'} @@ -61,7 +60,6 @@ exports.dockerfileStack = function () { 'machines': { 'dev-machine': { 'servers': {}, - 'installers': ['org.eclipse.che.ws-agent', 'org.eclipse.che.ssh', 'org.eclipse.che.exec', 'org.eclipse.che.terminal'], 'attributes': {'memoryLimitBytes': '2147483648'} } } diff --git a/dashboard/src/app/diagnostics/test/diagnostics-workspace-start-check.factory.ts b/dashboard/src/app/diagnostics/test/diagnostics-workspace-start-check.factory.ts index 8d9de039637..8fae076773d 100644 --- a/dashboard/src/app/diagnostics/test/diagnostics-workspace-start-check.factory.ts +++ b/dashboard/src/app/diagnostics/test/diagnostics-workspace-start-check.factory.ts @@ -175,7 +175,6 @@ export class DiagnosticsWorkspaceStartCheck { 'diagnostics': { 'machines': { 'dev-machine': { - 'installers': ['org.eclipse.che.ws-agent'], 'servers': {}, 'attributes': {'memoryLimitBytes': '1147483648'} } diff --git a/dashboard/src/app/organizations/organization-details/organization-workspaces/list-organization-workspaces.html b/dashboard/src/app/organizations/organization-details/organization-workspaces/list-organization-workspaces.html index 82315505620..8f9dd8605aa 100644 --- a/dashboard/src/app/organizations/organization-details/organization-workspaces/list-organization-workspaces.html +++ b/dashboard/src/app/organizations/organization-details/organization-workspaces/list-organization-workspaces.html @@ -135,7 +135,7 @@
- Not supported + Not compatible
diff --git a/dashboard/src/app/stacks/stack-details/stack.spec.ts b/dashboard/src/app/stacks/stack-details/stack.spec.ts index b4f58855791..186ed1dcb14 100644 --- a/dashboard/src/app/stacks/stack-details/stack.spec.ts +++ b/dashboard/src/app/stacks/stack-details/stack.spec.ts @@ -147,7 +147,6 @@ function getTestStack(): che.IStack { 'dev-machine': { 'env': { 'CHE_MACHINE_NAME': 'dev-machine' }, 'volumes': {}, - 'installers': ['org.eclipse.che.ws-agent'], 'servers': { 'tomcat8-debug': { 'protocol': 'http', diff --git a/dashboard/src/app/workspaces/list-workspaces/workspace-item/workspace-item.controller.ts b/dashboard/src/app/workspaces/list-workspaces/workspace-item/workspace-item.controller.ts index fbb1cf568ed..2458fcfc68e 100644 --- a/dashboard/src/app/workspaces/list-workspaces/workspace-item/workspace-item.controller.ts +++ b/dashboard/src/app/workspaces/list-workspaces/workspace-item/workspace-item.controller.ts @@ -30,6 +30,7 @@ export class WorkspaceItemCtrl { workspace: che.IWorkspace; workspaceName: string; + workspaceSupportIssues = ''; /** * Default constructor that is using resource @@ -42,16 +43,31 @@ export class WorkspaceItemCtrl { this.lodash = lodash; this.cheWorkspace = cheWorkspace; this.workspacesService = workspacesService; - this.workspaceName = this.cheWorkspace.getWorkspaceDataManager().getName(this.workspace); + this.workspaceName = this.cheWorkspace.getWorkspaceDataManager().getName(this.workspace); } /** - * Returns `true` if default environment of workspace contains supported recipe type. + * Returns `true` if supported. * * @returns {boolean} */ get isSupported(): boolean { - return this.workspacesService.isSupported(this.workspace); + if (!this.workspacesService.isSupportedRecipeType(this.workspace)) { + this.workspaceSupportIssues = 'Current infrastructure doesn\'t support this workspace recipe type.'; + + return false; + } + if (!this.workspacesService.isSupportedVersion(this.workspace)) { + this.workspaceSupportIssues = `This workspace is using old definition format which is not compatible anymore. + Please follow the documentation to update the definition of the workspace and benefits from the latest capabilities.`; + + return false; + } + if (!this.workspaceSupportIssues) { + this.workspaceSupportIssues = ''; + } + + return true; } /** diff --git a/dashboard/src/app/workspaces/list-workspaces/workspace-item/workspace-item.html b/dashboard/src/app/workspaces/list-workspaces/workspace-item/workspace-item.html index 64a581cd77c..6912ea21892 100644 --- a/dashboard/src/app/workspaces/list-workspaces/workspace-item/workspace-item.html +++ b/dashboard/src/app/workspaces/list-workspaces/workspace-item/workspace-item.html @@ -98,8 +98,8 @@
- Not supported - + Not compatible +
diff --git a/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status-button.directive.spec.ts b/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status-button.directive.spec.ts index 8e90f242d0b..312cd3824e6 100644 --- a/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status-button.directive.spec.ts +++ b/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status-button.directive.spec.ts @@ -75,7 +75,6 @@ describe('WorkspaceStatus >', () => { [defaultEnvironment]: { 'machines': { 'dev-machine': { - 'installers': ['org.eclipse.che.ws-agent'] } }, 'recipe': { diff --git a/dashboard/src/app/workspaces/workspace-details/machine-selector/machine-selector.html b/dashboard/src/app/workspaces/workspace-details/machine-selector/machine-selector.html index b30be2cbfe6..70ab5c37d8a 100644 --- a/dashboard/src/app/workspaces/workspace-details/machine-selector/machine-selector.html +++ b/dashboard/src/app/workspaces/workspace-details/machine-selector/machine-selector.html @@ -19,5 +19,5 @@
- There are no machines to display. + There are no containers to display.
diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-details.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-details.controller.ts index 22d0739b9a6..7603d52480a 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-details.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-details.controller.ts @@ -16,7 +16,6 @@ import {WorkspaceDetailsService} from './workspace-details.service'; import IdeSvc from '../../ide/ide.service'; import {WorkspacesService} from '../workspaces.service'; import {ICheEditModeOverlayConfig} from '../../../components/widget/edit-mode-overlay/che-edit-mode-overlay.directive'; -import {IEnvironmentManagerMachine} from '../../../components/api/environment/environment-manager-machine'; export interface IInitData { namespaceId: string; @@ -169,7 +168,7 @@ export class WorkspaceDetailsController { } /** - * Returns `true` if the recipe of default environment of the workspace has supported recipe type + * Returns `true` if supported. * * @returns {boolean} */ @@ -177,6 +176,14 @@ export class WorkspaceDetailsController { return this.workspacesService.isSupported(this.workspaceDetails); } + isSupportedVersion(): boolean { + return this.workspacesService.isSupportedVersion(this.workspaceDetails); + } + + isSupportedRecipeType(): boolean { + return this.workspacesService.isSupportedRecipeType(this.workspaceDetails); + } + /** * Update tabs. */ @@ -282,7 +289,7 @@ export class WorkspaceDetailsController { } this.workspaceDetails.config = config; - + if (!this.originWorkspaceDetails || !this.workspaceDetails) { return; @@ -292,7 +299,7 @@ export class WorkspaceDetailsController { const failedTabs = this.checkForFailedTabs(); // publish changes this.workspaceDetailsService.publishWorkspaceChange(this.workspaceDetails); - + if (!failedTabs || failedTabs.length === 0) { let runningWorkspace = this.getWorkspaceStatus() === WorkspaceStatus[WorkspaceStatus.STARTING] || this.getWorkspaceStatus() === WorkspaceStatus[WorkspaceStatus.RUNNING]; this.saveConfigChanges(false, runningWorkspace); @@ -315,16 +322,16 @@ export class WorkspaceDetailsController { if (this.newName !== devfile.name) { this.newName = devfile.name; } - + this.workspaceDetails.devfile = devfile; - + if (!this.originWorkspaceDetails || !this.workspaceDetails) { return; } this.workspaceDetailsService.publishWorkspaceChange(this.workspaceDetails); - + let runningWorkspace = this.getWorkspaceStatus() === WorkspaceStatus[WorkspaceStatus.STARTING] || this.getWorkspaceStatus() === WorkspaceStatus[WorkspaceStatus.RUNNING]; this.saveConfigChanges(false, runningWorkspace); } @@ -356,10 +363,14 @@ export class WorkspaceDetailsController { * @returns {string} */ getOverlayMessage(failedTabs?: string[]): string { - if (this.isSupported === false) { + if (!this.isSupportedRecipeType()) { return `Current infrastructure doesn't support this workspace recipe type.`; } + if (!this.isSupportedVersion()) { + return `This workspace is using old definition format which is not compatible anymore.`; + } + if (failedTabs && failedTabs.length > 0) { const url = this.$location.absUrl().split('?')[0]; let message = ``, () => { 'dev-machine': { 'env': {}, 'volumes': {}, - 'installers': ['org.eclipse.che.exec', 'org.eclipse.che.terminal', 'org.eclipse.che.ws-agent'], 'servers': { 'tomcat8-debug': {'protocol': 'http', 'port': '8000'}, 'codeserver': {'protocol': 'http', 'port': '9876'}, @@ -109,6 +108,8 @@ describe(`WorkspaceDetailsController >`, () => { }) .service('workspacesService', function() { this.isSupported = () => { return true; }; + this.isSupportedVersion = () => { return true; }; + this.isSupportedRecipeType = () => { return true; }; }) .service('$route', function() { this.current = { @@ -585,6 +586,11 @@ describe(`WorkspaceDetailsController >`, () => { compileDirective(); controller.workspacesService.isSupported = jasmine.createSpy('workspaceDetailsController.isSupported') + .and + .callFake(() => { + return false; + }); + controller.workspacesService.isSupportedRecipeType = jasmine.createSpy('workspaceDetailsController.isSupportedRecipeType') .and .callFake(() => { return false; diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-details.html b/dashboard/src/app/workspaces/workspace-details/workspace-details.html index 8c21ec7c966..013fe030b5e 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-details.html +++ b/dashboard/src/app/workspaces/workspace-details/workspace-details.html @@ -1,6 +1,9 @@ - + + This workspace is using old definition format which is not compatible anymore. + Please follow the documentation to update the definition of the workspace and benefits from the latest capabilities. + +
- There are no machines to display. + There are no containers to display.
Add another machine by changing the environment type to compose, kubernetes or openshift diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-ssh/workspace-details-ssh.html b/dashboard/src/app/workspaces/workspace-details/workspace-ssh/workspace-details-ssh.html index 287a8a81ab6..1ec015ef14c 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-ssh/workspace-details-ssh.html +++ b/dashboard/src/app/workspaces/workspace-details/workspace-ssh/workspace-details-ssh.html @@ -16,7 +16,7 @@ ng-show="workspaceDetailsSshCtrl.isLoading">
- There are no machines to display. + There are no containers to display.
diff --git a/dashboard/src/app/workspaces/workspaces.service.spec.ts b/dashboard/src/app/workspaces/workspaces.service.spec.ts new file mode 100644 index 00000000000..aaeec79d334 --- /dev/null +++ b/dashboard/src/app/workspaces/workspaces.service.spec.ts @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2015-2018 Red Hat, Inc. + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Red Hat, Inc. - initial API and implementation + */ +'use strict'; + +import {CheWorkspace} from '../../components/api/workspace/che-workspace.factory'; +import {WorkspacesService} from './workspaces.service'; + +/** + * WorkspacesService tests. + * + * @author Oleksii Orel + */ +describe(`WorkspacesService >`, () => { + + /** + * Service to test. + */ + let workspacesService: WorkspacesService; + let cheWorkspace: CheWorkspace; + + function getCHE6Workspace(recipeType?: string): che.IWorkspace { + return { + 'namespace': 'che', + 'status': 'RUNNING', + 'config': { + 'attributes': {}, + 'environments': { + 'default': { + 'recipe': { + 'type': recipeType ? recipeType : 'dockerimage', + 'content': 'eclipse/ubuntu_jdk8' + }, + 'machines': { + 'dev-machine': { + 'env': {}, + 'volumes': {}, + 'installers': [ + 'org.eclipse.che.exec', + 'org.eclipse.che.terminal' + ], + 'servers': { + 'tomcat8-debug': {'protocol': 'http', 'port': '8000'}, + 'codeserver': {'protocol': 'http', 'port': '9876'}, + 'tomcat8': {'protocol': 'http', 'port': '8080'} + }, + 'attributes': {'memoryLimitBytes': '2147483648'} + } + } + } + }, 'projects': [], 'commands': [], 'defaultEnv': 'default', 'name': 'wksp-98cs' + }, + 'temporary': false, + 'links': { + 'self': '...Fake self link...', + 'ide': '...Fake ide link...' + }, + 'id': 'workspacezbkov1e8qcm00dli', + 'attributes': { + 'created': 1516282666658, + 'stackId': '...Fake stack id...' + } + }; + } + + function getCHE7Workspace(recipeType?: string): che.IWorkspace { + return { + 'namespace': 'che', + 'status': 'RUNNING', + 'config': { + 'defaultEnv': 'default', + 'environments': { + 'default': { + 'machines': {}, + 'recipe': { + 'type': recipeType ? recipeType : 'kubernetes', + 'content': '...Fake recipe content...', + 'contentType': '...Fake recipe contentType...' + } + } + }, + 'attributes': { + 'editor': 'eclipse/che-theia/0.0.1', + 'plugins': 'eclipse/che-machine-exec-plugin/0.0.1' + }, + 'projects': [], + 'name': 'wksp-7znm', + 'commands': [] + }, + 'temporary': false, + 'links': { + 'self': '...Fake self link...', + 'ide': '...Fake ide link...' + }, + 'id': 'workspacezbkov1e8qcm00dli', + 'attributes': { + 'created': 1516282666658, + 'stackId': '...Fake stack id...' + } + }; + } + + /** + * Setup module + */ + beforeEach(() => { + angular.mock.module('userDashboard'); + }); + + beforeEach(() => { + angular.module('workspacesServiceMock', []) + .service('cheWorkspace', function () { + this.getSupportedRecipeTypes = (): string[] => { + return ['kubernetes','dockerimage','no-environment']; + } + }); + angular.mock.module('workspacesServiceMock'); + }); + + beforeEach(inject((_workspacesService_: WorkspacesService, + _cheWorkspace_: CheWorkspace) => { + cheWorkspace = _cheWorkspace_; + workspacesService = _workspacesService_; + })); + + describe(`supported workspace version >`, () => { + + it(`should support a CHE7 workspace >`, () => { + const newCHE7Workspace = getCHE7Workspace(); + expect(workspacesService.isSupported(newCHE7Workspace)).toBeTruthy(); + expect(workspacesService.isSupportedVersion(newCHE7Workspace)).toBeTruthy(); + }); + + it(`shouldn't support a CHE6 workspace >`, () => { + const oldCHE6Workspace = getCHE6Workspace(); + expect(workspacesService.isSupported(oldCHE6Workspace)).toBeFalsy(); + expect(workspacesService.isSupportedVersion(oldCHE6Workspace)).toBeFalsy(); + }); + + }); + + describe(`supported recipe type >`, () => { + + it(`should support a default recipe type >`, () => { + const newCHE7Workspace = getCHE7Workspace(); + expect(workspacesService.isSupported(newCHE7Workspace)).toBeTruthy(); + expect(workspacesService.isSupportedRecipeType(newCHE7Workspace)).toBeTruthy(); + }); + + it(`shouldn't support a fake recipe type >`, () => { + const recipeType = '...Fake recipeType...'; + const newCHE7Workspace = getCHE7Workspace(recipeType); + expect(workspacesService.isSupported(newCHE7Workspace)).toBeFalsy(); + expect(workspacesService.isSupportedRecipeType(newCHE7Workspace)).toBeFalsy(); + }); + + }); + +}); diff --git a/dashboard/src/app/workspaces/workspaces.service.ts b/dashboard/src/app/workspaces/workspaces.service.ts index 2c4bb7152b6..f7e4c416040 100644 --- a/dashboard/src/app/workspaces/workspaces.service.ts +++ b/dashboard/src/app/workspaces/workspaces.service.ts @@ -13,6 +13,8 @@ import {CheWorkspace} from '../../components/api/workspace/che-workspace.factory'; +const MINIMAL_SUPORTED_VERSION = 7; + /** * This is a helper class for workspaces. * @@ -42,7 +44,7 @@ export class WorkspacesService { * @param {string=} envName environment name * @returns {boolean} */ - isSupported(workspace: che.IWorkspace, envName?: string): boolean { + isSupportedRecipeType(workspace: che.IWorkspace, envName?: string): boolean { if (workspace.config) { envName = envName || workspace.config.defaultEnv; const supportedRecipeTypes = this.cheWorkspace.getSupportedRecipeTypes(), @@ -52,4 +54,45 @@ export class WorkspacesService { return true; } } + + /** + * Returns `true` if supported. + * @param {che.IWorkspace} workspace + * @param {string=} envName environment name + * @returns {boolean} + */ + isSupported(workspace: che.IWorkspace, envName?: string): boolean { + envName = envName || workspace.config.defaultEnv; + + return this.isSupportedRecipeType(workspace, envName) && this.isSupportedVersion(workspace); + } + + /** + * Returns `true` if supported in the current version of the product. + * @param {che.IWorkspace} workspace + * @returns {boolean} + */ + isSupportedVersion(workspace: che.IWorkspace): boolean { + if (!workspace || !workspace.config) { + return false; + } + const config = workspace.config; + const machines = config.environments[config.defaultEnv]; + + let version: number; + if (!Object.keys(machines).length || config.attributes.editor || config.attributes.plugins) { + version = 7; + } else { + for (const key in machines) { + const installers = machines[key].installers; + if (installers && installers.length !== 0) { + version = 6; + break; + } + } + } + + return version && version >= MINIMAL_SUPORTED_VERSION; + } + } diff --git a/dashboard/src/components/api/environment/compose-environment-manager.spec.ts b/dashboard/src/components/api/environment/compose-environment-manager.spec.ts index 277ba00077f..f7ed00daebc 100644 --- a/dashboard/src/components/api/environment/compose-environment-manager.spec.ts +++ b/dashboard/src/components/api/environment/compose-environment-manager.spec.ts @@ -51,7 +51,6 @@ describe('ComposeEnvironmentManager', () => { 'volumes': { 'volume1': {'path': '/some/path'} }, - 'installers': ['org.eclipse.che.ws-agent', 'org.eclipse.che.terminal', 'org.eclipse.che.ssh'] } }, 'recipe': { @@ -78,15 +77,6 @@ describe('ComposeEnvironmentManager', () => { expect(servers).toEqual(expectedServers); }); - - it('at least one machine should contain \'ws-agent\'', () => { - let devMachinesList = machines.filter((machine: IEnvironmentManagerMachine) => { - return envManager.isDev(machine); - }); - - expect(devMachinesList.length).toBeGreaterThan(0); - }); - }); describe('for recipe from content', () => { @@ -113,8 +103,7 @@ describe('ComposeEnvironmentManager', () => { 'volumes': { 'vol1': {'path': '/some/path'}, 'm22': {'path': '/home/user/.m2/repository'} - }, - 'installers': ['org.eclipse.che.ws-agent', 'org.eclipse.che.terminal', 'org.eclipse.che.ssh'] + } } }, 'recipe': { @@ -197,7 +186,6 @@ describe('ComposeEnvironmentManager', () => { 'dev-machine': { 'servers': {}, 'volumes': {}, - 'installers': ['org.eclipse.che.ws-agent', 'org.eclipse.che.terminal', 'org.eclipse.che.ssh'], 'attributes': {'memoryLimitBytes': '2147483648'} } }, diff --git a/dashboard/src/components/api/environment/docker-file-environment-manager.spec.ts b/dashboard/src/components/api/environment/docker-file-environment-manager.spec.ts index c66614f62b2..96e761fa6aa 100644 --- a/dashboard/src/components/api/environment/docker-file-environment-manager.spec.ts +++ b/dashboard/src/components/api/environment/docker-file-environment-manager.spec.ts @@ -31,7 +31,6 @@ describe('If recipe has content', () => { 'attributes': {'memoryLimitBytes': '2147483648'}, 'servers': {}, 'volumes': {}, - 'installers': ['org.eclipse.che.ws-agent', 'org.eclipse.che.terminal', 'org.eclipse.che.ssh'] } }, 'recipe': { @@ -73,12 +72,6 @@ describe('If recipe has content', () => { expect(source).toEqual(expectedSource); }); - it('the machine should be a dev machine', () => { - let isDev = envManager.isDev(machines[0]); - - expect(isDev).toBe(true); - }); - it('should update environment\'s recipe via machine\'s source', () => { let oldMachines = envManager.getMachines(environment), oldSource = envManager.getSource(oldMachines[0]), @@ -109,7 +102,6 @@ describe('If recipe has location', () => { 'dev-machine': { 'servers': {}, 'volumes': {}, - 'installers': ['org.eclipse.che.ws-agent', 'org.eclipse.che.terminal', 'org.eclipse.che.ssh'], 'attributes': {'memoryLimitBytes': '2147483648'} } }, @@ -151,12 +143,6 @@ describe('If recipe has location', () => { expect(source).toEqual(null); }); - it('the machine should be a dev machine', () => { - let isDev = envManager.isDev(machines[0]); - - expect(isDev).toBe(true); - }); - }); }); diff --git a/dashboard/src/components/api/environment/docker-image-environment-manager.spec.ts b/dashboard/src/components/api/environment/docker-image-environment-manager.spec.ts index ed6508fb895..a3b7abcc2b7 100644 --- a/dashboard/src/components/api/environment/docker-image-environment-manager.spec.ts +++ b/dashboard/src/components/api/environment/docker-image-environment-manager.spec.ts @@ -40,7 +40,7 @@ describe('DockerImageEnvironmentManager', () => { 'volume1': { 'path': '/123' } - }, 'installers': ['ws-agent', 'org.eclipse.che.ws-agent'], 'attributes': {'memoryLimitBytes': '16642998272'} + }, 'attributes': {'memoryLimitBytes': '16642998272'} } }, 'recipe': {'content': 'codenvy/ubuntu_jdk8', 'type': 'dockerimage'} }; @@ -73,12 +73,6 @@ describe('DockerImageEnvironmentManager', () => { expect(memoryLimit.toString()).toEqual(expectedMemoryLimit.toString()); }); - it('the machine should be a dev machine', () => { - let isDev = envManager.isDev(machines[0]); - - expect(isDev).toBe(true); - }); - it('should update environment\'s recipe via machine\'s source', () => { let machines = envManager.getMachines(environment), newSource = 'eclipse/node'; diff --git a/dashboard/src/components/api/environment/kubernetes-environment-manager.spec.ts b/dashboard/src/components/api/environment/kubernetes-environment-manager.spec.ts index 89e99535867..2f74fe067bf 100644 --- a/dashboard/src/components/api/environment/kubernetes-environment-manager.spec.ts +++ b/dashboard/src/components/api/environment/kubernetes-environment-manager.spec.ts @@ -56,7 +56,7 @@ describe('KubernetesEnvironmentManager', () => { 'volume1': { 'path': '/123' } - }, 'installers': ['org.eclipse.che.ws-agent'], 'attributes': {'memoryLimitBytes': '16642998272'} + }, 'attributes': {'memoryLimitBytes': '16642998272'} } }, 'recipe': { 'contentType': 'application/x-yaml', @@ -92,12 +92,6 @@ describe('KubernetesEnvironmentManager', () => { expect(memoryLimit.toString()).toEqual(expectedMemoryLimit.toString()); }); - it(`the machine should be a dev machine`, () => { - let isDev = envManager.isDev(machines[0]); - - expect(isDev).toBe(true); - }); - it(`should update environment's recipe via machine's source`, () => { const machines = envManager.getMachines(environment); const newSource = 'eclipse/node'; @@ -142,7 +136,7 @@ describe('KubernetesEnvironmentManager', () => { 'volume1': { 'path': '/123' } - }, 'installers': ['org.eclipse.che.ws-agent'], 'attributes': {'memoryLimitBytes': '16642998272'} + }, 'attributes': {'memoryLimitBytes': '16642998272'} } }, 'recipe': { 'contentType': 'application/x-yaml', @@ -178,12 +172,6 @@ describe('KubernetesEnvironmentManager', () => { expect(memoryLimit.toString()).toEqual(expectedMemoryLimit.toString()); }); - it(`the machine should be a dev machine`, () => { - let isDev = envManager.isDev(machines[0]); - - expect(isDev).toBe(true); - }); - it(`should update environment's recipe via machine's source`, () => { const machines = envManager.getMachines(environment); const newSource = 'eclipse/node'; diff --git a/dashboard/src/components/api/workspace/che-workspace.factory.ts b/dashboard/src/components/api/workspace/che-workspace.factory.ts index c4b34dac6b2..f76f7a118cd 100644 --- a/dashboard/src/components/api/workspace/che-workspace.factory.ts +++ b/dashboard/src/components/api/workspace/che-workspace.factory.ts @@ -25,11 +25,6 @@ import {WorkspaceDataManager} from './workspace-data-manager'; const WS_AGENT_HTTP_LINK: string = 'wsagent/http'; const WS_AGENT_WS_LINK: string = 'wsagent/ws'; -interface IWorkspaceSettings { - supportedRecipeTypes: string; - cheWorkspacePluginRegistryUrl: string; -} - interface ICHELicenseResource extends ng.resource.IResourceClass { create: any; createWithNamespace: any; @@ -42,7 +37,7 @@ interface ICHELicenseResource extends ng.resource.IResourceClass { startWorkspaceWithNoEnvironment: any; startTemporaryWorkspace: any; addCommand: any; - getSettings: () => ng.resource.IResource; + getSettings: () => ng.resource.IResource; } export enum WorkspaceStatus { @@ -79,7 +74,7 @@ export class CheWorkspace { private remoteWorkspaceAPI: ICHELicenseResource; private lodash: any; private statusDefers: Object; - private workspaceSettings: any; + private workspaceSettings: che.IWorkspaceSettings; private jsonRpcApiLocation: string; private workspaceLoaderUrl: string; /** @@ -89,9 +84,9 @@ export class CheWorkspace { /** * Map with promises. */ - private workspacePromises: Map> = new Map(); + private workspacePromises: Map> = new Map(); /** - * + * */ private workspaceDataManager: WorkspaceDataManager; @@ -392,7 +387,7 @@ export class CheWorkspace { } const defer = this.$q.defer(); const promise: ng.IHttpPromise = this.$http.get('/api/workspace/' + workspaceKey); - this.workspacePromises.set(workspacePromisesKey, promise); + this.workspacePromises.set(workspacePromisesKey, defer.promise); promise.then((response: ng.IHttpPromiseCallbackArg) => { const workspace = response.data; @@ -461,8 +456,7 @@ export class CheWorkspace { 'recipe': null, 'machines': { 'dev-machine': { - 'attributes': {'memoryLimitBytes': ram}, - 'installers': ['org.eclipse.che.ws-agent', 'org.eclipse.che.exec', 'org.eclipse.che.terminal', 'org.eclipse.che.ssh'] + 'attributes': {'memoryLimitBytes': ram} } } }; @@ -494,8 +488,7 @@ export class CheWorkspace { devMachine = { 'name': 'ws-machine', 'attributes': {'memoryLimitBytes': ram}, - 'type': 'docker', - 'installers': ['org.eclipse.che.ws-agent', 'org.eclipse.che.exec', 'org.eclipse.che.terminal', 'org.eclipse.che.ssh'] + 'type': 'docker' }; defaultEnvironment.machines[devMachine.name] = devMachine; } else { @@ -583,8 +576,8 @@ export class CheWorkspace { /** * Notify user if workspace is ephemeral. - * - * @param workspaceId + * + * @param workspaceId */ notifyIfEphemeral(workspaceId: string): void { let workspace = this.workspacesById.get(workspaceId); @@ -762,7 +755,7 @@ export class CheWorkspace { */ fetchWorkspaceSettings(): ng.IPromise { const promise = this.remoteWorkspaceAPI.getSettings().$promise; - return promise.then((settings: IWorkspaceSettings) => { + return promise.then((settings: che.IWorkspaceSettings) => { this.workspaceSettings = settings; return this.workspaceSettings; }, (error: any) => { @@ -791,7 +784,7 @@ export class CheWorkspace { * * @returns {any} the system settings for workspaces */ - getWorkspaceSettings(): IWorkspaceSettings { + getWorkspaceSettings(): che.IWorkspaceSettings { return this.workspaceSettings; } diff --git a/dashboard/src/components/typings/che.d.ts b/dashboard/src/components/typings/che.d.ts index 76b778addaf..eb918f02518 100755 --- a/dashboard/src/components/typings/che.d.ts +++ b/dashboard/src/components/typings/che.d.ts @@ -301,6 +301,12 @@ declare namespace che { usedResources?: string; } + export interface IWorkspaceSettings { + supportedRecipeTypes: string; + cheWorkspacePluginRegistryUrl: string; + [propName: string]: string | boolean; + } + export interface IWorkspaceAttributes { created: number; updated?: number; From a5cbe26e67df2907de28f1d18081fb2b2cf2c8b1 Mon Sep 17 00:00:00 2001 From: Skorik Sergey Date: Fri, 10 May 2019 12:20:57 +0300 Subject: [PATCH 2/3] remove from CheSute.xml test suite all selenium tests that start/stop workspaces from Dashboard --- .../test/resources/suites/CheOneThreadTestsSuite.xml | 2 -- .../src/test/resources/suites/CheSuite.xml | 10 ---------- 2 files changed, 12 deletions(-) diff --git a/selenium/che-selenium-test/src/test/resources/suites/CheOneThreadTestsSuite.xml b/selenium/che-selenium-test/src/test/resources/suites/CheOneThreadTestsSuite.xml index 4cd432932bd..970b9cd5d16 100644 --- a/selenium/che-selenium-test/src/test/resources/suites/CheOneThreadTestsSuite.xml +++ b/selenium/che-selenium-test/src/test/resources/suites/CheOneThreadTestsSuite.xml @@ -31,7 +31,6 @@ - @@ -40,7 +39,6 @@ - diff --git a/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml b/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml index 65e5401f75f..8df0672f7fe 100644 --- a/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml +++ b/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml @@ -35,21 +35,11 @@ - - - - - - - - - - From 4a9ec18c748d06794a2c268d29953d1c78fa94bd Mon Sep 17 00:00:00 2001 From: Skorik Sergey Date: Fri, 10 May 2019 16:37:03 +0300 Subject: [PATCH 3/3] remove ProjectStateAfterRenameWorkspaceTest test from CheSuite.xml test suite --- .../che-selenium-test/src/test/resources/suites/CheSuite.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml b/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml index 8df0672f7fe..ed4b3fc810c 100644 --- a/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml +++ b/selenium/che-selenium-test/src/test/resources/suites/CheSuite.xml @@ -239,7 +239,6 @@ -