Commit 1fee4f9a authored by Boris Kocherov's avatar Boris Kocherov

[erp5_only_office] sync with new version rjs_schema_form

parent 9e06df17
...@@ -23,19 +23,7 @@ ...@@ -23,19 +23,7 @@
} }
function get_used_dimensions(g) { function get_used_dimensions(g) {
var q; return g.getContent()
if (g.props.init_value) {
q = RSVP.Queue()
.push(function () {
return g.props.init_value;
});
} else {
q = g.getDeclaredGadget("olap_wizard")
.push(function (gadget) {
return gadget.getContent();
});
}
return q
.push(function (v) { .push(function (v) {
var dimensions = [], var dimensions = [],
key, key,
...@@ -109,7 +97,7 @@ ...@@ -109,7 +97,7 @@
} }
queue = make_request(urls[0])(); queue = make_request(urls[0])();
for (i = 1; i < settings.urls.length; i += 1) { for (i = 1; i < urls.length; i += 1) {
queue.push(undefined, make_request(urls[i])); queue.push(undefined, make_request(urls[i]));
} }
return queue; return queue;
...@@ -336,22 +324,12 @@ ...@@ -336,22 +324,12 @@
}); });
}) })
.declareMethod("render", function (opt) { .declareMethod("render", function (opt) {
var g = this;
if (!opt) { if (!opt) {
opt = {}; opt = {};
} }
g.props.init_value = opt.value; return this.getDeclaredGadget("olap_wizard")
return get_used_dimensions(g)
.push(function (v) {
g.props.used_dimensions = v;
return g.getDeclaredGadget("olap_wizard");
})
.push(function (gadget) { .push(function (gadget) {
return gadget.render(opt); return gadget.render(opt);
})
.push(function () {
delete g.props.init_value;
delete g.props.used_dimensions;
}); });
}) })
.declareMethod("getContent", function (path) { .declareMethod("getContent", function (path) {
...@@ -498,20 +476,21 @@ ...@@ -498,20 +476,21 @@
if ("urn:jio:choice.json" === url) { if ("urn:jio:choice.json" === url) {
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return g.getRemoteSettings(); return RSVP.all([
g.getRemoteSettings(),
g.getContent("/connection_name"),
g.getContent(path),
get_used_dimensions(g)
]);
}) })
.push(function (connections) { .push(function (arr) {
var connection_settings, var connection_settings,
choice_settings; choice_settings;
if (g.props.init_value) { connection_settings = arr[0][arr[1]];
connection_settings = if (path !== "/columns/" && path !== "/rows/") {
connections[convertOnMultiLevel(g.props.init_value, "/connection_name")]; choice_settings = arr[2];
if (path !== "/columns/" && path !== "/rows/") {
choice_settings = convertOnMultiLevel(g.props.init_value, path);
}
return generateChoiceSchema(connection_settings, g.props.used_dimensions, choice_settings);
} }
return {}; return generateChoiceSchema(connection_settings, arr[3], choice_settings);
}); });
} }
throw new Error("urn: '" + url + "' not supported"); throw new Error("urn: '" + url + "' not supported");
......
...@@ -216,19 +216,15 @@ ...@@ -216,19 +216,15 @@
}) })
.declareMethod("render", function (opt) { .declareMethod("render", function (opt) {
var gadget = this; var gadget = this;
gadget.props.init_value = opt.value;
return gadget.getDeclaredGadget("xmla_settings") return gadget.getDeclaredGadget("xmla_settings")
.push(function (g) { .push(function (g) {
return g.render(opt); return g.render(opt);
})
.push(function () {
delete gadget.props.init_value;
}); });
}) })
.declareMethod("getContent", function () { .declareMethod("getContent", function (sub_path) {
return this.getDeclaredGadget("xmla_settings") return this.getDeclaredGadget("xmla_settings")
.push(function (g) { .push(function (g) {
return g.getContent(); return g.getContent(sub_path);
}); });
}) })
.declareAcquiredMethod("notifyChange", "notifyChange") .declareAcquiredMethod("notifyChange", "notifyChange")
...@@ -293,18 +289,13 @@ ...@@ -293,18 +289,13 @@
return g.notifyChange(); return g.notifyChange();
}) })
.allowPublicAcquisition("resolveExternalReference", function (arr) { .allowPublicAcquisition("resolveExternalReference", function (arr) {
var g = this, var url = arr[0],
url = arr[0],
schema_path = arr[1], schema_path = arr[1],
path = arr[2]; path = arr[2],
connection_path = path.split('/').slice(0, -1).join('/');
if ("urn:jio:properties_from_xmla.connection.json" === url) { if ("urn:jio:properties_from_xmla.connection.json" === url) {
return new RSVP.Queue() return this.getContent(connection_path)
.push(function () { .push(function (settings) {
var connection_path = path.split('/').slice(0, -1).join('/'),
settings;
if (g.props.init_value) {
settings = convertOnMultiLevel(g.props.init_value, connection_path);
}
return generateSchema(settings); return generateSchema(settings);
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment