Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UD] Add Temporary Storage toggle button to Get Started page #16016

Merged
merged 1 commit into from
Feb 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export class TemplateListController {
'$log',
'cheNotification'];

ephemeralMode: boolean;

private $q: ng.IQService;
private $log: ng.ILogService;
private $filter: ng.IFilterService;
Expand Down Expand Up @@ -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();
});
}
Expand Down Expand Up @@ -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);
});
Expand Down
14 changes: 14 additions & 0 deletions dashboard/src/app/get-started/template-list/template-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@
<div class="header-title">Select a Sample</div>
<div class="header-description">Use a sample to create your first workspace.</div>
</div>
<div class="temporary-storage" layout="row" layout-align="start center">
<div class="temporary-storage-label">Temporary Storage</div>
<span class="temporary-storage-tooltip"
uib-tooltip-html="'Temporary Storage allows for faster I/O but may have limited storage and is not persistent.'"
tooltip-trigger="mouseenter"
tabindex="-1"
tooltip-append-to-body="true">
<i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<md-switch ng-model="templateListController.ephemeralMode"
ng-change="templateListController.onEphemeralModeChange()"
aria-label="Enables Temporary Storage.">
</md-switch>
</div>
<div flex class="template-search">
<div flex="100" layout="row">
<div flex="15" class="search-icon" ng-hide="templateListController.searchValue"><i class="fa fa-search"></i>
Expand Down
10 changes: 10 additions & 0 deletions dashboard/src/app/get-started/template-list/template-list.styl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ md-content.getting-started
line-height 34px
font-size 16px

.temporary-storage
margin 0 20px 0 0

& > *
margin 0 6px
& > .temporary-storage-label
margin-right 3px
& > .temporary-storage-tooltip
margin-left 3px

.template-info
text-align end
font-weight bold
Expand Down