From 33806c68ac0e2e868e6d2ea2e01eb79ba4ebfcec Mon Sep 17 00:00:00 2001 From: Oleksii Kurinnyi Date: Mon, 9 Sep 2019 17:16:11 +0300 Subject: [PATCH] restore dialogs controllers initialization --- .../add-user/add-user.controller.ts | 14 +++++++------- .../edit-registry/edit-registry.controller.ts | 7 +++++-- .../action/factory-action-edit.controller.ts | 7 +++++-- .../command/factory-command-edit.controller.ts | 5 ++++- .../organization-member-dialog.controller.ts | 15 +++++++-------- ...ganization-select-members-dialog.controller.ts | 15 +++++++-------- .../member-dialog/member-dialog.controller.ts | 7 +++++-- .../after-creation-dialog.controller.ts | 5 ++++- .../no-github-oauth-dialog.controller.ts | 5 ++++- .../add-developers/add-developers.controller.ts | 5 ++++- .../add-members/add-members.controller.ts | 12 +++++++----- .../edit-variable-dialog.controller.ts | 7 +++++-- .../edit-server-dialog.controller.ts | 8 ++++++-- .../delete-dev-machine-dialog.controller.ts | 8 +++++--- .../edit-machine-name-dialog.controller.ts | 7 +++++-- .../dialog/export-workspace-dialog.controller.ts | 11 ++++++----- .../edit-command-dialog.controller.ts | 7 +++++-- .../edit-variable-dialog.controller.ts | 7 +++++-- .../edit-server-dialog.controller.ts | 7 +++++-- .../edit-volume-dialog.controller.ts | 7 +++++-- .../edit-machine-dialog.controller.ts | 15 ++++++++------- .../pageobject/dashboard/ProjectSourcePage.java | 3 +-- .../dashboard/organization/AddMember.java | 3 +-- .../organization/OrganizationListPage.java | 4 ++-- 24 files changed, 118 insertions(+), 73 deletions(-) diff --git a/dashboard/src/app/admin/user-management/add-user/add-user.controller.ts b/dashboard/src/app/admin/user-management/add-user/add-user.controller.ts index e269dbacec69..cb463aac267b 100644 --- a/dashboard/src/app/admin/user-management/add-user/add-user.controller.ts +++ b/dashboard/src/app/admin/user-management/add-user/add-user.controller.ts @@ -23,7 +23,6 @@ export class AdminsAddUserController { private $mdDialog: ng.material.IDialogService; private lodash: any; private cheNotification: any; - private resourcesService: che.service.IResourcesService; private cheUser: any; private callbackController: AdminsUserManagementCtrl; private newUserName: string; @@ -51,26 +50,27 @@ export class AdminsAddUserController { this.cheNotification = cheNotification; this.cheOrganization = cheOrganization; this.chePermissions = chePermissions; - this.resourcesService = resourcesService; + this.organizationRoles = resourcesService.getOrganizationRoles(); this.organizations = []; - } - - $onInit(): void { - this.organizationRoles = this.resourcesService.getOrganizationRoles(); this.cheOrganization.fetchOrganizations().then(() => { let organizations = this.cheOrganization.getOrganizations(); let rootOrganizations = organizations.filter((organization: any) => { return !organization.parent; }); - this.organizations = this.lodash.pluck(rootOrganizations, 'name'); + this.organizations = lodash.pluck(rootOrganizations, 'name'); if (this.organizations.length > 0) { this.organization = this.organizations[0]; } }); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Callback of the cancel button of the dialog. */ diff --git a/dashboard/src/app/administration/docker-registry/docker-registry-list/edit-registry/edit-registry.controller.ts b/dashboard/src/app/administration/docker-registry/docker-registry-list/edit-registry/edit-registry.controller.ts index f6d7105fc67a..b8978a626834 100644 --- a/dashboard/src/app/administration/docker-registry/docker-registry-list/edit-registry/edit-registry.controller.ts +++ b/dashboard/src/app/administration/docker-registry/docker-registry-list/edit-registry/edit-registry.controller.ts @@ -37,14 +37,17 @@ export class EditRegistryController { this.$mdDialog = $mdDialog; this.chePreferences = chePreferences; this.cheNotification = cheNotification; - } - $onInit(): void { if (this.registry) { this.originRegistryUrl = angular.copy(this.registry.url); } } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * It will hide the dialog box. */ diff --git a/dashboard/src/app/factories/create-factory/action/factory-action-edit.controller.ts b/dashboard/src/app/factories/create-factory/action/factory-action-edit.controller.ts index a4a789a2de5d..ef7884ef90cf 100644 --- a/dashboard/src/app/factories/create-factory/action/factory-action-edit.controller.ts +++ b/dashboard/src/app/factories/create-factory/action/factory-action-edit.controller.ts @@ -35,13 +35,16 @@ export class FactoryActionDialogEditController { */ constructor($mdDialog: ng.material.IDialogService) { this.$mdDialog = $mdDialog; - } - $onInit(): void { this.isName = angular.isDefined(this.selectedValue.name); this.isFile = angular.isDefined(this.selectedValue.file); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Callback of the edit button of the dialog. */ diff --git a/dashboard/src/app/factories/create-factory/command/factory-command-edit.controller.ts b/dashboard/src/app/factories/create-factory/command/factory-command-edit.controller.ts index 442439fb2436..acd2ca3843f6 100644 --- a/dashboard/src/app/factories/create-factory/command/factory-command-edit.controller.ts +++ b/dashboard/src/app/factories/create-factory/command/factory-command-edit.controller.ts @@ -33,7 +33,10 @@ export class FactoryCommandDialogEditController { this.$mdDialog = $mdDialog; } - $onInit(): void { } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } /** * Callback of the edit button of the dialog. diff --git a/dashboard/src/app/organizations/organization-details/organization-member-dialog/organization-member-dialog.controller.ts b/dashboard/src/app/organizations/organization-details/organization-member-dialog/organization-member-dialog.controller.ts index fdf955ea1dc7..f38e4adbdf1f 100644 --- a/dashboard/src/app/organizations/organization-details/organization-member-dialog/organization-member-dialog.controller.ts +++ b/dashboard/src/app/organizations/organization-details/organization-member-dialog/organization-member-dialog.controller.ts @@ -41,10 +41,6 @@ export class OrganizationMemberDialogController { * Lodash library. */ private lodash: any; - /** - * Resources service. - */ - private resourcesService: che.service.IResourcesService; /** * Processing state of adding member. */ @@ -115,12 +111,10 @@ export class OrganizationMemberDialogController { this.cheOrganization = cheOrganization; this.$q = $q; this.lodash = lodash; - this.resourcesService = resourcesService; + this.organizationRoles = resourcesService.getOrganizationRoles(); this.isProcessing = false; - this.organizationRoles = this.resourcesService.getOrganizationRoles(); - this.emails = []; this.members.forEach((member: che.IMember) => { this.emails.push(member.email); @@ -139,7 +133,7 @@ export class OrganizationMemberDialogController { this.title = 'Edit ' + this.member.name + ' roles'; this.buttonTitle = 'Save'; this.email = this.member.email; - let roles = this.cheOrganization.getRolesFromActions(this.member.permissions.actions); + let roles = cheOrganization.getRolesFromActions(this.member.permissions.actions); this.newRole = (roles && roles.length > 0) ? roles[0].name : this.organizationRoles.MEMBER.name; } else { this.email = ''; @@ -149,6 +143,11 @@ export class OrganizationMemberDialogController { } } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Returns title of specified role. * diff --git a/dashboard/src/app/organizations/organization-details/organization-select-members-dialog/organization-select-members-dialog.controller.ts b/dashboard/src/app/organizations/organization-details/organization-select-members-dialog/organization-select-members-dialog.controller.ts index 586bd3f1dda5..afaed4966bbd 100644 --- a/dashboard/src/app/organizations/organization-details/organization-select-members-dialog/organization-select-members-dialog.controller.ts +++ b/dashboard/src/app/organizations/organization-details/organization-select-members-dialog/organization-select-members-dialog.controller.ts @@ -45,10 +45,6 @@ export class OrganizationSelectMembersDialogController { * Lodash library. */ private lodash: any; - /** - * Resources service; - */ - private resourcesService: che.service.IResourcesService; /** * Callback handler (is set from outside). */ @@ -103,7 +99,7 @@ export class OrganizationSelectMembersDialogController { this.lodash = lodash; this.cheProfile = cheProfile; this.cheUser = cheUser; - this.resourcesService = resourcesService; + this.organizationRoles = resourcesService.getOrganizationRoles(); this.isLoading = false; @@ -111,14 +107,17 @@ export class OrganizationSelectMembersDialogController { this.isBulkChecked = false; this.isNoSelected = true; this.isAllSelected = false; - } - $onInit(): void { - this.organizationRoles = this.resourcesService.getOrganizationRoles(); this.user = this.cheUser.getUser(); + this.formUsersAvailableList(); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Builds list of users that are available to be added. */ diff --git a/dashboard/src/app/teams/member-dialog/member-dialog.controller.ts b/dashboard/src/app/teams/member-dialog/member-dialog.controller.ts index 6c92645fb332..2020f77a631c 100644 --- a/dashboard/src/app/teams/member-dialog/member-dialog.controller.ts +++ b/dashboard/src/app/teams/member-dialog/member-dialog.controller.ts @@ -103,9 +103,7 @@ export class MemberDialogController { this.lodash = lodash; this.isProcessing = false; - } - $onInit(): void { this.emails = []; this.members.forEach((member: any) => { this.emails.push(member.email); @@ -134,6 +132,11 @@ export class MemberDialogController { } } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Hides the add member dialog. */ diff --git a/dashboard/src/app/workspaces/create-workspace/after-creation-dialog/after-creation-dialog.controller.ts b/dashboard/src/app/workspaces/create-workspace/after-creation-dialog/after-creation-dialog.controller.ts index 684075a6ee88..04f12395b2bd 100644 --- a/dashboard/src/app/workspaces/create-workspace/after-creation-dialog/after-creation-dialog.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/after-creation-dialog/after-creation-dialog.controller.ts @@ -27,7 +27,10 @@ export class AfterCreationDialogController { this.$mdDialog = $mdDialog; } - $onInit(): void { } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } /** * It will hide the dialog box. diff --git a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-github-project/oauth-dialog/no-github-oauth-dialog.controller.ts b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-github-project/oauth-dialog/no-github-oauth-dialog.controller.ts index b3ae088f73f4..73262c85a7aa 100644 --- a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-github-project/oauth-dialog/no-github-oauth-dialog.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-github-project/oauth-dialog/no-github-oauth-dialog.controller.ts @@ -38,7 +38,10 @@ export class NoGithubOauthDialogController { this.message = ($rootScope as any).branding.oauthDocs; } - $onInit(): void { } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } /** * It will hide the dialog box. diff --git a/dashboard/src/app/workspaces/share-workspace/add-developers/add-developers.controller.ts b/dashboard/src/app/workspaces/share-workspace/add-developers/add-developers.controller.ts index 92c9de5f76f7..d6326acb0377 100644 --- a/dashboard/src/app/workspaces/share-workspace/add-developers/add-developers.controller.ts +++ b/dashboard/src/app/workspaces/share-workspace/add-developers/add-developers.controller.ts @@ -51,7 +51,10 @@ export class AddDeveloperController { this.$mdDialog = $mdDialog; } - $onInit(): void { } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } /** * Callback of the cancel button of the dialog. diff --git a/dashboard/src/app/workspaces/share-workspace/add-members/add-members.controller.ts b/dashboard/src/app/workspaces/share-workspace/add-members/add-members.controller.ts index c70bdca78cc9..a2cf149d1f4d 100644 --- a/dashboard/src/app/workspaces/share-workspace/add-members/add-members.controller.ts +++ b/dashboard/src/app/workspaces/share-workspace/add-members/add-members.controller.ts @@ -84,11 +84,16 @@ export class AddMemberController { this.chePermissions = chePermissions; this.cheProfile = cheProfile; + this.team = cheTeam.getTeamByName(this.namespace); this.membersSelectedStatus = {}; this.isBulkChecked = false; this.isNoSelected = true; this.isAllSelected = true; + if (this.team) { + this.fetchTeamMembers(); + } + const helperId = 'add-members'; this.cheListHelper = cheListHelperFactory.getHelper(helperId); $scope.$on('$destroy', () => { @@ -97,11 +102,8 @@ export class AddMemberController { } $onInit(): void { - this.team = this.cheTeam.getTeamByName(this.namespace); - - if (this.team) { - this.fetchTeamMembers(); - } + // this method won't be called here + // place all initialization code in constructor } fetchTeamMembers(): void { diff --git a/dashboard/src/app/workspaces/workspace-details/environments/list-env-variables/edit-variable-dialog/edit-variable-dialog.controller.ts b/dashboard/src/app/workspaces/workspace-details/environments/list-env-variables/edit-variable-dialog/edit-variable-dialog.controller.ts index 3ed524c7df5e..6191e6c11f13 100644 --- a/dashboard/src/app/workspaces/workspace-details/environments/list-env-variables/edit-variable-dialog/edit-variable-dialog.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/environments/list-env-variables/edit-variable-dialog/edit-variable-dialog.controller.ts @@ -40,9 +40,7 @@ export class EditVariableDialogController { */ constructor($mdDialog: ng.material.IDialogService) { this.$mdDialog = $mdDialog; - } - $onInit(): void { // build list of used names let envVariablesCopy = angular.copy(this.envVariables); if (this.toEdit && envVariablesCopy[this.toEdit]) { @@ -59,6 +57,11 @@ export class EditVariableDialogController { } } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Check if name is unique. * diff --git a/dashboard/src/app/workspaces/workspace-details/environments/list-servers/edit-server-dialog/edit-server-dialog.controller.ts b/dashboard/src/app/workspaces/workspace-details/environments/list-servers/edit-server-dialog/edit-server-dialog.controller.ts index 4a1123d710e1..e98ec2751bdf 100644 --- a/dashboard/src/app/workspaces/workspace-details/environments/list-servers/edit-server-dialog/edit-server-dialog.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/environments/list-servers/edit-server-dialog/edit-server-dialog.controller.ts @@ -51,9 +51,7 @@ export class EditServerDialogController { lodash: any) { this.$mdDialog = $mdDialog; this.lodash = lodash; - } - $onInit(): void { // get used ports and references let serversCopy = angular.copy(this.servers); if (this.toEdit && serversCopy[this.toEdit]) { @@ -75,6 +73,12 @@ export class EditServerDialogController { this.port = this.getLowestFreePort(); this.popupTitle = 'Add a new server'; } + + } + + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor } /** diff --git a/dashboard/src/app/workspaces/workspace-details/environments/machine-config/delete-dev-machine-dialog/delete-dev-machine-dialog.controller.ts b/dashboard/src/app/workspaces/workspace-details/environments/machine-config/delete-dev-machine-dialog/delete-dev-machine-dialog.controller.ts index 318d6863f508..abae921d3cba 100644 --- a/dashboard/src/app/workspaces/workspace-details/environments/machine-config/delete-dev-machine-dialog/delete-dev-machine-dialog.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/environments/machine-config/delete-dev-machine-dialog/delete-dev-machine-dialog.controller.ts @@ -57,9 +57,6 @@ export class DeleteDevMachineDialogController { */ constructor($mdDialog: ng.material.IDialogService) { this.$mdDialog = $mdDialog; - } - - $onInit(): void { if (this.machinesList.length === 1) { this.message = 'You can\'t delete it without having other machines configured.'; } else { @@ -67,6 +64,11 @@ export class DeleteDevMachineDialogController { } } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Closes this dialog. */ diff --git a/dashboard/src/app/workspaces/workspace-details/environments/machine-config/edit-machine-name-dialog/edit-machine-name-dialog.controller.ts b/dashboard/src/app/workspaces/workspace-details/environments/machine-config/edit-machine-name-dialog/edit-machine-name-dialog.controller.ts index e2e3e776ce36..8b007a6a41ef 100644 --- a/dashboard/src/app/workspaces/workspace-details/environments/machine-config/edit-machine-name-dialog/edit-machine-name-dialog.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/environments/machine-config/edit-machine-name-dialog/edit-machine-name-dialog.controller.ts @@ -34,13 +34,16 @@ export class EditMachineNameDialogController { */ constructor($mdDialog: ng.material.IDialogService) { this.$mdDialog = $mdDialog; - } - $onInit(): void { this.origName = this.name; this.machineNamesLowercase = this.machineNames.map((name: string) => name.toLowerCase()); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + isUnique(name: string): boolean { return this.machineNamesLowercase.indexOf(name.toLowerCase()) < 0; } diff --git a/dashboard/src/app/workspaces/workspace-details/export-workspace/dialog/export-workspace-dialog.controller.ts b/dashboard/src/app/workspaces/workspace-details/export-workspace/dialog/export-workspace-dialog.controller.ts index 40f9a2b492d8..575967712a3e 100644 --- a/dashboard/src/app/workspaces/workspace-details/export-workspace/dialog/export-workspace-dialog.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/export-workspace/dialog/export-workspace-dialog.controller.ts @@ -31,7 +31,6 @@ export class ExportWorkspaceDialogController { private cheRemote: CheRemote; private $window: ng.IWindowService; private lodash: any; - private $scope: ng.IScope; private editorOptions: any; private destination: string; @@ -65,7 +64,6 @@ export class ExportWorkspaceDialogController { this.$mdDialog = $mdDialog; this.$log = $log; this.$window = $window; - this.$scope = $scope; this.editorOptions = { lineWrapping : true, @@ -78,13 +76,16 @@ export class ExportWorkspaceDialogController { this.privateCloudLogin = ''; this.privateCloudPassword = ''; this.importInProgress = false; - } - $onInit(): void { this.copyOfConfig = this.getCopyOfConfig(); this.exportConfigContent = this.$filter('json')(angular.fromJson(this.copyOfConfig), 2); - (this.$scope as any).selectedIndex = this.destination === 'file' ? 0 : 1; + ($scope as any).selectedIndex = this.destination === 'file' ? 0 : 1; + } + + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor } /** diff --git a/dashboard/src/app/workspaces/workspace-details/list-commands/edit-command-dialog/edit-command-dialog.controller.ts b/dashboard/src/app/workspaces/workspace-details/list-commands/edit-command-dialog/edit-command-dialog.controller.ts index 225572195dbc..b27bbe6d6f91 100644 --- a/dashboard/src/app/workspaces/workspace-details/list-commands/edit-command-dialog/edit-command-dialog.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/list-commands/edit-command-dialog/edit-command-dialog.controller.ts @@ -36,9 +36,7 @@ export class EditCommandDialogController { */ constructor($mdDialog: ng.material.IDialogService) { this.$mdDialog = $mdDialog; - } - $onInit(): void { let isAddMode: boolean = (this.index === -1); let command: any = isAddMode ? {name: '', commandLine: ''} : this.commands[this.index]; this.name = command.name; @@ -55,6 +53,11 @@ export class EditCommandDialogController { }); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Check if the name is unique. * @param name diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-machine-env-variables/edit-variable-dialog/edit-variable-dialog.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-machine-env-variables/edit-variable-dialog/edit-variable-dialog.controller.ts index 41f1ab84a470..93c82851f304 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-machine-env-variables/edit-variable-dialog/edit-variable-dialog.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-machine-env-variables/edit-variable-dialog/edit-variable-dialog.controller.ts @@ -37,9 +37,7 @@ export class EditEnvVariableDialogController { */ constructor($mdDialog: ng.material.IDialogService) { this.$mdDialog = $mdDialog; - } - $onInit(): void { // build list of used names this.usedNames = angular.isObject(this.envVariables) ? Object.keys(this.envVariables) : []; @@ -52,6 +50,11 @@ export class EditEnvVariableDialogController { } } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Check if name is unique. * @param {string} name environment variable name to test diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-machine-servers/edit-machine-server-dialog/edit-server-dialog.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-machine-servers/edit-machine-server-dialog/edit-server-dialog.controller.ts index 2ec1c27cc476..f46afa17dba2 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-machine-servers/edit-machine-server-dialog/edit-server-dialog.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-machine-servers/edit-machine-server-dialog/edit-server-dialog.controller.ts @@ -45,9 +45,7 @@ export class EditMachineServerDialogController { */ constructor($mdDialog: ng.material.IDialogService) { this.$mdDialog = $mdDialog; - } - $onInit(): void { // get used references and ports this.usedReferences = Object.keys(this.servers); this.usedPorts = []; @@ -73,6 +71,11 @@ export class EditMachineServerDialogController { } } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Check if port is unique. * diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-machine-volumes/edit-volume-dialog/edit-volume-dialog.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-machine-volumes/edit-volume-dialog/edit-volume-dialog.controller.ts index 0f9fb12d253d..e9003b780be3 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-machine-volumes/edit-volume-dialog/edit-volume-dialog.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-machine-volumes/edit-volume-dialog/edit-volume-dialog.controller.ts @@ -38,9 +38,7 @@ export class EditMachineVolumeDialogController { */ constructor($mdDialog: ng.material.IDialogService) { this.$mdDialog = $mdDialog; - } - $onInit(): void { // build list of used names this.usedNames = angular.isObject(this.machineVolumes) ? Object.keys(this.machineVolumes) : []; @@ -53,6 +51,11 @@ export class EditMachineVolumeDialogController { } } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Check if name is unique. * @param {string} name volume name to test diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-machines/edit-machine-dialog/edit-machine-dialog.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-machines/edit-machine-dialog/edit-machine-dialog.controller.ts index 300614863431..244a40398416 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-machines/edit-machine-dialog/edit-machine-dialog.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-machines/edit-machine-dialog/edit-machine-dialog.controller.ts @@ -66,9 +66,7 @@ export class EditMachineDialogController { this.$mdDialog = $mdDialog; this.cheEnvironmentRegistry = cheEnvironmentRegistry; this.cheRecipeService = cheRecipeService; - } - $onInit(): void { this.isAdd = angular.isUndefined(this.machineName); if (!this.environment) { return; @@ -82,7 +80,7 @@ export class EditMachineDialogController { return this.isAdd || machineName !== this.machineName; }); - this.environmentManager = this.cheEnvironmentRegistry.getEnvironmentManager(this.cheRecipeService.getRecipeType(this.currentStateEnvironment.recipe)); + this.environmentManager = this.cheEnvironmentRegistry.getEnvironmentManager(cheRecipeService.getRecipeType(this.currentStateEnvironment.recipe)); if (!this.environmentManager) { return; } @@ -90,7 +88,7 @@ export class EditMachineDialogController { this.editorMode = this.environmentManager.editorMode; if (this.isAdd) { - if (!this.cheRecipeService.isScalable(this.currentStateEnvironment.recipe)) { + if (!cheRecipeService.isScalable(this.currentStateEnvironment.recipe)) { // we can add a new machine in case with scalable type of recipes only return; } @@ -111,9 +109,12 @@ export class EditMachineDialogController { // update memory limit this.environmentManager.setMemoryLimit(this.machine, this.machineRAM); this.originMachine = angular.copy(this.machine); - if (!this.updateMachineRAM()) { - this.stringifyMachineRecipe(); - } + this.updateMachineRAM(); + } + + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor } /** diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/ProjectSourcePage.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/ProjectSourcePage.java index 4a4d0d9b224f..829cb4000dc5 100644 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/ProjectSourcePage.java +++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/ProjectSourcePage.java @@ -80,8 +80,7 @@ private interface Locators { String PROJECT_DESCRIPTION = "//input[@name='projectDescription']"; String CONNECT_GITHUB_ACCOUNT_BUTTON = "//*[@id='import-github-project-button']/*[contains(@class, 'che-button')]"; - String GITHUB_PROJECTS_LIST = - "//md-list[contains(@class,'import-github-project-repositories-list')]"; + String GITHUB_PROJECTS_LIST = "//*[contains(@class,'import-github-project-repositories-list')]"; String GITHUB_PROJECT_CHECKBOX = "//md-checkbox[@aria-label='GitHub repository %s']"; String LOGIN_FIELD = "login_field"; diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/organization/AddMember.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/organization/AddMember.java index 3245c8eafd56..40bd5ead5b8c 100644 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/organization/AddMember.java +++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/organization/AddMember.java @@ -43,8 +43,7 @@ private interface Locators { String ADD_MEMBER_WIDGET_XPATH = ADD_MEMBER_TITLE_XPATH + "/ancestor::che-popup"; String CLOSE_WIDGET_ICON_XPATH = "//div[@ng-click = 'onClose()']"; String MEMBERS_EMAIL_INPUT_XPATH = "//input[@name = 'email']"; - String MEMBER_RADIO_BUTTON_XPATH = - "//md-radio-button//span[text()='Member' or text()='Team Developer']/ancestor::md-radio-button"; + String MEMBER_RADIO_BUTTON_XPATH = "//md-radio-button[@value='MEMBER' or @value='TEAM_MEMBER']"; String ADMIN_RADIO_BUTTON_XPATH = "//md-radio-button[@value='ADMIN' or @value='TEAM_ADMIN']"; String ADD_MEMBER_BUTTON_XPATH = "//che-button-primary[@che-button-title = 'Add']//button"; String CANCEL_BUTTON_XPATH = "//che-button-cancel-flat//button"; diff --git a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/organization/OrganizationListPage.java b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/organization/OrganizationListPage.java index a5567e1ab5bd..ee7044c88c38 100644 --- a/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/organization/OrganizationListPage.java +++ b/selenium/che-selenium-test/src/main/java/org/eclipse/che/selenium/pageobject/dashboard/organization/OrganizationListPage.java @@ -79,9 +79,9 @@ public int getIndex() { private interface Locators { String TOOLBAR_ID = "Organizations"; String ADD_ORGANIZATION_BUTTON_XPATH = - "//*[@id='add-item-button']/*[contains(@class, 'che-button')]"; + "//*[@id='add-item-button']/*[text()='Add Organization']"; String ADD_SUB_ORGANIZATION_BUTTON_XPATH = - "//che-button-primary//span[text()='Add Sub-Organization']"; + "//*[@id='add-item-button']/*[text()='Add Sub-Organization']"; String DELETE_ORGANIZATION_BUTTON_XPATH = "//*[@id='delete-item-button']/*[contains(@class, 'che-button')]"; String ORGANIZATION_LIST_XPATH = "//list-organizations//md-list";