This commit is contained in:
Nawaz Dhandala 2022-04-15 15:31:34 +01:00
parent 6d086f7594
commit 357ffbfa35
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
13 changed files with 27 additions and 25 deletions

View File

@ -367,7 +367,7 @@ router.post(
);
const monitorUptime: $TSFixMe =
uptimePercents.reduce((a, b) => {
uptimePercents.reduce((a: $TSFixMe, b: $TSFixMe) => {
return (
parseFloat(a || 100) +
parseFloat(b || 100)

View File

@ -1690,7 +1690,7 @@ router.get(
...callScheduleStatus,
];
incidentMessages.sort(
(a, b) =>
(a: $TSFixMe, b: $TSFixMe) =>
typeof a.schedule !== 'object' &&
b.createdAt - a.createdAt
);

View File

@ -784,7 +784,7 @@ export default class Service {
request: data.request,
};
let _incident;
let _incident:$TSFixMe;
if (data.customFields && data.customFields.length > 0) {
for (const field of data.customFields) {
if (
@ -891,7 +891,7 @@ export default class Service {
componentName: joinNames(componentNames),
request: data.request,
};
let _incident;
let _incident:$TSFixMe;
if (data.customFields && data.customFields.length > 0) {
for (const field of data.customFields) {
if (

View File

@ -1797,7 +1797,7 @@ export default class Service {
}
}
calculateTime(statuses: $TSFixMe, start: $TSFixMe, range: $TSFixMe): void {
public calculateTime(statuses: $TSFixMe, start: $TSFixMe, range: $TSFixMe): void {
const timeBlock: $TSFixMe = [];
let totalUptime: $TSFixMe = 0;
let totalTime: $TSFixMe = 0;
@ -1863,7 +1863,7 @@ export default class Service {
});
//Second step
incidentsHappenedDuringTheDay.sort((a, b) => {
incidentsHappenedDuringTheDay.sort((a: $TSFixMe, b: $TSFixMe) => {
return moment(a.start).isSame(b.start)
? 0
: moment(a.start).isAfter(b.start)
@ -2067,7 +2067,7 @@ export default class Service {
return updatedMonitor;
}
calcTime(statuses: $TSFixMe, start: $TSFixMe, range: $TSFixMe): void {
public calcTime(statuses: $TSFixMe, start: $TSFixMe, range: $TSFixMe): void {
const timeBlock: $TSFixMe = [];
let totalUptime: $TSFixMe = 0;
let totalTime: $TSFixMe = 0;
@ -2164,7 +2164,7 @@ export default class Service {
);
//Second step
incidentsHappenedDuringTheDay.sort((a, b) => {
incidentsHappenedDuringTheDay.sort((a: $TSFixMe, b: $TSFixMe) => {
return moment(a.start).isSame(b.start)
? 0
: moment(a.start).isAfter(b.start)

View File

@ -307,7 +307,7 @@ export default class Service {
'Your subscription cannot be retrieved.'
);
} else {
let trial_end_date;
let trial_end_date:$TSFixMe;
if (
subscription.trial_end !== null &&
subscription.trial_end * 1000 > Date.now() //ensure the trial end date is in the future

View File

@ -122,9 +122,9 @@ export default class Service {
};
let avgTime: $TSFixMe = 0,
maxTime = 0,
throughput = 0,
errorCount = 0;
maxTime: $TSFixMe = 0,
throughput: $TSFixMe = 0,
errorCount: $TSFixMe = 0;
value.forEach((eachValue: $TSFixMe) => {
avgTime += eachValue.metrics.avgTime;

View File

@ -310,7 +310,7 @@ public async incidentCreateOrUpdate(data: $TSFixMe): void {
const internalIncidents: $TSFixMe = [];
for (let incident of incidents) {
if (monitor.type !== 'incomingHttpRequest') {
const initialProbes: $TSFixMe = incident.probes.map(probe: $TSFixMe => ({
const initialProbes: $TSFixMe = incident.probes.map((probe: $TSFixMe) => ({
probeId: probe.probeId._id || probe.probeId,
updatedAt: probe.updatedAt,
status: probe.status,
@ -385,7 +385,7 @@ public async incidentCreateOrUpdate(data: $TSFixMe): void {
const internalIncidents: $TSFixMe = [];
for (let incident of incidents) {
if (monitor.type !== 'incomingHttpRequest') {
const initialProbes: $TSFixMe = incident.probes.map(probe: $TSFixMe => ({
const initialProbes: $TSFixMe = incident.probes.map((probe: $TSFixMe) => ({
probeId: probe.probeId._id || probe.probeId,
updatedAt: probe.updatedAt,
status: probe.status,
@ -459,7 +459,7 @@ public async incidentCreateOrUpdate(data: $TSFixMe): void {
const internalIncidents: $TSFixMe = [];
for (let incident of incidents) {
if (monitor.type !== 'incomingHttpRequest') {
const initialProbes: $TSFixMe = incident.probes.map(probe: $TSFixMe => ({
const initialProbes: $TSFixMe = incident.probes.map((probe: $TSFixMe) => ({
probeId: probe.probeId._id || probe.probeId,
updatedAt: probe.updatedAt,
status: probe.status,
@ -624,7 +624,7 @@ public async incidentResolveOrAcknowledge(data, allCriteria): void {
incident.probes.length > 0 &&
monitor.type !== 'incomingHttpRequest'
) {
const initialProbes: $TSFixMe = incident.probes.map(probe: $TSFixMe => ({
const initialProbes: $TSFixMe = incident.probes.map((probe: $TSFixMe) => ({
probeId: probe.probeId._id || probe.probeId,
updatedAt: probe.updatedAt,
status: probe.status,

View File

@ -255,7 +255,9 @@ export const countryCode: Function = (): void => {
const invertedObject: $TSFixMe = _.invert(codes);
let keys: $TSFixMe = Object.keys(invertedObject);
keys = keys.sort();
const data: $TSFixMe = keys.map(k: $TSFixMe => ({ label: k, value: invertedObject[k] }));
const data: $TSFixMe = keys.map((k: $TSFixMe) => {
return { label: k, value: invertedObject[k] };
});
data.unshift({ value: '', label: 'Select a country' });
return data;
};

View File

@ -267,7 +267,7 @@ export default {
const internalIncidents: $TSFixMe = [];
for (let incident of incidents) {
if (monitor.type !== 'incomingHttpRequest') {
const initialProbes: $TSFixMe = incident.probes.map(probe: $TSFixMe => ({
const initialProbes: $TSFixMe = incident.probes.map((probe: $TSFixMe) => ({
probeId: probe.probeId._id || probe.probeId,
updatedAt: probe.updatedAt,
status: probe.status,
@ -347,7 +347,7 @@ export default {
const internalIncidents: $TSFixMe = [];
for (let incident of incidents) {
if (monitor.type !== 'incomingHttpRequest') {
const initialProbes: $TSFixMe = incident.probes.map(probe: $TSFixMe => ({
const initialProbes: $TSFixMe = incident.probes.map((probe: $TSFixMe) => ({
probeId: probe.probeId._id || probe.probeId,
updatedAt: probe.updatedAt,
status: probe.status,
@ -426,7 +426,7 @@ export default {
const internalIncidents: $TSFixMe = [];
for (let incident of incidents) {
if (monitor.type !== 'incomingHttpRequest') {
const initialProbes: $TSFixMe = incident.probes.map(probe: $TSFixMe => ({
const initialProbes: $TSFixMe = incident.probes.map((probe: $TSFixMe) => ({
probeId: probe.probeId._id || probe.probeId,
updatedAt: probe.updatedAt,
status: probe.status,
@ -582,7 +582,7 @@ export default {
incident.probes.length > 0 &&
monitor.type !== 'incomingHttpRequest'
) {
const initialProbes: $TSFixMe = incident.probes.map(probe: $TSFixMe => ({
const initialProbes: $TSFixMe = incident.probes.map((probe: $TSFixMe) => ({
probeId: probe.probeId._id || probe.probeId,
updatedAt: probe.updatedAt,
status: probe.status,

View File

@ -86,7 +86,7 @@ async function run(): void {
.filter((file: $TSFixMe) => {
return excludedScripts.indexOf(file) < 0;
}) // Exclude index, start and end scripts
.sort((a, b) => {
.sort((a: $TSFixMe, b: $TSFixMe) => {
return parseInt(a.split('.')[2]) > parseInt(b.split('.')[2])
? 1
: 0;

View File

@ -44,7 +44,7 @@ const _this: $TSFixMe = {
});
},
get: (url: URL, limit = 10) => {
get: (url: URL, limit: number = 10) => {
const headers: $TSFixMe = this.getHeaders();
return new Promise((resolve: Function, reject: Function) => {
axios({

View File

@ -11,7 +11,7 @@ const _this: $TSFixMe = {
clusterKey,
};
},
post: (url: URL, data: $TSFixMe, withBaseUrl = false) => {
post: (url: URL, data: $TSFixMe, withBaseUrl: $TSFixMe = false) => {
const headers: $TSFixMe = this.getHeaders();
return new Promise((resolve: Function, reject: Function) => {

View File

@ -10,7 +10,7 @@ const runConfig: $TSFixMe = {
};
class ScriptError extends Error {
errors: $TSFixMe;
public errors: $TSFixMe;
public constructor(errors: $TSFixMe, message = 'Script resource error') {
super();
this.message = message;