Commit 1d960b96bc4b990980e56c602b507a7ca9a187ea

Authored by Igor Kulikov
1 parent c14d36d4

UI improvements: href support for side menu

... ... @@ -30,12 +30,14 @@ import { getCurrentAuthState, selectAuthUser, selectUserDetails } from '@core/au
30 30 import { MediaBreakpoints } from '@shared/models/constants';
31 31 import { ActionNotificationShow } from '@core/notification/notification.actions';
32 32 import { Router } from '@angular/router';
33   -import * as screenfull from 'screenfull';
  33 +import * as _screenfull from 'screenfull';
34 34 import { MatSidenav } from '@angular/material/sidenav';
35 35 import { AuthState } from '@core/auth/auth.models';
36 36 import { WINDOW } from '@core/services/window.service';
37 37 import { ISearchableComponent, instanceOfSearchableComponent } from '@home/models/searchable-component.models';
38 38
  39 +const screenfull = _screenfull as _screenfull.Screenfull;
  40 +
39 41 @Component({
40 42 selector: 'tb-home',
41 43 templateUrl: './home.component.html',
... ... @@ -60,8 +62,7 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni
60 62
61 63 @ViewChild('searchInput') searchInputField: ElementRef;
62 64
63   - // @ts-ignore
64   - fullscreenEnabled = screenfull.enabled;
  65 + fullscreenEnabled = screenfull.isEnabled;
65 66
66 67 authUser$: Observable<any>;
67 68 userDetails$: Observable<User>;
... ... @@ -125,15 +126,12 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni
125 126 }
126 127
127 128 toggleFullscreen() {
128   - // @ts-ignore
129   - if (screenfull.enabled) {
130   - // @ts-ignore
  129 + if (screenfull.isEnabled) {
131 130 screenfull.toggle();
132 131 }
133 132 }
134 133
135 134 isFullscreen() {
136   - // @ts-ignore
137 135 return screenfull.isFullscreen;
138 136 }
139 137
... ...
... ... @@ -15,9 +15,10 @@
15 15 limitations under the License.
16 16
17 17 -->
18   -<button mat-button
19   - routerLinkActive="tb-active" [routerLinkActiveOptions]="{exact: true}" routerLink="{{section.path}}">
20   - <mat-icon *ngIf="!section.isMdiIcon && section.icon != null" class="material-icons">{{section.icon}}</mat-icon>
21   - <mat-icon *ngIf="section.isMdiIcon && section.icon != null" [svgIcon]="section.icon"></mat-icon>
22   - <span>{{section.name | translate}}</span>
23   -</button>
  18 +<a class="mat-button" routerLinkActive="tb-active" [routerLinkActiveOptions]="{exact: true}" routerLink="{{section.path}}">
  19 + <span class="mat-button-wrapper">
  20 + <mat-icon *ngIf="!section.isMdiIcon && section.icon != null" class="material-icons">{{section.icon}}</mat-icon>
  21 + <mat-icon *ngIf="section.isMdiIcon && section.icon != null" [svgIcon]="section.icon"></mat-icon>
  22 + <span>{{section.name | translate}}</span>
  23 + </span>
  24 +</a>
... ...
... ... @@ -15,15 +15,16 @@
15 15 limitations under the License.
16 16
17 17 -->
18   -<button mat-button
19   - routerLinkActive="tb-active" [routerLinkActiveOptions]="{exact: true}" routerLink="{{section.path}}"
20   - class="tb-button-toggle">
21   - <mat-icon *ngIf="!section.isMdiIcon && section.icon != null" class="material-icons">{{section.icon}}</mat-icon>
22   - <mat-icon *ngIf="section.isMdiIcon && section.icon != null" [svgIcon]="section.icon"></mat-icon>
23   - <span>{{section.name | translate}}</span>
24   - <span class=" pull-right fa fa-chevron-down tb-toggle-icon"
25   - [ngClass]="{'tb-toggled' : sectionActive()}"></span>
26   -</button>
  18 +<a class="mat-button tb-button-toggle"
  19 + routerLinkActive="tb-active" [routerLinkActiveOptions]="{exact: true}" routerLink="{{section.path}}">
  20 + <span class="mat-button-wrapper">
  21 + <mat-icon *ngIf="!section.isMdiIcon && section.icon != null" class="material-icons">{{section.icon}}</mat-icon>
  22 + <mat-icon *ngIf="section.isMdiIcon && section.icon != null" [svgIcon]="section.icon"></mat-icon>
  23 + <span>{{section.name | translate}}</span>
  24 + <span class=" pull-right fa fa-chevron-down tb-toggle-icon"
  25 + [ngClass]="{'tb-toggled' : sectionActive()}"></span>
  26 + </span>
  27 +</a>
27 28 <ul id="docs-menu-{{section.name | nospace}}" class="tb-menu-toggle-list" [ngStyle]="{height: sectionHeight()}">
28 29 <li *ngFor="let page of section.pages">
29 30 <tb-menu-link [section]="page"></tb-menu-link>
... ...
... ... @@ -13,6 +13,7 @@
13 13 * See the License for the specific language governing permissions and
14 14 * limitations under the License.
15 15 */
  16 +
16 17 :host {
17 18 width: 100%;
18 19 }
... ... @@ -30,7 +31,8 @@
30 31 border-bottom: 1px solid rgba(0, 0, 0, .12);
31 32 }
32 33
33   - button {
  34 + a.mat-button {
  35 + text-transform: uppercase;
34 36 display: flex;
35 37 width: 100%;
36 38 max-height: 40px;
... ... @@ -46,52 +48,46 @@
46 48 cursor: pointer;
47 49 border-radius: 0;
48 50 &:hover {
  51 + border-bottom: none;
49 52 background-color: rgba(255,255,255,0.08);
50 53 }
  54 + &:focus {
  55 + border-bottom: none;
  56 + }
  57 + &.tb-active {
  58 + font-weight: 500;
  59 + background-color: rgba(255, 255, 255, .15);
  60 + }
51 61
52 62 .mat-button-wrapper {
53 63 width: 100%;
  64 + mat-icon {
  65 + margin-right: 8px;
  66 + margin-left: 0;
  67 + }
54 68 span {
55 69 overflow: hidden;
56 70 text-overflow: ellipsis;
57 71 white-space: nowrap;
  72 + &.tb-toggle-icon {
  73 + padding-top: 12px;
  74 + padding-bottom: 12px;
  75 + }
58 76 }
59 77 }
60 78 }
61 79
62   - button.tb-active {
63   - font-weight: 500;
64   - background-color: rgba(255, 255, 255, .15);
65   - }
66   -
67   - span.tb-toggle-icon {
68   - padding-top: 12px;
69   - padding-bottom: 12px;
70   - }
71   -
72   - mat-icon {
73   - margin-right: 8px;
74   - margin-left: 0;
75   - }
76   -
77   - .tb-menu-toggle-list button {
78   - padding: 0 16px 0 32px;
79   - font-weight: 500;
80   - text-transform: none;
81   - text-rendering: optimizeLegibility;
82   - }
83   -
84   - .tb-button-toggle .tb-toggle-icon {
85   - display: inline-block;
86   - width: 15px;
87   - margin: auto 0 auto auto;
88   - background-size: 100% auto;
89   -
90   - transition: transform .3s, ease-in-out;
91   - }
92   -
93   - .tb-button-toggle .tb-toggle-icon.tb-toggled {
94   - transform: rotateZ(180deg);
  80 + .tb-button-toggle {
  81 + .tb-toggle-icon {
  82 + display: inline-block;
  83 + width: 15px;
  84 + margin: auto 0 auto auto;
  85 + background-size: 100% auto;
  86 + transition: transform .3s, ease-in-out;
  87 + &.tb-toggled {
  88 + transform: rotateZ(180deg);
  89 + }
  90 + }
95 91 }
96 92
97 93 .tb-menu-toggle-list {
... ... @@ -103,7 +99,7 @@
103 99
104 100 transition-property: height;
105 101
106   - button {
  102 + a.mat-button {
107 103 padding: 0 16px 0 32px;
108 104 font-weight: 500;
109 105 text-transform: none !important;
... ...
... ... @@ -110,7 +110,9 @@ export interface WidgetTimewindow {
110 110
111 111 export function historyInterval(timewindowMs: number): Timewindow {
112 112 const timewindow: Timewindow = {
  113 + selectedTab: TimewindowType.HISTORY,
113 114 history: {
  115 + historyType: HistoryWindowType.LAST_INTERVAL,
114 116 timewindowMs
115 117 }
116 118 };
... ...