From d666defaea5786aca9672cff8b497b31d6ee1254 Mon Sep 17 00:00:00 2001 From: Domas Date: Tue, 25 May 2021 10:26:10 +0300 Subject: [PATCH] Alerting: misc ui fixes volume 4 (#34503) --- .../amroutes/AmRoutesExpandedForm.tsx | 7 +-- .../amroutes/AmRoutesExpandedRead.tsx | 50 ++++++++++--------- .../components/amroutes/AmRoutesTable.tsx | 2 +- .../components/receivers/ReceiversTable.tsx | 11 +++- .../components/rule-editor/AlertRuleForm.tsx | 10 +++- .../components/rules/AlertInstanceDetails.tsx | 2 +- .../unified/components/rules/RuleDetails.tsx | 2 +- .../unified/components/rules/RuleState.tsx | 6 +-- .../components/silences/MatchersField.tsx | 7 ++- .../components/silences/SilencesTable.tsx | 2 +- .../alerting/unified/utils/receivers.ts | 42 ++++++++++------ 11 files changed, 86 insertions(+), 55 deletions(-) diff --git a/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedForm.tsx b/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedForm.tsx index 5a4e64b7696..1aa1871891c 100644 --- a/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedForm.tsx +++ b/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedForm.tsx @@ -54,21 +54,21 @@ export const AmRoutesExpandedForm: FC = ({ onCancel, {({ fields, append, remove }) => ( <> -
Matchers
+
Matching labels
{fields.map((field, index) => { const localPath = `matchers[${index}]`; - return ( = ({ onCancel, diff --git a/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedRead.tsx b/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedRead.tsx index 17462080798..4c918b98c63 100644 --- a/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedRead.tsx +++ b/public/app/features/alerting/unified/components/amroutes/AmRoutesExpandedRead.tsx @@ -38,30 +38,34 @@ export const AmRoutesExpandedRead: FC = ({ onChange,
{repeatInterval}
Nested policies
- { - setIsAddMode(false); - setSubroutes((subroutes) => { - const newSubroutes = [...subroutes]; - newSubroutes.pop(); - - return newSubroutes; - }); - }} - onChange={(newRoutes) => { - onChange({ - ...routes, - routes: newRoutes, - }); - - if (isAddMode) { + {!!subroutes.length ? ( + { setIsAddMode(false); - } - }} - receivers={receivers} - routes={subroutes} - /> + setSubroutes((subroutes) => { + const newSubroutes = [...subroutes]; + newSubroutes.pop(); + + return newSubroutes; + }); + }} + onChange={(newRoutes) => { + onChange({ + ...routes, + routes: newRoutes, + }); + + if (isAddMode) { + setIsAddMode(false); + } + }} + receivers={receivers} + routes={subroutes} + /> + ) : ( +

No nested policies configured.

+ )} {!isAddMode && (