Skip to content

Commit

Permalink
sort owner names, don't display filter for empty string user_names
Browse files Browse the repository at this point in the history
  • Loading branch information
rwblair committed Sep 30, 2021
1 parent a0d7770 commit 91854de
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions neuroscout/frontend/src/AnalysisList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ export class AnalysisListTable extends React.Component<

if (props.analyses !== null && props.analyses.length > 0) {
owners = [
...new Set(props.analyses.map(x => (x.user_name ? x.user_name : ' '))),
] as string[]
...new Set(
props.analyses.filter(x => x.user_name).map(x => x.user_name),
),
].sort() as string[]
ownersWidth = Math.max(...owners.map(x => (x ? x.length : 0))) + 4
}
this.state = {
Expand All @@ -65,9 +67,9 @@ export class AnalysisListTable extends React.Component<
) {
const owners = [
...new Set(
this.props.analyses.map(x => (x.user_name ? x.user_name : ' ')),
this.props.analyses.filter(x => x.user_name).map(x => x.user_name),
),
]
].sort() as string[]

/* no science behind adding 4, just a bit of buffer */
const ownersWidth = Math.max(...owners.map(x => (x ? x.length : 0))) + 4
Expand Down

0 comments on commit 91854de

Please sign in to comment.