|
|
@@ -6,6 +6,8 @@ if ('undefined' === typeof PRIMARY_KEY) throw "Missing PRIMARY_KEY";
|
|
|
// if ('undefined' === typeof FUNCTION_FETCH_PARENTS) throw "Missing FUNCTION_FETCH_PARENTS";
|
|
|
// if ('undefined' === typeof JS_CHANNEL_UPDATE_NAME) throw "Missing JS_CHANNEL_UPDATE_NAME";
|
|
|
var DBG = DBG || 0;
|
|
|
+var DBG_SANKEY = DBG_SANKEY || 0;
|
|
|
+DBG_SANKEY = 1
|
|
|
var SHOW_FLOW_DIAGRAM = SHOW_FLOW_DIAGRAM || 0;
|
|
|
|
|
|
var _isFullScreen = true; // TODO: get from arg
|
|
|
@@ -365,6 +367,7 @@ function fetchNodeMoreRefs(selectedNode, featureID) {
|
|
|
var backRefPK = selectedNode.ref['@backRefPK']
|
|
|
var backRefField = selectedNode.ref['@typeName']
|
|
|
var startIndex = selectedNode.ref['@startIndex']
|
|
|
+ if(DBG)console.log('DBG:fetch: fetchNodeMoreRefs', { 'selectedNode': selectedNode, 'featureID': featureID });
|
|
|
_nodes.update({
|
|
|
id: idSelectedNode,
|
|
|
label: "Pobieranie danych..."
|
|
|
@@ -454,10 +457,11 @@ function fetchNodeRecurse(selectedNode, featureID) {
|
|
|
if (!featureID) throw "Missing featureID"
|
|
|
var featureEx = featureID.split('.')
|
|
|
if (2 !== featureEx.length) throw "Not supported featureID format"
|
|
|
- var featureTypeName = 'default_db__x3A__' + featureEx[0] + ':' + featureEx[0]
|
|
|
+ var featureTypeName = selectedNode.typeName; // 'default_db__x3A__' + featureEx[0] + ':' + featureEx[0]
|
|
|
var wfsParams = Object.assign({}, _defaultWfsParams, {
|
|
|
primaryKey: featureEx[1]
|
|
|
});
|
|
|
+ if(DBG)console.log('DBG:fetch: fetchNodeRecurse', { 'selectedNode': selectedNode, 'featureID': featureID });
|
|
|
|
|
|
// view-source:http://visjs.org/examples/network/data/dynamicData.html
|
|
|
_nodes.update({
|
|
|
@@ -579,7 +583,7 @@ function renderSelectedNode(node) {
|
|
|
}
|
|
|
|
|
|
function updateSankeyDiagram() {
|
|
|
- console.log('updateSankeyDiagram..');
|
|
|
+ if(DBG||DBG_SANKEY)console.log('updateSankeyDiagram..');
|
|
|
if (!SHOW_FLOW_DIAGRAM || !sankey) return;
|
|
|
// var sankeyData = { // example
|
|
|
// nodes: [
|
|
|
@@ -620,15 +624,17 @@ function updateSankeyDiagram() {
|
|
|
ret[id] = idx;
|
|
|
return ret;
|
|
|
}, {});
|
|
|
+ // TODO: fix - count from leaf's to root's
|
|
|
var countOutLinks = _edges.get().reduce(function (ret, edge) {
|
|
|
if (!mapVisNodeIdToIdx.hasOwnProperty(edge.from)) throw "Missing to in mapVisNodeIdToIdx["+edge.from+"]"
|
|
|
var idxTarget = mapVisNodeIdToIdx[edge.from]
|
|
|
ret[idxTarget] = (ret[idxTarget] > 0) ? ret[idxTarget] + 1 : 1
|
|
|
- console.log('DBG:sankey: countOutLinks reduce', edge, ret);
|
|
|
+ // if(DBG||DBG_SANKEY)console.log('DBG:sankey: countOutLinks reduce', edge, ret);
|
|
|
return ret
|
|
|
}, {})
|
|
|
- console.log('DBG:sankey: mapVisNodeIdToIdx', mapVisNodeIdToIdx);
|
|
|
- console.log('DBG:sankey: countOutLinks', countOutLinks);
|
|
|
+ if(DBG||DBG_SANKEY)console.log('DBG:sankey: countOutLinks', Object.keys(countOutLinks).map(function (idx) {
|
|
|
+ return '' + _nodes.get()[idx].label + ' ('+countOutLinks[idx]+')';
|
|
|
+ }));
|
|
|
var sankeyInstance = sankey({
|
|
|
nodes: _nodes.map(function (node) {
|
|
|
return {
|