diff --git a/dashboard/src/app/workspaces/create-workspace/create-workspace.service.ts b/dashboard/src/app/workspaces/create-workspace/create-workspace.service.ts index 886550bb14..dca638652a 100644 --- a/dashboard/src/app/workspaces/create-workspace/create-workspace.service.ts +++ b/dashboard/src/app/workspaces/create-workspace/create-workspace.service.ts @@ -218,22 +218,6 @@ export class CreateWorkspaceSvc { this.$location.search({'init': 'true'}); } - /** - * Creates bunch of projects. - * - * @param {string} workspaceId the workspace ID - * @param {Array} projectTemplates the list of project templates to create - * @return {IPromise} - */ - createProjects(workspaceId: string, projectTemplates: Array): ng.IPromise { - if (projectTemplates.length === 0) { - return this.$q.reject(); - } - - const workspaceAgent = this.cheWorkspace.getWorkspaceAgent(workspaceId); - return workspaceAgent.getProject().createProjects(projectTemplates); - } - /** * Adds commands from the bunch of project templates to provided workspace config. * @@ -252,52 +236,4 @@ export class CreateWorkspaceSvc { }); } - /** - * Adds bunch of commands for project in row. - * Returns resolved promise if all commands are imported properly, otherwise returns rejected promise with list of names of failed commands. - * - * @param {string} workspaceId the workspace ID - * @param {string} projectName the name of project - * @param {any[]} projectCommands the list of commands - * @return {IPromise} - */ - addCommands(workspaceId: string, projectName: string, projectCommands: any[]): ng.IPromise { - const defer = this.$q.defer(); - defer.resolve(); - let accumulatorPromise = defer.promise; - - if (projectCommands.length === 0) { - return accumulatorPromise; - } - - const failedCommands = []; - - accumulatorPromise = projectCommands.reduce((_accumulatorPromise: ng.IPromise, command: any) => { - command.name = projectName + ':' + command.name; - return _accumulatorPromise.then(() => { - return this.cheWorkspace.addCommand(workspaceId, command); - }, (error: any) => { - failedCommands.push(command.name); - if (error && error.message) { - this.$log.error(`Adding of command "${command.name}" failed for project "${projectName}" with error: ${error}`); - } - }); - }, accumulatorPromise); - - return accumulatorPromise.then(() => { - if (failedCommands.length) { - return this.$q.reject(failedCommands); - } - return this.$q.when(); - }); - } - - private getIDE(): any { - const jqIframe = this.$document.find('#ide-application-iframe'); - if (!jqIframe || jqIframe.length === 0) { - return null; - } - return (jqIframe as any).contentWindow.IDE; - } - } diff --git a/dashboard/src/app/workspaces/workspace-details/workspace-details.service.ts b/dashboard/src/app/workspaces/workspace-details/workspace-details.service.ts index b584928dc2..528c5282ef 100644 --- a/dashboard/src/app/workspaces/workspace-details/workspace-details.service.ts +++ b/dashboard/src/app/workspaces/workspace-details/workspace-details.service.ts @@ -302,7 +302,7 @@ export class WorkspaceDetailsService { } // add commands - return this.createWorkspaceSvc.addProjectCommands(newWorkspace.id, projectTemplatesToAdd); + return this.createWorkspaceSvc.addProjectCommands(newWorkspace.config, projectTemplatesToAdd); }).then(() => { if (WorkspaceStatus[initStatus] === WorkspaceStatus.STOPPED || WorkspaceStatus[initStatus] === WorkspaceStatus.STOPPING) { // stop workspace