Skip to content

Commit 69c3c55

Browse files
committed
Fix bad config template values
1 parent ff27948 commit 69c3c55

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

API/templates/config_template.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ module.exports = {
4343
logourl: "",
4444
helpurl: "",
4545
},
46-
panels: ["viewer", "map", "globe"],
47-
time: ["enabled"],
46+
panelSettings: {},
47+
panels: { viewer: true, map: true, globe: true },
48+
time: { enabled: true },
4849
tools: [
4950
{
5051
name: "Layers",

configure/src/components/Main/Main.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,22 @@ export default function Main() {
142142
"get",
143143
{ mission: mission },
144144
(res) => {
145+
// This fixes an issue where the default configure template wrongly
146+
// had time as an array instead of an object, which made it uneditable.
147+
// This can probably be safely removed at some later point
148+
if (res && res.time && Array.isArray(res.time)) res.time = {};
149+
150+
// Similar issue but with the panels array to an object as well
151+
if (res && res.panels && Array.isArray(res.panels)) {
152+
const hasViewer = res.panels.indexOf("viewer") !== -1;
153+
const hasMap = res.panels.indexOf("map") !== -1;
154+
const hasGlobe = res.panels.indexOf("globe") !== -1;
155+
res.panels = {};
156+
res.panels.viewer = hasViewer;
157+
res.panels.map = hasMap;
158+
res.panels.globe = hasGlobe;
159+
}
160+
145161
dispatch(setConfiguration(res));
146162
dispatch(clearLockConfig({}));
147163
},

configure/src/core/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ export const setIn = (obj, keyArray, value, force) => {
3838
if (isNumeric(keyArray[i + 1]) && !Array.isArray(object[keyArray[i]]))
3939
object[keyArray[i]] = Array(object[keyArray[i]]);
4040
}
41-
if (!object.hasOwnProperty(keyArray[i]))
41+
if (!object.hasOwnProperty(keyArray[i])) {
4242
object[keyArray[i]] =
4343
i === keyArray.length - 2 && isNumeric(keyArray[i + 1]) ? [] : {};
44+
}
4445
object = object[keyArray[i]];
4546
} else {
4647
if (object.hasOwnProperty(keyArray[i])) object = object[keyArray[i]];

configure/src/metaconfigs/tab-time-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"rows": [
33
{
4-
"name": "Interface",
4+
"name": "Time",
55
"components": [
66
{
77
"field": "time.enabled",
@@ -14,6 +14,7 @@
1414
]
1515
},
1616
{
17+
"name": "Interface",
1718
"components": [
1819
{
1920
"field": "time.visible",

0 commit comments

Comments
 (0)