Skip to content

Commit 10e4da3

Browse files
committed
Separate folder for JSON configs
1 parent fc654b6 commit 10e4da3

File tree

23 files changed

+16
-47
lines changed

23 files changed

+16
-47
lines changed

src/client/components/main_layout/InstancePage.stories.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/client/containers/SemanticPortal.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import {
5555
from '../helpers/helpers'
5656

5757
// ** Generate portal configuration based on JSON configs **
58-
import portalConfig from '../configs/portalConfig.json'
58+
import portalConfig from '../../configs/portalConfig.json'
5959
await processPortalConfig(portalConfig)
6060
const {
6161
portalID,
@@ -71,9 +71,9 @@ const perspectiveConfigOnlyInfoPages = await createPerspectiveConfigOnlyInfoPage
7171
portalID,
7272
onlyInstancePagePerspectives: perspectives.onlyInstancePages
7373
})
74-
const apexChartsConfig = await import(`../configs/${portalID}/ApexCharts/ApexChartsConfig`)
75-
const leafletConfig = await import(`../configs/${portalID}/Leaflet/LeafletConfig`)
76-
const networkConfig = await import(`../configs/${portalID}/Cytoscape.js/NetworkConfig`)
74+
const apexChartsConfig = await import(`../library_configs/${portalID}/ApexCharts/ApexChartsConfig`)
75+
const leafletConfig = await import(`../library_configs/${portalID}/Leaflet/LeafletConfig`)
76+
const networkConfig = await import(`../library_configs/${portalID}/Cytoscape.js/NetworkConfig`)
7777
// ** portal configuration end **
7878

7979
// ** Import general components **

src/client/epics/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import {
5151
updateKnowledgeGraphMetadata,
5252
fetchGeoJSONLayersFailed
5353
} from '../actions'
54-
import portalConfig from '../configs/portalConfig.json'
54+
import portalConfig from '../../configs/portalConfig.json'
5555
const { portalID, localeConfig, documentFinderConfig } = portalConfig
5656
const { documentFinderAPIUrl } = documentFinderConfig
5757
export const availableLocales = {}

