Skip to content

Commit

Permalink
moved showIDE logic into the routeChange listener
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Orel <oorel@redhat.com>
  • Loading branch information
olexii4 committed Jun 19, 2017
1 parent 2ca7488 commit 5538f93
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 124 deletions.
11 changes: 3 additions & 8 deletions dashboard/src/app/administration/administration-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,24 @@
'use strict';


import {AdministrationController} from './administration.controller';
import {DockerRegistryList} from './docker-registry/docker-registry-list/docker-registry-list.directive';
import {DockerRegistryListController} from './docker-registry/docker-registry-list/docker-registry-list.controller';
import {EditRegistryController} from './docker-registry/docker-registry-list/edit-registry/edit-registry.controller';


export class AdministrationConfig {

constructor(register) {
register.controller('AdministrationController', AdministrationController);

constructor(register: che.IRegisterService) {
register.directive('dockerRegistryList', DockerRegistryList);
register.controller('DockerRegistryListController', DockerRegistryListController);

register.controller('EditRegistryController', EditRegistryController);

// config routes
register.app.config(($routeProvider) => {
register.app.config(($routeProvider: ng.route.IRouteProvider) => {
$routeProvider.accessWhen('/administration', {
title: 'Administration',
templateUrl: 'app/administration/administration.html',
controller: 'AdministrationController',
controllerAs: 'administrationController'
templateUrl: 'app/administration/administration.html'
});
});

Expand Down
30 changes: 0 additions & 30 deletions dashboard/src/app/administration/administration.controller.ts

This file was deleted.

14 changes: 5 additions & 9 deletions dashboard/src/app/dashboard/dashboard-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,30 @@
*/
'use strict';

import {DashboardController} from './dashboard.controller';
import {DashboardLastWorkspacesController} from './last-workspaces/last-workspaces.controller';
import {DashboardLastWorkspaces} from './last-workspaces/last-workspaces.directive';
import {DashboardPanel} from './dashboard-panel/dashboard-panel.directive';
import {CheService} from '../../components/api/che-service.factory';
import {CheWorkspace} from '../../components/api/che-workspace.factory';

export class DashboardConfig {

constructor(register) {
constructor(register: che.IRegisterService) {

// last workspaces
register.controller('DashboardLastWorkspacesController', DashboardLastWorkspacesController);
register.directive('dashboardLastWorkspaces', DashboardLastWorkspaces);

// controller
register.controller('DashboardController', DashboardController);

// panel of last used entries
register.directive('dashboardPanel', DashboardPanel);

// config routes
register.app.config(($routeProvider) => {
register.app.config(($routeProvider: ng.route.IRouteProvider) => {
$routeProvider.accessWhen('/', {
title: 'Dashboard',
templateUrl: 'app/dashboard/dashboard.html',
controller: 'DashboardController',
controllerAs: 'dashboardController',
resolve: {
check: ['$q', '$location', 'cheWorkspace', 'cheService', ($q, $location, cheWorkspace, cheService) => {
check: ['$q', '$location', 'cheWorkspace', 'cheService', ($q: ng.IQService, $location: ng.ILocationService, cheWorkspace: CheWorkspace, cheService: CheService) => {
cheWorkspace.fetchWorkspaces().then(() => {
if (cheWorkspace.getWorkspaces().length === 0) {
$location.path('/create-project');
Expand Down
30 changes: 0 additions & 30 deletions dashboard/src/app/dashboard/dashboard.controller.spec.ts

This file was deleted.

31 changes: 0 additions & 31 deletions dashboard/src/app/dashboard/dashboard.controller.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class ListFactoriesController {
* Default constructor that is using resource injection
* @ngInject for Dependency injection
*/
constructor($q: ng.IQService, $log: ng.ILogService, cheAPI: CheAPI, cheNotification: CheNotification, $rootScope: che.IRootScopeService,
constructor($q: ng.IQService, $log: ng.ILogService, cheAPI: CheAPI, cheNotification: CheNotification,
confirmDialogService: ConfirmDialogService, $scope: ng.IScope, cheListHelperFactory: che.widget.ICheListHelperFactory) {
this.$q = $q;
this.$log = $log;
Expand Down Expand Up @@ -72,8 +72,6 @@ export class ListFactoriesController {
});

this.pagesInfo = cheAPI.getFactory().getPagesInfo();

$rootScope.showIDE = false;
}

/**
Expand Down
1 change: 0 additions & 1 deletion dashboard/src/app/ide/ide.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class IdeCtrl {
this.cheWorkspace = cheWorkspace;
this.$timeout = $timeout;

this.$rootScope.showIDE = false;
this.$rootScope.wantTokeepLoader = true;

this.selectedWorkspaceExists = true;
Expand Down
15 changes: 9 additions & 6 deletions dashboard/src/app/index.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,17 @@ initModule.run(['$rootScope', '$location', '$routeParams', 'routingRedirect', '$
}
});


$rootScope.$on('$routeChangeSuccess', (event, next) => {
if (next.$$route.title && angular.isFunction(next.$$route.title)) {
$rootScope.currentPage = next.$$route.title($routeParams);
$rootScope.$on('$routeChangeSuccess', (event: ng.IAngularEvent, next: ng.route.IRoute) => {
const route = (<any>next).$$route;
if (angular.isFunction(route.title)) {
$rootScope.currentPage = route.title($routeParams);
} else {
$rootScope.currentPage = next.$$route.title || 'Dashboard';
$rootScope.currentPage = route.title || 'Dashboard';
}
const originalPath: string = route.originalPath;
if (originalPath && originalPath.indexOf('/ide/') === -1) {
$rootScope.showIDE = false;
}

// when a route is about to change, notify the routing redirect node
if (next.resolve) {
if (DEV) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ export class CreateProjectController {

cheAPI.getWorkspace().getWorkspaces();

$rootScope.showIDE = false;

this.isHandleClose = true;
this.connectionClosed = () => {
if (!this.isHandleClose) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class ListWorkspacesCtrl {
* @ngInject for Dependency injection
*/
constructor($log: ng.ILogService, $mdDialog: ng.material.IDialogService, $q: ng.IQService, lodash: any,
$rootScope: che.IRootScopeService, cheAPI: CheAPI, cheNotification: CheNotification, cheBranding: CheBranding,
cheAPI: CheAPI, cheNotification: CheNotification, cheBranding: CheBranding,
cheWorkspace: CheWorkspace, cheNamespaceRegistry: CheNamespaceRegistry,
confirmDialogService: ConfirmDialogService, $scope: ng.IScope, cheListHelperFactory: che.widget.ICheListHelperFactor) {
this.cheAPI = cheAPI;
Expand Down Expand Up @@ -90,8 +90,6 @@ export class ListWorkspacesCtrl {

this.getUserWorkspaces();

$rootScope.showIDE = false;

this.cheNamespaceRegistry.fetchNamespaces().then(() => {
this.namespaceLabels = this.getNamespaceLabelsList();
});
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/widget/input/che-input-box.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="che-input-area">
<input ng-trim="false" name="{{inputName}}"
ng-model-options="{allowInvalid: true}"
ng-change="onChange({value: valueModel})"
ng-change="onChange({$value: valueModel})"
ng-model="valueModel">
<span class="che-input-asterisk fa" ng-show="valueModel"
ng-class="myForm[inputName] && myForm[inputName].$invalid ? 'fa-times' : 'fa-check'"></span>
Expand Down

0 comments on commit 5538f93

Please sign in to comment.