From a0a265f2ab92da721b4c9a9dce2417d171e5c4d9 Mon Sep 17 00:00:00 2001 From: Oleksii Kurinnyi Date: Thu, 13 Feb 2020 10:07:23 +0200 Subject: [PATCH] [UD] Add Temporary Storage toggle to Get Started page Signed-off-by: Oleksii Kurinnyi --- .../template-list/template-list.controller.ts | 9 +++++++++ .../get-started/template-list/template-list.html | 14 ++++++++++++++ .../get-started/template-list/template-list.styl | 10 ++++++++++ 3 files changed, 33 insertions(+) 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 cf7e1249ea3..960934fab6d 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 @@ -37,6 +37,8 @@ export class TemplateListController { '$log', 'cheNotification']; + ephemeralMode: boolean; + private $q: ng.IQService; private $log: ng.ILogService; private $filter: ng.IFilterService; @@ -104,6 +106,7 @@ export class TemplateListController { cheWorkspace.fetchWorkspaceSettings().then(() => { const workspaceSettings = cheWorkspace.getWorkspaceSettings(); this.devfileRegistryUrl = workspaceSettings && workspaceSettings.cheWorkspaceDevfileRegistryUrl; + this.ephemeralMode = workspaceSettings['che.workspace.persist_volumes.default'] === 'false'; this.init(); }); } @@ -140,6 +143,12 @@ export class TemplateListController { const selfLink = this.selectedDevfile.links.self; return this.devfileRegistry.fetchDevfile(this.devfileRegistryUrl, selfLink).then(() => { const devfile = this.devfileRegistry.getDevfile(this.devfileRegistryUrl, selfLink); + if (this.ephemeralMode) { + if (!devfile.attributes) { + devfile.attributes = {}; + } + devfile.attributes.persistVolumes = 'false'; + } const attributes = {stackName: this.selectedDevfile.displayName}; return this.createWorkspaceSvc.createWorkspaceFromDevfile(undefined, devfile, attributes, true); }); 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 a150274a706..e672e743b76 100644 --- a/dashboard/src/app/get-started/template-list/template-list.html +++ b/dashboard/src/app/get-started/template-list/template-list.html @@ -30,6 +30,20 @@
Select a Sample
Use a sample to create your first workspace.
+
+
Temporary Storage
+ + + + + +