From e8ab082be15172ce5cfd26e0ec9dd696741c00a8 Mon Sep 17 00:00:00 2001 From: Oleksii Orel Date: Thu, 23 Jan 2020 15:10:07 +0200 Subject: [PATCH] Fix workspaces for UD (#15784) * fix workspace list Signed-off-by: Oleksii Orel --- .../template-list/template-list.controller.ts | 13 +- .../template-list/template-list.html | 4 +- .../template-list/template-list.styl | 11 +- dashboard/src/app/navbar/navbar.controller.ts | 31 ++-- dashboard/src/app/navbar/navbar.html | 4 +- .../recent-workspaces.controller.ts | 23 +-- ...list-organization-workspaces.controller.ts | 2 - .../list-workspaces.controller.ts | 107 ++--------- .../list-workspaces/list-workspaces.html | 23 +-- .../workspace-item.controller.ts | 38 +++- .../workspace-item/workspace-item.html | 31 ++-- .../workspace-details-config.ts | 15 +- .../workspace-details/workspace-details.styl | 3 + .../src/components/api/che-factory.factory.ts | 90 +++------- .../components/api/test/che-http-backend.ts | 2 +- .../api/workspace/che-workspace.factory.ts | 167 ++++++++++-------- .../api/workspace/che-workspace.spec.ts | 5 +- .../components/widget/footer/che-footer.styl | 2 + .../components/widget/list/che-list-item.styl | 7 +- 19 files changed, 255 insertions(+), 323 deletions(-) diff --git a/dashboard/src/app/get-started/template-list/template-list.controller.ts b/dashboard/src/app/get-started/template-list/template-list.controller.ts index df3dc2ad67..cf7e1249ea 100644 --- a/dashboard/src/app/get-started/template-list/template-list.controller.ts +++ b/dashboard/src/app/get-started/template-list/template-list.controller.ts @@ -76,7 +76,6 @@ export class TemplateListController { this.cheNotification = cheNotification; this.devfileRegistry = devfileRegistry; this.createWorkspaceSvc = createWorkspaceSvc; - this.devfileRegistryUrl = cheWorkspace.getWorkspaceSettings().cheWorkspaceDevfileRegistryUrl; this.createButtonConfig = { mainAction: { @@ -102,10 +101,20 @@ export class TemplateListController { }] }; - this.init(); + cheWorkspace.fetchWorkspaceSettings().then(() => { + const workspaceSettings = cheWorkspace.getWorkspaceSettings(); + this.devfileRegistryUrl = workspaceSettings && workspaceSettings.cheWorkspaceDevfileRegistryUrl; + this.init(); + }); } private init(): void { + if (!this.devfileRegistryUrl) { + const message = 'Failed to load the devfile registry URL.'; + this.cheNotification.showError(message); + this.$log.error(message); + return; + } this.isLoading = true; this.devfileRegistry.fetchDevfiles(this.devfileRegistryUrl).then((devfiles: Array) => { this.devfiles = devfiles.map(devfile => { diff --git a/dashboard/src/app/get-started/template-list/template-list.html b/dashboard/src/app/get-started/template-list/template-list.html index c3261eaa1e..a150274a70 100644 --- a/dashboard/src/app/get-started/template-list/template-list.html +++ b/dashboard/src/app/get-started/template-list/template-list.html @@ -27,8 +27,8 @@
-
Select a Template
-
Use a sample template to create your first workspace.
+
Select a Sample
+
Use a sample to create your first workspace.