Skip to content

Commit

Permalink
filter out composite aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
OskarDamkjaer committed Apr 5, 2024
1 parent ecf1b7b commit 9a8aa28
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
21 changes: 16 additions & 5 deletions src/browser/modules/DBMSInfo/DatabaseSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,22 @@ export const DatabaseSelector = ({

const aliasList = uniqueDatabases.flatMap(db =>
db.aliases
? db.aliases.map(alias => ({
databaseName: db.name,
name: alias,
status: db.status
}))
? db.aliases
.map(alias => ({
databaseName: db.name,
name: alias,
status: db.status
}))
.filter(
// If the alias points to a composite database and the alias is listed as
// one of the constituents, we don't want to show it as it's not directly queryable
alias =>
!uniqueDatabases.some(
db =>
db.type === 'composite' &&
db.constituents?.includes(alias.name)
)
)
: []
)

Expand Down
17 changes: 9 additions & 8 deletions src/shared/modules/dbMeta/dbMetaDuck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { uniq } from 'lodash-es'
import { QueryResult } from 'neo4j-driver'
import { SemVer, coerce, gte } from 'semver'
import { isConfigValFalsy } from 'services/bolt/boltHelpers'
import { GlobalState } from 'shared/globalState'
import { APP_START } from 'shared/modules/app/appDuck'
import { FIRST_MULTI_DB_SUPPORT } from '../features/versionedFeatures'
import {
extractServerInfo,
extractTrialStatus,
extractTrialStatusOld,
versionHasEditorHistorySetting
} from './utils'
import { isConfigValFalsy } from 'services/bolt/boltHelpers'
import { GlobalState } from 'shared/globalState'
import { APP_START } from 'shared/modules/app/appDuck'
import { extractServerInfo } from './utils'
import { coerce, SemVer, gte } from 'semver'
import { QueryResult } from 'neo4j-driver'
import { uniq } from 'lodash-es'
import { FIRST_MULTI_DB_SUPPORT } from '../features/versionedFeatures'

export const UPDATE_META = 'meta/UPDATE_META'
export const PARSE_META = 'meta/PARSE_META'
Expand Down Expand Up @@ -226,6 +226,7 @@ export type Database = {
home?: boolean // introduced in neo4j 4.3
aliases?: string[] // introduced in neo4j 4.4
type?: 'system' | 'composite' | 'standard' // introduced in neo4j 5
constituents?: string[] // introduced in neo4j 5
status: string
}

Expand Down

0 comments on commit 9a8aa28

Please sign in to comment.