Skip to content

Commit 1b8c79b

Browse files
committed
validate
1 parent cca424e commit 1b8c79b

File tree

1 file changed

+11
-17
lines changed
  • services/static-webserver/client/source/class/osparc/store

1 file changed

+11
-17
lines changed

services/static-webserver/client/source/class/osparc/store/Products.js

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,17 @@ qx.Class.define("osparc.store.Products", {
4444
])
4545
.then(values => {
4646
let uiConfig = {};
47-
if (values[0] && values[0]["ui"] && Object.keys(values[0]["ui"]).length) {
48-
uiConfig = values[0]["ui"];
47+
const beUiConfig = values[0];
48+
const feUiConfig = values[1];
49+
const schema = values[2];
50+
if (beUiConfig && beUiConfig["ui"] && Object.keys(beUiConfig["ui"]).length) {
51+
uiConfig = beUiConfig["ui"];
4952
} else {
5053
const product = osparc.product.Utils.getProductName();
51-
if (values[1] && product in values[1]) {
52-
uiConfig = values[1][product];
54+
if (feUiConfig && product in feUiConfig) {
55+
uiConfig = feUiConfig[product];
5356
}
5457
}
55-
// const schema = values[2];
56-
const schema = {
57-
"type": "object",
58-
"properties": {
59-
"resourceType": { "type": "string" },
60-
"title": { "type": "string" },
61-
"icon": { "type": "string" },
62-
"newStudyLabel": { "type": "string" },
63-
"idToWidget": { "type": "string" }
64-
},
65-
"required": ["resourceType", "title"],
66-
};
6758
const ajvLoader = new qx.util.DynamicScriptLoader([
6859
"/resource/ajv/ajv-6-11-0.min.js",
6960
"/resource/object-path/object-path-0-11-4.min.js"
@@ -81,7 +72,10 @@ qx.Class.define("osparc.store.Products", {
8172
this.__uiConfig = uiConfig;
8273
resolve(this.__uiConfig);
8374
} else {
84-
console.error("wrong ui_config")
75+
console.error("Wrong UI Config");
76+
validate.errors.forEach(err => {
77+
console.error(`Error at ${err.dataPath}: ${err.message}`);
78+
});
8579
}
8680
});
8781
ajvLoader.addListener("failed", console.error, this);

0 commit comments

Comments
 (0)