fix(ui): fix alert change value

This commit is contained in:
nick-delirium 2023-02-21 12:03:05 +01:00
parent 30efc6cfe5
commit bf4689e171
2 changed files with 5 additions and 2 deletions

View file

@ -2,6 +2,7 @@ import React from 'react';
import { Input } from 'UI';
import Select from 'Shared/Select';
import { alertConditions as conditions } from 'App/constants';
import Alert from 'Types/alert'
const thresholdOptions = [
{ label: '15 minutes', value: 15 },

View file

@ -20,7 +20,9 @@ export default class AlertsStore {
this.page = 1;
}
// TODO: remove it
updateKey(key: string, value: any) {
// @ts-ignore
this[key] = value
}
@ -77,10 +79,10 @@ export default class AlertsStore {
edit = (diff: Partial<Alert>) => {
const key = Object.keys(diff)[0]
const oldInst = this.instance
const oldInst = { ...this.instance }
// @ts-ignore
oldInst[key] = diff[key]
this.instance = oldInst
this.instance = new Alert(oldInst, !!oldInst.alertId)
}
}