Skip to content

Commit

Permalink
update default config (#1660)
Browse files Browse the repository at this point in the history
* update default config

* test

* test

* test

* fix logic for processing default config

* fix default config

* fix typo
  • Loading branch information
mfshao authored Dec 19, 2024
1 parent 6052088 commit 17ac050
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions data/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
"explorer": true,
"analysis": false
},
"dataExplorerConfig": {
"explorerConfig": [{
"charts": {
"project": {
"chartType": "count",
Expand Down Expand Up @@ -277,7 +277,7 @@
"file_format"
]
}
},
}],
"useArboristUI": false,
"showArboristAuthzOnProfile": false,
"showFenceAuthzOnProfile": true,
Expand Down
13 changes: 11 additions & 2 deletions data/getTexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function doStringify(value, variables, indent = 0, spaces = 0) {
const objs = value.map(
(item) => `${insertSpace(indent + spaces)}${doStringify(item, variables, indent + spaces, spaces)}`,
).join(`,${ending}`);
// console.log(doWrapping(objs, '[', ']', indent, spaces));
return doWrapping(objs, '[', ']', indent, spaces);
}
if (typeof value === 'string') {
Expand Down Expand Up @@ -102,15 +103,23 @@ function buildConfig(appIn, data) {
const app = appIn || process.env.APP || 'default';
const appConfig = data[app] || {};
const defaultConfig = data.default || {};
// don't copy 'explorerConfig' over from default config since that is a non-working example
delete defaultConfig.explorerConfig;
const result = { ...defaultConfig, ...appConfig };
delete result.components;
Object.keys(result).forEach(
(k) => {
if (typeof result[k] === 'object') {
const defaultVal = defaultConfig[k];
const appVal = appConfig[k];
if (defaultVal && appVal && typeof defaultVal === 'object' && typeof appVal === 'object') {
result[k] = { ...defaultVal, ...appVal };
if (defaultVal && appVal) {
if (typeof defaultVal === 'object' && typeof appVal === 'object') {
if (Array.isArray(defaultVal) && Array.isArray(appVal)) {
result[k] = defaultVal.concat(appVal);
} else if (!Array.isArray(defaultVal) && !Array.isArray(appVal)) {
result[k] = { ...defaultVal, ...appVal };
}
}
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions src/localconf.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ function buildConfig(opts) {
explorerConfig = config.explorerConfig;
}

console.log(explorerConfig);

// Two tiered-access options: site-wide and index-scoped.
// Tiered access is index-scoped if all guppyConfigs in the portal config
// contain a tierAccessLevel.
Expand Down

0 comments on commit 17ac050

Please sign in to comment.