src/client/helpers/helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export const processPortalConfig = async portalConfig => {
200200
export const createPerspectiveConfig = async ({ portalID, searchPerspectives }) => {
201201
const perspectiveConfig = []
202202
for (const perspectiveID of searchPerspectives) {
203-
const { default: perspective } = await import(`../configs/${portalID}/perspective_configs/search_perspectives/${perspectiveID}.json`)
203+
const { default: perspective } = await import(`../../configs/${portalID}/search_perspectives/${perspectiveID}.json`)
204204
perspectiveConfig.push(perspective)
205205
}
206206
for (const perspective of perspectiveConfig) {
@@ -252,7 +252,7 @@ export const createPerspectiveConfig = async ({ portalID, searchPerspectives })
252252
export const createPerspectiveConfigOnlyInfoPages = async ({ portalID, onlyInstancePagePerspectives }) => {
253253
const perspectiveConfigOnlyInfoPages = []
254254
for (const perspectiveID of onlyInstancePagePerspectives) {
255-
const { default: perspective } = await import(`../configs/${portalID}/perspective_configs/only_instance_pages/${perspectiveID}.json`)
255+
const { default: perspective } = await import(`../../configs/${portalID}/only_instance_pages/${perspectiveID}.json`)
256256
perspectiveConfigOnlyInfoPages.push(perspective)
257257
}
258258
for (const perspective of perspectiveConfigOnlyInfoPages) {

src/client/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import './index.css'
1515
import '@nosferatu500/react-sortable-tree/style.css'
1616
import 'react-redux-toastr/lib/css/react-redux-toastr.min.css'
1717
import 'mapbox-gl/dist/mapbox-gl.css'
18-
import portalConfig from './configs/portalConfig.json'
18+
import portalConfig from '../configs/portalConfig.json'
1919

2020
const { localeConfig } = portalConfig
2121
const store = configureStore()

src/client/reducers/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import portalConfig from '../configs/portalConfig.json'
1+
import portalConfig from '../../configs/portalConfig.json'
22
import { combineReducers } from 'redux'
33
import { reducer as toastrReducer } from 'react-redux-toastr'
44
import { createResultsReducer } from './general/results'
@@ -30,11 +30,11 @@ const { portalID, perspectives } = portalConfig
3030
const perspectiveConfig = []
3131
const perspectiveConfigOnlyInfoPages = []
3232
for (const perspectiveID of perspectives.searchPerspectives) {
33-
const { default: perspective } = await import(`../configs/${portalID}/perspective_configs/search_perspectives/${perspectiveID}.json`)
33+
const { default: perspective } = await import(`../../configs/${portalID}/search_perspectives/${perspectiveID}.json`)
3434
perspectiveConfig.push(perspective)
3535
}
3636
for (const perspectiveID of perspectives.onlyInstancePages) {
37-
const { default: perspective } = await import(`../configs/${portalID}/perspective_configs/only_instance_pages/${perspectiveID}.json`)
37+
const { default: perspective } = await import(`../../configs/${portalID}/only_instance_pages/${perspectiveID}.json`)
3838
perspectiveConfigOnlyInfoPages.push(perspective)
3939
}
4040
for (const perspective of perspectiveConfig) {
File renamed without changes.

src/server/sparql/Utils.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { has } from 'lodash'
33
// import { backendSearchConfig } from '../sparql/sampo/BackendSearchConfig'
44

55
export const createBackendSearchConfig = async () => {
6-
const portalConfigJSON = await readFile('src/client/configs/portalConfig.json')
6+
const portalConfigJSON = await readFile('src/configs/portalConfig.json')
77
const portalConfig = JSON.parse(portalConfigJSON)
88
const resultMappers = await import('./Mappers')
99
const { portalID } = portalConfig
1010
const backendSearchConfig = {}
1111
for (const perspectiveID of portalConfig.perspectives.searchPerspectives) {
12-
const perspectiveConfigJSON = await readFile(`src/client/configs/${portalID}/perspective_configs/search_perspectives/${perspectiveID}.json`)
12+
const perspectiveConfigJSON = await readFile(`src/configs/${portalID}/search_perspectives/${perspectiveID}.json`)
1313
const perspectiveConfig = JSON.parse(perspectiveConfigJSON)
1414
const { sparqlQueriesFile } = perspectiveConfig
1515
const sparqlQueries = await import(`../sparql/${portalID}/sparql_queries/${sparqlQueriesFile}`)
@@ -87,7 +87,7 @@ export const createBackendSearchConfig = async () => {
8787
backendSearchConfig[perspectiveID] = perspectiveConfig
8888
}
8989
for (const perspectiveID of portalConfig.perspectives.onlyInstancePages) {
90-
const perspectiveConfigJSON = await readFile(`src/client/configs/${portalID}/perspective_configs/only_instance_pages/${perspectiveID}.json`)
90+
const perspectiveConfigJSON = await readFile(`src/configs/${portalID}/only_instance_pages/${perspectiveID}.json`)
9191
const perspectiveConfig = JSON.parse(perspectiveConfigJSON)
9292
const { sparqlQueriesFile } = perspectiveConfig
9393
const sparqlQueries = await import(`../sparql/${portalID}/sparql_queries/${sparqlQueriesFile}`)
@@ -201,7 +201,7 @@ export const mergeFacetConfigs = (oldFacets, mergedFacets) => {
201201
}
202202

203203
export const mergeResultClasses = async oldBackendSearchConfig => {
204-
const portalConfigJSON = await readFile('src/client/configs/portalConfig.json')
204+
const portalConfigJSON = await readFile('src/configs/portalConfig.json')
205205
const portalConfig = JSON.parse(portalConfigJSON)
206206
const { portalID } = portalConfig
207207
const newPerspectiveConfigs = {}
@@ -211,7 +211,7 @@ export const mergeResultClasses = async oldBackendSearchConfig => {
211211
if (has(resultClassConfig, 'perspectiveID')) {
212212
const { perspectiveID } = resultClassConfig
213213
if (!has(newPerspectiveConfigs, perspectiveID)) {
214-
const perspectiveConfigJSON = await readFile(`src/client/configs/${portalID}/perspective_configs/search_perspectives/${perspectiveID}.json`)
214+
const perspectiveConfigJSON = await readFile(`src/configs/${portalID}/search_perspectives/${perspectiveID}.json`)
215215
newPerspectiveConfigs[perspectiveID] = JSON.parse(perspectiveConfigJSON)
216216
}
217217
}

0 commit comments

Comments
 (0)