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,12 +30,14 @@ import { getCurrentAuthState, selectAuthUser, selectUserDetails } from '@core/au
30 import { MediaBreakpoints } from '@shared/models/constants'; 30 import { MediaBreakpoints } from '@shared/models/constants';
31 import { ActionNotificationShow } from '@core/notification/notification.actions'; 31 import { ActionNotificationShow } from '@core/notification/notification.actions';
32 import { Router } from '@angular/router'; 32 import { Router } from '@angular/router';
33 -import * as screenfull from 'screenfull'; 33 +import * as _screenfull from 'screenfull';
34 import { MatSidenav } from '@angular/material/sidenav'; 34 import { MatSidenav } from '@angular/material/sidenav';
35 import { AuthState } from '@core/auth/auth.models'; 35 import { AuthState } from '@core/auth/auth.models';
36 import { WINDOW } from '@core/services/window.service'; 36 import { WINDOW } from '@core/services/window.service';
37 import { ISearchableComponent, instanceOfSearchableComponent } from '@home/models/searchable-component.models'; 37 import { ISearchableComponent, instanceOfSearchableComponent } from '@home/models/searchable-component.models';
38 38
  39 +const screenfull = _screenfull as _screenfull.Screenfull;
  40 +
39 @Component({ 41 @Component({
40 selector: 'tb-home', 42 selector: 'tb-home',
41 templateUrl: './home.component.html', 43 templateUrl: './home.component.html',
@@ -60,8 +62,7 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni @@ -60,8 +62,7 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni
60 62
61 @ViewChild('searchInput') searchInputField: ElementRef; 63 @ViewChild('searchInput') searchInputField: ElementRef;
62 64
63 - // @ts-ignore  
64 - fullscreenEnabled = screenfull.enabled; 65 + fullscreenEnabled = screenfull.isEnabled;
65 66
66 authUser$: Observable<any>; 67 authUser$: Observable<any>;
67 userDetails$: Observable<User>; 68 userDetails$: Observable<User>;
@@ -125,15 +126,12 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni @@ -125,15 +126,12 @@ export class HomeComponent extends PageComponent implements AfterViewInit, OnIni
125 } 126 }
126 127
127 toggleFullscreen() { 128 toggleFullscreen() {
128 - // @ts-ignore  
129 - if (screenfull.enabled) {  
130 - // @ts-ignore 129 + if (screenfull.isEnabled) {
131 screenfull.toggle(); 130 screenfull.toggle();
132 } 131 }
133 } 132 }
134 133
135 isFullscreen() { 134 isFullscreen() {
136 - // @ts-ignore  
137 return screenfull.isFullscreen; 135 return screenfull.isFullscreen;
138 } 136 }
139 137
@@ -15,9 +15,10 @@ @@ -15,9 +15,10 @@
15 limitations under the License. 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 +15,16 @@
15 limitations under the License. 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 <ul id="docs-menu-{{section.name | nospace}}" class="tb-menu-toggle-list" [ngStyle]="{height: sectionHeight()}"> 28 <ul id="docs-menu-{{section.name | nospace}}" class="tb-menu-toggle-list" [ngStyle]="{height: sectionHeight()}">
28 <li *ngFor="let page of section.pages"> 29 <li *ngFor="let page of section.pages">
29 <tb-menu-link [section]="page"></tb-menu-link> 30 <tb-menu-link [section]="page"></tb-menu-link>
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
  16 +
16 :host { 17 :host {
17 width: 100%; 18 width: 100%;
18 } 19 }
@@ -30,7 +31,8 @@ @@ -30,7 +31,8 @@
30 border-bottom: 1px solid rgba(0, 0, 0, .12); 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 display: flex; 36 display: flex;
35 width: 100%; 37 width: 100%;
36 max-height: 40px; 38 max-height: 40px;
@@ -46,52 +48,46 @@ @@ -46,52 +48,46 @@
46 cursor: pointer; 48 cursor: pointer;
47 border-radius: 0; 49 border-radius: 0;
48 &:hover { 50 &:hover {
  51 + border-bottom: none;
49 background-color: rgba(255,255,255,0.08); 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 .mat-button-wrapper { 62 .mat-button-wrapper {
53 width: 100%; 63 width: 100%;
  64 + mat-icon {
  65 + margin-right: 8px;
  66 + margin-left: 0;
  67 + }
54 span { 68 span {
55 overflow: hidden; 69 overflow: hidden;
56 text-overflow: ellipsis; 70 text-overflow: ellipsis;
57 white-space: nowrap; 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 .tb-menu-toggle-list { 93 .tb-menu-toggle-list {
@@ -103,7 +99,7 @@ @@ -103,7 +99,7 @@
103 99
104 transition-property: height; 100 transition-property: height;
105 101
106 - button { 102 + a.mat-button {
107 padding: 0 16px 0 32px; 103 padding: 0 16px 0 32px;
108 font-weight: 500; 104 font-weight: 500;
109 text-transform: none !important; 105 text-transform: none !important;
@@ -110,7 +110,9 @@ export interface WidgetTimewindow { @@ -110,7 +110,9 @@ export interface WidgetTimewindow {
110 110
111 export function historyInterval(timewindowMs: number): Timewindow { 111 export function historyInterval(timewindowMs: number): Timewindow {
112 const timewindow: Timewindow = { 112 const timewindow: Timewindow = {
  113 + selectedTab: TimewindowType.HISTORY,
113 history: { 114 history: {
  115 + historyType: HistoryWindowType.LAST_INTERVAL,
114 timewindowMs 116 timewindowMs
115 } 117 }
116 }; 118 };