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

Commit a123336

Browse files
authored
feat(left-sidebar): Configure left-side menu view in config file (closes #814) (#919)
* feat(left-sidebar): Configure left-side menu view in config file * refactor(template-model): after review
1 parent 31e6131 commit a123336

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

config-guide.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,5 +221,21 @@ Account tags are available only for the last API version. If you are using anoth
221221
"accountTagsEnabled": false
222222
```
223223

224+
### Sidebar Order
225+
This configuration allows a user to set a list of left-sidebar sections. Configure possible if property “allowReorderingSidebar” is true.
226+
For example,
227+
```
228+
"sidebarOrder": [
229+
"vms",
230+
"volumes",
231+
"templates",
232+
"sgs",
233+
"events",
234+
"ssh",
235+
"accounts",
236+
"settings"
237+
]
238+
```
239+
224240
### Extensions
225241
Please check [Wiki](https://github.com/bwsw/cloudstack-ui/wiki/Plugins) for extension configuration options.

src/app/navigation/app-sidebar.component.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@
6767
(change)="handleRouteChecked($event)"
6868
[@handleSlide]="!editing ? 'in' : ''"
6969
></mat-checkbox>
70-
<div [@linkSlide]="'out'">
71-
<div class="link-element" [innerHTML]="route.text | translate"></div>
72-
</div>
70+
<div class="link-element-edit" [innerHTML]="route.text | translate"></div>
7371
</div>
7472
</ng-container>
7573
</div>

src/app/navigation/app-sidebar.component.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@
4040
display: inline-block;
4141
border-color: inherit;
4242
vertical-align: middle;
43+
&-edit {
44+
transform: translateX(60px);
45+
}
4346
}
4447

4548
a {

src/app/navigation/app-sidebar.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export class AppSidebarComponent extends WithUnsubscribe()
6262
}
6363

6464
public ngOnInit() {
65+
this.setUpRoutes();
6566
this.setUpDragula();
6667
this.initNavigationOrder();
6768
}
@@ -164,4 +165,13 @@ export class AppSidebarComponent extends WithUnsubscribe()
164165
private toggleState(): void {
165166
this._editing = !this._editing;
166167
}
168+
169+
public setUpRoutes() {
170+
if (this.canEdit) {
171+
const defaultOrder = this.configService.get<Array<string>>('sidebarOrder');
172+
if (defaultOrder) {
173+
this.routes = this.routes.filter(route => defaultOrder.some(_ => _.toUpperCase() === route.id));
174+
}
175+
}
176+
}
167177
}

0 commit comments

Comments
 (0)