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

Dashboard: allow to update workspace config without workpace restarting #8505

Merged
merged 6 commits into from
Feb 1, 2018
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
40 changes: 38 additions & 2 deletions dashboard/src/app/demo-components/demo-components.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ import {
ICheButtonDropdownOtherAction
} from '../../components/widget/button-dropdown/che-button-dropdown.directive';

enum Tab {Font, Panel, Selecter, Icons, Dropdown_button, Buttons, Input, List, Label_container, Stack_selector, Popover}
import {ICheEditModeOverlayConfig} from '../../components/widget/edit-mode-overlay/che-edit-mode-overlay.directive';
import {CheNotification} from '../../components/notification/che-notification.factory';

enum Tab {Font, Panel, Selecter, Icons, Dropdown_button, Buttons, Input, List, Label_container, Stack_selector, Popover, Edit_mode_overlay}

/**
* This class is handling the controller for the demo of components
Expand All @@ -24,6 +27,7 @@ enum Tab {Font, Panel, Selecter, Icons, Dropdown_button, Buttons, Input, List, L
export class DemoComponentsController {

$location: ng.ILocationService;
cheNotification: CheNotification;
selectedIndex: number;
tab: Object = Tab;

Expand All @@ -48,12 +52,16 @@ export class DemoComponentsController {
otherActions: Array<ICheButtonDropdownOtherAction>;
};

overlayConfig: ICheEditModeOverlayConfig;

/**
* Default constructor that is using resource
* @ngInject for Dependency injection
*/
constructor($location: ng.ILocationService) {
constructor($location: ng.ILocationService,
cheNotification: CheNotification) {
this.$location = $location;
this.cheNotification = cheNotification;

const tab = $location.search().tab;
if (Tab[tab]) {
Expand Down Expand Up @@ -114,6 +122,34 @@ export class DemoComponentsController {
// number spinner
this.number = 0;
this.numberIsChanged = 0;

// edit-mode config
this.overlayConfig = {
visible: true,
disabled: false,
message: {
content: `Information message`,
visible: true
},
applyButton: {
action: () => {
this.cheNotification.showInfo(`Button 'Apply' was clicked.`);
},
disabled: false
},
saveButton: {
action: () => {
this.cheNotification.showInfo(`Button 'Save' was clicked.`);
},
disabled: false
},
cancelButton: {
action: () => {
this.cheNotification.showInfo(`Button 'Cancel' was clicked.`);
},
disabled: false
}
};
}

/**
Expand Down
54 changes: 54 additions & 0 deletions dashboard/src/app/demo-components/demo-components.html
Original file line number Diff line number Diff line change
Expand Up @@ -421,5 +421,59 @@ <h6>This is h6
class="btn btn-default">HTML Popover (inline)</button>
</textarea>
</md-tab>

<md-tab label="Edit Mode Overlay"
md-on-select="demoComponentsController.onSelectTab(demoComponentsController.tab.Edit_mode_overlay)">

<div class="demo-edit-overlay">
<form>
<label for="panel-visible">Panel Is Visible</label>
<input id="panel-visible" type="checkbox" ng-model="demoComponentsController.overlayConfig.visible">
<br/>
<label for="panel-disabled">Panel Is Visible</label>
<input id="panel-disabled" type="checkbox" ng-model="demoComponentsController.overlayConfig.disabled">

<fieldset>
<legend>Message</legend>
<label for="message-content">Content</label>
<input id="message-content" type="text" ng-model="demoComponentsController.overlayConfig.message.content">
<br/>
<label for="message-visible">Visible</label>
<input id="message-visible" type="checkbox" ng-model="demoComponentsController.overlayConfig.message.visible">
</fieldset>
<fieldset>
<legend>SAVE button</legend>
<label for="save-button-title">Title</label>
<input id="save-button-title" type="text" ng-model="demoComponentsController.overlayConfig.saveButton.title">
<br/>
<label for="save-button-disabled">Disabled</label>
<input id="save-button-disabled" type="checkbox" ng-model="demoComponentsController.overlayConfig.saveButton.disabled">
</fieldset>
<fieldset>
<legend>APPLY button</legend>
<label for="apply-button-title">Title</label>
<input id="apply-button-title" type="text" ng-model="demoComponentsController.overlayConfig.applyButton.title">
<br/>
<label for="apply-button-disabled">Disabled</label>
<input id="apply-button-disabled" type="checkbox" ng-model="demoComponentsController.overlayConfig.applyButton.disabled">
</fieldset>
<fieldset>
<legend>CANCEL button</legend>
<label for="cancel-button-title">Title</label>
<input id="cancel-button-title" type="text" ng-model="demoComponentsController.overlayConfig.cancelButton.title">
<br/>
<label for="cancel-button-disabled">Disabled</label>
<input id="cancel-button-disabled" type="checkbox" ng-model="demoComponentsController.overlayConfig.cancelButton.disabled">
</fieldset>
</form>
</div>

<textarea demo-source-render>
<che-edit-mode-overlay config="demoComponentsController.overlayConfig"></che-edit-mode-overlay>
</textarea>

</md-tab>

</md-tabs>

</md-content>
11 changes: 11 additions & 0 deletions dashboard/src/app/demo-components/demo-components.styl
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,14 @@
& + button
margin-left 70px
outline none !important

.demo-edit-overlay
fieldset
margin-top 20px

legend
font-size 1em
font-weight bold

label
min-width 100px
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<span title="{{navbarRecentWorkspacesController.getWorkspaceName(workspace.id)}}"
class="recent-workspace-name-container"
ng-class="{'recent-workspaces-stopped-workspace': navbarRecentWorkspacesController.getWorkspaceStatus(workspace.id) === 'STOPPED'}">
<span che-clip-the-middle>{{navbarRecentWorkspacesController.getWorkspaceName(workspace.id)}}</span>
<span che-clip-the-middle>{{workspace.config.name}}</span>
</span>
</div>
</md-button>
Expand Down
Loading