Commit 6fa0f582 authored by Boris Kocherov's avatar Boris Kocherov

use new version rjs_form

parent 3cd406b7
......@@ -260,6 +260,8 @@
p = arr[0].path,
scope = arr[0].scope,
action = arr[0].action,
url = arr[0].ref,
connection_path,
path;
function rerender(sub_scope, settings_path) {
......@@ -286,17 +288,23 @@
});
}
if (action === "render") {
if ("urn:jio:properties_from_xmla.connection.json" === url) {
connection_path = p.split('/').slice(0, -1).join('/');
g.props.xmla_connections[connection_path] = scope.split('_').slice(0, -1).join('_');
}
// action `render` fake change so do nothing
return;
}
for (path in g.props.xmla_connections) {
if (g.props.xmla_connections.hasOwnProperty(path)) {
if (p === path && action === "add") {
g.props.xmla_connections[path] = scope;
return rerender(scope, path);
}
s = g.props.xmla_connections[path];
if (action === "delete") {
if (s === scope) {
// xxx memory leak
g.props.xmla_connections[path] = false;
delete g.props.xmla_connections[path];
}
} else {
// check if receive message from gadget with scope == s or his sub_gadgets
......@@ -319,7 +327,6 @@
.push(function () {
var connection_path = path.split('/').slice(0, -1).join('/'),
settings;
g.props.xmla_connections[connection_path] = false;
if (g.props.init_value) {
settings = convertOnMultiLevel(g.props.init_value, connection_path);
}
......
......@@ -319,7 +319,7 @@
rJS(window)
.ready(function (g) {
g.props = {};
g.props.xmla_connections = {};
g.props.choices = [];
return g.render({
schema_url: new URL("olap_wizard.json", window.location).toString(),
value: {}
......@@ -354,16 +354,16 @@
.declareAcquiredMethod("notifyChange", "notifyChange")
.allowPublicAcquisition("notifyChange", function (arr, s) {
var g = this,
p = arr[0].path,
scope = arr[0].scope,
relPath = arr[0].rel_path,
action = arr[0].action,
gadget_settings,
used_diemensions,
path;
url = arr[0].ref,
y;
function rerender(sub_scope, rerender_path) {
var queue;
function rerender(sub_scope) {
var queue,
gadget_settings;
if (!used_diemensions) {
queue = get_used_dimensions(g)
.push(function (v) {
......@@ -381,7 +381,10 @@
gadget_settings = gadget;
return RSVP.all([
getCurrentConnectionSettings(gadget),
gadget.getContent(rerender_path)
gadget.getSubGadget(sub_scope)
.push(function (z) {
return z.getContent();
})
]);
})
.push(function (arr) {
......@@ -401,43 +404,36 @@
}
function allRerender() {
var tasks = [],
i;
for (i in g.props.xmla_connections) {
if (g.props.xmla_connections.hasOwnProperty(i)) {
s = g.props.xmla_connections[i];
if (s) {
tasks.push(rerender(s, i));
}
}
}
return get_used_dimensions(g)
.push(function (v) {
used_diemensions = v;
return RSVP.all(tasks);
return RSVP.all(g.props.choices.map(function (q) {
return rerender(q);
}));
});
}
if (p === "/connection_name") {
if ("urn:jio:remote_connections.json" === url) {
return allRerender();
}
for (path in g.props.xmla_connections) {
if (g.props.xmla_connections.hasOwnProperty(path)) {
if (p === path && action === "add") {
g.props.xmla_connections[path] = scope;
return rerender(scope, path);
if (action === "render") {
if ("urn:jio:choice.json" === url) {
g.props.choices.push(scope);
}
// action `render` fake change so do nothing
return;
}
for (y = 0; y < g.props.choices.length; y += 1) {
s = g.props.choices[y];
if (scope.startsWith(s)) {
if (action === "delete") {
g.props.choices.splice(y, 1);
return allRerender();
}
s = g.props.xmla_connections[path];
if (scope === s) {
if (action === "delete") {
// xxx memory leak
g.props.xmla_connections[path] = false;
}
if (relPath === "/dimension") {
return allRerender();
}
return rerender(s, path);
if (relPath === "/dimension") {
return allRerender();
}
return rerender(s);
}
}
// return g.notifyChange();
......@@ -474,9 +470,6 @@
.push(function (connections) {
var connection_settings,
choice_settings;
if (path !== "/parameters/columns/" && path !== "/parameters/rows/") {
g.props.xmla_connections[path] = false;
}
if (g.props.init_value) {
connection_settings =
connections[convertOnMultiLevel(g.props.init_value, "/connection_name")];
......
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