diff --git a/dashboard/src/app/ide/ide.service.ts b/dashboard/src/app/ide/ide.service.ts index fc89df87e6f..48b1882d10a 100644 --- a/dashboard/src/app/ide/ide.service.ts +++ b/dashboard/src/app/ide/ide.service.ts @@ -122,7 +122,7 @@ class IdeSvc { } startWorkspace(data: any): ng.IPromise { - let startWorkspacePromise = this.cheAPI.getWorkspace().startWorkspace(data.id, data.config.defaultEnv); + let startWorkspacePromise = this.cheAPI.getWorkspace().startWorkspace(data.id, data.config ? data.config.defaultEnv: null); return startWorkspacePromise; } 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 99415db7ecc..4c92bdb28d3 100644 --- a/dashboard/src/app/workspaces/create-workspace/create-workspace.controller.ts +++ b/dashboard/src/app/workspaces/create-workspace/create-workspace.controller.ts @@ -299,7 +299,7 @@ export class CreateWorkspaceController { */ createWorkspace(): ng.IPromise { // update workspace name - this.selectedDevfile.name = this.workspaceName; + this.selectedDevfile.metadata.name = this.workspaceName; return this.createWorkspaceSvc.createWorkspaceFromDevfile(this.selectedDevfile, null); } 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 25d7fddde28..ceb3b40c1cd 100644 --- a/dashboard/src/app/workspaces/create-workspace/create-workspace.service.ts +++ b/dashboard/src/app/workspaces/create-workspace/create-workspace.service.ts @@ -193,9 +193,22 @@ export class CreateWorkspaceSvc { const namespaceId = this.namespaceSelectorSvc.getNamespaceId(), projectTemplates = this.projectSourceSelectorService.getProjectTemplates(); + let projects = []; + projectTemplates.forEach((template: che.IProjectTemplate) => { + let project = { + name: template.displayName, + source: { + type: template.source.type, + location: template.source.location + } + }; + projects.push(project); + }); + return this.checkEditingProgress().then(() => { - workspaceDevfile.projects = projectTemplates; - this.addProjectCommands({devfile: workspaceDevfile}, projectTemplates); + workspaceDevfile.projects = projects; + //TODO waits for fix https://github.com/eclipse/che/issues/13514 + //this.addProjectCommands({devfile: workspaceDevfile}, projectTemplates); return this.cheWorkspace.createWorkspaceFromDevfile(namespaceId, workspaceDevfile, attributes).then((workspace: che.IWorkspace) => { return this.cheWorkspace.fetchWorkspaces().then(() => this.cheWorkspace.getWorkspaceById(workspace.id)); }) 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 2c8abd347be..7e339c587ea 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 @@ -50,13 +50,13 @@ export class WorkspaceStatusController { return; } const workspace = this.cheWorkspace.getWorkspaceById(this.workspaceId); - if (!workspace || !workspace.config) { + if (!workspace) { return; } const status = this.getWorkspaceStatus(); const isRunButton = status !== WorkspaceStatus.RUNNING && status !== WorkspaceStatus.STOPPING && status !== WorkspaceStatus.STARTING; - const environment = workspace.config.defaultEnv; + const environment = workspace.config ? workspace.config.defaultEnv : null; if (isRunButton) { this.updateRecentWorkspace(this.workspaceId); @@ -65,7 +65,6 @@ export class WorkspaceStatusController { this.cheWorkspace.fetchStatusChange(this.workspaceId, 'ERROR').then((data: any) => { this.cheNotification.showError(data.error); }); - const promise = isRunButton ? this.cheWorkspace.startWorkspace(this.workspaceId, environment) : this.cheWorkspace.stopWorkspace(this.workspaceId); promise.catch((error: any) => { this.cheNotification.showError(`${isRunButton ? 'Run' : 'Stop'} workspace error.`, error); 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 09e67b37278..1f725990fbf 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 @@ -190,11 +190,13 @@ export class WorkspaceDetailsProjectsCtrl { if (!projectTemplate.type && projectTemplate.projectType) { projectTemplate.type = projectTemplate.projectType; } - this.workspaceDetailsProjectsService.addProjectTemplate(projectTemplate); this.workspaceDataManager.addProject(this.workspaceDetails, projectTemplate); }); - this.createWorkspaceSvc.addProjectCommands(this.workspaceDetails, projectTemplates); + //TODO waits for fix https://github.com/eclipse/che/issues/13514 to enable for devfile + if (this.workspaceDetails.config) { + this.createWorkspaceSvc.addProjectCommands(this.workspaceDetails, projectTemplates); + } this.projectsOnChange(); } diff --git a/dashboard/src/components/api/workspace/workspace-data-manager.ts b/dashboard/src/components/api/workspace/workspace-data-manager.ts index cebe29247ea..7d3bada7c72 100644 --- a/dashboard/src/components/api/workspace/workspace-data-manager.ts +++ b/dashboard/src/components/api/workspace/workspace-data-manager.ts @@ -96,10 +96,17 @@ export class WorkspaceDataManager { * @param workspace workspace * @param project project to be added to pointed workspace */ - addProject(workspace: che.IWorkspace, project: any): void { + addProject(workspace: che.IWorkspace, projectTemplate: che.IProjectTemplate): void { if (workspace.config) { - workspace.config.projects.push(project); + workspace.config.projects.push(projectTemplate); } else if (workspace.devfile) { + let project = { + name: projectTemplate.displayName, + source: { + type: projectTemplate.source.type, + location: projectTemplate.source.location + } + }; workspace.devfile.projects.push(project); } } diff --git a/deploy/openshift/deploy_che.sh b/deploy/openshift/deploy_che.sh index 055fee426bb..879bad8988c 100755 --- a/deploy/openshift/deploy_che.sh +++ b/deploy/openshift/deploy_che.sh @@ -227,7 +227,7 @@ export DEVFILE_REGISTRY_IMAGE=${DEVFILE_REGISTRY_IMAGE:-${DEFAULT_DEVFILE_REGIST DEFAULT_DEVFILE_REGISTRY_IMAGE_PULL_POLICY="Always" export DEVFILE_REGISTRY_IMAGE_PULL_POLICY=${DEVFILE_REGISTRY_IMAGE_PULL_POLICY:-${DEFAULT_DEVFILE_REGISTRY_IMAGE_PULL_POLICY}} -DEFAULT_DEVFILE__REGISTRY__URL="NULL" +DEFAULT_DEVFILE__REGISTRY__URL="https://che-devfile-registry.openshift.io/" export DEVFILE__REGISTRY__URL=${DEVFILE__REGISTRY__URL:-${DEFAULT_DEVFILE__REGISTRY__URL}}