Skip to content

Commit

Permalink
Allow filtering of search registries by selected/filtered schemes
Browse files Browse the repository at this point in the history
Registries are not shown at all if they don't contain relevant mappings. Only applies to KonSys mapping registry at the moment.
  • Loading branch information
stefandesu committed Oct 27, 2023
1 parent 52da97c commit 27021f5
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/components/MappingBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,21 @@ export default {
return this.$store.state.mapping.mappingsNeedRefresh
},
searchRegistries() {
return _.get(this.registryGroups.find(group => group.stored), "registries", [])
return _.get(this.registryGroups.find(group => group.stored), "registries", []).filter(registry => {
// Support "schemes" field for stored registries, but handle it a bit differently than with non-stored ones.
// (Registries with no "schemes" property will always be shown.)
// ? It might make sense to apply this to navigatorRegistries as well.
if (!registry.schemes || !registry.supportsScheme) {
return true
}
// If either one of the selected schemes or one of the search filter schemes is supported, show the registry.
for (const scheme of [this.getSchemeForFilter(this.searchFilter.fromScheme), this.getSchemeForFilter(this.searchFilter.toScheme), getItem(this.selected.scheme[true]), getItem(this.selected.scheme[false])]) {
if (registry.supportsScheme(scheme)) {
return true
}
}
return false
})
},
mappingRegistriesSorted() {
return _.flatten(this.registryGroups.map(group => group.registries))
Expand Down Expand Up @@ -848,7 +862,7 @@ export default {
// ? Do we need this elsewhere?
readonly: true,
isAuthorizedFor() {
return false
return false
},
}
section.id = registry.uri
Expand Down Expand Up @@ -1325,6 +1339,8 @@ export default {
}
// TODO: Use only registries that support search/filter/sort
let registries = this.searchRegistries.filter(registry => registryUri == null || registry.uri == registryUri)
// Clear search results of old registries
_.difference(Object.keys(this.searchResults), registries.map(r => r.uri)).forEach(uri => this.$delete(this.searchResults, uri))
for (let registry of registries) {
// Cancel previous requests
if (this.searchCancelToken[registry.uri]) {
Expand Down

0 comments on commit 27021f5

Please sign in to comment.