Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
rnavagamuwa committed Aug 31, 2016
2 parents 15d37b0 + a2eeb38 commit 9a98864
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
12 changes: 11 additions & 1 deletion dashboard/src/app/dashboard/dashboard-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ export class DashboardConfig {
controller: 'DashboardController',
controllerAs: 'dashboardController',
resolve: {
check: ['$q', 'cheService', 'cheAdminService', ($q, cheService, cheAdminService) => {
check: ['$q', '$location', 'cheWorkspace', 'cheService', 'cheAdminService', ($q, $location, cheWorkspace, cheService, cheAdminService) => {
cheWorkspace.fetchWorkspaces().then(() => {
if (cheWorkspace.getWorkspaces().length === 0) {
$location.path('/create-project');
}
}, (error) => {
if (error.status === 304 && cheWorkspace.getWorkspaces().length === 0) {
$location.path('/create-project');
}
});

var defer = $q.defer();
cheService.fetchServices().then(() => {
cheAdminService.fetchServices().then(() => {
Expand Down
20 changes: 1 addition & 19 deletions dashboard/src/app/dashboard/dashboard.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,9 @@ export class DashboardController {
* Default constructor
* @ngInject for Dependency injection
*/
constructor($rootScope, cheWorkspace, $location) {
constructor($rootScope) {
'ngInject';
$rootScope.showIDE = false;
this.cheWorkspace = cheWorkspace;
this.$location = $location;

cheWorkspace.fetchWorkspaces().then(() => {
this.checkWorkspaces();
},
(error) => {
if (error.status === 304) {
this.checkWorkspaces();
return;
}
});
}

checkWorkspaces() {
//If there are any workspaces - redirect to create workspace with project page:
if (this.cheWorkspace.getWorkspaces() && this.cheWorkspace.getWorkspaces().length === 0) {
this.$location.path('/create-project');
}
}
}

0 comments on commit 9a98864

Please sign in to comment.