mirror of https://gitee.com/bigwinds/arangodb
issue #611: a bit more preselection in the graph viewer
This commit is contained in:
parent
9bb89bb654
commit
dd8fef21a4
|
@ -49,7 +49,6 @@ function ArangoAdapter(nodes, edges, config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var self = this,
|
var self = this,
|
||||||
absAdapter,
|
absAdapter,
|
||||||
absConfig = {},
|
absConfig = {},
|
||||||
|
@ -599,6 +598,18 @@ function ArangoAdapter(nodes, edges, config) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.getNodeCollection = function () {
|
||||||
|
return nodeCollection;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getEdgeCollection = function () {
|
||||||
|
return edgeCollection;
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getDirection = function () {
|
||||||
|
return direction;
|
||||||
|
}
|
||||||
|
|
||||||
self.setWidth = absAdapter.setWidth;
|
self.setWidth = absAdapter.setWidth;
|
||||||
self.changeTo = absAdapter.changeTo;
|
self.changeTo = absAdapter.changeTo;
|
||||||
|
|
|
@ -431,17 +431,18 @@ function NodeShaper(parent, flags, idfunc) {
|
||||||
}
|
}
|
||||||
if (config.label !== undefined) {
|
if (config.label !== undefined) {
|
||||||
parseLabelFlag(config.label);
|
parseLabelFlag(config.label);
|
||||||
|
self.label = config.label;
|
||||||
}
|
}
|
||||||
if (config.actions !== undefined) {
|
if (config.actions !== undefined) {
|
||||||
parseActionFlag(config.actions);
|
parseActionFlag(config.actions);
|
||||||
}
|
}
|
||||||
if (config.color !== undefined) {
|
if (config.color !== undefined) {
|
||||||
parseColorFlag(config.color);
|
parseColorFlag(config.color);
|
||||||
|
self.color = config.color;
|
||||||
}
|
}
|
||||||
if (config.distortion !== undefined) {
|
if (config.distortion !== undefined) {
|
||||||
parseDistortionFlag(config.distortion);
|
parseDistortionFlag(config.distortion);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.parent = parent;
|
self.parent = parent;
|
||||||
|
@ -518,7 +519,14 @@ function NodeShaper(parent, flags, idfunc) {
|
||||||
self.setGVStartFunction = function(func) {
|
self.setGVStartFunction = function(func) {
|
||||||
start = func;
|
start = func;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.getLabel = function() {
|
||||||
|
return self.label || "";
|
||||||
|
};
|
||||||
|
|
||||||
|
self.getColor = function() {
|
||||||
|
return self.color.key || "";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeShaper.shapes = Object.freeze({
|
NodeShaper.shapes = Object.freeze({
|
||||||
|
|
|
@ -43,6 +43,7 @@ function ArangoAdapterControls(list, adapter) {
|
||||||
this.addControlChangeCollections = function(callback) {
|
this.addControlChangeCollections = function(callback) {
|
||||||
var prefix = "control_adapter_collections",
|
var prefix = "control_adapter_collections",
|
||||||
idprefix = prefix + "_";
|
idprefix = prefix + "_";
|
||||||
|
|
||||||
adapter.getCollections(function(nodeCols, edgeCols) {
|
adapter.getCollections(function(nodeCols, edgeCols) {
|
||||||
adapter.getGraphs(function(graphs) {
|
adapter.getGraphs(function(graphs) {
|
||||||
uiComponentsHelper.createButton(baseClass, list, "Collections", prefix, function() {
|
uiComponentsHelper.createButton(baseClass, list, "Collections", prefix, function() {
|
||||||
|
@ -58,12 +59,14 @@ function ArangoAdapterControls(list, adapter) {
|
||||||
type: "list",
|
type: "list",
|
||||||
id: "node_collection",
|
id: "node_collection",
|
||||||
text: "Vertex collection",
|
text: "Vertex collection",
|
||||||
objects: nodeCols
|
objects: nodeCols,
|
||||||
|
selected: adapter.getNodeCollection()
|
||||||
},{
|
},{
|
||||||
type: "list",
|
type: "list",
|
||||||
id: "edge_collection",
|
id: "edge_collection",
|
||||||
text: "Edge collection",
|
text: "Edge collection",
|
||||||
objects: edgeCols
|
objects: edgeCols,
|
||||||
|
selected: adapter.getEdgeCollection()
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
|
@ -81,7 +84,8 @@ function ArangoAdapterControls(list, adapter) {
|
||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
type: "checkbox",
|
type: "checkbox",
|
||||||
id: "undirected"
|
id: "undirected",
|
||||||
|
selected: (adapter.getDirection() === "any"),
|
||||||
}], function () {
|
}], function () {
|
||||||
var nodes = $("#" + idprefix + "node_collection")
|
var nodes = $("#" + idprefix + "node_collection")
|
||||||
.children("option")
|
.children("option")
|
||||||
|
@ -116,6 +120,7 @@ function ArangoAdapterControls(list, adapter) {
|
||||||
var prefix = "control_adapter_priority",
|
var prefix = "control_adapter_priority",
|
||||||
idprefix = prefix + "_",
|
idprefix = prefix + "_",
|
||||||
prioList = adapter.getPrioList();
|
prioList = adapter.getPrioList();
|
||||||
|
|
||||||
uiComponentsHelper.createButton(baseClass, list, "Group By", prefix, function() {
|
uiComponentsHelper.createButton(baseClass, list, "Group By", prefix, function() {
|
||||||
modalDialogHelper.createModalChangeDialog("Group By",
|
modalDialogHelper.createModalChangeDialog("Group By",
|
||||||
idprefix, [{
|
idprefix, [{
|
||||||
|
|
|
@ -388,7 +388,7 @@ function GraphViewerUI(container, adapterConfig, optWidth, optHeight, viewerConf
|
||||||
|
|
||||||
adapterUI.addControlChangeCollections(updateAttributeExamples);
|
adapterUI.addControlChangeCollections(updateAttributeExamples);
|
||||||
adapterUI.addControlChangePriority();
|
adapterUI.addControlChangePriority();
|
||||||
nodeShaperUI.addControlOpticLabelAndColour();
|
nodeShaperUI.addControlOpticLabelAndColour(graphViewer.adapter);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
buttons.appendChild(nodeShaperDropDown);
|
buttons.appendChild(nodeShaperDropDown);
|
||||||
|
|
|
@ -161,21 +161,23 @@ var modalDialogHelper = modalDialogHelper || {};
|
||||||
$("#" + idprefix + "modal").modal('show');
|
$("#" + idprefix + "modal").modal('show');
|
||||||
},
|
},
|
||||||
|
|
||||||
createTextInput = function(id) {
|
createTextInput = function(id, value) {
|
||||||
var input = document.createElement("input");
|
var input = document.createElement("input");
|
||||||
input.type = "text";
|
input.type = "text";
|
||||||
input.id = id;
|
input.id = id;
|
||||||
|
input.value = value;
|
||||||
return input;
|
return input;
|
||||||
},
|
},
|
||||||
|
|
||||||
createCheckboxInput = function(id) {
|
createCheckboxInput = function(id, selected) {
|
||||||
var input = document.createElement("input");
|
var input = document.createElement("input");
|
||||||
input.type = "checkbox";
|
input.type = "checkbox";
|
||||||
input.id = id;
|
input.id = id;
|
||||||
|
input.checked = selected;
|
||||||
return input;
|
return input;
|
||||||
},
|
},
|
||||||
|
|
||||||
createListInput = function(id, list) {
|
createListInput = function(id, list, selected) {
|
||||||
var input = document.createElement("select");
|
var input = document.createElement("select");
|
||||||
input.id = id;
|
input.id = id;
|
||||||
_.each(
|
_.each(
|
||||||
|
@ -184,6 +186,7 @@ var modalDialogHelper = modalDialogHelper || {};
|
||||||
}), function(entry) {
|
}), function(entry) {
|
||||||
var option = document.createElement("option");
|
var option = document.createElement("option");
|
||||||
option.value = entry;
|
option.value = entry;
|
||||||
|
option.selected = (entry === selected);
|
||||||
option.appendChild(
|
option.appendChild(
|
||||||
document.createTextNode(entry)
|
document.createTextNode(entry)
|
||||||
);
|
);
|
||||||
|
@ -314,13 +317,13 @@ var modalDialogHelper = modalDialogHelper || {};
|
||||||
contentTh.className = "collectionTh";
|
contentTh.className = "collectionTh";
|
||||||
switch(o.type) {
|
switch(o.type) {
|
||||||
case "text":
|
case "text":
|
||||||
contentTh.appendChild(createTextInput(idprefix + o.id));
|
contentTh.appendChild(createTextInput(idprefix + o.id, o.value || ""));
|
||||||
break;
|
break;
|
||||||
case "checkbox":
|
case "checkbox":
|
||||||
contentTh.appendChild(createCheckboxInput(idprefix + o.id));
|
contentTh.appendChild(createCheckboxInput(idprefix + o.id, o.selected || false));
|
||||||
break;
|
break;
|
||||||
case "list":
|
case "list":
|
||||||
contentTh.appendChild(createListInput(idprefix + o.id, o.objects));
|
contentTh.appendChild(createListInput(idprefix + o.id, o.objects, o.selected || undefined));
|
||||||
break;
|
break;
|
||||||
case "extendable":
|
case "extendable":
|
||||||
insertExtendableInput(idprefix, o.id, o.objects, contentTh, table, tr);
|
insertExtendableInput(idprefix, o.id, o.objects, contentTh, table, tr);
|
||||||
|
|
|
@ -218,7 +218,7 @@ function NodeShaperControls(list, shaper) {
|
||||||
// Mixed Buttons
|
// Mixed Buttons
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
this.addControlOpticLabelAndColour = function() {
|
this.addControlOpticLabelAndColour = function(adapter) {
|
||||||
var prefix = "control_node_labelandcolour",
|
var prefix = "control_node_labelandcolour",
|
||||||
idprefix = prefix + "_";
|
idprefix = prefix + "_";
|
||||||
uiComponentsHelper.createButton(baseClass, list, "Label", prefix, function() {
|
uiComponentsHelper.createButton(baseClass, list, "Label", prefix, function() {
|
||||||
|
@ -226,24 +226,26 @@ function NodeShaperControls(list, shaper) {
|
||||||
idprefix, [{
|
idprefix, [{
|
||||||
type: "text",
|
type: "text",
|
||||||
id: "label-attribute",
|
id: "label-attribute",
|
||||||
text: "Vertex label attribute"
|
text: "Vertex label attribute",
|
||||||
|
value: shaper.getLabel() || ""
|
||||||
},{
|
},{
|
||||||
type: "decission",
|
type: "decission",
|
||||||
id: "samecolour",
|
id: "samecolour",
|
||||||
group: "colour",
|
group: "colour",
|
||||||
text: "Use this attribute for coloring, too",
|
text: "Use this attribute for coloring, too",
|
||||||
isDefault: true
|
isDefault: (shaper.getLabel() === shaper.getColor())
|
||||||
},{
|
},{
|
||||||
type: "decission",
|
type: "decission",
|
||||||
id: "othercolour",
|
id: "othercolour",
|
||||||
group: "colour",
|
group: "colour",
|
||||||
text: "Use different attribute for coloring",
|
text: "Use different attribute for coloring",
|
||||||
isDefault: false,
|
isDefault: (shaper.getLabel() !== shaper.getColor()),
|
||||||
interior: [
|
interior: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
id: "colour-attribute",
|
id: "colour-attribute",
|
||||||
text: "Color attribute"
|
text: "Color attribute",
|
||||||
|
value: shaper.getColor() || ""
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}], function () {
|
}], function () {
|
||||||
|
|
Loading…
Reference in New Issue