Fixed wrong behavior under customer level
This commit is contained in:
parent
90d945cb2c
commit
a246b0454c
@ -48,7 +48,7 @@
|
|||||||
{{ 'widgets.recent-dashboards.name' | translate }}
|
{{ 'widgets.recent-dashboards.name' | translate }}
|
||||||
</mat-header-cell>
|
</mat-header-cell>
|
||||||
<mat-cell class="title" *matCellDef="let lastVisitedDashboard">
|
<mat-cell class="title" *matCellDef="let lastVisitedDashboard">
|
||||||
<a routerLink="/dashboards/{{lastVisitedDashboard.id}}">{{ lastVisitedDashboard.title }}</a>
|
<a [routerLink]="createDashboardUrl(lastVisitedDashboard.id)">{{ lastVisitedDashboard.title }}</a>
|
||||||
</mat-cell>
|
</mat-cell>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
<ng-container matColumnDef="lastVisited">
|
<ng-container matColumnDef="lastVisited">
|
||||||
@ -78,7 +78,7 @@
|
|||||||
class="star" [ngClass]="{'starred': dashboard.starred}">{{ dashboard.starred ? 'star' : 'star_border' }}</mat-icon>
|
class="star" [ngClass]="{'starred': dashboard.starred}">{{ dashboard.starred ? 'star' : 'star_border' }}</mat-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="tb-cell title">
|
<div class="tb-cell title">
|
||||||
<a routerLink="/dashboards/{{dashboard.id}}">{{ dashboard.title }}</a>
|
<a [routerLink]="createDashboardUrl(dashboard.id)">{{ dashboard.title }}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -87,6 +87,7 @@
|
|||||||
subscriptSizing="dynamic"
|
subscriptSizing="dynamic"
|
||||||
appearance="outline"
|
appearance="outline"
|
||||||
[useIdValue]="false"
|
[useIdValue]="false"
|
||||||
|
[customerId]="customerId"
|
||||||
label=""
|
label=""
|
||||||
placeholder="{{ 'dashboard.select-dashboard' | translate }}"
|
placeholder="{{ 'dashboard.select-dashboard' | translate }}"
|
||||||
[(ngModel)]="starredDashboardValue" (ngModelChange)="onStarDashboard($event)"></tb-dashboard-autocomplete>
|
[(ngModel)]="starredDashboardValue" (ngModelChange)="onStarDashboard($event)"></tb-dashboard-autocomplete>
|
||||||
|
|||||||
@ -14,16 +14,7 @@
|
|||||||
/// limitations under the License.
|
/// limitations under the License.
|
||||||
///
|
///
|
||||||
|
|
||||||
import {
|
import { AfterViewInit, ChangeDetectorRef, Component, Input, OnDestroy, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core';
|
||||||
AfterViewInit,
|
|
||||||
ChangeDetectorRef,
|
|
||||||
Component,
|
|
||||||
Input,
|
|
||||||
OnDestroy,
|
|
||||||
OnInit,
|
|
||||||
QueryList, ViewChild,
|
|
||||||
ViewChildren
|
|
||||||
} from '@angular/core';
|
|
||||||
import { PageComponent } from '@shared/components/page.component';
|
import { PageComponent } from '@shared/components/page.component';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { AppState } from '@core/core.state';
|
import { AppState } from '@core/core.state';
|
||||||
@ -33,7 +24,8 @@ import { getCurrentAuthUser } from '@core/auth/auth.selectors';
|
|||||||
import { WidgetContext } from '@home/models/widget-component.models';
|
import { WidgetContext } from '@home/models/widget-component.models';
|
||||||
import {
|
import {
|
||||||
AbstractUserDashboardInfo,
|
AbstractUserDashboardInfo,
|
||||||
LastVisitedDashboardInfo, StarredDashboardInfo,
|
LastVisitedDashboardInfo,
|
||||||
|
StarredDashboardInfo,
|
||||||
UserDashboardAction,
|
UserDashboardAction,
|
||||||
UserDashboardsInfo
|
UserDashboardsInfo
|
||||||
} from '@shared/models/user-settings.models';
|
} from '@shared/models/user-settings.models';
|
||||||
@ -46,6 +38,8 @@ import { Direction, SortOrder } from '@shared/models/page/sort-order';
|
|||||||
import { MatSort } from '@angular/material/sort';
|
import { MatSort } from '@angular/material/sort';
|
||||||
import { DashboardInfo } from '@shared/models/dashboard.models';
|
import { DashboardInfo } from '@shared/models/dashboard.models';
|
||||||
import { DashboardAutocompleteComponent } from '@shared/components/dashboard-autocomplete.component';
|
import { DashboardAutocompleteComponent } from '@shared/components/dashboard-autocomplete.component';
|
||||||
|
import { UserService } from '@core/http/user.service';
|
||||||
|
import { User } from '@shared/models/user.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-recent-dashboards-widget',
|
selector: 'tb-recent-dashboards-widget',
|
||||||
@ -77,14 +71,23 @@ export class RecentDashboardsWidgetComponent extends PageComponent implements On
|
|||||||
hasDashboardsAccess = true;
|
hasDashboardsAccess = true;
|
||||||
|
|
||||||
dirty = false;
|
dirty = false;
|
||||||
|
public customerId: string;
|
||||||
|
private isFullscreenMode = false;
|
||||||
|
|
||||||
constructor(protected store: Store<AppState>,
|
constructor(protected store: Store<AppState>,
|
||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
|
private userService: UserService,
|
||||||
private userSettingService: UserSettingsService) {
|
private userSettingService: UserSettingsService) {
|
||||||
super(store);
|
super(store);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
this.userService.getUser(this.authUser.userId).subscribe((userInfo: User) => {
|
||||||
|
this.isFullscreenMode = userInfo.additionalInfo.defaultDashboardFullscreen;
|
||||||
|
});
|
||||||
|
if (this.authUser.authority === Authority.CUSTOMER_USER) {
|
||||||
|
this.customerId = this.authUser.customerId;
|
||||||
|
}
|
||||||
this.hasDashboardsAccess = [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER].includes(this.authUser.authority);
|
this.hasDashboardsAccess = [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER].includes(this.authUser.authority);
|
||||||
if (this.hasDashboardsAccess) {
|
if (this.hasDashboardsAccess) {
|
||||||
this.reload();
|
this.reload();
|
||||||
@ -110,6 +113,11 @@ export class RecentDashboardsWidgetComponent extends PageComponent implements On
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public createDashboardUrl(id: string): string {
|
||||||
|
const baseUrl = this.isFullscreenMode ? '/dashboard/' : '/dashboards/';
|
||||||
|
return baseUrl + id;
|
||||||
|
}
|
||||||
|
|
||||||
toggleValueChange(value: 'last' | 'starred') {
|
toggleValueChange(value: 'last' | 'starred') {
|
||||||
this.toggleValue = value;
|
this.toggleValue = value;
|
||||||
if (this.dirty) {
|
if (this.dirty) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user