Skip to content

Commit

Permalink
Params change
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjoel committed Apr 24, 2024
1 parent 72c1a9e commit f7bf1ea
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,30 @@ export class ListOfSpeakersMainComponent extends BaseModelRequestHandlerComponen

protected override onParamsChanged(params: any, oldParams: any): void {
if (params[`id`] !== oldParams[`id`] || params[`meetingId`] !== oldParams[`meetingId`]) {
this.sequentialNumberMapping
.getIdBySequentialNumber({
collection: ListOfSpeakers.COLLECTION,
meetingId: params[`meetingId`],
sequentialNumber: +params[`id`]
})
.then(id => {
if (id && this._currentLOSId !== id) {
this._currentLOSId = id;
this.loadLOSDetail();
}
});
this.loadLOSDetail(+params[`id`], +params[`meetingId`]);
}
}

private loadLOSDetail(): void {
this.updateSubscribeTo(getListOfSpeakersDetailSubscriptionConfig(this._currentLOSId), {
hideWhenDestroyed: true
});
protected override onShouldCreateModelRequests(params: any, meetingId: Id): void {
if (params[`id`] && meetingId) {
this.loadLOSDetail(+params[`id`], meetingId);
}
}

private loadLOSDetail(id: Id, meetingId: Id): void {
this.sequentialNumberMapping
.getIdBySequentialNumber({
collection: ListOfSpeakers.COLLECTION,
meetingId: meetingId,
sequentialNumber: id
})
.then(id => {
if (id && this._currentLOSId !== id) {
this._currentLOSId = id;
this.updateSubscribeTo(getListOfSpeakersDetailSubscriptionConfig(this._currentLOSId), {
hideWhenDestroyed: true
});
}
});
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import { Id } from 'src/app/domain/definitions/key-types';
import { BaseModelRequestHandlerComponent } from 'src/app/site/base/base-model-request-handler.component';
import { SequentialNumberMappingService } from 'src/app/site/pages/meetings/services/sequential-number-mapping.service';

Expand All @@ -15,17 +16,17 @@ export class FullscreenProjectorMainComponent extends BaseModelRequestHandlerCom
super();
}

protected override onParamsChanged(params: any, _oldParams?: any): void {
protected override onShouldCreateModelRequests(params: any, meetingId: Id): void {
if (params[`id`]) {
this.sequentialNumberMappingService
.getIdBySequentialNumber({
collection: ViewProjector.COLLECTION,
meetingId: params[`meetingId`],
meetingId,
sequentialNumber: +params[`id`]
})
.then(id => {
if (id) {
this.subscribeTo(getProjectorSubscriptionConfig(id), { hideWhenMeetingChanged: true });
this.subscribeTo(getProjectorSubscriptionConfig(id), { hideWhenDestroyed: true });
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component } from '@angular/core';
import { Id } from 'src/app/domain/definitions/key-types';
import { BaseModelRequestHandlerComponent } from 'src/app/site/base/base-model-request-handler.component/base-model-request-handler.component';

import { getCommitteeDetailSubscriptionConfig } from '../../../../committees.subscription';
Expand All @@ -10,12 +9,17 @@ import { getCommitteeDetailSubscriptionConfig } from '../../../../committees.sub
styleUrls: [`./committee-detail.component.scss`]
})
export class CommitteeDetailComponent extends BaseModelRequestHandlerComponent {
private committeeId: Id | null = null;

protected override onParamsChanged(params: any, oldParams: any): void {
if (params[`committeeId`] !== oldParams[`committeeId`]) {
this.committeeId = +params[`committeeId`] || null;
this.subscribeTo(getCommitteeDetailSubscriptionConfig(this.committeeId), { hideWhenDestroyed: true });
if (params[`committeeId`] !== oldParams[`committeeId`] && +params[`committeeId`]) {
this.updateSubscribeTo(getCommitteeDetailSubscriptionConfig(+params[`committeeId`]), {
hideWhenDestroyed: true
});
}
}

protected override onShouldCreateModelRequests(params: any): void {
if (+params[`committeeId`]) {
this.subscribeTo(getCommitteeDetailSubscriptionConfig(+params[`committeeId`]), { hideWhenDestroyed: true });
}
}
}

0 comments on commit f7bf1ea

Please sign in to comment.