cockpit/js/instance.js in cpee-1.4.30 vs cockpit/js/instance.js in cpee-1.4.31
- old
+ new
@@ -11,10 +11,11 @@
save['graph'] = undefined;
save['graph_theme'] = undefined;
save['graph_adaptor'] = undefined;
save['endpoints'] = undefined;
save['endpoints_cache'] = {};
+ save['endpoints_list'] = {};
save['dataelements'] = undefined;
save['attributes'] = undefined;
save['details'] = undefined;
save['details_target'] = undefined;
save['instance_pos'] = [];
@@ -351,12 +352,14 @@
type: "GET",
url: url + "/properties/values/" + val + "/",
success: function(res){
save[val].content(res);
if (val == "endpoints") {
+ save['endpoints_list'] = {};
var tmp = {};
$(res).find(" > value > *").each(function(k,v) {
+ save['endpoints_list'][v.localName] = v.lastChild.nodeValue;
$.ajax({
url: rep + encodeURIComponent($(v).text()),
success: function() {
tmp[v.tagName] = {};
var deferreds = [new $.Deferred(), new $.Deferred()];
@@ -407,11 +410,38 @@
} //}}}
function adaptor_init(url,theme,dslx) { //{{{
if (save['graph_theme'] != theme) {
save['graph_theme'] = theme;
save['graph_adaptor'] = new WfAdaptor($('body').data('theme-base') + '/' + theme + '/theme.js',function(graphrealization){
+ manifestation.endpoints = save.endpoints_list;
+ graphrealization.draw_labels = function(max,labels,shift) {
+ $('#graphcanvas').css('grid-row', '1/span ' +( max.row + 1));
+ $('#graphgrid .graphlabel').remove();
+ $('#graphgrid').css('grid-template-rows', shift + 'px repeat(' + max.row + ', 1fr)');
+ var tlabels = {};
+ var tcolumns = [];
+ _.each(labels,function(val){
+ if (val.label != "") {
+ tlabels[val.row] = [];
+ _.each(val.label,function(col) {
+ if (!tcolumns.includes(col.column)) {
+ tcolumns.push(col.column);
+ }
+ tlabels[val.row][tcolumns.indexOf(col.column)] = col.value;
+ });
+ }
+ });
+ for (var i = 0; i < max.row; i++) {
+ _.each(tlabels[i+1],function(col,j) {
+ if (col != undefined) {
+ $('#graphgrid').append($('<div class="graphlabel" style="grid-column: ' + (j+2) + '; grid-row: ' + (i+2) + '; padding-bottom: ' + shift + 'px"><span>' + col + '</span></div>'));
+ }
+ });
+ }
+ };
graphrealization.set_svg_container($('#graphcanvas'));
+ graphrealization.set_css_container($('#graphgrid'));
graphrealization.set_description($(dslx), true);
graphrealization.notify = function(svgid) {
var g = graphrealization.get_description();
save['graph'] = $X(g);
save['graph'].find('[xmlns]').removeAttr('xmlns');
@@ -428,11 +458,11 @@
monitor_instance_pos();
$('#dat_details').empty();
});
} else {
save['graph_adaptor'].update(function(graphrealization){
- var svgid = manifestation.clicked();
+ var svgid = manifestation.selected();
graphrealization.set_description($(dslx));
adaptor_update();
manifestation.events.click(svgid);
format_instance_pos();
});
@@ -554,15 +584,17 @@
format_visual_clear();
}
var but = "";
if (notification == "ready" || notification == "stopped") {
+ $('#state_extended').show();
$("button[name=state_start]").show();
$("button[name=state_stop]").hide();
$("button[name=state_sim]").show();
$("button[name=state_abandon]").show();
} else if (notification == "running") {
+ $('#state_extended').hide();
$("button[name=state_start]").hide();
$("button[name=state_stop]").show();
$("button[name=state_sim]").hide();
$("button[name=state_abandon]").hide();
}
@@ -572,12 +604,13 @@
// remove all markings with state change
if (save['graph_adaptor'] && save['graph_adaptor'].illustrator) {
save['graph_adaptor'].illustrator.get_elements().removeClass('marked');
}
- if (notification == "finished") {
+ if (notification == "finished" || notification == "abandoned") {
$('.tabbehind button').hide();
+ $('#state_any').hide();
} else {
$('#parameters .tabbehind button').show();
}
$("#state_text").text(notification);
@@ -1144,11 +1177,11 @@
$('.super .active').each(function(a,b){b.setAttribute('class','active');});
$('.super .passive').each(function(a,b){b.setAttribute('class','passive');});
$('.super .vote').each(function(a,b){b.setAttribute('class','vote');});
$('.super .colon').each(function(a,b){b.setAttribute('class','colon');});
$('.activities').each(function(a,b){
- if (b.hasAttribute('clicked')) {
- b.setAttribute('class','activities clicked');
+ if (b.hasAttribute('selected')) {
+ b.setAttribute('class','activities selected');
} else {
b.setAttribute('class','activities');
}
});
$('#votes').empty();