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

use new version rjs_form

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