Browse Source

UI: Do not report visited dashboard for public user

pull/8463/head
Igor Kulikov 3 years ago
parent
commit
983c86eb4d
  1. 11
      ui-ngx/src/app/modules/home/pages/dashboard/dashboard-routing.module.ts

11
ui-ngx/src/app/modules/home/pages/dashboard/dashboard-routing.module.ts

@ -22,18 +22,22 @@ import { Authority } from '@shared/models/authority.enum';
import { DashboardsTableConfigResolver } from './dashboards-table-config.resolver';
import { DashboardPageComponent } from '@home/components/dashboard-page/dashboard-page.component';
import { BreadCrumbConfig, BreadCrumbLabelFunction } from '@shared/components/breadcrumb';
import { mergeMap, Observable } from 'rxjs';
import { mergeMap, Observable, of } from 'rxjs';
import { Dashboard } from '@app/shared/models/dashboard.models';
import { DashboardService } from '@core/http/dashboard.service';
import { DashboardUtilsService } from '@core/services/dashboard-utils.service';
import { map } from 'rxjs/operators';
import { UserSettingsService } from '@core/http/user-settings.service';
import { UserDashboardAction } from '@shared/models/user-settings.models';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
@Injectable()
export class DashboardResolver implements Resolve<Dashboard> {
constructor(private dashboardService: DashboardService,
constructor(private store: Store<AppState>,
private dashboardService: DashboardService,
private userSettingService: UserSettingsService,
private dashboardUtils: DashboardUtilsService) {
}
@ -42,7 +46,8 @@ export class DashboardResolver implements Resolve<Dashboard> {
const dashboardId = route.params.dashboardId;
return this.dashboardService.getDashboard(dashboardId).pipe(
mergeMap((dashboard) =>
this.userSettingService.reportUserDashboardAction(dashboardId, UserDashboardAction.VISIT, {ignoreLoading: true}).pipe(
(getCurrentAuthUser(this.store).isPublic ? of(null) :
this.userSettingService.reportUserDashboardAction(dashboardId, UserDashboardAction.VISIT, {ignoreLoading: true})).pipe(
map(() => dashboard)
)),
map((dashboard) => this.dashboardUtils.validateAndUpdateDashboard(dashboard))

Loading…
Cancel
Save