Browse Source

fix: hide dashboards marked hidden for mobile in dashboard select inside the mobile app (#16797)

The dashboard selection dropdown requested /api/user/dashboards without the
mobile flag, so dashboards with "Hide dashboard in mobile application" were
listed and could be opened from the mobile app. Pass mobile=true when the UI
runs inside the mobile app; browser behaviour is unchanged.
pull/16810/merge
Artem Babak 1 week ago
committed by GitHub
parent
commit
079271a98d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      ui-ngx/src/app/core/http/dashboard.service.ts
  2. 5
      ui-ngx/src/app/shared/components/dashboard-select.component.ts

5
ui-ngx/src/app/core/http/dashboard.service.ts

@ -60,7 +60,7 @@ export class DashboardService {
}
public getUserDashboards(userId: string, operation: Operation,
pageLink: PageLink, config?: RequestConfig): Observable<PageData<DashboardInfo>> {
pageLink: PageLink, config?: RequestConfig, mobile = false): Observable<PageData<DashboardInfo>> {
let url = `/api/user/dashboards${pageLink.toQuery()}`;
if (userId) {
url += `&userId=${userId}`;
@ -68,6 +68,9 @@ export class DashboardService {
if (operation) {
url += `&operation=${operation}`;
}
if (mobile) {
url += `&mobile=true`;
}
return this.http.get<PageData<DashboardInfo>>(url,
defaultHttpOptionsFromConfig(config));
}

5
ui-ngx/src/app/shared/components/dashboard-select.component.ts

@ -37,6 +37,7 @@ import {
} from './dashboard-select-panel.component';
import { Operation } from '@shared/models/security.models';
import { UtilsService } from '@core/services/utils.service';
import { MobileService } from '@core/services/mobile.service';
// @dynamic
@Component({
@ -87,6 +88,7 @@ export class DashboardSelectComponent implements ControlValueAccessor, OnInit {
constructor(private store: Store<AppState>,
private dashboardService: DashboardService,
private utils: UtilsService,
private mobileService: MobileService,
private overlay: Overlay,
private breakpointObserver: BreakpointObserver,
private viewContainerRef: ViewContainerRef,
@ -185,7 +187,8 @@ export class DashboardSelectComponent implements ControlValueAccessor, OnInit {
if (this.customerId) {
dashboardsObservable = this.dashboardService.getCustomerDashboards(true, this.customerId, pageLink, {ignoreLoading: true});
} else {
dashboardsObservable = this.dashboardService.getUserDashboards(null, this.operation, pageLink, {ignoreLoading: true});
dashboardsObservable = this.dashboardService.getUserDashboards(null, this.operation, pageLink, {ignoreLoading: true},
this.mobileService.isMobileApp());
}
}
return dashboardsObservable;

Loading…
Cancel
Save