@@ -37,7 +37,6 @@ const Select = styled.select`
37
37
const EMPTY_OPTION = 'Select db to use'
38
38
39
39
const HOUSE_EMOJI = '\u{1F3E0}'
40
- const HOUR_GLASS_EMOJI = '\u{231B}'
41
40
const NBSP_CHAR = '\u{00A0}'
42
41
43
42
type DatabaseSelectorProps = {
@@ -92,19 +91,28 @@ export const DatabaseSelector = ({
92
91
< option value = { EMPTY_OPTION } > { EMPTY_OPTION } </ option >
93
92
) }
94
93
95
- { databasesAndAliases . map ( dbOrAlias => (
96
- < option
97
- key = { dbOrAlias . name }
98
- value = { dbOrAlias . name }
99
- disabled = { dbOrAlias . status === 'unknown' }
100
- >
101
- { dbOrAlias . name }
102
- { dbOrAlias === homeDb ? NBSP_CHAR + HOUSE_EMOJI : '' }
103
- { dbOrAlias . status === 'unknown'
104
- ? NBSP_CHAR + HOUR_GLASS_EMOJI
105
- : '' }
106
- </ option >
107
- ) ) }
94
+ { databasesAndAliases . map ( dbOrAlias => {
95
+ /* When deduplicating the list of databases and aliases on clusters
96
+ we prefer to find ones that are "online". If our deduplicated
97
+ db is not online, it means none of the databases on the cluster with
98
+ that name is online, so we should disable it in the list and show
99
+ one of the statuses as a simplification (even though they could
100
+ technically be different)
101
+ */
102
+ const dbNotOnline = dbOrAlias . status !== 'online'
103
+
104
+ return (
105
+ < option
106
+ key = { dbOrAlias . name }
107
+ value = { dbOrAlias . name }
108
+ disabled = { dbNotOnline }
109
+ >
110
+ { dbOrAlias . name }
111
+ { dbOrAlias === homeDb ? NBSP_CHAR + HOUSE_EMOJI : '' }
112
+ { dbNotOnline && ` [${ dbOrAlias . status } ]` }
113
+ </ option >
114
+ )
115
+ } ) }
108
116
</ Select >
109
117
</ DrawerSectionBody >
110
118
</ DrawerSection >
0 commit comments