Skip to content

Commit

Permalink
Clicking on an empty "custom" check node does not break UI.
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrczarnas committed Feb 14, 2024
1 parent d89c2db commit 9ead75a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dqops/src/main/frontend/src/contexts/definitionContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,19 +264,19 @@ function DefinitionProvider(props: any) {

const sortItemsTreeAlphabetically = (array: TTreeItems) => {
if (!array) return [];
if ('sensor_name' in array[0] ?? {}) {
if ('sensor_name' in (array.length > 0 ? array[0] : {}) ?? {}) {
return array.slice().sort((a, b) => {
const sensorNameA = (a as SensorListModel).sensor_name ?? '';
const sensorNameB = (b as SensorListModel).sensor_name ?? '';
return sensorNameA.localeCompare(sensorNameB);
});
} else if ('rule_name' in array[0] ?? {}) {
} else if ('rule_name' in (array.length > 0 ? array[0] : {}) ?? {}) {
return array.slice().sort((a, b) => {
const ruleNameA = (a as RuleListModel).rule_name ?? '';
const ruleNameB = (b as RuleListModel).rule_name ?? '';
return ruleNameA.localeCompare(ruleNameB);
});
} else if ('check_name' in array[0] ?? {}) {
} else if ('check_name' in (array.length > 0 ? array[0] : {}) ?? {}) {
return array.slice().sort((a, b) => {
const checkNameA = (a as CheckDefinitionListModel).check_name ?? '';
const checkNameB = (b as CheckDefinitionListModel).check_name ?? '';
Expand Down

0 comments on commit 9ead75a

Please sign in to comment.