From 757a82f38a2c398199b57c3277f94b51f7522922 Mon Sep 17 00:00:00 2001 From: Oleksii Kurinnyi Date: Tue, 20 Aug 2019 18:00:23 +0300 Subject: [PATCH 1/5] upgrade dependencies lodash to 4.17.15 angularJS to v1.6.10 Signed-off-by: Oleksii Kurinnyi --- dashboard/package.json | 22 ++--- .../add-user/add-user.controller.ts | 9 +- .../user-details/user-details.controller.ts | 5 + .../user-management.controller.ts | 5 + .../docker-registry-list.controller.ts | 2 + .../edit-registry/edit-registry.controller.ts | 2 + .../last-workspaces.controller.ts | 4 +- .../demo-components.controller.ts | 16 ++-- .../action/factory-action-box.controller.ts | 2 + .../action/factory-action-edit.controller.ts | 2 + .../factory-command-edit.controller.ts | 2 + .../command/factory-command.controller.ts | 2 + .../factory-from-file.controller.ts | 2 + .../create-factory.controller.ts | 5 + .../git/create-factory-git.controller.ts | 2 +- .../factory-from-template.controller.ts | 2 + .../factory-from-workpsace.controller.ts | 16 ++-- .../factory-details.controller.ts | 5 + .../factory-information.controller.ts | 9 +- .../last-factories.controller.ts | 8 +- .../factory-item/factory-item.controller.ts | 2 + .../list-factories.controller.ts | 5 + .../load-factory/load-factory.controller.ts | 5 + .../ide/ide-iframe/ide-iframe.directive.ts | 2 + dashboard/src/app/ide/ide.controller.ts | 4 + dashboard/src/app/index.module.ts | 4 + .../navbar-dropdown-menu.controller.ts | 2 + dashboard/src/app/navbar/navbar.controller.ts | 14 +-- .../navbar-notification.controller.ts | 2 + .../recent-workspaces.controller.ts | 21 +++-- .../create-organizations.controller.ts | 5 + .../list-organizations.controller.ts | 5 + .../organizations-item.controller.ts | 17 +++- .../organization-details.controller.ts | 5 + ...-organization-invite-members.controller.ts | 17 +++- .../organization-member-dialog.controller.ts | 12 ++- .../list-organization-members.controller.ts | 12 ++- ...zation-select-members-dialog.controller.ts | 10 +- ...list-organization-workspaces.controller.ts | 2 + .../organizations/organizations.controller.ts | 5 + .../src/app/profile/profile.controller.ts | 5 + .../list-stacks/list-stacks.controller.ts | 5 + .../stacks/stack-details/stack.controller.ts | 6 ++ .../create-team/create-team.controller.ts | 5 + .../invite-members/list-members.controller.ts | 2 + .../app/teams/list/list-teams.controller.ts | 17 ++-- .../list/team-item/team-item.controller.ts | 2 + .../member-dialog/member-dialog.controller.ts | 2 + .../navbar-teams/navbar-teams.controller.ts | 7 +- .../team-details/team-details.controller.ts | 5 + .../list-team-members.controller.ts | 11 ++- .../member-item/member-item.controller.ts | 2 + .../list-team-owners.controller.ts | 10 +- .../list-team-workspaces.controller.ts | 10 +- .../after-creation-dialog.controller.ts | 2 + .../create-workspace.controller.ts | 5 + .../devfile-selector.controller.ts | 5 +- .../namespace-selector.controller.ts | 2 + .../add-import-project.controller.ts | 8 +- .../import-blank-project.controller.ts | 2 + .../import-git-project.controller.ts | 2 + .../import-github-project.controller.ts | 35 +++---- .../no-github-oauth-dialog.controller.ts | 2 + .../import-zip-project.controller.ts | 2 + .../template-selector.controller.ts | 6 +- .../edit-project/edit-project.controller.ts | 5 +- .../project-metadata.controller.ts | 2 + .../project-source-selector.controller.ts | 7 +- .../ram-settings-machine-item.controller.ts | 3 +- .../ram-settings/ram-settings.controller.ts | 2 + .../list-workspaces.controller.ts | 4 + .../workspace-item.controller.ts | 9 +- .../workspace-status.controller.ts | 2 + .../add-developers.controller.ts | 2 + .../add-members/add-members.controller.ts | 13 ++- .../share-workspace.controller.ts | 20 ++-- .../user-item/user-item.controller.ts | 2 + .../workspace-config-import.controller.ts | 2 + .../workspace-devfile-editor.controller.ts | 3 +- .../environments/environments.controller.ts | 2 + .../list-agents/list-agents.controller.ts | 2 + .../edit-variable-dialog.controller.ts | 2 + .../list-env-variables.controller.ts | 2 + .../edit-server-dialog.controller.ts | 3 +- .../list-servers/list-servers.controller.ts | 2 + .../delete-dev-machine-dialog.controller.ts | 3 + .../edit-machine-name-dialog.controller.ts | 2 + .../machine-config.controller.ts | 2 + .../export-workspace-dialog.controller.ts | 6 +- .../export-workspace.controller.ts | 3 +- .../edit-command-dialog.controller.ts | 2 + .../list-commands/list-commands.controller.ts | 2 + .../machine-selector.controller.ts | 7 +- .../warnings/workspace-warnings.controller.ts | 3 + .../workspace-details.controller.ts | 5 + .../workspace-editors.controller.ts | 2 + .../edit-variable-dialog.controller.ts | 2 + .../env-variables.controller.ts | 5 +- .../edit-server-dialog.controller.ts | 2 + .../machine-servers.controller.ts | 5 +- .../edit-volume-dialog.controller.ts | 2 + .../machine-volumes.controller.ts | 2 + .../edit-machine-dialog.controller.ts | 6 +- .../workspace-machines.controller.ts | 5 +- .../workspace-details-overview.controller.ts | 13 ++- .../workspace-details-overview.styl | 3 +- .../workspace-plugins.controller.ts | 6 +- .../add-project-popover.controller.ts | 2 + .../project-item/project-item.controller.ts | 3 + .../workspace-details-projects.controller.ts | 15 ++- .../workspace-details-ssh.controller.ts | 48 +++++----- ...kspace-ram-allocation-slider.controller.ts | 2 + .../che-confirm-dialog.controller.ts | 2 + .../dropzone/che-dropzone.controller.ts | 2 + .../widget/editor/che-editor.controller.ts | 21 +++-- .../che-filter-selector.controller.ts | 1 + .../widget/footer/che-footer.controller.ts | 2 + .../learn-more/che-learn-more.controller.ts | 20 ++-- .../widget/panel/che-panel.controller.ts | 2 + .../selecter/che-selecter.controller.ts | 2 + .../toggle-button/che-toggle.controller.ts | 2 + dashboard/yarn.lock | 93 ++++++++++--------- workspace-loader/package.json | 2 +- workspace-loader/yarn.lock | 8 +- 124 files changed, 607 insertions(+), 230 deletions(-) diff --git a/dashboard/package.json b/dashboard/package.json index 1774d7a7a15..4518d46a378 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -8,7 +8,7 @@ "license": "EPL-1.0", "devDependencies": { "angular-bootstrap": "^0.12.2", - "angular-mocks": "1.4.8", + "angular-mocks": "1.6.10", "awesome-typescript-loader": "^1.1.1", "babel-core": "^6.4.5", "babel-loader": "^6.2.1", @@ -62,7 +62,7 @@ "karma-ng-html2js-preprocessor": "~0.1.2", "karma-phantomjs-launcher": "~1.0.4", "karma-webpack": "^2.0.9", - "lodash": "4.17.11", + "lodash": "4.17.15", "merge-stream": "^1.0.1", "minimist": "^1.2.0", "ng-annotate-loader": "^0.6.1", @@ -96,20 +96,20 @@ "test": "gulp test" }, "dependencies": { - "angular": "1.4.8", - "angular-animate": "1.4.8", - "angular-aria": "1.4.8", - "angular-cookies": "1.4.8", + "angular": "1.6.10", + "angular-animate": "1.6.10", + "angular-aria": "1.6.10", + "angular-cookies": "1.6.10", "angular-file-upload": "2.0.0", "angular-filter": "0.5.4", "angular-gravatar": "0.2.4", "angular-material": "1.0.1", - "angular-messages": "1.4.8", + "angular-messages": "1.6.10", "angular-moment": "0.9.0", - "angular-resource": "1.4.8", - "angular-route": "1.4.8", - "angular-sanitize": "1.4.8", - "angular-touch": "1.4.8", + "angular-resource": "1.6.10", + "angular-route": "1.6.10", + "angular-sanitize": "1.6.10", + "angular-touch": "1.6.10", "angular-ui-bootstrap": "1.1.2", "angular-uuid4": "0.3.1", "angular-websocket": "1.0.9", 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 b769aa6bc00..e269dbacec6 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,6 +23,7 @@ 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; @@ -50,16 +51,20 @@ export class AdminsAddUserController { this.cheNotification = cheNotification; this.cheOrganization = cheOrganization; this.chePermissions = chePermissions; - this.organizationRoles = resourcesService.getOrganizationRoles(); + this.resourcesService = resourcesService; 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 = lodash.pluck(rootOrganizations, 'name'); + this.organizations = this.lodash.pluck(rootOrganizations, 'name'); if (this.organizations.length > 0) { this.organization = this.organizations[0]; } diff --git a/dashboard/src/app/admin/user-management/user-details/user-details.controller.ts b/dashboard/src/app/admin/user-management/user-details/user-details.controller.ts index b4bac785eb6..64fda2aaf10 100644 --- a/dashboard/src/app/admin/user-management/user-details/user-details.controller.ts +++ b/dashboard/src/app/admin/user-management/user-details/user-details.controller.ts @@ -129,6 +129,11 @@ export class AdminUserDetailsController { this.updateData(); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Update user's data. */ diff --git a/dashboard/src/app/admin/user-management/user-management.controller.ts b/dashboard/src/app/admin/user-management/user-management.controller.ts index 96d9d462765..7e890d7e83f 100644 --- a/dashboard/src/app/admin/user-management/user-management.controller.ts +++ b/dashboard/src/app/admin/user-management/user-management.controller.ts @@ -100,6 +100,11 @@ export class AdminsUserManagementCtrl { this.pagesInfo = this.cheUser.getPagesInfo(); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Callback when name is changed. * diff --git a/dashboard/src/app/administration/docker-registry/docker-registry-list/docker-registry-list.controller.ts b/dashboard/src/app/administration/docker-registry/docker-registry-list/docker-registry-list.controller.ts index f44a29ec990..4b5ce8b87f1 100644 --- a/dashboard/src/app/administration/docker-registry/docker-registry-list/docker-registry-list.controller.ts +++ b/dashboard/src/app/administration/docker-registry/docker-registry-list/docker-registry-list.controller.ts @@ -65,7 +65,9 @@ export class DockerRegistryListController { $scope.$on('$destroy', () => { cheListHelperFactory.removeHelper(helperId); }); + } + $onInit(): void { this.getRegistries(); } 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 b2840bbfb85..f6d7105fc67 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,7 +37,9 @@ export class EditRegistryController { this.$mdDialog = $mdDialog; this.chePreferences = chePreferences; this.cheNotification = cheNotification; + } + $onInit(): void { if (this.registry) { this.originRegistryUrl = angular.copy(this.registry.url); } diff --git a/dashboard/src/app/dashboard/last-workspaces/last-workspaces.controller.ts b/dashboard/src/app/dashboard/last-workspaces/last-workspaces.controller.ts index 048a2bd96d8..1a9e77b9900 100644 --- a/dashboard/src/app/dashboard/last-workspaces/last-workspaces.controller.ts +++ b/dashboard/src/app/dashboard/last-workspaces/last-workspaces.controller.ts @@ -34,7 +34,9 @@ export class DashboardLastWorkspacesController { constructor(cheWorkspace: CheWorkspace, cheNotification: CheNotification) { this.cheWorkspace = cheWorkspace; this.cheNotification = cheNotification; + } + $onInit(): void { this.loadData(); } @@ -48,7 +50,7 @@ export class DashboardLastWorkspacesController { this.isLoading = false; return; } - + let promise = this.cheWorkspace.fetchWorkspaces(); promise.then((result) => { diff --git a/dashboard/src/app/demo-components/demo-components.controller.ts b/dashboard/src/app/demo-components/demo-components.controller.ts index 0a7d8c4af5c..af0e9448228 100644 --- a/dashboard/src/app/demo-components/demo-components.controller.ts +++ b/dashboard/src/app/demo-components/demo-components.controller.ts @@ -67,12 +67,6 @@ export class DemoComponentsController { this.$location = $location; this.cheNotification = cheNotification; - const tab = $location.search().tab; - if (Tab[tab]) { - this.selectedIndex = parseInt(Tab[tab], 10); - } else { - this.selectedIndex = Tab.Font; - } this.placement = { options: [ 'top', @@ -105,6 +99,16 @@ export class DemoComponentsController { orderNumber: 1 }] }; + } + + $onInit(): void { + const tab = this.$location.search().tab; + if (Tab[tab]) { + this.selectedIndex = parseInt(Tab[tab], 10); + } else { + this.selectedIndex = Tab.Font; + } + this.init(); } diff --git a/dashboard/src/app/factories/create-factory/action/factory-action-box.controller.ts b/dashboard/src/app/factories/create-factory/action/factory-action-box.controller.ts index baa79e04324..ca06b6cdd07 100644 --- a/dashboard/src/app/factories/create-factory/action/factory-action-box.controller.ts +++ b/dashboard/src/app/factories/create-factory/action/factory-action-box.controller.ts @@ -41,6 +41,8 @@ export class FactoryActionBoxController { this.selectedAction = this.actions[0].id; } + $onInit(): void { } + /** * Edit the action based on the provided index * @param $event the mouse event 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 3ed98cc52af..a4a789a2de5 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,7 +35,9 @@ 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); } 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 3ad22152775..442439fb243 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,6 +33,8 @@ export class FactoryCommandDialogEditController { this.$mdDialog = $mdDialog; } + $onInit(): void { } + /** * Callback of the edit button of the dialog. */ diff --git a/dashboard/src/app/factories/create-factory/command/factory-command.controller.ts b/dashboard/src/app/factories/create-factory/command/factory-command.controller.ts index 91d7c53e449..93460a81b6f 100644 --- a/dashboard/src/app/factories/create-factory/command/factory-command.controller.ts +++ b/dashboard/src/app/factories/create-factory/command/factory-command.controller.ts @@ -34,6 +34,8 @@ export class FactoryCommandController { this.$mdDialog = $mdDialog; } + $onInit(): void { } + /** * User clicked on the add button to add a new command */ diff --git a/dashboard/src/app/factories/create-factory/config-file-tab/factory-from-file.controller.ts b/dashboard/src/app/factories/create-factory/config-file-tab/factory-from-file.controller.ts index 13c5170b019..ae91f642b19 100644 --- a/dashboard/src/app/factories/create-factory/config-file-tab/factory-from-file.controller.ts +++ b/dashboard/src/app/factories/create-factory/config-file-tab/factory-from-file.controller.ts @@ -105,4 +105,6 @@ export class FactoryFromFileCtrl { this.factoryContent = null; } + $onInit(): void { } + } diff --git a/dashboard/src/app/factories/create-factory/create-factory.controller.ts b/dashboard/src/app/factories/create-factory/create-factory.controller.ts index 7f94a51258a..3127ef6f154 100644 --- a/dashboard/src/app/factories/create-factory/create-factory.controller.ts +++ b/dashboard/src/app/factories/create-factory/create-factory.controller.ts @@ -96,6 +96,11 @@ export class CreateFactoryCtrl { }); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Clear factory content */ diff --git a/dashboard/src/app/factories/create-factory/git/create-factory-git.controller.ts b/dashboard/src/app/factories/create-factory/git/create-factory-git.controller.ts index 5f91f132ba7..d287557973a 100644 --- a/dashboard/src/app/factories/create-factory/git/create-factory-git.controller.ts +++ b/dashboard/src/app/factories/create-factory/git/create-factory-git.controller.ts @@ -19,6 +19,6 @@ */ export class CreateFactoryGitController { - + $onInit(): void { } } diff --git a/dashboard/src/app/factories/create-factory/template-tab/factory-from-template.controller.ts b/dashboard/src/app/factories/create-factory/template-tab/factory-from-template.controller.ts index 60874f3f8ad..3dcf33b964b 100644 --- a/dashboard/src/app/factories/create-factory/template-tab/factory-from-template.controller.ts +++ b/dashboard/src/app/factories/create-factory/template-tab/factory-from-template.controller.ts @@ -40,7 +40,9 @@ export class FactoryFromTemplateController { this.isImporting = false; this.factoryContent = null; this.templateName = 'minimal'; + } + $onInit(): void { this.updateFactoryContent(); } diff --git a/dashboard/src/app/factories/create-factory/workspaces-tab/factory-from-workpsace.controller.ts b/dashboard/src/app/factories/create-factory/workspaces-tab/factory-from-workpsace.controller.ts index 78c93c84bde..d8bab2285f9 100644 --- a/dashboard/src/app/factories/create-factory/workspaces-tab/factory-from-workpsace.controller.ts +++ b/dashboard/src/app/factories/create-factory/workspaces-tab/factory-from-workpsace.controller.ts @@ -44,20 +44,21 @@ export class FactoryFromWorkspaceCtrl { this.cheNotification = cheNotification; this.workspacesService = workspacesService; - this.workspaces = cheAPI.getWorkspace().getWorkspaces().filter((workspace: che.IWorkspace) => { - return this.workspacesService.isSupported(workspace); - }); - this.workspacesById = cheAPI.getWorkspace().getWorkspacesById(); - this.filtersWorkspaceSelected = {}; this.workspaceFilter = {config: {name: ''}}; this.isLoading = true; + } - // fetch workspaces when initializing - let promise = cheAPI.getWorkspace().fetchWorkspaces(); + $onInit(): void { + this.workspaces = this.cheAPI.getWorkspace().getWorkspaces().filter((workspace: che.IWorkspace) => { + return this.workspacesService.isSupported(workspace); + }); + this.workspacesById = this.cheAPI.getWorkspace().getWorkspacesById(); + // fetch workspaces when initializing + let promise = this.cheAPI.getWorkspace().fetchWorkspaces(); promise.then(() => { this.isLoading = false; this.updateData(); @@ -67,7 +68,6 @@ export class FactoryFromWorkspaceCtrl { this.updateData(); } }); - } updateData(): void { diff --git a/dashboard/src/app/factories/factory-details/factory-details.controller.ts b/dashboard/src/app/factories/factory-details/factory-details.controller.ts index 441deaa583b..6de5328159f 100644 --- a/dashboard/src/app/factories/factory-details/factory-details.controller.ts +++ b/dashboard/src/app/factories/factory-details/factory-details.controller.ts @@ -43,6 +43,11 @@ export class FactoryDetailsController { }); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Returns `true` if supported version of factory workspace. * @returns {boolean} diff --git a/dashboard/src/app/factories/factory-details/information-tab/factory-information/factory-information.controller.ts b/dashboard/src/app/factories/factory-details/information-tab/factory-information/factory-information.controller.ts index 159de3c82c4..11bb04ef576 100644 --- a/dashboard/src/app/factories/factory-details/information-tab/factory-information/factory-information.controller.ts +++ b/dashboard/src/app/factories/factory-details/information-tab/factory-information/factory-information.controller.ts @@ -32,6 +32,7 @@ export class FactoryInformationController { private $timeout: ng.ITimeoutService; private lodash: any; private $filter: ng.IFilterService; + private cheBranding: CheBranding; private timeoutPromise: ng.IPromise; private editorLoadedPromise: ng.IPromise; @@ -73,7 +74,7 @@ export class FactoryInformationController { this.lodash = lodash; this.$filter = $filter; this.confirmDialogService = confirmDialogService; - this.factoryDocs = cheBranding.getDocs().factory; + this.cheBranding = cheBranding; this.timeoutPromise = null; $scope.$on('$destroy', () => { @@ -97,7 +98,6 @@ export class FactoryInformationController { this.stackRecipeMode = 'current-recipe'; - this.updateData(); $scope.$watch(() => { return this.factory; }, () => { @@ -105,6 +105,11 @@ export class FactoryInformationController { }); } + $onInit(): void { + this.factoryDocs = this.cheBranding.getDocs().factory; + this.updateData(); + } + /** * Update factory content data for editor */ diff --git a/dashboard/src/app/factories/last-factories/last-factories.controller.ts b/dashboard/src/app/factories/last-factories/last-factories.controller.ts index ccac61a3e32..c03992ccb8c 100644 --- a/dashboard/src/app/factories/last-factories/last-factories.controller.ts +++ b/dashboard/src/app/factories/last-factories/last-factories.controller.ts @@ -35,14 +35,16 @@ export class LastFactoriesController { constructor(cheFactory: CheFactory) { this.cheFactory = cheFactory; - this.factories = this.cheFactory.getPageFactories(); - // TODO we should change to modificationDate after model's change this.factoriesOrderBy = '-creator.created'; this.maxItems = 5; + } + + $onInit(): void { + this.factories = this.cheFactory.getPageFactories(); // TODO add OrderBy to condition in fetch API - let promise = this.cheFactory.fetchFactories(this.maxItems); + const promise = this.cheFactory.fetchFactories(this.maxItems); this.isLoading = true; promise.finally(() => { diff --git a/dashboard/src/app/factories/list-factories/factory-item/factory-item.controller.ts b/dashboard/src/app/factories/list-factories/factory-item/factory-item.controller.ts index f68ab8b8540..d4199290edc 100644 --- a/dashboard/src/app/factories/list-factories/factory-item/factory-item.controller.ts +++ b/dashboard/src/app/factories/list-factories/factory-item/factory-item.controller.ts @@ -44,6 +44,8 @@ export class FactoryItemController { this.loadFactoryService = loadFactoryService; } + $onInit(): void { } + /** * Returns `true` if supported version of factory workspace. * @returns {boolean} diff --git a/dashboard/src/app/factories/list-factories/list-factories.controller.ts b/dashboard/src/app/factories/list-factories/list-factories.controller.ts index 66821408da1..94e54389114 100644 --- a/dashboard/src/app/factories/list-factories/list-factories.controller.ts +++ b/dashboard/src/app/factories/list-factories/list-factories.controller.ts @@ -76,6 +76,11 @@ export class ListFactoriesController { this.pagesInfo = cheAPI.getFactory().getPagesInfo(); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Provides actual list of factories to helper. */ diff --git a/dashboard/src/app/factories/load-factory/load-factory.controller.ts b/dashboard/src/app/factories/load-factory/load-factory.controller.ts index e48266ad1f2..bb4a934db84 100644 --- a/dashboard/src/app/factories/load-factory/load-factory.controller.ts +++ b/dashboard/src/app/factories/load-factory/load-factory.controller.ts @@ -85,6 +85,11 @@ export class LoadFactoryController { this.getFactoryData(); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Hides menu and footer to maximize view. */ diff --git a/dashboard/src/app/ide/ide-iframe/ide-iframe.directive.ts b/dashboard/src/app/ide/ide-iframe/ide-iframe.directive.ts index 10fa3bbc9f0..9c9cd92189e 100644 --- a/dashboard/src/app/ide/ide-iframe/ide-iframe.directive.ts +++ b/dashboard/src/app/ide/ide-iframe/ide-iframe.directive.ts @@ -27,6 +27,8 @@ class IdeIframe implements ng.IDirective { this.templateUrl = 'app/ide/ide-iframe/ide-iframe.html'; } + $onInit(): void { } + } export default IdeIframe; diff --git a/dashboard/src/app/ide/ide.controller.ts b/dashboard/src/app/ide/ide.controller.ts index a7a8773a845..4e7fdfca576 100644 --- a/dashboard/src/app/ide/ide.controller.ts +++ b/dashboard/src/app/ide/ide.controller.ts @@ -115,7 +115,11 @@ class IdeCtrl { this.updateData(); }); } + } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor } /** diff --git a/dashboard/src/app/index.module.ts b/dashboard/src/app/index.module.ts index 77172c73698..74eb26da7d0 100755 --- a/dashboard/src/app/index.module.ts +++ b/dashboard/src/app/index.module.ts @@ -187,6 +187,10 @@ angular.element(document).ready(() => { }); }); +initModule.config(['$locationProvider', $locationProvider => { + $locationProvider.hashPrefix(''); +}]); + // add a global resolve flag on all routes (user needs to be resolved first) initModule.config(['$routeProvider', ($routeProvider: che.route.IRouteProvider) => { $routeProvider.accessWhen = (path: string, route: che.route.IRoute) => { diff --git a/dashboard/src/app/navbar/navbar-dropdown-menu/navbar-dropdown-menu.controller.ts b/dashboard/src/app/navbar/navbar-dropdown-menu/navbar-dropdown-menu.controller.ts index 3a31e1d7452..a1bd29ab41c 100644 --- a/dashboard/src/app/navbar/navbar-dropdown-menu/navbar-dropdown-menu.controller.ts +++ b/dashboard/src/app/navbar/navbar-dropdown-menu/navbar-dropdown-menu.controller.ts @@ -33,7 +33,9 @@ export class NavbarDropdownMenuController { */ constructor($window: ng.IWindowService) { this.$window = $window; + } + $onInit(): void { this.offset = angular.isUndefined(this.offset) ? '0 0' : this.offset; } diff --git a/dashboard/src/app/navbar/navbar.controller.ts b/dashboard/src/app/navbar/navbar.controller.ts index 9ed534a7541..1fe20f5141e 100644 --- a/dashboard/src/app/navbar/navbar.controller.ts +++ b/dashboard/src/app/navbar/navbar.controller.ts @@ -83,21 +83,23 @@ export class CheNavBarController { this.chePermissions = chePermissions; this.cheKeycloak = cheKeycloak; this.cheService = cheService; + } + $onInit(): void { this.isKeycloackPresent = this.cheKeycloak.isPresent(); - this.profile = cheAPI.getProfile().getProfile(); + this.profile = this.cheAPI.getProfile().getProfile(); this.userServices = this.chePermissions.getUserServices(); // highlight navbar menu item - $scope.$on('$locationChangeStart', () => { - let path = '#' + $location.path(); - $scope.$broadcast('navbar-selected:set', path); + this.$scope.$on('$locationChangeStart', () => { + let path = '#' + this.$location.path(); + this.$scope.$broadcast('navbar-selected:set', path); }); - cheAPI.getWorkspace().fetchWorkspaces(); - cheAPI.getFactory().fetchFactories(); + this.cheAPI.getWorkspace().fetchWorkspaces(); + this.cheAPI.getFactory().fetchFactories(); this.isPermissionServiceAvailable = false; this.resolvePermissionServiceAvailability().then((isAvailable: boolean) => { diff --git a/dashboard/src/app/navbar/notification/navbar-notification.controller.ts b/dashboard/src/app/navbar/notification/navbar-notification.controller.ts index 1c5e5c2ab04..5a20fd467cf 100644 --- a/dashboard/src/app/navbar/notification/navbar-notification.controller.ts +++ b/dashboard/src/app/navbar/notification/navbar-notification.controller.ts @@ -33,6 +33,8 @@ export class NavbarNotificationController { }); } + $onInit(): void { } + /** * Returns the number of notifications to be shown to user. * @returns {number} number of the notifications diff --git a/dashboard/src/app/navbar/recent-workspaces/recent-workspaces.controller.ts b/dashboard/src/app/navbar/recent-workspaces/recent-workspaces.controller.ts index a30d4420014..f62468a381a 100644 --- a/dashboard/src/app/navbar/recent-workspaces/recent-workspaces.controller.ts +++ b/dashboard/src/app/navbar/recent-workspaces/recent-workspaces.controller.ts @@ -44,7 +44,7 @@ export class NavbarRecentWorkspacesController { workspaceCreationLink: string; workspacesService: WorkspacesService; cheNotification: CheNotification; - + cheBranding: CheBranding; /** * Default constructor @@ -63,19 +63,14 @@ export class NavbarRecentWorkspacesController { this.$log = $log; this.$window = $window; this.$rootScope = $rootScope; - this.workspaceCreationLink = cheBranding.getWorkspace().creationLink; this.workspacesService = workspacesService; this.cheNotification = cheNotification; + this.cheBranding = cheBranding; // workspace updated time map by id this.workspaceUpdated = new Map(); - // get workspaces - this.workspaces = cheWorkspace.getWorkspaces(); this.recentWorkspaces = []; - // fetch workspaces when initializing - this.cheWorkspace.fetchWorkspaces(); - this.dropdownItems = {}; this.dropdownItemTempl = []; @@ -92,6 +87,16 @@ export class NavbarRecentWorkspacesController { }, () => { this.updateRecentWorkspaces(); }, true); + } + + $onInit(): void { + this.workspaceCreationLink = this.cheBranding.getWorkspace().creationLink; + + // get workspaces + this.workspaces = this.cheWorkspace.getWorkspaces(); + + // fetch workspaces when initializing + this.cheWorkspace.fetchWorkspaces(); this.updateRecentWorkspaces(); this.fetchWorkspaceSettings(); @@ -331,7 +336,7 @@ export class NavbarRecentWorkspacesController { let workspace = this.cheWorkspace.getWorkspaceById(workspaceId); this.updateRecentWorkspace(workspaceId); - + this.cheWorkspace.startWorkspace(workspace.id, workspace.config ? workspace.config.defaultEnv: null).catch((error: any) => { this.$log.error(error); this.cheNotification.showError('Run workspace error.', error); diff --git a/dashboard/src/app/organizations/create-organizations/create-organizations.controller.ts b/dashboard/src/app/organizations/create-organizations/create-organizations.controller.ts index 1170d777a70..1c6cb01da59 100644 --- a/dashboard/src/app/organizations/create-organizations/create-organizations.controller.ts +++ b/dashboard/src/app/organizations/create-organizations/create-organizations.controller.ts @@ -99,6 +99,11 @@ export class CreateOrganizationController { this.parentOrganizationMembers = initData.parentOrganizationMembers; } + $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/organizations/list-organizations/list-organizations.controller.ts b/dashboard/src/app/organizations/list-organizations/list-organizations.controller.ts index e340a359868..eea156888cf 100644 --- a/dashboard/src/app/organizations/list-organizations/list-organizations.controller.ts +++ b/dashboard/src/app/organizations/list-organizations/list-organizations.controller.ts @@ -147,6 +147,11 @@ export class ListOrganizationsController { this.processOrganizations(); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Callback when name is changed. * diff --git a/dashboard/src/app/organizations/list-organizations/organizations-item/organizations-item.controller.ts b/dashboard/src/app/organizations/list-organizations/organizations-item/organizations-item.controller.ts index d4e6870e26b..f64ec5f93fb 100644 --- a/dashboard/src/app/organizations/list-organizations/organizations-item/organizations-item.controller.ts +++ b/dashboard/src/app/organizations/list-organizations/organizations-item/organizations-item.controller.ts @@ -11,6 +11,7 @@ */ 'use strict'; import {OrganizationsPermissionService} from '../../organizations-permission.service'; +import { ChePermissions } from '../../../../components/api/che-permissions.factory'; /** * @ngdoc controller @@ -38,6 +39,14 @@ export class OrganizationsItemController { * Organization permission service. */ private organizationsPermissionService: OrganizationsPermissionService; + /** + * Resources service. + */ + private resourcesService: che.service.IResourcesService; + /** + * Permissions API interaction. + */ + private chePermissions: che.api.IChePermissions; /** * Organization API interaction. */ @@ -69,9 +78,13 @@ export class OrganizationsItemController { this.cheOrganization = cheOrganization; this.cheNotification = cheNotification; this.organizationsPermissionService = organizationsPermissionService; - this.organizationActions = resourcesService.getOrganizationActions(); + this.resourcesService = resourcesService; + this.chePermissions = chePermissions; + } - this.userServices = chePermissions.getUserServices(); + $onInit(): void { + this.organizationActions = this.resourcesService.getOrganizationActions(); + this.userServices = this.chePermissions.getUserServices(); } /** diff --git a/dashboard/src/app/organizations/organization-details/organization-details.controller.ts b/dashboard/src/app/organizations/organization-details/organization-details.controller.ts index 97cad5d790d..7ec96b3a7aa 100644 --- a/dashboard/src/app/organizations/organization-details/organization-details.controller.ts +++ b/dashboard/src/app/organizations/organization-details/organization-details.controller.ts @@ -161,6 +161,11 @@ export class OrganizationDetailsController { }); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + get SET_PERMISSIONS(): string { return this.organizationActions.SET_PERMISSIONS; } diff --git a/dashboard/src/app/organizations/organization-details/organization-invite-members/list-organization-invite-members.controller.ts b/dashboard/src/app/organizations/organization-details/organization-invite-members/list-organization-invite-members.controller.ts index a2709b8254f..bee4638d7f0 100644 --- a/dashboard/src/app/organizations/organization-details/organization-invite-members/list-organization-invite-members.controller.ts +++ b/dashboard/src/app/organizations/organization-details/organization-invite-members/list-organization-invite-members.controller.ts @@ -29,6 +29,14 @@ export class ListOrganizationInviteMembersController { * Service for displaying dialogs. */ private $mdDialog: ng.material.IDialogService; + /** + * User API interaction. + */ + private cheUser: any; + /** + * Resources service. + */ + private resourcesService: che.service.IResourcesService; /** * No members selected. */ @@ -76,16 +84,21 @@ export class ListOrganizationInviteMembersController { constructor($mdDialog: angular.material.IDialogService, lodash: any, cheUser: any, resourcesService: che.service.IResourcesService) { this.$mdDialog = $mdDialog; this.lodash = lodash; - this.organizationRoles = resourcesService.getOrganizationRoles(); + this.cheUser = cheUser; + this.resourcesService = resourcesService; this.isNoSelected = true; this.isBulkChecked = false; this.membersSelectedStatus = {}; this.membersSelectedNumber = 0; this.membersOrderBy = 'email'; + } + + $onInit(): void { + this.organizationRoles = this.resourcesService.getOrganizationRoles(); // add current user to members list - const user = cheUser.getUser(); + const user = this.cheUser.getUser(); const member = user as che.IMember; member.role = this.organizationRoles.ADMIN.name; this.members = [member]; 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 fc7d1ebfd2e..76be8c7be71 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,6 +41,10 @@ export class OrganizationMemberDialogController { * Lodash library. */ private lodash: any; + /** + * Resources service. + */ + private resourcesService: che.service.IResourcesService; /** * Processing state of adding member. */ @@ -111,9 +115,13 @@ export class OrganizationMemberDialogController { this.cheOrganization = cheOrganization; this.$q = $q; this.lodash = lodash; - this.organizationRoles = resourcesService.getOrganizationRoles(); + this.resourcesService = resourcesService; this.isProcessing = false; + } + + $onInit(): void { + this.organizationRoles = this.resourcesService.getOrganizationRoles(); this.emails = []; this.members.forEach((member: che.IMember) => { @@ -133,7 +141,7 @@ export class OrganizationMemberDialogController { this.title = 'Edit ' + this.member.name + ' roles'; this.buttonTitle = 'Save'; this.email = this.member.email; - let roles = cheOrganization.getRolesFromActions(this.member.permissions.actions); + let roles = this.cheOrganization.getRolesFromActions(this.member.permissions.actions); this.newRole = (roles && roles.length > 0) ? roles[0].name : this.organizationRoles.MEMBER.name; } else { this.email = ''; diff --git a/dashboard/src/app/organizations/organization-details/organization-members/list-organization-members.controller.ts b/dashboard/src/app/organizations/organization-details/organization-members/list-organization-members.controller.ts index 1583330e306..8f801ddf8c5 100644 --- a/dashboard/src/app/organizations/organization-details/organization-members/list-organization-members.controller.ts +++ b/dashboard/src/app/organizations/organization-details/organization-members/list-organization-members.controller.ts @@ -63,6 +63,10 @@ export class ListOrganizationMembersController { * Confirm dialog service. */ private confirmDialogService: ConfirmDialogService; + /** + * Resources service. + */ + private resourcesService: che.service.IResourcesService; /** * Promises service. */ @@ -134,9 +138,8 @@ export class ListOrganizationMembersController { this.cheNotification = cheNotification; this.confirmDialogService = confirmDialogService; this.organizationsPermissionService = organizationsPermissionService; - this.organizationActions = resourcesService.getOrganizationActions(); - this.organizationRoles = resourcesService.getOrganizationRoles(); this.$log = $log; + this.resourcesService = resourcesService; this.members = []; @@ -146,6 +149,11 @@ export class ListOrganizationMembersController { $scope.$on('$destroy', () => { cheListHelperFactory.removeHelper(helperId); }); + } + + $onInit(): void { + this.organizationActions = this.resourcesService.getOrganizationActions(); + this.organizationRoles = this.resourcesService.getOrganizationRoles(); this.formMemberList(); } 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 8f79fd6aad6..586bd3f1dda 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,6 +45,10 @@ export class OrganizationSelectMembersDialogController { * Lodash library. */ private lodash: any; + /** + * Resources service; + */ + private resourcesService: che.service.IResourcesService; /** * Callback handler (is set from outside). */ @@ -99,7 +103,7 @@ export class OrganizationSelectMembersDialogController { this.lodash = lodash; this.cheProfile = cheProfile; this.cheUser = cheUser; - this.organizationRoles = resourcesService.getOrganizationRoles(); + this.resourcesService = resourcesService; this.isLoading = false; @@ -107,9 +111,11 @@ 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(); } diff --git a/dashboard/src/app/organizations/organization-details/organization-workspaces/list-organization-workspaces.controller.ts b/dashboard/src/app/organizations/organization-details/organization-workspaces/list-organization-workspaces.controller.ts index ba760a15628..771d4097924 100644 --- a/dashboard/src/app/organizations/organization-details/organization-workspaces/list-organization-workspaces.controller.ts +++ b/dashboard/src/app/organizations/organization-details/organization-workspaces/list-organization-workspaces.controller.ts @@ -111,7 +111,9 @@ export class ListOrganizationWorkspacesController { $scope.$on('$destroy', () => { cheListHelperFactory.removeHelper(helperId); }); + } + $onInit(): void { this.fetchPermissions(); } diff --git a/dashboard/src/app/organizations/organizations.controller.ts b/dashboard/src/app/organizations/organizations.controller.ts index 8f7ca39d0c4..ac866e98f9c 100644 --- a/dashboard/src/app/organizations/organizations.controller.ts +++ b/dashboard/src/app/organizations/organizations.controller.ts @@ -78,6 +78,11 @@ export class OrganizationsController { this.fetchOrganizations(); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Fetches the list of root organizations. * @param pageKey {string} diff --git a/dashboard/src/app/profile/profile.controller.ts b/dashboard/src/app/profile/profile.controller.ts index 78fbcfe76df..2b8fc1daa63 100644 --- a/dashboard/src/app/profile/profile.controller.ts +++ b/dashboard/src/app/profile/profile.controller.ts @@ -42,6 +42,11 @@ export class ProfileController { this.userName = (profile.attributes as any).preferred_username; } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Edit profile - redirects to proper page. */ diff --git a/dashboard/src/app/stacks/list-stacks/list-stacks.controller.ts b/dashboard/src/app/stacks/list-stacks/list-stacks.controller.ts index e8321d945ab..5f80841479c 100644 --- a/dashboard/src/app/stacks/list-stacks/list-stacks.controller.ts +++ b/dashboard/src/app/stacks/list-stacks/list-stacks.controller.ts @@ -65,6 +65,11 @@ export class ListStacksController { this.loadDevfiles(); } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + loadDevfiles(): void { this.isLoading = true; this.pluginRegistryUrl = this.cheWorkspace.getWorkspaceSettings().cheWorkspaceDevfileRegistryUrl; diff --git a/dashboard/src/app/stacks/stack-details/stack.controller.ts b/dashboard/src/app/stacks/stack-details/stack.controller.ts index 180adb2b87b..944c0a5b2af 100644 --- a/dashboard/src/app/stacks/stack-details/stack.controller.ts +++ b/dashboard/src/app/stacks/stack-details/stack.controller.ts @@ -40,4 +40,10 @@ export class StackController { this.devfileYaml = jsyaml.dump(initData.devfileContent, {'indent': 1}); this.devfileName = initData.devfileContent.metadata.name; } + + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + } diff --git a/dashboard/src/app/teams/create-team/create-team.controller.ts b/dashboard/src/app/teams/create-team/create-team.controller.ts index 7a900ed3732..e6143837cb8 100644 --- a/dashboard/src/app/teams/create-team/create-team.controller.ts +++ b/dashboard/src/app/teams/create-team/create-team.controller.ts @@ -120,6 +120,11 @@ export class CreateTeamController { } } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Performs new team creation. */ diff --git a/dashboard/src/app/teams/invite-members/list-members.controller.ts b/dashboard/src/app/teams/invite-members/list-members.controller.ts index 85fb3dabdb4..ccc59609d3f 100644 --- a/dashboard/src/app/teams/invite-members/list-members.controller.ts +++ b/dashboard/src/app/teams/invite-members/list-members.controller.ts @@ -78,6 +78,8 @@ export class ListMembersController { this.membersOrderBy = 'email'; } + $onInit(): void { } + /** * Forms the list of members. */ diff --git a/dashboard/src/app/teams/list/list-teams.controller.ts b/dashboard/src/app/teams/list/list-teams.controller.ts index 8fdb94dc7fc..dbf2599fc5d 100644 --- a/dashboard/src/app/teams/list/list-teams.controller.ts +++ b/dashboard/src/app/teams/list/list-teams.controller.ts @@ -41,6 +41,10 @@ export class ListTeamsController { * Service for displaying dialogs. */ private confirmDialogService: any; + /** + * Resources service. + */ + private resourcesService: che.service.IResourcesService; /** * Promises service. */ @@ -95,12 +99,11 @@ export class ListTeamsController { this.cheTeam = cheTeam; this.chePermissions = chePermissions; this.cheResourcesDistribution = cheResourcesDistribution; - this.resourceLimits = resourcesService.getResourceLimits(); - this.cheNotification = cheNotification; this.confirmDialogService = confirmDialogService; this.$q = $q; this.$location = $location; + this.resourcesService = resourcesService; this.teams = []; this.isLoading = true; @@ -108,13 +111,10 @@ export class ListTeamsController { this.teamsSelectedStatus = {}; this.isBulkChecked = false; this.isNoSelected = true; - this.fetchTeams(); - - let refreshHandler = () => { + const refreshHandler = () => { this.fetchTeams(); }; - cheTeamEventsManager.addDeleteHandler(refreshHandler); cheTeamEventsManager.addRenameHandler(refreshHandler); @@ -124,6 +124,11 @@ export class ListTeamsController { }); } + $onInit(): void { + this.resourceLimits = this.resourcesService.getResourceLimits(); + this.fetchTeams(); + } + /** * Fetches the list of teams. */ diff --git a/dashboard/src/app/teams/list/team-item/team-item.controller.ts b/dashboard/src/app/teams/list/team-item/team-item.controller.ts index 6b0f41e71d6..3265be0101e 100644 --- a/dashboard/src/app/teams/list/team-item/team-item.controller.ts +++ b/dashboard/src/app/teams/list/team-item/team-item.controller.ts @@ -55,6 +55,8 @@ export class TeamItemController { this.cheNotification = cheNotification; } + $onInit(): void { } + /** * Redirect to team details. */ 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 6dcbf7a51fc..6c92645fb33 100644 --- a/dashboard/src/app/teams/member-dialog/member-dialog.controller.ts +++ b/dashboard/src/app/teams/member-dialog/member-dialog.controller.ts @@ -103,7 +103,9 @@ export class MemberDialogController { this.lodash = lodash; this.isProcessing = false; + } + $onInit(): void { this.emails = []; this.members.forEach((member: any) => { this.emails.push(member.email); diff --git a/dashboard/src/app/teams/navbar-teams/navbar-teams.controller.ts b/dashboard/src/app/teams/navbar-teams/navbar-teams.controller.ts index 393d893beb5..807f7f5fa23 100644 --- a/dashboard/src/app/teams/navbar-teams/navbar-teams.controller.ts +++ b/dashboard/src/app/teams/navbar-teams/navbar-teams.controller.ts @@ -31,14 +31,17 @@ export class NavbarTeamsController { */ constructor(cheTeam: che.api.ICheTeam) { this.cheTeam = cheTeam; + } + + $onInit(): void { this.fetchTeams(); } /** * Fetch the list of available teams. */ - fetchTeams(): void { - this.cheTeam.fetchTeams(); + fetchTeams(): ng.IPromise { + return this.cheTeam.fetchTeams(); } getTeamDisplayName(team: any): string { diff --git a/dashboard/src/app/teams/team-details/team-details.controller.ts b/dashboard/src/app/teams/team-details/team-details.controller.ts index b6561c96c1b..529f20e987e 100644 --- a/dashboard/src/app/teams/team-details/team-details.controller.ts +++ b/dashboard/src/app/teams/team-details/team-details.controller.ts @@ -177,6 +177,11 @@ tab: Object = Tab; } } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Update selected tab index by search part of URL. * diff --git a/dashboard/src/app/teams/team-details/team-members/list-team-members.controller.ts b/dashboard/src/app/teams/team-details/team-members/list-team-members.controller.ts index c4389f90e55..0a083209f79 100644 --- a/dashboard/src/app/teams/team-details/team-members/list-team-members.controller.ts +++ b/dashboard/src/app/teams/team-details/team-members/list-team-members.controller.ts @@ -72,6 +72,10 @@ export class ListTeamMembersController { * Promises service. */ private $q: ng.IQService; + /** + * Team details service. + */ + private teamDetailsService: TeamDetailsService; /** * Lodash library. */ @@ -129,6 +133,7 @@ export class ListTeamMembersController { this.lodash = lodash; this.cheNotification = cheNotification; this.confirmDialogService = confirmDialogService; + this.teamDetailsService = teamDetailsService; this.members = []; this.isLoading = true; @@ -139,9 +144,11 @@ export class ListTeamMembersController { $scope.$on('$destroy', () => { cheListHelperFactory.removeHelper(helperId); }); + } - this.owner = teamDetailsService.getOwner(); - this.team = teamDetailsService.getTeam(); + $onInit(): void { + this.owner = this.teamDetailsService.getOwner(); + this.team = this.teamDetailsService.getTeam(); this.refreshData(true, true); } diff --git a/dashboard/src/app/teams/team-details/team-members/member-item/member-item.controller.ts b/dashboard/src/app/teams/team-details/team-members/member-item/member-item.controller.ts index 0383372f9b3..a26d839394e 100644 --- a/dashboard/src/app/teams/team-details/team-members/member-item/member-item.controller.ts +++ b/dashboard/src/app/teams/team-details/team-members/member-item/member-item.controller.ts @@ -66,6 +66,8 @@ export class MemberItemController { this.otherActions = []; } + $onInit(): void { } + /** * Call user permissions removal. Show the dialog * @param event - the $event diff --git a/dashboard/src/app/teams/team-details/team-owners/list-team-owners.controller.ts b/dashboard/src/app/teams/team-details/team-owners/list-team-owners.controller.ts index 0d8689231ce..cf7caa02c88 100644 --- a/dashboard/src/app/teams/team-details/team-owners/list-team-owners.controller.ts +++ b/dashboard/src/app/teams/team-details/team-owners/list-team-owners.controller.ts @@ -42,6 +42,10 @@ export class ListTeamOwnersController { * Notifications service. */ private cheNotification: any; + /** + * Team details service. + */ + private teamDetailsService: TeamDetailsService; /** * Lodash library. */ @@ -70,9 +74,13 @@ export class ListTeamOwnersController { this.cheProfile = cheProfile; this.cheNotification = cheNotification; this.lodash = lodash; + this.teamDetailsService = teamDetailsService; this.isLoading = true; - this.owner = teamDetailsService.getOwner(); + } + + $onInit(): void { + this.owner = this.teamDetailsService.getOwner(); this.processOwner(); } diff --git a/dashboard/src/app/teams/team-details/team-workspaces/list-team-workspaces.controller.ts b/dashboard/src/app/teams/team-details/team-workspaces/list-team-workspaces.controller.ts index c25aabb30ef..95cd3173d98 100644 --- a/dashboard/src/app/teams/team-details/team-workspaces/list-team-workspaces.controller.ts +++ b/dashboard/src/app/teams/team-details/team-workspaces/list-team-workspaces.controller.ts @@ -50,6 +50,10 @@ export class ListTeamWorkspacesController { * Promises service. */ private $q: ng.IQService; + /** + * Team details service. + */ + private teamDetailsService: TeamDetailsService; private lodash: any; /** @@ -87,6 +91,7 @@ export class ListTeamWorkspacesController { this.$mdDialog = $mdDialog; this.$q = $q; this.lodash = lodash; + this.teamDetailsService = teamDetailsService; this.workspaces = []; this.isLoading = true; @@ -97,9 +102,10 @@ export class ListTeamWorkspacesController { $scope.$on('$destroy', () => { cheListHelperFactory.removeHelper(helperId); }); + } - this.team = teamDetailsService.getTeam(); - + $onInit(): void { + this.team = this.teamDetailsService.getTeam(); this.fetchPermissions(); } 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 93931004fed..684075a6ee8 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,6 +27,8 @@ export class AfterCreationDialogController { this.$mdDialog = $mdDialog; } + $onInit(): void { } + /** * It will hide the dialog box. */ diff --git a/dashboard/src/app/workspaces/create-workspace/create-workspace.controller.ts b/dashboard/src/app/workspaces/create-workspace/create-workspace.controller.ts index e36c851a60a..3647847fb05 100644 --- a/dashboard/src/app/workspaces/create-workspace/create-workspace.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/create-workspace.controller.ts @@ -163,6 +163,11 @@ export class CreateWorkspaceController { }; } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Callback which is called when stack is selected. * diff --git a/dashboard/src/app/workspaces/create-workspace/devfile-selector/devfile-selector.controller.ts b/dashboard/src/app/workspaces/create-workspace/devfile-selector/devfile-selector.controller.ts index f1c08f2f38c..a1703e40ee8 100644 --- a/dashboard/src/app/workspaces/create-workspace/devfile-selector/devfile-selector.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/devfile-selector/devfile-selector.controller.ts @@ -35,6 +35,9 @@ export class DevfileSelectorController { this.devfileRegistry = devfileRegistry; this.cheWorkspace = cheWorkspace; this.devfileOrderBy = 'displayName'; + } + + $onInit(): void { this.loadDevfiles(); } @@ -51,7 +54,7 @@ export class DevfileSelectorController { devfileOnClick(devfile: any): void { this.selectedDevfile = devfile; - + let location = this.cheWorkspace.getWorkspaceSettings().cheWorkspaceDevfileRegistryUrl; let devfileContent = this.devfileRegistry.getDevfile(location, devfile.links.self); diff --git a/dashboard/src/app/workspaces/create-workspace/namespace-selector/namespace-selector.controller.ts b/dashboard/src/app/workspaces/create-workspace/namespace-selector/namespace-selector.controller.ts index 00bd1f099d3..601a9fadb81 100644 --- a/dashboard/src/app/workspaces/create-workspace/namespace-selector/namespace-selector.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/namespace-selector/namespace-selector.controller.ts @@ -37,6 +37,8 @@ export class NamespaceSelectorController { this.namespaceSelectorSvc = namespaceSelectorSvc; } + $onInit(): void { } + /** * Returns list of labels of namespaces * diff --git a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/add-import-project.controller.ts b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/add-import-project.controller.ts index 6d7c49588de..7a6c0641428 100644 --- a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/add-import-project.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/add-import-project.controller.ts @@ -62,14 +62,16 @@ export class AddImportProjectController { this.projectSource = ProjectSource; - this.activeProjectSource = this.devfile ? ProjectSource.SAMPLES : ProjectSource.GIT; - this.sourceChanged(); - $scope.$on('$destroy', () => { this.addImportProjectService.clearAllSources(); }); } + $onInit(): void { + this.activeProjectSource = this.devfile ? ProjectSource.SAMPLES : ProjectSource.GIT; + this.sourceChanged(); + } + /** * Set source of project which is going to be added. */ diff --git a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-blank-project/import-blank-project.controller.ts b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-blank-project/import-blank-project.controller.ts index 06a41f8189d..ee31012ed38 100644 --- a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-blank-project/import-blank-project.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-blank-project/import-blank-project.controller.ts @@ -70,6 +70,8 @@ export class ImportBlankProjectController { }); } + $onInit(): void { } + /** * Callback which is called when project template is added to the list of ready-to-import projects. * Clears name and description. diff --git a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-git-project/import-git-project.controller.ts b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-git-project/import-git-project.controller.ts index 6f97db8ce60..2e70413eab5 100644 --- a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-git-project/import-git-project.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-git-project/import-git-project.controller.ts @@ -60,6 +60,8 @@ export class ImportGitProjectController { }); } + $onInit(): void { } + /** * Callback which is called when project template is added to the list of ready-to-import projects. * Clears project's location. diff --git a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-github-project/import-github-project.controller.ts b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-github-project/import-github-project.controller.ts index 6b6b83fceec..32bfcd6b9b6 100644 --- a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-github-project/import-github-project.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-github-project/import-github-project.controller.ts @@ -11,11 +11,11 @@ */ 'use strict'; -import {CheBranding} from '../../../../../../components/branding/che-branding.factory'; -import {ImportGithubProjectService, LoadingState} from './import-github-project.service'; -import {ProjectSource} from '../../project-source.enum'; -import {IGithubRepository} from './github-repository-interface'; -import {AddImportProjectService} from '../add-import-project.service'; +import { CheBranding } from '../../../../../../components/branding/che-branding.factory'; +import { ImportGithubProjectService, LoadingState } from './import-github-project.service'; +import { ProjectSource } from '../../project-source.enum'; +import { IGithubRepository } from './github-repository-interface'; +import { AddImportProjectService } from '../add-import-project.service'; /** * This class is handling the controller for the GitHub part @@ -26,7 +26,7 @@ import {AddImportProjectService} from '../add-import-project.service'; export class ImportGithubProjectController { static $inject = ['$q', '$mdDialog', '$location', '$browser', '$scope', 'githubPopup', 'cheBranding', 'githubOrganizationNameResolver', -'importGithubProjectService', 'cheListHelperFactory', 'addImportProjectService', 'keycloakAuth']; + 'importGithubProjectService', 'cheListHelperFactory', 'addImportProjectService', 'keycloakAuth']; /** * Promises service. @@ -121,10 +121,10 @@ export class ImportGithubProjectController { /** * Default constructor that is using resource */ - constructor ($q: ng.IQService, $mdDialog: ng.material.IDialogService, $location: ng.ILocationService, - $browser: any, $scope: ng.IScope, githubPopup: any, cheBranding: CheBranding, - githubOrganizationNameResolver: any, importGithubProjectService: ImportGithubProjectService, - cheListHelperFactory: che.widget.ICheListHelperFactory, addImportProjectService: AddImportProjectService, keycloakAuth: any) { + constructor($q: ng.IQService, $mdDialog: ng.material.IDialogService, $location: ng.ILocationService, + $browser: any, $scope: ng.IScope, githubPopup: any, cheBranding: CheBranding, + githubOrganizationNameResolver: any, importGithubProjectService: ImportGithubProjectService, + cheListHelperFactory: che.widget.ICheListHelperFactory, addImportProjectService: AddImportProjectService, keycloakAuth: any) { this.$q = $q; this.$mdDialog = $mdDialog; this.$location = $location; @@ -135,8 +135,8 @@ export class ImportGithubProjectController { this.resolveOrganizationName = this.githubOrganizationNameResolver.resolve; this.addImportProjectService = addImportProjectService; this.keycloakAuth = keycloakAuth; - this.importGithubProjectService = importGithubProjectService; + this.productName = cheBranding.getName(); this.loadingState = LoadingState; @@ -146,15 +146,12 @@ export class ImportGithubProjectController { cheListHelperFactory.removeHelper(helperId); }); - this.repositoryFilter = {name: ''}; + this.repositoryFilter = { name: '' }; this.organizationFilter = { owner: { login: '' } }; - - this.githubRepositoriesList = this.importGithubProjectService.getGithubRepositories(); - this.organizationsList = this.importGithubProjectService.getOrganizations(); this.cheListHelper.setList(this.githubRepositoriesList, 'clone_url'); const actionOnPublish = (source: ProjectSource) => { @@ -165,6 +162,11 @@ export class ImportGithubProjectController { $scope.$on('$destroy', () => { this.addImportProjectService.unsubscribe(actionOnPublish); }); + } + + $onInit(): void { + this.githubRepositoriesList = this.importGithubProjectService.getGithubRepositories(); + this.organizationsList = this.importGithubProjectService.getOrganizations(); this.selectedRepositories = this.importGithubProjectService.getSelectedRepositories(); this.selectedRepositories.forEach((repository: IGithubRepository) => { @@ -178,7 +180,6 @@ export class ImportGithubProjectController { }); } - /** * Returns current loading state. * @@ -268,7 +269,7 @@ export class ImportGithubProjectController { width: 1020, height: 618 }) - .then( () => { + .then(() => { return this.importGithubProjectService.getAndStoreRemoteToken(); }, (rejectionReason: any) => { return this.$q.reject(rejectionReason); 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 0e385d3ef95..b3ae088f73f 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,6 +38,8 @@ export class NoGithubOauthDialogController { this.message = ($rootScope as any).branding.oauthDocs; } + $onInit(): void { } + /** * It will hide the dialog box. */ diff --git a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-zip-project/import-zip-project.controller.ts b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-zip-project/import-zip-project.controller.ts index 4f21bc27cdf..71e7a85a446 100644 --- a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-zip-project/import-zip-project.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/import-zip-project/import-zip-project.controller.ts @@ -65,6 +65,8 @@ export class ImportZipProjectController { }); } + $onInit(): void { } + /** * Callback which is called when project template is added to the list of ready-to-import projects. * Clears project's location. diff --git a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/template-selector/template-selector.controller.ts b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/template-selector/template-selector.controller.ts index 880b8771108..5e0411f1391 100644 --- a/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/template-selector/template-selector.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/project-source-selector/add-import-project/template-selector/template-selector.controller.ts @@ -60,7 +60,6 @@ export class TemplateSelectorController { */ constructor($filter: ng.IFilterService, $scope: ng.IScope, addImportProjectService: AddImportProjectService, templateSelectorSvc: TemplateSelectorSvc, cheListHelperFactory: che.widget.ICheListHelperFactory) { - this.$filter = $filter; this.templateSelectorSvc = templateSelectorSvc; this.addImportProjectService = addImportProjectService; @@ -83,7 +82,6 @@ export class TemplateSelectorController { cheListHelperFactory.removeHelper(helperId); }); - this.selectedTemplates = this.templateSelectorSvc.getTemplates(); const actionOnPublish = (source: ProjectSource) => { this.onAddImportProjectServicePublish(source); @@ -95,6 +93,10 @@ export class TemplateSelectorController { }); } + $onInit(): void { + this.selectedTemplates = this.templateSelectorSvc.getTemplates(); + } + /** * Callback which is called when project template is added to the list of ready-to-import projects. * Make samples not checked. diff --git a/dashboard/src/app/workspaces/create-workspace/project-source-selector/edit-project/edit-project.controller.ts b/dashboard/src/app/workspaces/create-workspace/project-source-selector/edit-project/edit-project.controller.ts index d3266982046..1c2cf04ea0d 100644 --- a/dashboard/src/app/workspaces/create-workspace/project-source-selector/edit-project/edit-project.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/project-source-selector/edit-project/edit-project.controller.ts @@ -53,7 +53,10 @@ export class EditProjectController { $scope.$on('$destroy', () => { this.editProjectService.restoreTemplate(); - }); } + }); + } + + $onInit(): void { } /** * Callback which should be called when "Save" button is pressed. diff --git a/dashboard/src/app/workspaces/create-workspace/project-source-selector/edit-project/project-metadata/project-metadata.controller.ts b/dashboard/src/app/workspaces/create-workspace/project-source-selector/edit-project/project-metadata/project-metadata.controller.ts index e928171593d..bf5456ece8e 100644 --- a/dashboard/src/app/workspaces/create-workspace/project-source-selector/edit-project/project-metadata/project-metadata.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/project-source-selector/edit-project/project-metadata/project-metadata.controller.ts @@ -86,6 +86,8 @@ export class ProjectMetadataController { }); } + $onInit(): void { } + /** * Restores project's name and source location from original state. */ diff --git a/dashboard/src/app/workspaces/create-workspace/project-source-selector/project-source-selector.controller.ts b/dashboard/src/app/workspaces/create-workspace/project-source-selector/project-source-selector.controller.ts index a509d8a8780..b2e73a4805a 100644 --- a/dashboard/src/app/workspaces/create-workspace/project-source-selector/project-source-selector.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/project-source-selector/project-source-selector.controller.ts @@ -73,7 +73,6 @@ export class ProjectSourceSelectorController { this.projectSourceSelectorService = projectSourceSelectorService; this.actionType = ActionType; this.devfileProjectsCopy = null; - $scope.$watch(() => { return this.devfile; @@ -94,7 +93,7 @@ export class ProjectSourceSelectorController { this.devfileProjects.forEach((project: any) => { this.projectSourceSelectorService.addProjectTemplate(project); }); - + // update list of templates to redraw the projects section this.projectTemplates = this.projectSourceSelectorService.getProjectTemplates(); this.updateData({buttonState: true, actionType: ActionType.EDIT_PROJECT, template: this.devfileProjects[0]}); @@ -108,6 +107,8 @@ export class ProjectSourceSelectorController { }); } + $onInit(): void { } + /** * Add project templates from selected source to the list. * @@ -179,7 +180,7 @@ export class ProjectSourceSelectorController { this.activeActionType = actionType; this.selectedProjectTemplate = angular.copy(template); - + this.$scope.updateWidget(this.activeButtonId, this.scrollToBottom); this.scrollToBottom = false; } diff --git a/dashboard/src/app/workspaces/create-workspace/ram-settings/ram-settings-machine-item/ram-settings-machine-item.controller.ts b/dashboard/src/app/workspaces/create-workspace/ram-settings/ram-settings-machine-item/ram-settings-machine-item.controller.ts index 1c7ad106360..2436aac2f62 100644 --- a/dashboard/src/app/workspaces/create-workspace/ram-settings/ram-settings-machine-item/ram-settings-machine-item.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/ram-settings/ram-settings-machine-item/ram-settings-machine-item.controller.ts @@ -26,6 +26,8 @@ export class RamSettingsMachineItemController { */ onRamChange: (data: {name: string, memoryLimitGBytes: number}) => void; + $onInit(): void { } + /** * Callback which is called when machine's RAM setting is changed. * @@ -36,4 +38,3 @@ export class RamSettingsMachineItemController { } } - diff --git a/dashboard/src/app/workspaces/create-workspace/ram-settings/ram-settings.controller.ts b/dashboard/src/app/workspaces/create-workspace/ram-settings/ram-settings.controller.ts index 19141fe8149..33590206b09 100644 --- a/dashboard/src/app/workspaces/create-workspace/ram-settings/ram-settings.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/ram-settings/ram-settings.controller.ts @@ -62,6 +62,8 @@ export class RamSettingsController { }, true); } + $onInit(): void { } + /** * Builds list of machines properties. */ diff --git a/dashboard/src/app/workspaces/list-workspaces/list-workspaces.controller.ts b/dashboard/src/app/workspaces/list-workspaces/list-workspaces.controller.ts index eadda87f134..432bb9ba4f1 100644 --- a/dashboard/src/app/workspaces/list-workspaces/list-workspaces.controller.ts +++ b/dashboard/src/app/workspaces/list-workspaces/list-workspaces.controller.ts @@ -118,7 +118,11 @@ export class ListWorkspacesCtrl { this.cheListHelper.applyFilter('namespace', this.namespaceFilter, this.isExactMatch); }; + } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor } /** 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 9aa257ee98f..32cec73cbcb 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 @@ -59,18 +59,21 @@ export class WorkspaceItemCtrl { this.workspacesService = workspacesService; this.$timeout = $timeout; this.$document = $document; - this.workspaceName = this.cheWorkspace.getWorkspaceDataManager().getName(this.workspace); this.supportedRecipeTypeIssue = $sce.trustAsHtml('Current infrastructure doesn\'t support this workspace recipe type.'); - + // TODO change to cheBranding.getDocs().converting after https://github.com/eclipse/che/issues/14308 const converting = 'https://www.eclipse.org/che/docs/che-7/converting-a-che-6-workspace-to-a-che-7-devfile/'; - this.supportedVersionTypeIssue = $sce.trustAsHtml(`This workspace is using old definition format which is not compatible anymore. + this.supportedVersionTypeIssue = $sce.trustAsHtml(`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.`); } + $onInit(): void { + this.workspaceName = this.cheWorkspace.getWorkspaceDataManager().getName(this.workspace); + } + /** * Returns `true` if supported. * diff --git a/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status.controller.ts b/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status.controller.ts index 7e339c587ea..cee5c5c9bee 100644 --- a/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status.controller.ts +++ b/dashboard/src/app/workspaces/list-workspaces/workspace-status-action/workspace-status.controller.ts @@ -42,6 +42,8 @@ export class WorkspaceStatusController { this.cheNotification = cheNotification; } + $onInit(): void { } + /** * Change workspace status. */ 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 a12595d051e..92c9de5f76f 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,6 +51,8 @@ export class AddDeveloperController { this.$mdDialog = $mdDialog; } + $onInit(): void { } + /** * 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 df4ca63f512..c70bdca78cc 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,16 +84,11 @@ 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', () => { @@ -101,6 +96,14 @@ export class AddMemberController { }); } + $onInit(): void { + this.team = this.cheTeam.getTeamByName(this.namespace); + + if (this.team) { + this.fetchTeamMembers(); + } + } + fetchTeamMembers(): void { this.isLoading = true; this.chePermissions.fetchOrganizationPermissions(this.team.id).then(() => { diff --git a/dashboard/src/app/workspaces/share-workspace/share-workspace.controller.ts b/dashboard/src/app/workspaces/share-workspace/share-workspace.controller.ts index eb17298dbdd..7297a4ce12d 100644 --- a/dashboard/src/app/workspaces/share-workspace/share-workspace.controller.ts +++ b/dashboard/src/app/workspaces/share-workspace/share-workspace.controller.ts @@ -146,6 +146,17 @@ export class ShareWorkspaceController { this.namespace = $route.current.params.namespace; this.workspaceName = $route.current.params.workspaceName; + this.userOrderBy = 'email'; + this.userFilter = {email: ''}; + + const helperId = 'share-workspace'; + this.cheListHelper = cheListHelperFactory.getHelper(helperId); + $scope.$on('$destroy', () => { + cheListHelperFactory.removeHelper(helperId); + }); + } + + $onInit(): void { this.workspace = this.cheWorkspace.getWorkspaceByName(this.namespace, this.workspaceName); if (this.workspace) { this.refreshWorkspacePermissions(); @@ -163,15 +174,6 @@ export class ShareWorkspaceController { }); } - this.userOrderBy = 'email'; - this.userFilter = {email: ''}; - - const helperId = 'share-workspace'; - this.cheListHelper = cheListHelperFactory.getHelper(helperId); - $scope.$on('$destroy', () => { - cheListHelperFactory.removeHelper(helperId); - }); - this.fetchPersonalAccount(); } diff --git a/dashboard/src/app/workspaces/share-workspace/user-item/user-item.controller.ts b/dashboard/src/app/workspaces/share-workspace/user-item/user-item.controller.ts index 59ed88626af..8d74e4a8345 100644 --- a/dashboard/src/app/workspaces/share-workspace/user-item/user-item.controller.ts +++ b/dashboard/src/app/workspaces/share-workspace/user-item/user-item.controller.ts @@ -36,6 +36,8 @@ export class UserItemController { this.$mdDialog = $mdDialog; } + $onInit(): void { } + /** * Call user permissions removal. Show the dialog. */ diff --git a/dashboard/src/app/workspaces/workspace-details/config-import/workspace-config-import.controller.ts b/dashboard/src/app/workspaces/workspace-details/config-import/workspace-config-import.controller.ts index e5ea9c63e82..152dbdf66e5 100644 --- a/dashboard/src/app/workspaces/workspace-details/config-import/workspace-config-import.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/config-import/workspace-config-import.controller.ts @@ -83,6 +83,8 @@ export class WorkspaceConfigImportController { this.errorMessagesService.registerCallback(this.errorsScopeEnvironment, this.updateErrorsList.bind(this, this.errorsScopeEnvironment)); } + $onInit(): void { } + updateErrorsList(errorsScope: string, otherErrors: string[]) { this.otherValidationMessages[errorsScope] = angular.copy(otherErrors); } diff --git a/dashboard/src/app/workspaces/workspace-details/devfile/workspace-devfile-editor.controller.ts b/dashboard/src/app/workspaces/workspace-details/devfile/workspace-devfile-editor.controller.ts index 4d2553f81e6..81b922ca46a 100644 --- a/dashboard/src/app/workspaces/workspace-details/devfile/workspace-devfile-editor.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/devfile/workspace-devfile-editor.controller.ts @@ -65,9 +65,10 @@ export class WorkspaceDevfileEditorController { const validateOnly = true; this.onChange(validateOnly); }, true); - } + $onInit(): void { } + /** * Callback when editor content is changed. */ diff --git a/dashboard/src/app/workspaces/workspace-details/environments/environments.controller.ts b/dashboard/src/app/workspaces/workspace-details/environments/environments.controller.ts index bda586e417a..16903eb311c 100644 --- a/dashboard/src/app/workspaces/workspace-details/environments/environments.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/environments/environments.controller.ts @@ -105,6 +105,8 @@ export class WorkspaceEnvironmentsController { }); } + $onInit(): void { } + /** * Sets initial values */ diff --git a/dashboard/src/app/workspaces/workspace-details/environments/list-agents/list-agents.controller.ts b/dashboard/src/app/workspaces/workspace-details/environments/list-agents/list-agents.controller.ts index b6a37d8a17a..efb192e8c20 100644 --- a/dashboard/src/app/workspaces/workspace-details/environments/list-agents/list-agents.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/environments/list-agents/list-agents.controller.ts @@ -46,6 +46,8 @@ export class ListAgentsController { }); } + $onInit(): void { } + buildAgentsList(): void { this.agentsList = []; this.allAgents = this.cheAgent.getAgents(); 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 22a5fffd9c6..3ed524c7df5 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,7 +40,9 @@ 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]) { diff --git a/dashboard/src/app/workspaces/workspace-details/environments/list-env-variables/list-env-variables.controller.ts b/dashboard/src/app/workspaces/workspace-details/environments/list-env-variables/list-env-variables.controller.ts index b77bbe0dc16..65fb6622231 100644 --- a/dashboard/src/app/workspaces/workspace-details/environments/list-env-variables/list-env-variables.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/environments/list-env-variables/list-env-variables.controller.ts @@ -54,7 +54,9 @@ export class ListEnvVariablesController { this.$mdDialog = $mdDialog; this.lodash = lodash; this.confirmDialogService = confirmDialogService; + } + $onInit(): void { this.buildVariablesList(); } 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 3bf3e61017d..4a1123d710e 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,7 +51,9 @@ 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]) { @@ -73,7 +75,6 @@ export class EditServerDialogController { this.port = this.getLowestFreePort(); this.popupTitle = 'Add a new server'; } - } /** diff --git a/dashboard/src/app/workspaces/workspace-details/environments/list-servers/list-servers.controller.ts b/dashboard/src/app/workspaces/workspace-details/environments/list-servers/list-servers.controller.ts index 7bf609b5a4d..f808a006550 100644 --- a/dashboard/src/app/workspaces/workspace-details/environments/list-servers/list-servers.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/environments/list-servers/list-servers.controller.ts @@ -55,7 +55,9 @@ export class ListServersController { this.$mdDialog = $mdDialog; this.lodash = lodash; this.confirmDialogService = confirmDialogService; + } + $onInit(): void { this.buildServersList(); } 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 df5464c851c..318d6863f50 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,6 +57,9 @@ 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 { 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 a97c76e63b4..e2e3e776ce3 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,7 +34,9 @@ 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()); } diff --git a/dashboard/src/app/workspaces/workspace-details/environments/machine-config/machine-config.controller.ts b/dashboard/src/app/workspaces/workspace-details/environments/machine-config/machine-config.controller.ts index 70363038292..81fcdecd891 100644 --- a/dashboard/src/app/workspaces/workspace-details/environments/machine-config/machine-config.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/environments/machine-config/machine-config.controller.ts @@ -85,7 +85,9 @@ export class WorkspaceMachineConfigController { $timeout.cancel(this.timeoutPromise); } }); + } + $onInit(): void { this.init(); } 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 ace5af6b98e..40f9a2b492d 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,6 +31,7 @@ export class ExportWorkspaceDialogController { private cheRemote: CheRemote; private $window: ng.IWindowService; private lodash: any; + private $scope: ng.IScope; private editorOptions: any; private destination: string; @@ -64,6 +65,7 @@ export class ExportWorkspaceDialogController { this.$mdDialog = $mdDialog; this.$log = $log; this.$window = $window; + this.$scope = $scope; this.editorOptions = { lineWrapping : true, @@ -76,11 +78,13 @@ 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); - ($scope as any).selectedIndex = this.destination === 'file' ? 0 : 1; + (this.$scope as any).selectedIndex = this.destination === 'file' ? 0 : 1; } /** diff --git a/dashboard/src/app/workspaces/workspace-details/export-workspace/export-workspace.controller.ts b/dashboard/src/app/workspaces/workspace-details/export-workspace/export-workspace.controller.ts index 44341360277..2f8f5374eae 100644 --- a/dashboard/src/app/workspaces/workspace-details/export-workspace/export-workspace.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/export-workspace/export-workspace.controller.ts @@ -33,6 +33,8 @@ export class ExportWorkspaceController { this.$mdDialog = $mdDialog; } + $onInit(): void { } + showExport($event: MouseEvent, destination: string) { this.$mdDialog.show({ targetEvent: $event, @@ -50,5 +52,4 @@ export class ExportWorkspaceController { }); } - } 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 6a6d1b67efb..225572195db 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,7 +36,9 @@ 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; diff --git a/dashboard/src/app/workspaces/workspace-details/list-commands/list-commands.controller.ts b/dashboard/src/app/workspaces/workspace-details/list-commands/list-commands.controller.ts index 038aa62e8d6..d9b280f930d 100644 --- a/dashboard/src/app/workspaces/workspace-details/list-commands/list-commands.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/list-commands/list-commands.controller.ts @@ -49,6 +49,8 @@ export class ListCommandsController { this.commandsOrderBy = 'name'; } + $onInit(): void { } + /** * Update command selected status */ diff --git a/dashboard/src/app/workspaces/workspace-details/machine-selector/machine-selector.controller.ts b/dashboard/src/app/workspaces/workspace-details/machine-selector/machine-selector.controller.ts index e8923c27a93..5c87f9efe6b 100644 --- a/dashboard/src/app/workspaces/workspace-details/machine-selector/machine-selector.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/machine-selector/machine-selector.controller.ts @@ -88,15 +88,18 @@ export class MachineSelectorController { this.$scope = $scope; this.$timeout = $timeout; this.cheEnvironmentRegistry = cheEnvironmentRegistry; - this.init(this.workspaceDetails); + const action = this.init.bind(this); workspaceDetailsService.subscribeOnWorkspaceChange(action); - $scope.$on('$destroy', () => { workspaceDetailsService.subscribeOnWorkspaceChange(action); }); } + $onInit(): void { + this.init(this.workspaceDetails); + } + /** * Update workspace data. * @param workspaceDetails {che.IWorkspace} diff --git a/dashboard/src/app/workspaces/workspace-details/warnings/workspace-warnings.controller.ts b/dashboard/src/app/workspaces/workspace-details/warnings/workspace-warnings.controller.ts index c99eedce83f..01c02a55d04 100644 --- a/dashboard/src/app/workspaces/workspace-details/warnings/workspace-warnings.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/warnings/workspace-warnings.controller.ts @@ -31,11 +31,14 @@ export class WorkspaceWarningsController { */ constructor() { this.warnings = []; + } + $onInit(): void { if (this.workspace && this.workspace.runtime && this.workspace.runtime.warnings) { this.warnings = this.warnings.concat(this.workspace.runtime.warnings); } } + } 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 11fb53a4ddb..a2dd709ee6c 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-details.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-details.controller.ts @@ -167,6 +167,11 @@ export class WorkspaceDetailsController { }; } + $onInit(): void { + // this method won't be called here + // place all initialization code in constructor + } + /** * Returns `true` if supported. * diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-editors/workspace-editors.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-editors/workspace-editors.controller.ts index 0d20439f6b6..4a4778b0a86 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-editors/workspace-editors.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-editors/workspace-editors.controller.ts @@ -72,7 +72,9 @@ export class WorkspaceEditorsController { $scope.$on('$destroy', () => { deRegistrationFn(); }); + } + $onInit(): void { this.loadPlugins(); } 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 87da29d558d..41f1ab84a47 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,7 +37,9 @@ 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) : []; diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-machine-env-variables/env-variables.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-machine-env-variables/env-variables.controller.ts index c48fe37e61b..1e80c10c239 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-machine-env-variables/env-variables.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-machine-env-variables/env-variables.controller.ts @@ -52,7 +52,6 @@ export class EnvVariablesController { this.$mdDialog = $mdDialog; this.confirmDialogService = confirmDialogService; - this.buildVariablesList(this.selectedMachine); const deRegistrationFn = $scope.$watch(() => { return this.selectedMachine; }, (selectedMachine: IEnvironmentManagerMachine) => { @@ -64,6 +63,10 @@ export class EnvVariablesController { }); } + $onInit(): void { + this.buildVariablesList(this.selectedMachine); + } + /** * Build variables list. * @param selectedMachine {IEnvironmentManagerMachine} 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 d3f0f8c43a0..2ec1c27cc47 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,7 +45,9 @@ 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 = []; diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-machine-servers/machine-servers.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-machine-servers/machine-servers.controller.ts index 93e9f795fb1..405f3b984fd 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-machine-servers/machine-servers.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-machine-servers/machine-servers.controller.ts @@ -54,7 +54,6 @@ export class MachineServersController { this.$mdDialog = $mdDialog; this.confirmDialogService = confirmDialogService; - this.buildServersList(this.selectedMachine); const deRegistrationFn = $scope.$watch(() => { return this.selectedMachine; }, (selectedMachine: IEnvironmentManagerMachine) => { @@ -66,6 +65,10 @@ export class MachineServersController { }); } + $onInit(): void { + this.buildServersList(this.selectedMachine); + } + /** * Build servers list. * @param selectedMachine {IEnvironmentManagerMachine} 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 f1f802ebefb..0f9fb12d253 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,7 +38,9 @@ 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) : []; diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-machine-volumes/machine-volumes.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-machine-volumes/machine-volumes.controller.ts index 48ad83bc609..755924465c9 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-machine-volumes/machine-volumes.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-machine-volumes/machine-volumes.controller.ts @@ -61,6 +61,8 @@ export class MachineVolumesController { }); } + $onInit(): void { } + /** * Build variables list. * @param selectedMachine {IEnvironmentManagerMachine} 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 f5db768d22b..30061486343 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,7 +66,9 @@ export class EditMachineDialogController { this.$mdDialog = $mdDialog; this.cheEnvironmentRegistry = cheEnvironmentRegistry; this.cheRecipeService = cheRecipeService; + } + $onInit(): void { this.isAdd = angular.isUndefined(this.machineName); if (!this.environment) { return; @@ -80,7 +82,7 @@ export class EditMachineDialogController { return this.isAdd || machineName !== this.machineName; }); - this.environmentManager = this.cheEnvironmentRegistry.getEnvironmentManager(cheRecipeService.getRecipeType(this.currentStateEnvironment.recipe)); + this.environmentManager = this.cheEnvironmentRegistry.getEnvironmentManager(this.cheRecipeService.getRecipeType(this.currentStateEnvironment.recipe)); if (!this.environmentManager) { return; } @@ -88,7 +90,7 @@ export class EditMachineDialogController { this.editorMode = this.environmentManager.editorMode; if (this.isAdd) { - if (!cheRecipeService.isScalable(this.currentStateEnvironment.recipe)) { + if (!this.cheRecipeService.isScalable(this.currentStateEnvironment.recipe)) { // we can add a new machine in case with scalable type of recipes only return; } diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-machines/workspace-machines.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-machines/workspace-machines.controller.ts index 9c94df54772..2dc648b0a1c 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-machines/workspace-machines.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-machines/workspace-machines.controller.ts @@ -122,7 +122,6 @@ export class WorkspaceMachinesController { this.machines = []; this.cheListHelper = cheListHelperFactory.getHelper(MACHINE_LIST_HELPER_ID); - this.updateData(this.workspaceDetails); const action = this.updateData.bind(this); workspaceDetailsService.subscribeOnWorkspaceChange(action); @@ -132,6 +131,10 @@ export class WorkspaceMachinesController { }); } + $onInit(): void { + this.updateData(this.workspaceDetails); + } + /** * Returns true if the recipe type is scalable. * diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-overview/workspace-details-overview.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-overview/workspace-details-overview.controller.ts index 6a9e62ad6ca..9b0c2ccdd05 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-overview/workspace-details-overview.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-overview/workspace-details-overview.controller.ts @@ -33,6 +33,7 @@ export class WorkspaceDetailsOverviewController { onChange: Function; + private $scope: ng.IScope; private $q: ng.IQService; private $route: ng.route.IRouteService; private $location: ng.ILocationService; @@ -60,6 +61,7 @@ export class WorkspaceDetailsOverviewController { constructor($scope: ng.IScope, $q: ng.IQService, $route: ng.route.IRouteService, $timeout: ng.ITimeoutService, $location: ng.ILocationService, cheWorkspace: CheWorkspace, cheNotification: CheNotification, confirmDialogService: ConfirmDialogService, namespaceSelectorSvc: NamespaceSelectorSvc, workspaceDetailsService: WorkspaceDetailsService) { + this.$scope = $scope; this.$q = $q; this.$route = $route; this.$timeout = $timeout; @@ -69,13 +71,14 @@ export class WorkspaceDetailsOverviewController { this.confirmDialogService = confirmDialogService; this.namespaceSelectorSvc = namespaceSelectorSvc; this.workspaceDetailsService = workspaceDetailsService; + } - const routeParams = $route.current.params; + $onInit(): void { + const routeParams = this.$route.current.params; this.namespaceId = routeParams.namespace; this.workspaceName = routeParams.workspaceName; - this.init(); - const deRegistrationFn = $scope.$watch(() => { + const deRegistrationFn = this.$scope.$watch(() => { return this.workspaceDetails; }, (workspace: che.IWorkspace) => { if (!workspace) { @@ -84,9 +87,11 @@ export class WorkspaceDetailsOverviewController { this.init(); }, true); - $scope.$on('$destroy', () => { + this.$scope.$on('$destroy', () => { deRegistrationFn(); }); + + this.init(); } init(): void { diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-overview/workspace-details-overview.styl b/dashboard/src/app/workspaces/workspace-details/workspace-overview/workspace-details-overview.styl index 4775283dc73..3dd9906bf09 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-overview/workspace-details-overview.styl +++ b/dashboard/src/app/workspaces/workspace-details/workspace-overview/workspace-details-overview.styl @@ -27,8 +27,7 @@ background-color $che-button-gray-color !important border-color $che-button-gray-color box-shadow none !important - span - color $white-color + color $white-color !important &:hover background-color $che-button-gray-color !important che-brightness(80%) diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-plugins/workspace-plugins.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-plugins/workspace-plugins.controller.ts index 98df88612b6..57d9847cc58 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-plugins/workspace-plugins.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-plugins/workspace-plugins.controller.ts @@ -74,7 +74,9 @@ export class WorkspacePluginsController { $scope.$on('$destroy', () => { deRegistrationFn(); }); + } + $onInit(): void { this.loadPlugins(); } @@ -211,11 +213,11 @@ export class WorkspacePluginsController { * @returns {string} plugin ID */ private findInSelected(plugin: IPluginRow): string { - const selectedPluginId = this.selectedPlugins.find(selectedPluginId => { + const pluginId = this.selectedPlugins.find(selectedPluginId => { const partialId = `${plugin.publisher}/${plugin.name}/`; return selectedPluginId.indexOf(partialId) !== -1; }); - return !!selectedPluginId ? selectedPluginId : ''; + return !!pluginId ? pluginId : ''; } /** diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-projects/add-project-popover/add-project-popover.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-projects/add-project-popover/add-project-popover.controller.ts index fada8950a8d..554f4af6a6e 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-projects/add-project-popover/add-project-popover.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-projects/add-project-popover/add-project-popover.controller.ts @@ -42,6 +42,8 @@ export class AddProjectPopoverController { this.isOpen = false; } + $onInit(): void { } + /** * Callback which should be called when project templates are added. * diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-projects/project-item/project-item.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-projects/project-item/project-item.controller.ts index 5c62a5ecfde..1821d9c1305 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-projects/project-item/project-item.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-projects/project-item/project-item.controller.ts @@ -36,4 +36,7 @@ export class ProjectItemCtrl { this.$location = $location; this.cheWorkspace = cheWorkspace; } + + $onInit(): void { } + } diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-projects/workspace-details-projects.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-projects/workspace-details-projects.controller.ts index 573b2ab95a3..6eb5e76bc6d 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-projects/workspace-details-projects.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-projects/workspace-details-projects.controller.ts @@ -31,6 +31,7 @@ export class WorkspaceDetailsProjectsCtrl { static $inject = ['cheAPI', '$mdDialog', 'confirmDialogService', '$scope', 'cheListHelperFactory', 'randomSvc', 'createWorkspaceSvc', 'workspaceDetailsService', 'workspaceDetailsProjectsService']; + private cheAPI: CheAPI; /** * Material design Dialog service. */ @@ -85,6 +86,7 @@ export class WorkspaceDetailsProjectsCtrl { createWorkspaceSvc: CreateWorkspaceSvc, workspaceDetailsService: WorkspaceDetailsService, workspaceDetailsProjectsService: WorkspaceDetailsProjectsService) { + this.cheAPI = cheAPI; this.$mdDialog = $mdDialog; this.confirmDialogService = confirmDialogService; this.randomSvc = randomSvc; @@ -98,10 +100,6 @@ export class WorkspaceDetailsProjectsCtrl { cheListHelperFactory.removeHelper(helperId); }); - const preferences = cheAPI.getPreferences().getPreferences(); - this.workspaceDataManager = cheAPI.getWorkspace().getWorkspaceDataManager(); - this.profileCreationDate = preferences['che:created']; - this.projectFilter = {name: ''}; const workspaceEditWatcher = $scope.$on('edit-workspace-details', (event: ng.IAngularEvent, data: {status: string}) => { @@ -111,7 +109,6 @@ export class WorkspaceDetailsProjectsCtrl { } }); - this.updateProjectsData(this.workspaceDetails); const action = this.updateProjectsData.bind(this); workspaceDetailsService.subscribeOnWorkspaceChange(action); @@ -124,6 +121,14 @@ export class WorkspaceDetailsProjectsCtrl { }); } + $onInit(): void { + const preferences = this.cheAPI.getPreferences().getPreferences(); + this.workspaceDataManager = this.cheAPI.getWorkspace().getWorkspaceDataManager(); + this.profileCreationDate = preferences['che:created']; + + this.updateProjectsData(this.workspaceDetails); + } + /** * Callback when name is changed. * diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-ssh/workspace-details-ssh.controller.ts b/dashboard/src/app/workspaces/workspace-details/workspace-ssh/workspace-details-ssh.controller.ts index 10b702f5f51..037abcd618d 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-ssh/workspace-details-ssh.controller.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-ssh/workspace-details-ssh.controller.ts @@ -9,9 +9,9 @@ * Contributors: * Red Hat, Inc. - initial API and implementation */ -import {CheWorkspace} from '../../../../components/api/workspace/che-workspace.factory'; -import {CheNotification} from '../../../../components/notification/che-notification.factory'; -import {CheSsh} from '../../../../components/api/che-ssh.factory'; +import { CheWorkspace } from '../../../../components/api/workspace/che-workspace.factory'; +import { CheNotification } from '../../../../components/notification/che-notification.factory'; +import { CheSsh } from '../../../../components/api/che-ssh.factory'; 'use strict'; /** @@ -54,15 +54,15 @@ export class WorkspaceDetailsSshCtrl { */ private $q: ng.IQService; - private $timeout : ng.ITimeoutService; + private $timeout: ng.ITimeoutService; - private namespace : string; - private workspaceName : string; - private workspaceKey : string; - private workspace : any; + private namespace: string; + private workspaceName: string; + private workspaceKey: string; + private workspace: any; private workspaceId: string; - private sshKeyPair : any; + private sshKeyPair: any; /** * Loading state of the page. */ @@ -73,19 +73,19 @@ export class WorkspaceDetailsSshCtrl { */ private hasSSHAgents: boolean; - private machineSshAgents : Array<{agentEnabled : boolean, name: string}>; + private machineSshAgents: Array<{ agentEnabled: boolean, name: string }>; /** * Default constructor that is using resource */ constructor($route: ng.route.IRouteService, - cheSsh: CheSsh, - cheWorkspace: CheWorkspace, - cheNotification: CheNotification, - $mdDialog: ng.material.IDialogService, - $log: ng.ILogService, - $q: ng.IQService, - $timeout : ng.ITimeoutService) { + cheSsh: CheSsh, + cheWorkspace: CheWorkspace, + cheNotification: CheNotification, + $mdDialog: ng.material.IDialogService, + $log: ng.ILogService, + $q: ng.IQService, + $timeout: ng.ITimeoutService) { this.cheWorkspace = cheWorkspace; this.cheSsh = cheSsh; this.cheNotification = cheNotification; @@ -98,12 +98,12 @@ export class WorkspaceDetailsSshCtrl { this.namespace = $route.current.params.namespace; this.workspaceName = $route.current.params.workspaceName; this.workspaceKey = this.namespace + ':' + this.workspaceName; + } + $onInit(): void { this.updateData(); - } - updateData() { this.hasSSHAgents = false; this.workspace = this.cheWorkspace.getWorkspaceByName(this.namespace, this.workspaceName); @@ -117,13 +117,13 @@ export class WorkspaceDetailsSshCtrl { this.isLoading = false; }); - let defaultEnv : string = this.workspace.config.defaultEnv; - let machines : any = defaultEnv ? this.workspace.config.environments[defaultEnv].machines : []; - let machineNames : Array = Object.keys(machines); + let defaultEnv: string = this.workspace.config.defaultEnv; + let machines: any = defaultEnv ? this.workspace.config.environments[defaultEnv].machines : []; + let machineNames: Array = Object.keys(machines); this.machineSshAgents.length = 0; machineNames.forEach((machineName: string) => { - let enabled : boolean = machines[machineName].installers && machines[machineName].installers.indexOf('org.eclipse.che.ssh') >= 0; - let machineAgent = {agentEnabled : enabled, name: machineName}; + let enabled: boolean = machines[machineName].installers && machines[machineName].installers.indexOf('org.eclipse.che.ssh') >= 0; + let machineAgent = { agentEnabled: enabled, name: machineName }; this.machineSshAgents.push(machineAgent); if (enabled) { this.hasSSHAgents = true; diff --git a/dashboard/src/app/workspaces/workspace-ram-slider/che-workspace-ram-allocation-slider.controller.ts b/dashboard/src/app/workspaces/workspace-ram-slider/che-workspace-ram-allocation-slider.controller.ts index 97b2a61b3e3..2963ff54d92 100644 --- a/dashboard/src/app/workspaces/workspace-ram-slider/che-workspace-ram-allocation-slider.controller.ts +++ b/dashboard/src/app/workspaces/workspace-ram-slider/che-workspace-ram-allocation-slider.controller.ts @@ -38,6 +38,8 @@ export class CheWorkspaceRamAllocationSliderController { }); } + $onInit(): void { } + /** * Rounds value to first decimal * @param value: number original value diff --git a/dashboard/src/components/service/confirm-dialog/che-confirm-dialog.controller.ts b/dashboard/src/components/service/confirm-dialog/che-confirm-dialog.controller.ts index 9f0d6834c3e..908e21cc527 100644 --- a/dashboard/src/components/service/confirm-dialog/che-confirm-dialog.controller.ts +++ b/dashboard/src/components/service/confirm-dialog/che-confirm-dialog.controller.ts @@ -23,6 +23,8 @@ export class CheConfirmDialogController { content: string; title: string; + $onInit(): void { } + /** * It will hide the dialog box and reject it. */ diff --git a/dashboard/src/components/widget/dropzone/che-dropzone.controller.ts b/dashboard/src/components/widget/dropzone/che-dropzone.controller.ts index 28b637fa188..08f60519b73 100644 --- a/dashboard/src/components/widget/dropzone/che-dropzone.controller.ts +++ b/dashboard/src/components/widget/dropzone/che-dropzone.controller.ts @@ -39,6 +39,8 @@ export class CheDropZoneCtrl { this.lodash = lodash; } + $onInit(): void { } + dropCallback(evt: ICheDropZoneEventObject): void { evt.stopPropagation(); evt.preventDefault(); diff --git a/dashboard/src/components/widget/editor/che-editor.controller.ts b/dashboard/src/components/widget/editor/che-editor.controller.ts index ad98b52cef8..317c3248f6b 100644 --- a/dashboard/src/components/widget/editor/che-editor.controller.ts +++ b/dashboard/src/components/widget/editor/che-editor.controller.ts @@ -39,6 +39,8 @@ export class CheEditorController { static $inject = ['$timeout']; + $timeout: ng.ITimeoutService; + setEditorValue: (content: string) => void; /** * Editor options object. @@ -57,7 +59,7 @@ export class CheEditorController { /** * Editor state object. */ - private editorState: IEditorState = {isValid: true, errors: []}; + private editorState: IEditorState; /** * Custom validator callback. */ @@ -77,19 +79,24 @@ export class CheEditorController { /** * Cursor position. */ - private cursorPos: ICursorPos = {line: 0, ch: 0}; + private cursorPos: ICursorPos = { line: 0, ch: 0 }; /** * Default constructor that is using resource injection */ constructor($timeout: ng.ITimeoutService) { + this.$timeout = $timeout; + } + + $onInit(): void { + this.editorState = { isValid: true, errors: [] }; this.editorOptions = { mode: angular.isString(this.editorMode) ? this.editorMode : 'application/json', readOnly: this.editorReadOnly ? this.editorReadOnly : false, lineWrapping: true, lineNumbers: true, onLoad: (editor: IEditor) => { - $timeout(() => { + this.$timeout(() => { //to avoid Ctrl+Z clear the content editor.getDoc().clearHistory(); editor.refresh(); @@ -99,14 +106,14 @@ export class CheEditorController { doc.setValue(content); }; editor.on('change', () => { - const {line, ch} = editor.getCursor(); + const { line, ch } = editor.getCursor(); if (line === 0 && ch === 0) { editor.setCursor(this.cursorPos); } else { this.cursorPos.ch = ch; this.cursorPos.line = line; } - $timeout(() => { + this.$timeout(() => { this.editorState.errors.length = 0; let editorErrors: Array<{ id: string; message: string }> = doc.getAllMarks().filter((mark: any) => { return mark.className && mark.className.includes('error'); @@ -120,7 +127,7 @@ export class CheEditorController { } else { message = 'Parse error'; } - return {id: mark.id, message: message}; + return { id: mark.id, message: message }; }); editorErrors.forEach((editorError: { id: string; message: string }) => { if (!editorError || !editorError.message) { @@ -142,7 +149,7 @@ export class CheEditorController { } this.editorState.isValid = this.editorState.errors.length === 0; if (angular.isFunction(this.onContentChange)) { - this.onContentChange({editorState: this.editorState}); + this.onContentChange({ editorState: this.editorState }); } this.editorForm.$setValidity('custom-validator', this.editorState.isValid, null); diff --git a/dashboard/src/components/widget/filter-selector/che-filter-selector.controller.ts b/dashboard/src/components/widget/filter-selector/che-filter-selector.controller.ts index 3459728d6f8..870493e65c4 100644 --- a/dashboard/src/components/widget/filter-selector/che-filter-selector.controller.ts +++ b/dashboard/src/components/widget/filter-selector/che-filter-selector.controller.ts @@ -29,6 +29,7 @@ export class CheFilterSelectorController { this.width = this.width || '150px'; } + $onInit(): void { } /** * Performs value selection and calls value changed handler. diff --git a/dashboard/src/components/widget/footer/che-footer.controller.ts b/dashboard/src/components/widget/footer/che-footer.controller.ts index d01029e5731..9141aa29f30 100644 --- a/dashboard/src/components/widget/footer/che-footer.controller.ts +++ b/dashboard/src/components/widget/footer/che-footer.controller.ts @@ -19,6 +19,8 @@ */ export class CheFooterController { + $onInit(): void { } + /** * Returns 'Make a wish' email subject. * diff --git a/dashboard/src/components/widget/learn-more/che-learn-more.controller.ts b/dashboard/src/components/widget/learn-more/che-learn-more.controller.ts index e15d1241d3b..1b6e400bac7 100644 --- a/dashboard/src/components/widget/learn-more/che-learn-more.controller.ts +++ b/dashboard/src/components/widget/learn-more/che-learn-more.controller.ts @@ -48,16 +48,6 @@ export class CheLearnMoreCtrl { // current index is first one this.currentIndex = 0; - let preferences = this.chePreferences.getPreferences(); - let promise = preferences.$promise; - - promise.then(() => { - let selectedIndexInPreferences = preferences[this.WIDGET_PREFERENCES_PREFIX + 'selected-index']; - if (selectedIndexInPreferences) { - this.currentIndex = parseInt(selectedIndexInPreferences, 10); - } - }); - // by default, all icons are disabled this.stateIcons = []; @@ -70,6 +60,16 @@ export class CheLearnMoreCtrl { this.$scope.$on('cheLearnMore:updateState', (event: ng.IAngularEvent, data: any) => { this.updateState(data); }); + } + + $onInit(): void { + const preferences = this.chePreferences.getPreferences(); + preferences.$promise.then(() => { + let selectedIndexInPreferences = preferences[this.WIDGET_PREFERENCES_PREFIX + 'selected-index']; + if (selectedIndexInPreferences) { + this.currentIndex = parseInt(selectedIndexInPreferences, 10); + } + }); this.compileTemplate(); } diff --git a/dashboard/src/components/widget/panel/che-panel.controller.ts b/dashboard/src/components/widget/panel/che-panel.controller.ts index 9fcda99a76d..8e7fe48e91b 100644 --- a/dashboard/src/components/widget/panel/che-panel.controller.ts +++ b/dashboard/src/components/widget/panel/che-panel.controller.ts @@ -42,6 +42,8 @@ export class ChePanelCtrl { this.$scope = $scope; } + $onInit(): void { } + /** * Sets the id * @param id diff --git a/dashboard/src/components/widget/selecter/che-selecter.controller.ts b/dashboard/src/components/widget/selecter/che-selecter.controller.ts index eb5dfdf4b44..d2283b708b1 100644 --- a/dashboard/src/components/widget/selecter/che-selecter.controller.ts +++ b/dashboard/src/components/widget/selecter/che-selecter.controller.ts @@ -34,6 +34,8 @@ export class CheSelecterCtrl { this.selectedValuesByKey = new Map(); } + $onInit(): void { } + /** * perform sharing state in an upper scope as it may be shared */ diff --git a/dashboard/src/components/widget/toggle-button/che-toggle.controller.ts b/dashboard/src/components/widget/toggle-button/che-toggle.controller.ts index ba02c9ccdf1..6c17de1b671 100644 --- a/dashboard/src/components/widget/toggle-button/che-toggle.controller.ts +++ b/dashboard/src/components/widget/toggle-button/che-toggle.controller.ts @@ -28,6 +28,8 @@ export class CheToggleController { this.$scope = $scope; } + $onInit(): void { } + getSelected(): string { return (this.$scope as any).setupModelController.$viewValue; } diff --git a/dashboard/yarn.lock b/dashboard/yarn.lock index 90f9142936b..a7c709ffc32 100644 --- a/dashboard/yarn.lock +++ b/dashboard/yarn.lock @@ -208,25 +208,25 @@ amdefine@>=0.0.4: resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" integrity sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU= -angular-animate@1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/angular-animate/-/angular-animate-1.4.8.tgz#2c388a066d16677aecbebbddaf27a217f7002a57" - integrity sha1-LDiKBm0WZ3rsvrvdryeiF/cAKlc= +angular-animate@1.6.10: + version "1.6.10" + resolved "https://registry.yarnpkg.com/angular-animate/-/angular-animate-1.6.10.tgz#c520f6d341370e34e0a62060c99bcf47b7d7db8c" + integrity sha512-RU9ZJbTspq0W0x675H5k1DeSgKbAFfp2aiYoNGdlD+wQNKvwwMR5ho+EkDKkx9zE02a5goe8Z6EhhYPQSff9dA== -angular-aria@1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/angular-aria/-/angular-aria-1.4.8.tgz#ddea768ad30b58f875e5181141a7ffa9cd100e8e" - integrity sha1-3ep2itMLWPh15RgRQaf/qc0QDo4= +angular-aria@1.6.10: + version "1.6.10" + resolved "https://registry.yarnpkg.com/angular-aria/-/angular-aria-1.6.10.tgz#472bfff8682c4cfe634d4bfda0524443e07e3501" + integrity sha512-QO+jSbsnGxLhULD8syFvfH0sQVCKCwDPDCd130ou11HYw4D8vAaU/NG6ufcmnh9XJHTcngAaBe3VVfZefMkiBA== angular-bootstrap@^0.12.2: version "0.12.2" resolved "https://registry.yarnpkg.com/angular-bootstrap/-/angular-bootstrap-0.12.2.tgz#de9900a7db087a7e9da47304a9c2f77f9c069827" integrity sha1-3pkAp9sIen6dpHMEqcL3f5wGmCc= -angular-cookies@1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/angular-cookies/-/angular-cookies-1.4.8.tgz#07db4bba0234053c64123e958f1ad317d8fd1ed7" - integrity sha1-B9tLugI0BTxkEj6VjxrTF9j9Htc= +angular-cookies@1.6.10: + version "1.6.10" + resolved "https://registry.yarnpkg.com/angular-cookies/-/angular-cookies-1.6.10.tgz#20a014d501242e2edacd21397c0e5480e08dee00" + integrity sha512-ADfbqXLhwcaecAiWIaxpl8XWFJgWsrDl/ksSEkYm5dSoXHYlj3HKlAhPbjBv/foYS7pdI0apmSGHWrBPqdjF/g== angular-file-upload@2.0.0: version "2.0.0" @@ -254,15 +254,15 @@ angular-material@1.0.1: resolved "https://registry.yarnpkg.com/angular-material/-/angular-material-1.0.1.tgz#cc4000a1eb2ff6ca16a47d13759919011c7790dd" integrity sha1-zEAAoesv9soWpH0TdZkZARx3kN0= -angular-messages@1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/angular-messages/-/angular-messages-1.4.8.tgz#2fa529d59abcdb666430fe5443b9c5cba8380fd4" - integrity sha1-L6Up1Zq822ZkMP5UQ7nFy6g4D9Q= +angular-messages@1.6.10: + version "1.6.10" + resolved "https://registry.yarnpkg.com/angular-messages/-/angular-messages-1.6.10.tgz#09eedc5b50db99eeed9776414428c587c1259715" + integrity sha512-FpILIYqeBj2fP5U5txnO/cneeKZxdF+WqpBo7tgHXl2BmOVVWKUCEjMmByouYxwn9PFLeipBPjaaDs2/eB/m5A== -angular-mocks@1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/angular-mocks/-/angular-mocks-1.4.8.tgz#1497426d480862ca8b1f637e9c2fc1a1df664208" - integrity sha1-FJdCbUgIYsqLH2N+nC/Bod9mQgg= +angular-mocks@1.6.10: + version "1.6.10" + resolved "https://registry.yarnpkg.com/angular-mocks/-/angular-mocks-1.6.10.tgz#6a139e43c461d0c9a5a1acebc91e63db16031176" + integrity sha512-1865/NmqHNogibNoglY1MGBjx882iu2hI46BBhYDWyz0C4TDM5ER8H8SnYwQKUUG4RXMDsJizszEQ2BEoYKV9w== angular-moment@0.9.0: version "0.9.0" @@ -271,25 +271,25 @@ angular-moment@0.9.0: dependencies: moment ">=2.8.0 <2.10.0" -angular-resource@1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/angular-resource/-/angular-resource-1.4.8.tgz#aa3168ad2b98ffdfea2208c465cce6f4ca0a0d37" - integrity sha1-qjForSuY/9/qIgjEZczm9MoKDTc= +angular-resource@1.6.10: + version "1.6.10" + resolved "https://registry.yarnpkg.com/angular-resource/-/angular-resource-1.6.10.tgz#28c1834e9fa623467d2f9894716a4e6c7e077459" + integrity sha512-jrYXUGPtpv/lTBlYZ6HZefIV6Lb+6e1HUavBPg9TSzW7s4zYRBWzMj6vMg8gZzVjWdH/nYBWfilV0qfnmZSI+A== -angular-route@1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/angular-route/-/angular-route-1.4.8.tgz#dffb646fa7ea10f29870875d60bd3729fe217cb7" - integrity sha1-3/tkb6fqEPKYcIddYL03Kf4hfLc= +angular-route@1.6.10: + version "1.6.10" + resolved "https://registry.yarnpkg.com/angular-route/-/angular-route-1.6.10.tgz#4247a32eab19495624623e96c1626dfba17ebf21" + integrity sha512-BxjrjQNCbVqQKyB3nHjNI8zSUwhnQWFZnSBv5BZ336VbMKhWu74ad5xpFx5VMk6WyHlmMGDoRagzB6AKkRcvKA== -angular-sanitize@1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.4.8.tgz#43a6d79b65ec8c9d5f6651b945493e585f83d713" - integrity sha1-Q6bXm2XsjJ1fZlG5RUk+WF+D1xM= +angular-sanitize@1.6.10: + version "1.6.10" + resolved "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.6.10.tgz#635a362afb2dd040179f17d3a5455962b2c1918f" + integrity sha512-01i1Xoq9ykUrsoYQMSB6dWZmPp9Df5hfCqMAGGzJBWZ7L2WY0OtUphdI0YvR8ZF9lAsWtGNtsEFilObjq5nTgQ== -angular-touch@1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/angular-touch/-/angular-touch-1.4.8.tgz#4a340b7c3398439488014d76d166b4bcc129e012" - integrity sha1-SjQLfDOYQ5SIAU120Wa0vMEp4BI= +angular-touch@1.6.10: + version "1.6.10" + resolved "https://registry.yarnpkg.com/angular-touch/-/angular-touch-1.6.10.tgz#bd51fa48bd2c2c477fea776817535601e6340c2f" + integrity sha512-ZblW46aN5s7OOihpXDa0qzrJXdaVGE44jc+a8e1NpOjhCKZDQze+nBHh3xw3toAF1BIfDJIkRstadk4h2R/uLg== angular-ui-bootstrap@1.1.2: version "1.1.2" @@ -314,10 +314,10 @@ angular@*: resolved "https://registry.yarnpkg.com/angular/-/angular-1.7.5.tgz#d1c1c01c6f5dc835638f3f9aa51012857bdac49e" integrity sha512-760183yxtGzni740IBTieNuWLtPNAoMqvmC0Z62UoU0I3nqk+VJuO3JbQAXOyvo3Oy/ZsdNQwrSTh/B0OQZjNw== -angular@1.4.8: - version "1.4.8" - resolved "https://registry.yarnpkg.com/angular/-/angular-1.4.8.tgz#f4573d5019d21ebf44a6b5c28a14fbd9d5967449" - integrity sha1-9Fc9UBnSHr9EprXCihT72dWWdEk= +angular@1.6.10: + version "1.6.10" + resolved "https://registry.yarnpkg.com/angular/-/angular-1.6.10.tgz#eed3080a34d29d0f681ff119b18ce294e3f74826" + integrity sha512-PCZ5/hVdvPQiYyH0VwsPjrErPHRcITnaXxhksceOXgtJeesKHLA7KDu4X/yvcAi+1zdGgGF+9pDxkJvghXI9Wg== ansi-align@^1.1.0: version "1.1.0" @@ -6972,10 +6972,10 @@ lodash.values@~2.4.1: dependencies: lodash.keys "~2.4.1" -lodash@4.17.11, lodash@^4.0.0, lodash@^4.0.1, lodash@^4.12.0, lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.4: - version "4.17.11" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" - integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== +lodash@4.17.15: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== lodash@^2.4.1, lodash@~2.4.1: version "2.4.2" @@ -6987,6 +6987,11 @@ lodash@^3.10.1, lodash@^3.3.1, lodash@^3.6.0, lodash@^3.8.0, lodash@^3.9.3: resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" integrity sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y= +lodash@^4.0.0, lodash@^4.0.1, lodash@^4.12.0, lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.4: + version "4.17.11" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" + integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== + lodash@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/lodash/-/lodash-1.0.2.tgz#8f57560c83b59fc270bd3d561b690043430e2551" diff --git a/workspace-loader/package.json b/workspace-loader/package.json index 57e5e72c078..dc1ba3e8fba 100644 --- a/workspace-loader/package.json +++ b/workspace-loader/package.json @@ -35,7 +35,7 @@ }, "dependencies": { "@eclipse-che/api": "^7.0.0-beta-4.0-80162ea6d2", - "lodash": "4.17.11", + "lodash": "4.17.15", "reconnecting-websocket": "3.2.2" }, "jest": { diff --git a/workspace-loader/yarn.lock b/workspace-loader/yarn.lock index d5054e8daa4..4536ac4fba6 100644 --- a/workspace-loader/yarn.lock +++ b/workspace-loader/yarn.lock @@ -4037,10 +4037,10 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@4.17.11: - version "4.17.11" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" - integrity sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg== +lodash@4.17.15: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== lodash@^4.13.1, lodash@^4.17.10, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.17.5: version "4.17.10" From 5ab2bdcccee2e7d7b94a935f5914bfdc7d750838 Mon Sep 17 00:00:00 2001 From: Oleksii Kurinnyi Date: Fri, 23 Aug 2019 17:39:46 +0300 Subject: [PATCH 2/5] fix unit tests Signed-off-by: Oleksii Kurinnyi --- .../recent-workspaces.controller.spec.ts | 6 ++-- .../workspace-details.directive.spec.ts | 35 ++++++++++++------- .../src/components/api/che-team.factory.ts | 2 ++ .../components/api/test/che-http-backend.ts | 4 +++ ...unique-factory-name-validator.directive.ts | 2 ++ 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/dashboard/src/app/navbar/recent-workspaces/recent-workspaces.controller.spec.ts b/dashboard/src/app/navbar/recent-workspaces/recent-workspaces.controller.spec.ts index a344ba874c0..84359510a63 100644 --- a/dashboard/src/app/navbar/recent-workspaces/recent-workspaces.controller.spec.ts +++ b/dashboard/src/app/navbar/recent-workspaces/recent-workspaces.controller.spec.ts @@ -15,6 +15,7 @@ import {CheAPIBuilder} from '../../../components/api/builder/che-api-builder.fac import {CheHttpBackend} from '../../../components/api/test/che-http-backend'; import IdeSvc from '../../ide/ide.service'; import {CheBranding} from '../../../components/branding/che-branding.factory'; +import { NavbarRecentWorkspacesController } from './recent-workspaces.controller'; /** * Test of the NavbarRecentWorkspacesController @@ -23,7 +24,7 @@ describe('NavbarRecentWorkspacesController', () => { /** * NavbarRecentWorkspacesController */ - let navbarRecentWorkspacesController; + let navbarRecentWorkspacesController: NavbarRecentWorkspacesController; /** * API builder @@ -82,8 +83,7 @@ describe('NavbarRecentWorkspacesController', () => { // setup backend cheBackend.setup(); - // fetch workspaces - cheWorkspace.fetchWorkspaces(); + navbarRecentWorkspacesController.$onInit(); // flush command httpBackend.flush(); diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-details.directive.spec.ts b/dashboard/src/app/workspaces/workspace-details/workspace-details.directive.spec.ts index 0911425c80f..fae4eb8ac89 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-details.directive.spec.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-details.directive.spec.ts @@ -161,6 +161,17 @@ describe(`WorkspaceDetailsController >`, () => { } subscriptions[workspaceId].push(action); }; + this.unsubscribeOnWorkspaceChange = (workspaceId: string, action: Function): void => { + const actions = subscriptions[workspaceId]; + if (actions === undefined) { + return; + } + const index = actions.indexOf(action); + if (index === -1) { + return; + } + actions.splice(index, 1); + }; this.getWorkspaceById = (workspaceId: string): che.IWorkspace => { return workspace; }; @@ -286,7 +297,7 @@ describe(`WorkspaceDetailsController >`, () => { describe(`overflow panel >`, () => { function getOverlayPanelEl(): ng.IAugmentedJQuery { - return compiledDirective.find('.che-edit-mode-overlay'); + return compiledDirective.find('che-edit-mode-overlay'); } function getSaveButton(): ng.IAugmentedJQuery { return compiledDirective.find('.save-button button'); @@ -300,7 +311,7 @@ describe(`WorkspaceDetailsController >`, () => { it(`should be hidden initially >`, () => { compileDirective(); - expect(getOverlayPanelEl().length).toEqual(0); + expect(getOverlayPanelEl().children().length).toEqual(0); }); describe(`when config is changed >`, () => { @@ -343,7 +354,7 @@ describe(`WorkspaceDetailsController >`, () => { }); it(`the overlay panel should be hidden >`, () => { - expect(getOverlayPanelEl().length).toEqual(0); + expect(getOverlayPanelEl().children().length).toEqual(0); }); }); @@ -360,7 +371,7 @@ describe(`WorkspaceDetailsController >`, () => { }); it(`the overlay panel should be hidden >`, () => { - expect(getOverlayPanelEl().length).toEqual(0); + expect(getOverlayPanelEl().children().length).toEqual(0); }); }); @@ -403,7 +414,7 @@ describe(`WorkspaceDetailsController >`, () => { }); it(`the overlay panel should be hidden >`, () => { - expect(getOverlayPanelEl().length).toEqual(0); + expect(getOverlayPanelEl().children().length).toEqual(0); }); }); @@ -446,7 +457,7 @@ describe(`WorkspaceDetailsController >`, () => { }); it(`the overlay panel should be hidden >`, () => { - expect(getOverlayPanelEl().length).toEqual(0); + expect(getOverlayPanelEl().children().length).toEqual(0); }); }); @@ -497,7 +508,7 @@ describe(`WorkspaceDetailsController >`, () => { }); it(`the overlay panel should be hidden >`, () => { - expect(getOverlayPanelEl().length).toEqual(0); + expect(getOverlayPanelEl().children().length).toEqual(0); }); }); @@ -514,7 +525,7 @@ describe(`WorkspaceDetailsController >`, () => { }); it(`the overlay panel should be hidden >`, () => { - expect(getOverlayPanelEl().length).toEqual(0); + expect(getOverlayPanelEl().children().length).toEqual(0); }); }); @@ -554,7 +565,7 @@ describe(`WorkspaceDetailsController >`, () => { }); it(`the overlay panel should be hidden >`, () => { - expect(getOverlayPanelEl().length).toEqual(0); + expect(getOverlayPanelEl().children().length).toEqual(0); }); }); @@ -571,7 +582,7 @@ describe(`WorkspaceDetailsController >`, () => { }); it(`the overlay panel should be hidden >`, () => { - expect(getOverlayPanelEl().length).toEqual(0); + expect(getOverlayPanelEl().children().length).toEqual(0); }); }); @@ -589,7 +600,7 @@ describe(`WorkspaceDetailsController >`, () => { .and .callFake(() => { return false; - }); + }); controller.workspacesService.isSupportedRecipeType = jasmine.createSpy('workspaceDetailsController.isSupportedRecipeType') .and .callFake(() => { @@ -627,7 +638,7 @@ describe(`WorkspaceDetailsController >`, () => { }); it(`the overlay panel should be hidden >`, () => { - expect(getOverlayPanelEl().length).toEqual(0); + expect(getOverlayPanelEl().children().length).toEqual(0); }); }); diff --git a/dashboard/src/components/api/che-team.factory.ts b/dashboard/src/components/api/che-team.factory.ts index b33bc7345fe..545379570fc 100644 --- a/dashboard/src/components/api/che-team.factory.ts +++ b/dashboard/src/components/api/che-team.factory.ts @@ -108,6 +108,8 @@ export class CheTeam implements che.api.ICheTeam { cheTeamEventsManager.addNewTeamHandler(() => { this.fetchTeams(); }); + + this.fetchTeams(); // this resolves `cheNamespaceRegistry.fetchNamespaces()` as well } /** diff --git a/dashboard/src/components/api/test/che-http-backend.ts b/dashboard/src/components/api/test/che-http-backend.ts index 400b068ce79..9aa3a18257a 100644 --- a/dashboard/src/components/api/test/che-http-backend.ts +++ b/dashboard/src/components/api/test/che-http-backend.ts @@ -93,6 +93,10 @@ export class CheHttpBackend { * Setup all data that should be retrieved on calls */ setup(): void { + this.$httpBackend.when('GET', '/api/oauth/').respond(200, []); + this.$httpBackend.when('GET', 'https://api.github.com/user/orgs').respond(200, {}); + this.$httpBackend.when('GET', 'https://api.github.com/user').respond(200, {}); + this.$httpBackend.when('OPTIONS', '/api/').respond({}); this.$httpBackend.when('GET', '/api/').respond(200, {rootResources: []}); diff --git a/dashboard/src/components/validator/unique-factory-name-validator.directive.ts b/dashboard/src/components/validator/unique-factory-name-validator.directive.ts index ffbc4925fe5..955772f1286 100644 --- a/dashboard/src/components/validator/unique-factory-name-validator.directive.ts +++ b/dashboard/src/components/validator/unique-factory-name-validator.directive.ts @@ -86,6 +86,8 @@ export class UniqueFactoryNameValidator implements ng.IDirective { } else { deferred.resolve(true); } + }).catch(() => { + // this fixes unit test for the directive }); } From 41444497e9868e03f416aafb7bc024d89e792c7f Mon Sep 17 00:00:00 2001 From: Oleksii Kurinnyi Date: Thu, 5 Sep 2019 16:30:35 +0300 Subject: [PATCH 3/5] fix tests for Che Multiuser Signed-off-by: Oleksii Kurinnyi --- dashboard/src/app/navbar/navbar.controller.ts | 20 +++++++++++++------ .../list-organizations.controller.ts | 3 --- .../organization-details.controller.ts | 5 +++-- .../organization-details.html | 1 + .../organization-member-dialog.controller.ts | 2 -- .../create-workspace/create-workspace.html | 2 +- .../create-workspace/create-workspace.styl | 2 +- .../import-github-project.controller.ts | 2 +- .../import-github-project.html | 2 +- .../import-github-project.styl | 2 +- .../project-source-selector.html | 3 ++- .../components/api/che-permissions.factory.ts | 2 ++ .../pageobject/dashboard/AddOrImportForm.java | 2 +- .../pageobject/dashboard/ConfirmDialog.java | 5 +++-- .../dashboard/DashboardFactories.java | 3 ++- .../pageobject/dashboard/NewWorkspace.java | 2 +- .../dashboard/ProjectSourcePage.java | 3 ++- .../dashboard/organization/AddMember.java | 3 +-- .../organization/OrganizationListPage.java | 6 ++++-- .../organization/OrganizationPage.java | 3 ++- .../workspaces/WorkspaceDetails.java | 5 +++-- 21 files changed, 46 insertions(+), 32 deletions(-) diff --git a/dashboard/src/app/navbar/navbar.controller.ts b/dashboard/src/app/navbar/navbar.controller.ts index 1fe20f5141e..01c9c8727b3 100644 --- a/dashboard/src/app/navbar/navbar.controller.ts +++ b/dashboard/src/app/navbar/navbar.controller.ts @@ -109,9 +109,13 @@ export class CheNavBarController { if (this.chePermissions.getSystemPermissions()) { this.updateData(); } else { - this.chePermissions.fetchSystemPermissions().finally(() => { - this.updateData(); - }); + this.chePermissions.fetchSystemPermissions() + .catch((error: any) => { + // noop + }) + .finally(() => { + this.updateData(); + }); } } }); @@ -136,9 +140,13 @@ export class CheNavBarController { organization.fetchOrganizations().then(() => { this.organizations = organization.getOrganizations(); const user = this.cheAPI.getUser().getUser(); - organization.fetchOrganizationByName(user.name).finally(() => { - this.hasPersonalAccount = angular.isDefined(organization.getOrganizationByName(user.name)); - }); + organization.fetchOrganizationByName(user.name) + .catch((error: any) => { + // noop + }) + .finally(() => { + this.hasPersonalAccount = angular.isDefined(organization.getOrganizationByName(user.name)); + }); }); } diff --git a/dashboard/src/app/organizations/list-organizations/list-organizations.controller.ts b/dashboard/src/app/organizations/list-organizations/list-organizations.controller.ts index eea156888cf..6c68604e516 100644 --- a/dashboard/src/app/organizations/list-organizations/list-organizations.controller.ts +++ b/dashboard/src/app/organizations/list-organizations/list-organizations.controller.ts @@ -178,9 +178,6 @@ export class ListOrganizationsController { * Process organization - retrieving additional data. */ processOrganizations(): void { - if (angular.isUndefined(this.organizations)) { - return; - } if (this.parentName) { const parentOrganization = this.cheOrganization.getOrganizationByName(this.parentName); this.parentId = parentOrganization ? parentOrganization.id : null; diff --git a/dashboard/src/app/organizations/organization-details/organization-details.controller.ts b/dashboard/src/app/organizations/organization-details/organization-details.controller.ts index 7ec96b3a7aa..29ec249ea71 100644 --- a/dashboard/src/app/organizations/organization-details/organization-details.controller.ts +++ b/dashboard/src/app/organizations/organization-details/organization-details.controller.ts @@ -224,7 +224,8 @@ export class OrganizationDetailsController { * @param {string} tab */ updateSelectedTab(tab: string): void { - this.selectedTabIndex = parseInt(this.tab[tab], 10); + const tabIndex = parseInt(this.tab[tab], 10); + this.selectedTabIndex = isNaN(tabIndex) ? 0 : tabIndex; } /** @@ -233,7 +234,7 @@ export class OrganizationDetailsController { * @param {number} tabIndex */ onSelectTab(tabIndex?: number): void { - let param: { tab?: string } = {}; + const param: { tab?: string } = {}; if (angular.isDefined(tabIndex)) { param.tab = Tab[tabIndex]; } diff --git a/dashboard/src/app/organizations/organization-details/organization-details.html b/dashboard/src/app/organizations/organization-details/organization-details.html index 16470206f0a..5dccff3f6ba 100644 --- a/dashboard/src/app/organizations/organization-details/organization-details.html +++ b/dashboard/src/app/organizations/organization-details/organization-details.html @@ -152,6 +152,7 @@ che-label-name="Delete Organization" che-label-description="This is irreversible. Deleting your organization will also destroy organization workspaces and stacks."> 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 76be8c7be71..fdf955ea1dc 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 @@ -118,9 +118,7 @@ export class OrganizationMemberDialogController { this.resourcesService = resourcesService; this.isProcessing = false; - } - $onInit(): void { this.organizationRoles = this.resourcesService.getOrganizationRoles(); this.emails = []; diff --git a/dashboard/src/app/workspaces/create-workspace/create-workspace.html b/dashboard/src/app/workspaces/create-workspace/create-workspace.html index 1af842e838b..23b9d199917 100644 --- a/dashboard/src/app/workspaces/create-workspace/create-workspace.html +++ b/dashboard/src/app/workspaces/create-workspace/create-workspace.html @@ -61,7 +61,7 @@ -