Handle unsafe array access
This commit is contained in:
@@ -168,9 +168,9 @@ export const RulesGroup = React.memo(({ group, namespace, expandAll, viewMode }:
|
|||||||
if (isListView) {
|
if (isListView) {
|
||||||
groupName = <RuleLocation namespace={decodeGrafanaNamespace(namespace).name} />;
|
groupName = <RuleLocation namespace={decodeGrafanaNamespace(namespace).name} />;
|
||||||
} else if (isUngroupedRuleGroup(group.name)) {
|
} else if (isUngroupedRuleGroup(group.name)) {
|
||||||
groupName = (
|
const firstRuleName = group.rules[0]?.name ?? 'Unknown Rule';
|
||||||
<RuleLocation namespace={decodeGrafanaNamespace(namespace).name} group={`${group.rules[0].name} (Ungrouped)`} />
|
const groupDisplayName = `${firstRuleName} (Ungrouped)`;
|
||||||
);
|
groupName = <RuleLocation namespace={decodeGrafanaNamespace(namespace).name} group={groupDisplayName} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -162,7 +162,8 @@ export function GrafanaRuleGroupListItem({ group, namespaceName }: GrafanaRuleGr
|
|||||||
|
|
||||||
const detailsLink = groups.detailsPageLink(GRAFANA_RULES_SOURCE_NAME, group.folderUid, group.name);
|
const detailsLink = groups.detailsPageLink(GRAFANA_RULES_SOURCE_NAME, group.folderUid, group.name);
|
||||||
|
|
||||||
const groupDisplayName = isUngroupedRuleGroup(group.name) ? `${group.rules[0].name} (Ungrouped)` : group.name;
|
const firstRuleName = group.rules[0]?.name ?? 'Unknown Rule';
|
||||||
|
const groupDisplayName = isUngroupedRuleGroup(group.name) ? `${firstRuleName} (Ungrouped)` : group.name;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ListGroup
|
<ListGroup
|
||||||
|
|||||||
Reference in New Issue
Block a user