Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Commit

Permalink
feat(left-sidebar): Configure left-side menu view in config file (closes
Browse files Browse the repository at this point in the history
 #814) (#919)

* feat(left-sidebar): Configure left-side menu view in config file

* refactor(template-model): after review
  • Loading branch information
HeyRoach authored Feb 8, 2018
1 parent 31e6131 commit a123336
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
16 changes: 16 additions & 0 deletions config-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,5 +221,21 @@ Account tags are available only for the last API version. If you are using anoth
"accountTagsEnabled": false
```

### Sidebar Order
This configuration allows a user to set a list of left-sidebar sections. Configure possible if property “allowReorderingSidebar” is true.
For example,
```
"sidebarOrder": [
"vms",
"volumes",
"templates",
"sgs",
"events",
"ssh",
"accounts",
"settings"
]
```

### Extensions
Please check [Wiki](https://github.com/bwsw/cloudstack-ui/wiki/Plugins) for extension configuration options.
4 changes: 1 addition & 3 deletions src/app/navigation/app-sidebar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@
(change)="handleRouteChecked($event)"
[@handleSlide]="!editing ? 'in' : ''"
></mat-checkbox>
<div [@linkSlide]="'out'">
<div class="link-element" [innerHTML]="route.text | translate"></div>
</div>
<div class="link-element-edit" [innerHTML]="route.text | translate"></div>
</div>
</ng-container>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/app/navigation/app-sidebar.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
display: inline-block;
border-color: inherit;
vertical-align: middle;
&-edit {
transform: translateX(60px);
}
}

a {
Expand Down
10 changes: 10 additions & 0 deletions src/app/navigation/app-sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class AppSidebarComponent extends WithUnsubscribe()
}

public ngOnInit() {
this.setUpRoutes();
this.setUpDragula();
this.initNavigationOrder();
}
Expand Down Expand Up @@ -164,4 +165,13 @@ export class AppSidebarComponent extends WithUnsubscribe()
private toggleState(): void {
this._editing = !this._editing;
}

public setUpRoutes() {
if (this.canEdit) {
const defaultOrder = this.configService.get<Array<string>>('sidebarOrder');
if (defaultOrder) {
this.routes = this.routes.filter(route => defaultOrder.some(_ => _.toUpperCase() === route.id));
}
}
}
}

0 comments on commit a123336

Please sign in to comment.