mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 15:24:55 +00:00
Dictonary
This commit is contained in:
parent
c2729af014
commit
fa409a533e
@ -128,7 +128,7 @@ export default class ProbeMonitorResponseService {
|
||||
})
|
||||
.flat();
|
||||
|
||||
const autoResolveCriteriaInstanceIdIncidentIdsDictonary: Dictionary<
|
||||
const autoResolveCriteriaInstanceIdIncidentIdsDictionary: Dictionary<
|
||||
Array<string>
|
||||
> = {};
|
||||
const criteriaInstanceMap: Dictionary<MonitorCriteriaInstance> = {};
|
||||
@ -144,16 +144,16 @@ export default class ProbeMonitorResponseService {
|
||||
.incidents) {
|
||||
if (incidentTemplate.autoResolveIncident) {
|
||||
if (
|
||||
!autoResolveCriteriaInstanceIdIncidentIdsDictonary[
|
||||
!autoResolveCriteriaInstanceIdIncidentIdsDictionary[
|
||||
criteriaInstance.data.id.toString()
|
||||
]
|
||||
) {
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictonary[
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictionary[
|
||||
criteriaInstance.data.id.toString()
|
||||
] = [];
|
||||
}
|
||||
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictonary[
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictionary[
|
||||
criteriaInstance.data.id.toString()
|
||||
]?.push(incidentTemplate.id);
|
||||
}
|
||||
@ -207,7 +207,7 @@ export default class ProbeMonitorResponseService {
|
||||
monitor: monitor,
|
||||
rootCause: response.rootCause,
|
||||
probeMonitorResponse: probeMonitorResponse,
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictonary,
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictionary,
|
||||
criteriaInstance: criteriaInstanceMap[response.criteriaMetId!]!,
|
||||
});
|
||||
} else if (
|
||||
@ -244,7 +244,7 @@ export default class ProbeMonitorResponseService {
|
||||
monitor: Monitor;
|
||||
probeMonitorResponse: ProbeMonitorResponse;
|
||||
rootCause: string;
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictonary: Dictionary<
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictionary: Dictionary<
|
||||
Array<string>
|
||||
>;
|
||||
}): Promise<void> {
|
||||
@ -310,8 +310,8 @@ export default class ProbeMonitorResponseService {
|
||||
const shouldClose: boolean =
|
||||
ProbeMonitorResponseService.shouldCloseIncident({
|
||||
openIncident,
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictonary:
|
||||
input.autoResolveCriteriaInstanceIdIncidentIdsDictonary,
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictionary:
|
||||
input.autoResolveCriteriaInstanceIdIncidentIdsDictionary,
|
||||
criteriaInstance: input.criteriaInstance,
|
||||
});
|
||||
|
||||
@ -453,7 +453,7 @@ export default class ProbeMonitorResponseService {
|
||||
|
||||
private static shouldCloseIncident(input: {
|
||||
openIncident: Incident;
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictonary: Dictionary<
|
||||
autoResolveCriteriaInstanceIdIncidentIdsDictionary: Dictionary<
|
||||
Array<string>
|
||||
>;
|
||||
criteriaInstance: MonitorCriteriaInstance;
|
||||
@ -477,12 +477,12 @@ export default class ProbeMonitorResponseService {
|
||||
}
|
||||
|
||||
if (
|
||||
input.autoResolveCriteriaInstanceIdIncidentIdsDictonary[
|
||||
input.autoResolveCriteriaInstanceIdIncidentIdsDictionary[
|
||||
input.openIncident.createdCriteriaId?.toString()
|
||||
]
|
||||
) {
|
||||
if (
|
||||
input.autoResolveCriteriaInstanceIdIncidentIdsDictonary[
|
||||
input.autoResolveCriteriaInstanceIdIncidentIdsDictionary[
|
||||
input.openIncident.createdCriteriaId?.toString()
|
||||
]?.includes(
|
||||
input.openIncident.createdIncidentTemplateId?.toString()
|
||||
|
@ -36,7 +36,7 @@ import StatusPageCerts from './Jobs/StatusPageCerts/StatusPageCerts';
|
||||
|
||||
// Express
|
||||
import Express, { ExpressApplication } from 'CommonServer/Utils/Express';
|
||||
import JobDictonary from './Utils/JobDictionary';
|
||||
import JobDictionary from './Utils/JobDictionary';
|
||||
|
||||
// Monitor Owners
|
||||
import './Jobs/MonitorOwners/SendCreatedResourceNotification';
|
||||
@ -98,7 +98,7 @@ const init: Function = async (): Promise<void> => {
|
||||
|
||||
logger.info('Running Job: ' + name);
|
||||
|
||||
const funcToRun: Function = JobDictonary.getJobFunction(name);
|
||||
const funcToRun: Function = JobDictionary.getJobFunction(name);
|
||||
|
||||
if (funcToRun) {
|
||||
await funcToRun();
|
||||
|
@ -1,4 +1,4 @@
|
||||
import JobDictonary from './JobDictionary';
|
||||
import JobDictionary from './JobDictionary';
|
||||
import Queue, { QueueName } from 'CommonServer/Infrastructure/Queue';
|
||||
import logger from 'CommonServer/Utils/Logger';
|
||||
|
||||
@ -10,7 +10,7 @@ const RunCron: Function = (
|
||||
},
|
||||
runFunction: Function
|
||||
): void => {
|
||||
JobDictonary.setJobFunction(jobName, runFunction);
|
||||
JobDictionary.setJobFunction(jobName, runFunction);
|
||||
|
||||
logger.info('Adding job to the queue: ' + jobName);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Dictionary from 'Common/Types/Dictionary';
|
||||
import BadDataException from 'Common/Types/Exception/BadDataException';
|
||||
|
||||
export default class JobDictonary {
|
||||
export default class JobDictionary {
|
||||
private static dictionary: Dictionary<Function> = {};
|
||||
|
||||
public static getJobFunction(name: string): Function {
|
||||
|
Loading…
Reference in New Issue
Block a user