* Add missing OK option to models
* add ok to legacy legacy UI does not support it but it is possible to do so via provisioning.
* use enums in migration so linter would catch missing cases
returnstring(ngmodels.OK),nil// values from ngalert/models/rule
case"","no_data":
case"",legacymodels.NoDataSetNoData:
return"NoData",nil
returnstring(ngmodels.NoData),nil
case"alerting":
caselegacymodels.NoDataSetAlerting:
return"Alerting",nil
returnstring(ngmodels.Alerting),nil
case"keep_state":
caselegacymodels.NoDataKeepState:
return"NoData",nil// "keep last state" translates to no data because we now emit a special alert when the state is "noData". The result is that the evaluation will not return firing and instead we'll raise the special alert.
returnstring(ngmodels.NoData),nil// "keep last state" translates to no data because we now emit a special alert when the state is "noData". The result is that the evaluation will not return firing and instead we'll raise the special alert.
}
}
return"",fmt.Errorf("unrecognized No Data setting %v",s)
return"",fmt.Errorf("unrecognized No Data setting %v",s)
}
}
functransExecErr(sstring)(string,error){
functransExecErr(sstring)(string,error){
switchs{
switchlegacymodels.ExecutionErrorOption(s){
case"","alerting":
case"",legacymodels.ExecutionErrorSetAlerting:
return"Alerting",nil
returnstring(ngmodels.AlertingErrState),nil
case"keep_state":
caselegacymodels.ExecutionErrorKeepState:
// Keep last state is translated to error as we now emit a
// Keep last state is translated to error as we now emit a