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