cockpit/js/instance.js in cpee-2.1.52 vs cockpit/js/instance.js in cpee-2.1.53
- old
+ new
@@ -4,10 +4,11 @@
var paths = '#dat_details input, #dat_details textarea, #dat_details select, #dat_details button, #dat_details [contenteditable], #dat_dataelements input, #dat_dataelements textarea, #dat_dataelements select, #dat_dataelements button, #dat_dataelements [contenteditable], #dat_endpoints input, #dat_endpoints textarea, #dat_endpoints select, #dat_endpoints button, #dat_endpoints [contenteditable], #dat_attributes input, #dat_attributes textarea, #dat_attributes select, #dat_attributes button, #dat_attributes [contenteditable]';
var loading = false;
var subscription;
var subscription_state = 'less';
var graph_changed = new Event("graph:changed", {"bubbles":true, "cancelable":false});
+var model_loaded = new Event("model:loaded", {"bubbles":true, "cancelable":false});
var save = {};
save['endpoints'] = undefined;
save['dataelements'] = undefined;
save['attributes'] = undefined;
var node_state = {};
@@ -591,18 +592,19 @@
// Start Peilei
if (col.type == "resource") {
let str = '';
for (const [k, v] of Object.entries(col.value)) {
var p = {};
+ p.row = val.row;
p.AR = v;
p.yc = dimensions.height_shift/2 + dimensions.height * val.row - 20;
if (!mapPoints.has(k)) {
p.y0 = p.y0 == undefined ? (dimensions.height_shift/2 + dimensions.height * val.row - 20) : p.y0;
- p.ymax = (p.ymax == undefined) ? p.y0 : p.ymax; //(dimensions.height_shift/2 + dimensions.height * val.row - 20 > p.ymax ? dimensions.height_shift/2 + dimensions.height * val.row - 20 : p.ymax);
+ p.ymax = (p.ymax == undefined) ? p.y0 : p.ymax;
} else {
p.y0 = mapPoints.get(k).y0;
- p.ymax = mapPoints.get(k).ymax; //(dimensions.height_shift/2 + dimensions.height * val.row - 20 > p.ymax ? dimensions.height_shift/2 + dimensions.height * val.row - 20 : p.ymax);
+ p.ymax = mapPoints.get(k).ymax;
}
mapPoints.set(k, p);
}
var cx = iconshift*2;
str += '<g xmlns="http://www.w3.org/2000/svg">';
@@ -642,12 +644,12 @@
}
}
if (firstAssignFlag == 1) {
// Additional logic and construction of another polygon for orange triangle pointing left
- p.y0 -= dimensions.height;
- str += '<polygon xmlns="http://www.w3.org/2000/svg" points="' + (cx + 5) + ',' + (dimensions.height_shift/2 + dimensions.height * (val.row - 1) - 20) + ' ' + (cx - 5) + ',' + (dimensions.height_shift/2 + dimensions.height * (val.row - 1) - 15) + ' ' + (cx - 5) + ',' + (dimensions.height_shift/2 + dimensions.height * (val.row - 1) - 25) + '" fill="orange" class="resource-point">' + '<text xmlns="http://www.w3.org/2000/svg">' + k + '</text></polygon>';
+ p.y0 -= ((p.row-1) * dimensions.height);
+ str += '<polygon xmlns="http://www.w3.org/2000/svg" points="' + (cx + 5) + ',' + (dimensions.height_shift/2 + dimensions.height - 20) + ' ' + (cx - 5) + ',' + (dimensions.height_shift/2 + dimensions.height - 15) + ' ' + (cx - 5) + ',' + (dimensions.height_shift/2 + dimensions.height - 25) + '" fill="orange" class="resource-point">' + '<text xmlns="http://www.w3.org/2000/svg">' + k + '</text></polygon>';
}
cx += iconsize;
}
for (const [k, p] of mapPoints) {
@@ -1206,10 +1208,12 @@
})
);
await Promise.all(promises);
+ document.dispatchEvent(model_loaded);
+
$.ajax({
type: "GET",
url: url + "/properties/state/",
dataType: "text",
success: function(res){
@@ -1222,12 +1226,14 @@
if (exec) start_instance();
}
});
}
});
- }// }}}
+
+}// }}}
+
function load_testsetfile_after() { //{{{
if (loading) return;
loading = true;
if (typeof window.FileReader !== 'function') {
alert('FileReader not yet supportet');
@@ -1342,10 +1348,13 @@
headers: {
'Content-ID': 'description',
'CPEE-Event-Source': myid
},
data: model,
- error: report_failure
+ error: report_failure,
+ success: () => {
+ document.dispatchEvent(model_loaded);
+ }
});
} //}}}
function load_testset_extract_handlers(inp,han,suburl) { //{{{
inp.push("url="+encodeURIComponent(suburl).replace(/~/,'%7E'));