Skip to content

Commit

Permalink
Adjust checking of registry.has (#670)
Browse files Browse the repository at this point in the history
Only assume a capability is not available when it's explicitly set to false. Related to upgrade of cocoda-sdk to v3.
  • Loading branch information
stefandesu committed Mar 1, 2022
1 parent 8f62f0c commit bf4ad71
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/components/AnnotationPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export default {
},
assessing(value) {
let provider = this.provider
if (!provider || !provider.has.annotations) {
if (!provider || provider.has.annotations === false) {
this.$log.warn("No provider found to add annotation.")
this.alert(this.$t("alerts.annotationError"), null, "danger")
return
Expand Down Expand Up @@ -375,7 +375,7 @@ export default {
},
async confirm() {
const provider = this.provider
if (!provider || !provider.has.annotations) {
if (!provider || provider.has.annotations === false) {
this.$log.warn("No provider found to add annotation.")
this.alert(this.$t("alerts.annotationError"), null, "danger")
return
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConceptSchemeSelection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export default {
},
// Returns an array of all available registries
availableRegistries() {
return this.config.registries.filter(registry => registry.has.concepts)
return this.config.registries.filter(registry => registry.has.concepts !== false)
},
// Returns an array of all available languages.
availableLanguages() {
Expand Down
4 changes: 2 additions & 2 deletions src/components/MappingBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -712,13 +712,13 @@ export default {
},
concordanceRegistries() {
return this.config.registries.filter(r =>
r.has.concordances, // only use registries that offer concordances
r.has.concordances !== false, // only use registries that offer concordances
)
},
concordanceUrls() {
let urls = {}
for (let registry of this.concordanceRegistries) {
if (registry.has.concordances && registry._api.concordances) {
if (registry.has.concordances !== false && registry._api.concordances) {
urls[this.$jskos.prefLabel(registry)] = registry._api.concordances
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/TheSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
:key="`settingsModal-other-registries-${index}`"
class="settingsModal-mapping-registry">
<b-form-checkbox
v-if="registry.has.mappings"
v-if="registry.has.mappings !== false"
v-model="showRegistry[registry.uri]" />
<registry-info
:registry="registry"
Expand Down
8 changes: 4 additions & 4 deletions src/items/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export async function loadTypes(scheme, { registry, force = false } = {}) {
if (!registry) {
throw new Error(`loadTop: Could not find registry for item ${scheme.uri}`)
}
if (!registry.has.types) {
if (registry.has.types === false) {
// Set to empty array
modifyItem(scheme, "types", [])
return []
Expand All @@ -270,7 +270,7 @@ export async function loadTop(scheme, { registry, force = false } = {}) {
if (!registry) {
throw new Error(`loadTop: Could not find registry for item ${scheme.uri}`)
}
if (!registry.has.top) {
if (registry.has.top === false) {
// Set to empty array
modifyItem(scheme, "topConcepts", [])
return []
Expand Down Expand Up @@ -368,7 +368,7 @@ export async function loadNarrower(concept, { registry, force = false } = {}) {
if (!registry) {
throw new Error(`loadNarrower: Could not find registry for item ${concept.uri}`)
}
if (!registry.has.narrower) {
if (registry.has.narrower === false) {
// Set to empty array
modifyItem(concept, "narrower", [])
return []
Expand Down Expand Up @@ -408,7 +408,7 @@ export async function loadAncestors(concept, { registry, force = false } = {}) {
if (!registry) {
throw new Error(`loadAncestors: Could not find registry for item ${concept.uri}`)
}
if (!registry.has.ancestors) {
if (registry.has.ancestors === false) {
// Set to empty array
modifyItem(concept, "ancestors", [])
return []
Expand Down
4 changes: 2 additions & 2 deletions src/mixins/cdk.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default {
},
mappingRegistries() {
let registries = this.config.registries.filter(registry =>
registry.has.mappings || registry.has.occurrences,
registry.has.mappings !== false || registry.has.occurrences !== false,
)
return registries
},
Expand Down Expand Up @@ -264,7 +264,7 @@ export default {
if (!registry) {
throw new Error("getMappings: No registry to get mappings from.")
}
if (!registry.has.mappings) {
if (registry.has.mappings == false) {
throw new Error(`getMappings: Registry ${registry.uri} does not support mappings.`)
}
// Adjust certain parameters in the config
Expand Down

0 comments on commit bf4ad71

Please sign in to comment.