Merge pull request #604 from eclipse/CHE-217

Che 217  improve creating project flow
6.19.x
Oleksii Orel 2016-03-02 09:30:26 +02:00
commit 62740febf4
4 changed files with 38 additions and 26 deletions

View File

@ -122,20 +122,26 @@ export class CreateProjectCtrl {
}
// fetch workspaces when initializing
let promise = cheAPI.getWorkspace().fetchWorkspaces();
promise.then(() => {
this.updateData();
},
(error) => {
// etag handling so also retrieve last data that were fetched before
if (error.status === 304) {
// ok
this.workspaces = this.cheAPI.getWorkspace().getWorkspaces();
if (this.workspaces.length > 0) {
this.updateData();
} else {
// fetch workspaces when initializing
let promise = cheAPI.getWorkspace().fetchWorkspaces();
promise.then(() => {
this.updateData();
return;
}
this.state = 'error';
});
},
(error) => {
// etag handling so also retrieve last data that were fetched before
if (error.status === 304) {
// ok
this.updateData();
return;
}
this.state = 'error';
});
}
// selected current tab
this.currentTab = '';
@ -237,17 +243,23 @@ export class CreateProjectCtrl {
* Fetching operation has been done, so get workspaces and websocket connection
*/
updateData() {
this.workspaces = this.cheAPI.getWorkspace().getWorkspaces();
// generate project name
this.generateProjectName(true);
// init WS bus
if (this.workspaces.length > 0) {
this.messageBus = this.cheAPI.getWebsocket().getBus(this.workspaces[0].id);
//if create project in progress and workspace have started
if (this.createProjectSvc.isCreateProjectInProgress() && this.createProjectSvc.getCurrentProgressStep() > 0) {
let workspaceName = this.createProjectSvc.getWorkspaceOfProject();
let findWorkspace = this.lodash.find(this.workspaces, function (workspace) {
return workspace.config.name === workspaceName;
});
//check current workspace
if (findWorkspace) {
// init WS bus
this.messageBus = this.cheAPI.getWebsocket().getBus(findWorkspace.id);
} else {
this.resetCreateProgress();
}
} else {
// generate project name
this.generateProjectName(true);
}
}
/**

View File

@ -49,8 +49,7 @@
<div id="create-project-panel" class="create-project-progress-panel" >
<div class="create-project-progress-panel-top" style="background-image: url('assets/images/bg-intermediate-screen.svg')">
<div class="create-project-progress-panel-top">
<div class="create-project-progress-widget-progress" layout-align="center center" class="progress-global" layout="row">
<md-icon ng-hide="createProjectCtrl.getCurrentProgressStep() === (createProjectCtrl.getCreationSteps().length - 1)" md-svg-src="assets/images/loader.svg" class="create-project-progress-loader-icon" aria-label="loader"></md-icon>
</div>

View File

@ -60,6 +60,7 @@ md-select.create-project-select
background-repeat no-repeat
background-position-x 0
background-position-y bottom
background-image url('../assets/images/bg-intermediate-screen.svg')
height 220px
padding-left 40px
padding-right 40px

View File

@ -65,7 +65,7 @@
</label>
<div layout="column" flex="85">
<che-button-danger che-button-title="Delete"
ng-disabled="workspaceDetailsCtrl.workspaceDetails.status === 'STARTING' || workspaceDetailsCtrl.workspaceDetails.status === 'STOPPING'"
ng-disabled="!(workspaceDetailsCtrl.workspaceDetails.status === 'RUNNING' || workspaceDetailsCtrl.workspaceDetails.status === 'STOPPED')"
ng-click="workspaceDetailsCtrl.deleteWorkspace($event)"></che-button-danger>
</div>
</div>