Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed May 3, 2023
1 parent 90c140d commit 29b9505
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export class StatusRuleExecutor {
monitors: Array<SavedObjectsFindResult<EncryptedSyntheticsMonitor>> = [];

public locationIdNameMap: Record<string, string> = {};
public locationNameIdMap: Record<string, string> = {};

constructor(
previousStartedAt: Date | null,
Expand All @@ -76,12 +75,10 @@ export class StatusRuleExecutor {

publicLocations.forEach((loc) => {
this.locationIdNameMap[loc.label] = loc.id;
this.locationNameIdMap[loc.id] = loc.label;
});

privateLocations.forEach((loc) => {
this.locationIdNameMap[loc.label] = loc.id;
this.locationIdNameMap[loc.id] = loc.label;
});
}

Expand Down Expand Up @@ -198,13 +195,10 @@ export class StatusRuleExecutor {
delete downConfigs[locPlusId];
} else {
const { locations } = monitor.attributes;
if (
!locations.some(
(l) =>
l.label === downConfig.location ||
this.locationNameIdMap[l.id] === downConfig.location
)
) {
const isLocationRemoved = !locations.some(
(l) => l.id === this.getLocationId(downConfig.location)
);
if (isLocationRemoved) {
staleDownConfigs[locPlusId] = { ...downConfig, isLocationRemoved: true };
delete downConfigs[locPlusId];
}
Expand Down

0 comments on commit 29b9505

Please sign in to comment.