* 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
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.
switchlegacymodels.NoDataOption(s){
caselegacymodels.NoDataSetOK:
returnstring(ngmodels.OK),nil// values from ngalert/models/rule
case"",legacymodels.NoDataSetNoData:
returnstring(ngmodels.NoData),nil
caselegacymodels.NoDataSetAlerting:
returnstring(ngmodels.Alerting),nil
caselegacymodels.NoDataKeepState:
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)
}
functransExecErr(sstring)(string,error){
switchs{
case"","alerting":
return"Alerting",nil
case"keep_state":
switchlegacymodels.ExecutionErrorOption(s){
case"",legacymodels.ExecutionErrorSetAlerting:
returnstring(ngmodels.AlertingErrState),nil
caselegacymodels.ExecutionErrorKeepState:
// Keep last state is translated to error as we now emit a