From acbff2e6b42e15284e53ee522f6cc1ed807424ca Mon Sep 17 00:00:00 2001 From: Jens Vannerum Date: Mon, 5 Dec 2022 15:13:13 +0100 Subject: [PATCH] 97049: Minor refactor // adding docs --- config/config.example.yml | 10 +++++++++- config/config.yml | 5 ----- src/config/FilterVocabularyConfig.ts | 7 ------- src/config/app-config.interface.ts | 2 +- src/config/default-app-config.ts | 5 ++++- src/config/filter-vocabulary-config.ts | 22 ++++++++++++++++++++++ 6 files changed, 36 insertions(+), 15 deletions(-) delete mode 100644 src/config/FilterVocabularyConfig.ts create mode 100644 src/config/filter-vocabulary-config.ts diff --git a/config/config.example.yml b/config/config.example.yml index 27400f0041..7bc96b8e4a 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -295,4 +295,12 @@ info: # display in supported metadata fields. By default, only dc.description.abstract is supported. markdown: enabled: false - mathjax: false \ No newline at end of file + mathjax: false + +# Which vocabularies should be used for which search filters +# and whether to show the filter in the search sidebar +# Take a look at the filter-vocabulary-config.ts file for documentation on how the options are obtained +vocabularies: + - filter: 'subject' + vocabulary: 'srsc' + enabled: true diff --git a/config/config.yml b/config/config.yml index 5b171d9cc4..b5eecd112f 100644 --- a/config/config.yml +++ b/config/config.yml @@ -3,8 +3,3 @@ rest: host: api7.dspace.org port: 443 nameSpace: /server - -vocabularies: - - filter: 'subject' - vocabulary: 'srsc' - enabled: true diff --git a/src/config/FilterVocabularyConfig.ts b/src/config/FilterVocabularyConfig.ts deleted file mode 100644 index a9b37af2d8..0000000000 --- a/src/config/FilterVocabularyConfig.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Config } from './config.interface'; - -export interface FilterVocabularyConfig extends Config { - filter: string; - vocabulary: string; - enabled: boolean; -} diff --git a/src/config/app-config.interface.ts b/src/config/app-config.interface.ts index bba7c66168..d62b9e5bcb 100644 --- a/src/config/app-config.interface.ts +++ b/src/config/app-config.interface.ts @@ -20,7 +20,7 @@ import { InfoConfig } from './info-config.interface'; import { CommunityListConfig } from './community-list-config.interface'; import { HomeConfig } from './homepage-config.interface'; import { MarkdownConfig } from './markdown-config.interface'; -import { FilterVocabularyConfig } from './FilterVocabularyConfig'; +import { FilterVocabularyConfig } from './filter-vocabulary-config'; interface AppConfig extends Config { ui: UIServerConfig; diff --git a/src/config/default-app-config.ts b/src/config/default-app-config.ts index e78ef0a221..c4ab741103 100644 --- a/src/config/default-app-config.ts +++ b/src/config/default-app-config.ts @@ -20,7 +20,7 @@ import { InfoConfig } from './info-config.interface'; import { CommunityListConfig } from './community-list-config.interface'; import { HomeConfig } from './homepage-config.interface'; import { MarkdownConfig } from './markdown-config.interface'; -import { FilterVocabularyConfig } from './FilterVocabularyConfig'; +import { FilterVocabularyConfig } from './filter-vocabulary-config'; export class DefaultAppConfig implements AppConfig { production = false; @@ -378,6 +378,9 @@ export class DefaultAppConfig implements AppConfig { mathjax: false, }; + // Which vocabularies should be used for which search filters + // and whether to show the filter in the search sidebar + // Take a look at the filter-vocabulary-config.ts file for documentation on how the options are obtained vocabularies: FilterVocabularyConfig[] = [ { filter: 'subject', diff --git a/src/config/filter-vocabulary-config.ts b/src/config/filter-vocabulary-config.ts new file mode 100644 index 0000000000..54e57090c8 --- /dev/null +++ b/src/config/filter-vocabulary-config.ts @@ -0,0 +1,22 @@ +import { Config } from './config.interface'; + +/** + * Configuration that can be used to enable a vocabulary tree to be used as search filter + */ +export interface FilterVocabularyConfig extends Config { + /** + * The name of the filter where the vocabulary tree should be used + * This is the name of the filter as it's configured in the facet in discovery.xml + * (can also be seen on the /server/api/discover/facets endpoint) + */ + filter: string; + /** + * name of the vocabulary tree to use + * ( name of the file as stored in the dspace/config/controlled-vocabularies folder without file extension ) + */ + vocabulary: string; + /** + * Whether to show the vocabulary tree in the sidebar + */ + enabled: boolean; +}