static files update

parent 78f8c0ea
...@@ -21,7 +21,12 @@ ...@@ -21,7 +21,12 @@
} }
throw error; throw error;
}).push(function(sim_json) { }).push(function(sim_json) {
var document_list = JSON.parse(sim_json).result.result_list, result_list = [], i; var document = JSON.parse(sim_json), document_list = [], result_list = [], i;
if (document.result) {
if (document.result.result_list) {
document_list = document.result.result_list;
}
}
for (i = 0; i < document_list.length; i += 1) { for (i = 0; i < document_list.length; i += 1) {
result_list.push(RSVP.all([ gadget.whoWantsToDisplayThisResult(gadget.props.jio_key, i), document_list[i].score, document_list[i].key ])); result_list.push(RSVP.all([ gadget.whoWantsToDisplayThisResult(gadget.props.jio_key, i), document_list[i].score, document_list[i].key ]));
} }
......
...@@ -174,14 +174,23 @@ ...@@ -174,14 +174,23 @@
anchor: "Continuous" anchor: "Continuous"
}); });
} }
function updateNodeStyle(gadget, element_id) { function updateNodeStyle(gadget, element_id, class_definition) {
// Update node size according to the zoom level // Update node size according to the zoom level
// XXX does nothing for now // XXX does nothing for now
var zoom_level = gadget.props.zoom_level * 1.1111, element = $(gadget.props.element).find("#" + element_id), new_value; var zoom_level = gadget.props.zoom_level * 1.1111, element = $(gadget.props.element).find("#" + element_id), new_value;
$.each(gadget.props.style_attr_list, function(i, j) { $.each(gadget.props.style_attr_list, function(i, j) {
new_value = $(gadget.props.element).find(".dummy_window").css(j).replace("px", "") * zoom_level + "px"; new_value = $(gadget.props.element).find(".dummy_window").css(j).replace("px", "") * zoom_level + "px";
console.log(new_value);
element.css(j, new_value); element.css(j, new_value);
}); });
console.log("extra box style");
console.log(element[0]);
Object.keys(class_definition.css || {}).forEach(function(k) {
console.log("<>");
console.log(k);
console.log(class_definition.css[k]);
element.css(k, class_definition.css[k]);
});
} }
// function positionGraph(gadget) { // function positionGraph(gadget) {
// $.ajax( // $.ajax(
...@@ -476,7 +485,6 @@ ...@@ -476,7 +485,6 @@
console.log("expanding properties"); console.log("expanding properties");
console.log(definition); console.log(definition);
var property, temp1, temp2, i, subProp, temp3; var property, temp1, temp2, i, subProp, temp3;
//, coppy;
for (property in definition.properties) { for (property in definition.properties) {
if (definition.properties.hasOwnProperty(property)) { if (definition.properties.hasOwnProperty(property)) {
console.log("..."); console.log("...");
...@@ -744,6 +752,8 @@ ...@@ -744,6 +752,8 @@
function addNode(gadget, node_id, node_data) { function addNode(gadget, node_id, node_data) {
console.log("addNODE 0"); console.log("addNODE 0");
var render_element = $(gadget.props.main), class_definition = gadget.props.data.class_definition[node_data._class], coordinate = node_data.coordinate, dom_element_id, box, absolute_position, domElement; var render_element = $(gadget.props.main), class_definition = gadget.props.data.class_definition[node_data._class], coordinate = node_data.coordinate, dom_element_id, box, absolute_position, domElement;
console.log("addnode class_definition");
console.log(class_definition);
dom_element_id = generateDomElementId(gadget.props.element); dom_element_id = generateDomElementId(gadget.props.element);
gadget.props.node_id_to_dom_element_id[node_id] = dom_element_id; gadget.props.node_id_to_dom_element_id[node_id] = dom_element_id;
node_data.name = node_data.name || class_definition.name; node_data.name = node_data.name || class_definition.name;
...@@ -764,6 +774,8 @@ ...@@ -764,6 +774,8 @@
title: node_data.name || node_data.id, title: node_data.name || node_data.id,
name: node_data.name || node_data.id name: node_data.name || node_data.id
}), "text/html").querySelector(".window"); }), "text/html").querySelector(".window");
console.log("dom element");
console.log(domElement);
render_element.append(domElement); render_element.append(domElement);
waitForNodeClick(gadget, domElement); waitForNodeClick(gadget, domElement);
//waitForNodeClick(gadget, domElement, class_definition); //waitForNodeClick(gadget, domElement, class_definition);
...@@ -771,7 +783,11 @@ ...@@ -771,7 +783,11 @@
absolute_position = convertToAbsolutePosition(gadget, coordinate.left, coordinate.top); absolute_position = convertToAbsolutePosition(gadget, coordinate.left, coordinate.top);
box.css("top", absolute_position[1]); box.css("top", absolute_position[1]);
box.css("left", absolute_position[0]); box.css("left", absolute_position[0]);
updateNodeStyle(gadget, dom_element_id); console.log("box " + dom_element_id);
console.log(box);
console.log("gadget");
console.log(gadget);
updateNodeStyle(gadget, dom_element_id, class_definition);
draggable(gadget); draggable(gadget);
// XXX make only this element draggable. // XXX make only this element draggable.
// Add some flowchart endpoints // Add some flowchart endpoints
......
/*global window, document, RSVP, rJS, initGadgetMixin*/ /*global window, document, RSVP, rJS, initGadgetMixin, console*/
(function(window, document, RSVP, rJS, initGadgetMixin) { (function(window, document, RSVP, rJS, initGadgetMixin) {
"use strict"; "use strict";
/*jslint nomen: true*/ /*jslint nomen: true*/
...@@ -29,11 +29,15 @@ ...@@ -29,11 +29,15 @@
/* display all nodes in the palette. /* display all nodes in the palette.
*/ */
tools_container.className = "tools-container"; tools_container.className = "tools-container";
console.log("rendering toolbox");
Object.keys(data.class_definition).forEach(function(key) { Object.keys(data.class_definition).forEach(function(key) {
var _class_object = data.class_definition[key], tool; var _class_object = data.class_definition[key], tool;
console.log("key");
console.log(key);
console.log(_class_object);
// XXX "expand" the json schema "allOF" etc // XXX "expand" the json schema "allOF" etc
if (_class_object.allOf) { if (_class_object.allOf) {
if (_class_object.allOf[0].$ref === "#/class_definition/node") { if (_class_object.allOf[0].$ref === "#/node") {
tool = document.createElement("div"); tool = document.createElement("div");
// XXX maybe allow to configure the class name ? // XXX maybe allow to configure the class name ?
tool.className = "tool " + key; tool.className = "tool " + key;
...@@ -41,8 +45,13 @@ ...@@ -41,8 +45,13 @@
tool.draggable = true; tool.draggable = true;
tool.dataset.class_name = JSON.stringify(key); tool.dataset.class_name = JSON.stringify(key);
Object.keys(_class_object.css || {}).forEach(function(k) { Object.keys(_class_object.css || {}).forEach(function(k) {
console.log("<>");
console.log(k);
console.log(_class_object.css[k]);
tool.style[k] = _class_object.css[k]; tool.style[k] = _class_object.css[k];
}); });
console.log("tool style");
console.log(tool.style);
tools_container.appendChild(tool); tools_container.appendChild(tool);
} }
} }
......
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