E2C: Add new error for alert rule quota (#107225)
* add new error for alert rule quota * add alert rule group quota error * make openapi3-gen * revert message * update translation * prettier * update text per review suggestion
This commit is contained in:
@@ -150,17 +150,19 @@ const (
|
||||
type ItemErrorCode string
|
||||
|
||||
const (
|
||||
ErrDatasourceNameConflict ItemErrorCode = "DATASOURCE_NAME_CONFLICT"
|
||||
ErrDatasourceInvalidURL ItemErrorCode = "DATASOURCE_INVALID_URL"
|
||||
ErrDatasourceAlreadyManaged ItemErrorCode = "DATASOURCE_ALREADY_MANAGED"
|
||||
ErrFolderNameConflict ItemErrorCode = "FOLDER_NAME_CONFLICT"
|
||||
ErrDashboardAlreadyManaged ItemErrorCode = "DASHBOARD_ALREADY_MANAGED"
|
||||
ErrLibraryElementNameConflict ItemErrorCode = "LIBRARY_ELEMENT_NAME_CONFLICT"
|
||||
ErrUnsupportedDataType ItemErrorCode = "UNSUPPORTED_DATA_TYPE"
|
||||
ErrResourceConflict ItemErrorCode = "RESOURCE_CONFLICT"
|
||||
ErrUnexpectedStatus ItemErrorCode = "UNEXPECTED_STATUS_CODE"
|
||||
ErrInternalServiceError ItemErrorCode = "INTERNAL_SERVICE_ERROR"
|
||||
ErrGeneric ItemErrorCode = "GENERIC_ERROR"
|
||||
ErrAlertRulesQuotaReached ItemErrorCode = "ALERT_RULES_QUOTA_REACHED"
|
||||
ErrAlertRulesGroupQuotaReached ItemErrorCode = "ALERT_RULES_GROUP_QUOTA_REACHED"
|
||||
ErrDatasourceNameConflict ItemErrorCode = "DATASOURCE_NAME_CONFLICT"
|
||||
ErrDatasourceInvalidURL ItemErrorCode = "DATASOURCE_INVALID_URL"
|
||||
ErrDatasourceAlreadyManaged ItemErrorCode = "DATASOURCE_ALREADY_MANAGED"
|
||||
ErrFolderNameConflict ItemErrorCode = "FOLDER_NAME_CONFLICT"
|
||||
ErrDashboardAlreadyManaged ItemErrorCode = "DASHBOARD_ALREADY_MANAGED"
|
||||
ErrLibraryElementNameConflict ItemErrorCode = "LIBRARY_ELEMENT_NAME_CONFLICT"
|
||||
ErrUnsupportedDataType ItemErrorCode = "UNSUPPORTED_DATA_TYPE"
|
||||
ErrResourceConflict ItemErrorCode = "RESOURCE_CONFLICT"
|
||||
ErrUnexpectedStatus ItemErrorCode = "UNEXPECTED_STATUS_CODE"
|
||||
ErrInternalServiceError ItemErrorCode = "INTERNAL_SERVICE_ERROR"
|
||||
ErrGeneric ItemErrorCode = "GENERIC_ERROR"
|
||||
)
|
||||
|
||||
// swagger:parameters getCloudMigrationRun
|
||||
|
||||
@@ -110,17 +110,19 @@ const (
|
||||
type ResourceErrorCode string
|
||||
|
||||
const (
|
||||
ErrDatasourceNameConflict ResourceErrorCode = "DATASOURCE_NAME_CONFLICT"
|
||||
ErrDatasourceInvalidURL ResourceErrorCode = "DATASOURCE_INVALID_URL"
|
||||
ErrDatasourceAlreadyManaged ResourceErrorCode = "DATASOURCE_ALREADY_MANAGED"
|
||||
ErrFolderNameConflict ResourceErrorCode = "FOLDER_NAME_CONFLICT"
|
||||
ErrDashboardAlreadyManaged ResourceErrorCode = "DASHBOARD_ALREADY_MANAGED"
|
||||
ErrLibraryElementNameConflict ResourceErrorCode = "LIBRARY_ELEMENT_NAME_CONFLICT"
|
||||
ErrUnsupportedDataType ResourceErrorCode = "UNSUPPORTED_DATA_TYPE"
|
||||
ErrResourceConflict ResourceErrorCode = "RESOURCE_CONFLICT"
|
||||
ErrUnexpectedStatus ResourceErrorCode = "UNEXPECTED_STATUS_CODE"
|
||||
ErrInternalServiceError ResourceErrorCode = "INTERNAL_SERVICE_ERROR"
|
||||
ErrGeneric ResourceErrorCode = "GENERIC_ERROR"
|
||||
ErrAlertRulesQuotaReached ResourceErrorCode = "ALERT_RULES_QUOTA_REACHED"
|
||||
ErrAlertRulesGroupQuotaReached ResourceErrorCode = "ALERT_RULES_GROUP_QUOTA_REACHED"
|
||||
ErrDatasourceNameConflict ResourceErrorCode = "DATASOURCE_NAME_CONFLICT"
|
||||
ErrDatasourceInvalidURL ResourceErrorCode = "DATASOURCE_INVALID_URL"
|
||||
ErrDatasourceAlreadyManaged ResourceErrorCode = "DATASOURCE_ALREADY_MANAGED"
|
||||
ErrFolderNameConflict ResourceErrorCode = "FOLDER_NAME_CONFLICT"
|
||||
ErrDashboardAlreadyManaged ResourceErrorCode = "DASHBOARD_ALREADY_MANAGED"
|
||||
ErrLibraryElementNameConflict ResourceErrorCode = "LIBRARY_ELEMENT_NAME_CONFLICT"
|
||||
ErrUnsupportedDataType ResourceErrorCode = "UNSUPPORTED_DATA_TYPE"
|
||||
ErrResourceConflict ResourceErrorCode = "RESOURCE_CONFLICT"
|
||||
ErrUnexpectedStatus ResourceErrorCode = "UNEXPECTED_STATUS_CODE"
|
||||
ErrInternalServiceError ResourceErrorCode = "INTERNAL_SERVICE_ERROR"
|
||||
ErrGeneric ResourceErrorCode = "GENERIC_ERROR"
|
||||
)
|
||||
|
||||
type SnapshotResourceStats struct {
|
||||
|
||||
@@ -5764,6 +5764,8 @@
|
||||
"errorCode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ALERT_RULES_QUOTA_REACHED",
|
||||
"ALERT_RULES_GROUP_QUOTA_REACHED",
|
||||
"DATASOURCE_NAME_CONFLICT",
|
||||
"DATASOURCE_INVALID_URL",
|
||||
"DATASOURCE_ALREADY_MANAGED",
|
||||
|
||||
@@ -17319,6 +17319,8 @@
|
||||
"errorCode": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ALERT_RULES_QUOTA_REACHED",
|
||||
"ALERT_RULES_GROUP_QUOTA_REACHED",
|
||||
"DATASOURCE_NAME_CONFLICT",
|
||||
"DATASOURCE_INVALID_URL",
|
||||
"DATASOURCE_ALREADY_MANAGED",
|
||||
|
||||
@@ -206,6 +206,8 @@ export type CreateSnapshotRequestDto = {
|
||||
};
|
||||
export type MigrateDataResponseItemDto = {
|
||||
errorCode?:
|
||||
| 'ALERT_RULES_QUOTA_REACHED'
|
||||
| 'ALERT_RULES_GROUP_QUOTA_REACHED'
|
||||
| 'DATASOURCE_NAME_CONFLICT'
|
||||
| 'DATASOURCE_INVALID_URL'
|
||||
| 'DATASOURCE_ALREADY_MANAGED'
|
||||
|
||||
@@ -13,6 +13,16 @@ interface ResourceDetailsModalProps {
|
||||
|
||||
function getTMessage(errorCode: MigrateDataResponseItemDto['errorCode']): string {
|
||||
switch (errorCode) {
|
||||
case 'ALERT_RULES_QUOTA_REACHED':
|
||||
return t(
|
||||
'migrate-to-cloud.resource-details.error-messages.alert-rules-quota-reached',
|
||||
'Maximum number of alert rules reached: Delete some alert rules or upgrade your plan and try again.'
|
||||
);
|
||||
case 'ALERT_RULES_GROUP_QUOTA_REACHED':
|
||||
return t(
|
||||
'migrate-to-cloud.resource-details.error-messages.alert-rules-group-quota-reached',
|
||||
'Maximum number of alert rule groups reached: Delete some alert rule groups or upgrade your plan and try again.'
|
||||
);
|
||||
case 'DATASOURCE_NAME_CONFLICT':
|
||||
return t(
|
||||
'migrate-to-cloud.resource-details.error-messages.datasource-name-conflict',
|
||||
@@ -106,9 +116,11 @@ export function ResourceDetailsModal(props: ResourceDetailsModalProps) {
|
||||
<>
|
||||
<Text element="p">{msgTitle}</Text>
|
||||
<Text element="p">
|
||||
{getTMessage(resource?.errorCode) ||
|
||||
resource?.message ||
|
||||
'There has been an error while migrating. Please check the cloud migration logs for more information.'}
|
||||
{getTMessage(resource?.errorCode) || resource?.message || (
|
||||
<Trans i18nKey="migrate-to-cloud.resource-details.error-messages.generic-error">
|
||||
There has been an error while migrating. Please check the cloud migration logs for more information.
|
||||
</Trans>
|
||||
)}
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
|
||||
@@ -9121,6 +9121,8 @@
|
||||
"resource-details": {
|
||||
"dismiss-button": "OK",
|
||||
"error-messages": {
|
||||
"alert-rules-group-quota-reached": "Maximum number of alert rule groups reached: Delete some alert rule groups or upgrade your plan and try again.",
|
||||
"alert-rules-quota-reached": "Maximum number of alert rules reached: Delete some alert rules or upgrade your plan and try again.",
|
||||
"dashboard-already-managed": "Dashboard is already provisioned and managed by Grafana in the cloud instance. We recommend using the provisioned dashboard going forward. If you still wish to copy the dashboard to the cloud instance, then change the dashboard ID in the dashboard JSON, save a new snapshot and upload again.",
|
||||
"datasource-already-managed": "Data source is already provisioned and managed by Grafana in the cloud instance. If this is a different resource, set another UID and try again.",
|
||||
"datasource-invalid-url": "There is a data source which has an invalid URL. Provide a valid URL and try again.",
|
||||
|
||||
@@ -7360,6 +7360,8 @@
|
||||
"properties": {
|
||||
"errorCode": {
|
||||
"enum": [
|
||||
"ALERT_RULES_QUOTA_REACHED",
|
||||
"ALERT_RULES_GROUP_QUOTA_REACHED",
|
||||
"DATASOURCE_NAME_CONFLICT",
|
||||
"DATASOURCE_INVALID_URL",
|
||||
"DATASOURCE_ALREADY_MANAGED",
|
||||
|
||||
Reference in New Issue
Block a user