Skip to content

Commit

Permalink
ui: sort items in the sql activity dropdown menu
Browse files Browse the repository at this point in the history
Fixes cockroachdb#78081.

Previously, app names in the dropdown menu for the stmts, txns, and
sessions pages were unsorted. This change sorts these app names.

Release note (ui): app names in the dropdown menu are sorted.
  • Loading branch information
Gerardo Torres committed Mar 18, 2022
1 parent 464a1d4 commit 0905923
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/cluster-ui/src/sessions/sessionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function getSessionAppFilterOptions(sessions: SessionInfo[]): string[] {
),
);

return Array.from(uniqueAppNames);
return Array.from(uniqueAppNames).sort();
}

export class SessionsPage extends React.Component<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const selectApps = createSelector(sqlStatsSelector, sqlStatsState => {
}
},
);
return [].concat(sawBlank ? ["(unset)"] : []).concat(Object.keys(apps));
return [].concat(sawBlank ? ["(unset)"] : []).concat(Object.keys(apps).sort());
});

// selectDatabases returns the array of all databases with statement statistics present
Expand Down
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/cluster-ui/src/transactionsPage/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const getTrxAppFilterOptions = (
.map(t => (t.stats_data.app ? t.stats_data.app : "(unset)")),
);

return Array.from(uniqueAppNames);
return Array.from(uniqueAppNames).sort();
};

export const collectStatementsText = (statements: Statement[]): string =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export const selectApps = createSelector(
}
},
);
return [].concat(sawBlank ? ["(unset)"] : []).concat(Object.keys(apps));
return [].concat(sawBlank ? ["(unset)"] : []).concat(Object.keys(apps).sort());
},
);

Expand Down

0 comments on commit 0905923

Please sign in to comment.