Переглянути джерело

updated show/hide graph view - React, Readux; fixed query for kontrahenci graph

Piotr Labudda 6 роки тому
батько
коміт
60c4b8652b
2 змінених файлів з 224 додано та 59 видалено
  1. 2 2
      tools/Bocian.php
  2. 222 57
      tools/Bocian.php.graphShowHide.js

+ 2 - 2
tools/Bocian.php

@@ -2881,8 +2881,8 @@ public function showPowiazaniaEnergaRumKontrahenciPowiazania($items) {
 
 		$btnGrafPowiazan = '';
 		switch ($type) {
-			case 'PRACOWNICY': $btnGrafPowiazan = '<button class="btn btn-primary smad-pracownicy-graph-button" onclick="graphShowHide(\'pracownicy\')" style="padding:1px 5px; margin-left:12px">GRAF POWIĄZAŃ</button>'; break;
-			case 'KONTRAHENCI': $btnGrafPowiazan = '<button class="btn btn-primary smad-kontrahenci-graph-button" onclick="graphShowHide(\'kontrahenci\')" style="padding:1px 5px; margin-left:12px">GRAF POWIĄZAŃ</button>'; break;
+			case 'PRACOWNICY': $btnGrafPowiazan = '<div class="btn-group"><button class="btn btn-primary" onclick="graphShowHide(this, \'pracownicy\')" style="padding:1px 5px">GRAF POWIĄZAŃ</button></div>'; break;
+			case 'KONTRAHENCI': $btnGrafPowiazan = '<div class="btn-group"><button class="btn btn-primary" onclick="graphShowHide(this, \'kontrahenci\')" style="padding:1px 5px">GRAF POWIĄZAŃ</button></div>'; break;
 		}
 
 		$formFilterHeadDesc = '';

+ 222 - 57
tools/Bocian.php.graphShowHide.js

@@ -4,51 +4,191 @@ var p5WFS_GetFeature = global.p5WFS_GetFeature;
 var renderGraph = global.renderGraph; // @from sankey-init
 var DBG = DBG || 0;
 var DBG1 = 1;
+var globalGraphStore = null;
+function graphStore(state, action) {
+	var prevState = state || {
+		isLoading: false,
+		sentRequestId: 0,
+		receivedRequestId: 0,
+		items: [],
+	};
+	DBG && console.log('DBG: graph store', { prevState, action });
+	switch (action.type) {
+		case 'SET_SENT_REQUEST_ID': return Object.assign(prevState, {
+			sentRequestId: action.sentRequestId,
+			isLoading: true
+		});
+		case 'SET_RESPONSE': return Object.assign(prevState, {
+			receivedRequestId: action.requestId,
+			items: action.items,
+			isLoading: (prevState.sentRequestId > action.requestId) ? true : false,
+		});
+		default: return prevState;
+	}
+}
+var createGraphActions = function () {
 
-// requestId - job/task id int (auto increment or timestamp)
-// TODO: if (requestId > idSentToRender) // then still loading, but rendered old response
-var graphShowHide__requestId = 0;
-var graphShowHide__idSentToRender = 0;
-function graphShowHide(nameSection) {
-	graphShowHide__requestId++;
-	var this__requestId = graphShowHide__requestId;
-	var node = $('#smad-'+nameSection+'-graph-view')
-	if (!node || !node.length) return;
-	if ('block' !== node.css('display')) {
-		DBG && console.log("DBG:graphShowHide: sending Request("+this__requestId+") ...", { graphShowHide__requestId, graphShowHide__idSentToRender });
-		node.show()
-		var graphResultNode = node.get(0)
-		graphFetchData(nameSection).then(function (response) {
-			return {
-				requestId: this__requestId,
-				response: response
-			};
-		}).then(function (graphJobResponse) {
-			var requestId = graphJobResponse.requestId;
-			var items = graphJobResponse.response;
-			DBG && console.warn("DBG:graphShowHide: Response("+requestId+") received", { requestId, graphShowHide__requestId, graphShowHide__idSentToRender, items });
-
-			if (graphShowHide__idSentToRender > requestId) {
-				return;
-			}
+	var setSentRequestId = function (sentRequestId) {
+		return { type: 'SET_SENT_REQUEST_ID', sentRequestId: sentRequestId };
+	}
+	var setResponse = function (obj) {
+		return Object.assign(obj, { type: 'SET_RESPONSE' });
+	}
+
+	var fetchData = function (nameSection) {
+		return function (dispatch, getState) {
+			var state = getState();
+			var this__requestId = state.sentRequestId + 1;
+			dispatch(setSentRequestId(this__requestId));
+
+			var reqPromise = graphFetchData(nameSection);
+			return reqPromise.then(function (response) {
+				var items = response;
+				var state = getState();
+
+				if (state.receivedRequestId > this__requestId) {
+					DBG && console.log('DBG: skiped response', { 'state.receivedRequestId': state.receivedRequestId, this__requestId });
+					return;
+				}
 
-			graphShowHide__idSentToRender = requestId;
+				dispatch(
+					setResponse({
+						requestId: this__requestId,
+						msg: "Pobrano dane",
+						typeName: ('pracownicy' === nameSection) ? 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY' : 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI',
+						items: items
+					})
+				);
+			}).catch(function (e) {
+				p5UI__notifyAjaxCallback({type: 'error', msg: 'Wystąpił błąd #GS1: ' + e});
+				// dispatch( setErrorMsg(e) ); // TODO: show error with msg and refresh button
+			});
+		}
+	}
+
+	return {
+		fetchData: fetchData,
+	}
+}
+var globalGraphActions = ''; // createGraphActions();
+
+var createReactClass = global.p5VendorJs.createReactClass;
+var h = global.p5VendorJs.React.createElement;
+var ReactDOM = global.p5VendorJs.ReactDOM;
+var Redux = global.p5VendorJs.Redux;
+var ReduxThunk = global.p5VendorJs.ReduxThunk;
+var createStoreWithThunkMiddleware = Redux.applyMiddleware(ReduxThunk)(Redux.createStore); // TODO: to vendor.js
+
+global['P5UI__BocianGraphView'] = createReactClass({
+	// props.nameSection: PropTypes.string.isRequired
+	// props.store: Redux store with state: { isLoading: false, sentRequestId: 0, receivedRequestId: 0, items: [] }
+	// props.actions: Redux store actions {  }
+	getStateFromStore: function () {
+		var state = this.props.store.getState();
+		return {
+			isLoading: state.isLoading,
+			items: state.items,
+			sentRequestId: state.sentRequestId,
+			receivedRequestId: state.receivedRequestId,
+		};
+	},
+	getInitialState: function () {
+		return this.getStateFromStore();
+	},
+	componentDidMount: function () {
+		DBG && console.log('DBG::P5UI__BocianGraphView::componentDidMount');
+		this.unsubscribe = this.props.store.subscribe(this.storeUpdated)
+	},
+	componentWillUnmount: function () {
+		this.unsubscribe()
+	},
+	storeUpdated: function () {
+		DBG && console.log('DBG::P5UI__BocianGraphView::storeUpdated');
+		this.setState(this.getStateFromStore())
+	},
+	shouldComponentUpdate: function (nextProps, nextState) {
+		DBG && console.log('DBG::P5UI__BocianGraphView::shouldComponentUpdate', { state: this.state, nextState});
+		// return (
+		// 	this.state.isLoading !== nextState.isLoading
+		// 	|| this.state.sentRequestId !== nextState.sentRequestId
+		// 	|| this.state.receivedRequestId !== nextState.receivedRequestId
+		// );
+		if (nextState.receivedRequestId > this.state.receivedRequestId) {
+			var htmlId = 'p5_graphView_' + this.props.nameSection; // #smad-'+nameSection+'-graph-view
 			graphRaportRender({
 				msg: "Pobrano dane",
-				typeName: ('pracownicy' === nameSection) ? 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY' : 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI',
-				items: items
-			}, graphResultNode)
-		}).catch(function (err) {
-			if(DBG)console.log('p5WFS_GetFeature: err: ', err);
-			// graphRaportRender({ msg: "Wystąpiły błędy podczas pobierania danych", nameSection: nameSection, err: err }, node)
-		})
-	} else {
+				typeName: ('pracownicy' === this.props.nameSection) ? 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY' : 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI',
+				items: nextState.items
+			}, document.getElementById(htmlId))
+		}
+		return (
+			this.state.isLoading !== nextState.isLoading
+		);
+	},
+	render: function () {
+		DBG && console.log('DBG::P5UI__BocianGraphView::render', { props: this.props, state: this.state });
+		var htmlId = 'p5_graphView_' + this.props.nameSection; // #smad-'+nameSection+'-graph-view
+		var msg = (this.state.isLoading) ? "Pobieranie danych..." : null;
+		return h('div', {}, [
+			msg && h('div', {
+				className: 'alert alert-info',
+				style: {
+					maxWidth: '600px',
+					margin: '0 auto',
+					padding: '3px 24px',
+				}
+			}, msg),
+			h('div', { id: htmlId })
+		]);
+	}
+});
+
+var btnRefresh = null;
+var btnHide = null;
+function graphShowHide(btnNode, nameSection) {
+	var node = $('#smad-'+nameSection+'-graph-view')
+	if (!node || !node.length) {
+		console.log("Missing dom node '#smad-"+nameSection+"-graph-view'")
+		return;
+	}
+	var btnJqNode = jQuery(btnNode);
+	if ('block' == node.css('display')) {
 		DBG && console.warn("DBG:graphShowHide: hide");
 		node.hide()
+		btnRefresh.remove();
+		btnHide.remove();
+		return;
 	}
+	node.show()
+	btnRefresh = jQuery('<button class="btn btn-primary" style="padding:1px 5px">odśwież</button>').appendTo(btnJqNode.parent());
+	btnRefresh.on('click', function () {
+		globalGraphStore.dispatch(globalGraphActions.fetchData(nameSection));
+	})
+	btnHide = jQuery('<button class="btn btn-primary" style="padding:1px 5px"><i class="glyphicon glyphicon-remove"></i></button>').appendTo(btnJqNode.parent());
+	btnHide.on('click', function () {
+		node.hide()
+		btnRefresh.remove();
+		btnHide.remove();
+	})
+	var graphResultNode = node.get(0)
+
+	if (!globalGraphStore) {
+		globalGraphStore = createStoreWithThunkMiddleware(graphStore);
+		globalGraphActions = createGraphActions();
+		ReactDOM.render(
+			h(P5UI__BocianGraphView, {
+				nameSection: nameSection,
+				store: globalGraphStore,
+				actions: globalGraphActions,
+			}),
+			graphResultNode
+		);
+	}
+
+	globalGraphStore.dispatch(globalGraphActions.fetchData(nameSection));
 }
 
-function graphFetchData(nameSection) {
+function graphFetchData(nameSection) { // @return Promise
 	var page = page || getItemLocalStorage('Bocian.biAuditForm.'+nameSection+'.pagination.page');
 	if ( page === 1) {
 		setItemLocalStorage('Bocian.biAuditForm.'+nameSection+'.pagination.page', 1);
@@ -97,7 +237,7 @@ function graphFetchData(nameSection) {
 
 	var paginationLimit = 20;
 
-	if(DBG)console.log('graphFetchData...', {
+	DBG && console.log('graphFetchData...', {
 		paginationLimit: paginationLimit,
 		page: page,
 		filterIdGroup: filterIdGroup,
@@ -149,9 +289,14 @@ function graphFetchData(nameSection) {
 				]
 			)
 			.concat(refFieldsOnPathToList('default_db__x3A__BI_audit_KRS:BI_audit_KRS', [ 'ID', 'nazwa', 'krs', 'S_miejscowosc' ]))
-			.concat(refFieldsOnPathToList('default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI', [ 'ID', 'Pelna_nazwa_kontrahenta' ]))
 			.concat(refFieldsOnPathToList('default_db__x3A__BI_audit_MSIG:BI_audit_MSIG', [ 'ID', 'nazwa' ]))
 			.concat(refFieldsOnPathToList('default_db__x3A__BI_audit_CEIDG:BI_audit_CEIDG', [ 'ID', 'nazwisko', 'firma' ]))
+			.concat(refFieldsOnPathToList('default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI', [ 'ID', 'Pelna_nazwa_kontrahenta' ]))
+			.concat(
+				('pracownicy' === nameSection)
+				? []
+				: refFieldsOnPathToList('default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY', [ 'ID', 'imiona', 'nazwisko', 'miejscowosc' ])
+			)
 			.concat([
 				// '*',
 				// 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY_adresy:BI_audit_ENERGA_PRACOWNICY_adresy/*',
@@ -222,7 +367,7 @@ function graphRaportRender(props, wrapNode) {
 	// var data = parseGraphRec(props.items, props.nameSection)
 	var _todoGraphData = [];
 	parseResponseRec(_todoGraphData, props.items, props.typeName)
-	if(DBG)console.log('_todoGraphData', _todoGraphData)
+	DBG && console.log('_todoGraphData', _todoGraphData)
 	var _nodes = [];
 	var _links = [];
 	var mapNodeIdToIdx = {};
@@ -234,7 +379,7 @@ function graphRaportRender(props, wrapNode) {
 					_nodes.push(node) // _nodes.add(node)
 					mapNodeIdToIdx[node.id] = _nodes.length - 1
 				} catch (e) {
-					if(DBG)console.log('_graphData.nodes.add [level='+levelIdx+'] error:', e);
+					DBG && console.log('_graphData.nodes.add [level='+levelIdx+'] error:', e);
 				}
 			})
 		}
@@ -244,7 +389,7 @@ function graphRaportRender(props, wrapNode) {
 	_todoGraphData.forEach(function (levelData, levelIdx) {
 		if (levelData.edges && levelData.edges.length) {
 			levelData.edges.forEach(function (edge) {
-				if(DBG)console.log('_graphData.edges.add [level='+levelIdx+']:', {edge, source:mapNodeIdToIdx[edge.source], target:mapNodeIdToIdx[edge.target], mapNodeIdToIdx});
+				DBG && console.log('_graphData.edges.add [level='+levelIdx+']:', {edge, source:mapNodeIdToIdx[edge.source], target:mapNodeIdToIdx[edge.target], mapNodeIdToIdx});
 				// try {
 					// var source = mapNodeIdToIdx[edge.source]
 					// var target = mapNodeIdToIdx[edge.target]
@@ -266,7 +411,7 @@ function graphRaportRender(props, wrapNode) {
 					}) // _edges.add(edge)
 					linkIdsAdded.push(edge.id)
 				// } catch (e) {
-				// 	if(DBG)console.log('_graphData.edges.add [level='+levelIdx+'] error:', e);
+				// 	DBG && console.log('_graphData.edges.add [level='+levelIdx+'] error:', e);
 				// }
 			})
 		}
@@ -274,7 +419,7 @@ function graphRaportRender(props, wrapNode) {
 
 	var totalLinks = _links.length
 	// console.log('DBG:0: _links', _links)
-	// console.log('DBG:1: _nodes', _nodes)
+	DBG && console.log('DBG:1: _nodes', _nodes)
 	_nodes = _nodes.filter(function (node, idx) {
 		if (node.typeName !== props.typeName) return true
 		for (var i=0; i<totalLinks; i++) {
@@ -306,14 +451,21 @@ function graphRaportRender(props, wrapNode) {
 	}
 
 
-	var graphData = { nodes: _nodes, links: _links };
+	var graphData = {
+		nodes: _nodes,
+		links: _links.filter(function (link) {
+			DBG && console.log('DBG loop link', { link, source: link.source, target: link.target, filtered: (link.source && link.target) });
+			return (link.source && link.target);
+		})
+	};
 
+	DBG && console.warn('render graphData', graphData);
 	var graf = renderGraph(svgNode, graphData, {
 		width: jQuery(wrapNode).width(),
 		height: (rightSideNodes.length > 20) ? rightSideNodes.length * 22 : 500
 	})
 	graf.on('click', (event) => {
-	  if(DBG)console.log('event', event)
+	  DBG && console.log('event', event)
 	  // event = {
 	  //   nativeEvent: d3.event,
 	  //   node: a,
@@ -327,7 +479,7 @@ function graphRaportRender(props, wrapNode) {
 function parseResponseRec(_todoGraphData, json, typeName, parentNodeId, level) {
 	var level = level || 0
 	var parentNodeId = parentNodeId || null
-	if(DBG)console.log('DBG::parseResponseRec', {json:json, typeName:typeName, parentNodeId:parentNodeId, isString: p5Utils__isString(json), isArray: p5Utils__isArray(json), isObject: p5Utils__isObject(json)});
+	DBG && console.log('DBG::parseResponseRec', {json:json, typeName:typeName, parentNodeId:parentNodeId, isString: p5Utils__isString(json), isArray: p5Utils__isArray(json), isObject: p5Utils__isObject(json)});
 	if (p5Utils__isArray(json)) {
 		// TODO: create named group
 		var isXlinkList = (json.length > 0 && p5Utils__isString(json[0]))
@@ -339,7 +491,7 @@ function parseResponseRec(_todoGraphData, json, typeName, parentNodeId, level) {
 			}
 		})
 	} else if (p5Utils__isObject(json) && isP5LinkObject(json)) {
-		if(DBG)console.log('DBG::parseResponseRec isP5LinkObject');
+		DBG && console.log('DBG::parseResponseRec isP5LinkObject');
 		parseResponseP5Link(_todoGraphData, json, typeName, parentNodeId, level)
 	} else if (p5Utils__isObject(json)) {
 		// _todoGraphData.nodes.add({ id: nodeId, label: nodeId })
@@ -365,6 +517,7 @@ function parseResponseRec(_todoGraphData, json, typeName, parentNodeId, level) {
 			})
 		}
 		else {
+			DBG && console.warn('DBG::parseResponseRec: obj node.push', { id: nodeObject.id, parentNodeId, typeName, nodeObject });
 			_todoGraphData[level].nodes.push(nodeObject)
 			if (parentNodeId) {
 				_todoGraphData[level].edges.push(dataMakeEdge(parentNodeId, nodeObject))
@@ -378,14 +531,16 @@ function parseResponseRec(_todoGraphData, json, typeName, parentNodeId, level) {
 			})
 		}
 	} else if (p5Utils__isString(json)) {
-		if(DBG)console.log('TODO: Not implemented - parseResponseRec isString');
+		DBG && console.log('TODO: Not implemented - parseResponseRec isString');
 	} else {
-		if(DBG)console.log('TODO: Not implemented - parseResponseRec is not string, not array and not object');
+		DBG && console.log('TODO: Not implemented - parseResponseRec is not string, not array and not object');
 	}
 }
 function parseResponseXlinkListRec(_todoGraphData, json, typeName, parentNodeId, level) {
-	if(DBG)console.log('DBG::parseResponseRec:XlinkList', {json:json, typeName:typeName, parentNodeId:parentNodeId, isString: p5Utils__isString(json), isArray: p5Utils__isArray(json), isObject: p5Utils__isObject(json)});
+	DBG && console.log('DBG::parseResponseRec:XlinkList', {json:json, typeName:typeName, parentNodeId:parentNodeId, isString: p5Utils__isString(json), isArray: p5Utils__isArray(json), isObject: p5Utils__isObject(json)});
 	if (p5Utils__isString(json)) { // xlink "https://biuro.biall-net.pl/wfs/default_db/BI_audit_ENERGA_RUM_KONTRAHENCI#BI_audit_ENERGA_RUM_KONTRAHENCI.9233",
+		if ("default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row_object" === typeName) return;
+		if ("default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row:BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA_row" === typeName) return;
 		var nodeId = json.substr(json.indexOf('#') + 1)
 		{
 			// _graphData.nodes.add({ id: nodeId, label: nodeId })
@@ -394,6 +549,7 @@ function parseResponseXlinkListRec(_todoGraphData, json, typeName, parentNodeId,
 				xlink: json,
 				typeName: typeName,
 			})
+			DBG && console.warn('DBG::parseResponseRec: xlink node.push', { id: nodeObject.id, parentNodeId, typeName, nodeObject });
 			_todoGraphData[level].nodes.push(nodeObject)
 			if (parentNodeId) {
 				_todoGraphData[level].edges.push(dataMakeEdge(parentNodeId, nodeObject))
@@ -401,12 +557,15 @@ function parseResponseXlinkListRec(_todoGraphData, json, typeName, parentNodeId,
 		}
 	} else if (p5Utils__isObject(json) && isP5LinkObject(json)) {
 		parseResponseP5Link(_todoGraphData, json, typeName, parentNodeId, level)
+	} else if (p5Utils__isObject(json)) {
+		DBG && console.warn('TODO: Not implemented - parseResponseRec:XlinkList is object', {json:json, typeName:typeName, parentNodeId:parentNodeId, isString: p5Utils__isString(json), isArray: p5Utils__isArray(json), isObject: p5Utils__isObject(json)});
+		parseResponseRec(_todoGraphData, json, typeName, parentNodeId, level + 1)
 	} else {
-		if(DBG)console.log('TODO: Not implemented - parseResponseRec:XlinkList is not string and not object');
+		DBG && console.warn('TODO: Not implemented - parseResponseRec:XlinkList is not string and not object');
 	}
 }
 function parseResponseP5Link(_todoGraphData, json, typeName, parentNodeId, level) {
-	if(DBG)console.log('parseResponseRec isObject and P5Link - fetch more xlink object');
+	DBG && console.log('parseResponseRec isObject and P5Link - fetch more xlink object');
 	// example json: { type: "next",
 	//  @backRefNS: "default_db/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA/BI_audit_ENERGA_RUM_KONTRAHENCI_POWIAZANIA",
 	//  @backRefPK: "42",
@@ -430,7 +589,7 @@ function parseResponseP5Link(_todoGraphData, json, typeName, parentNodeId, level
 				// _todoGraphData[level].edges.push(dataMakeFetchMoreEdge(parentNodeId, nodeObject))
 			} break;
 			default: {
-				if(DBG)console.log('TODO: Not implemented - parseResponseRec isObject with type "'+json.type+'" - fetch more xlink object');
+				DBG && console.log('TODO: Not implemented - parseResponseRec isObject with type "'+json.type+'" - fetch more xlink object');
 			}
 		}
 	}
@@ -497,11 +656,11 @@ function parseGraphRec(items, featureType, parentFeatureId) { // TODO: not used
 	if (!items) return;
 	items.forEach(function (item) {
 		if ('string' === typeof item) {
-			if(DBG)console.log('TODO: xlink "'+item+'": ', {item:item, parentFeatureId:parentFeatureId})
+			DBG && console.log('TODO: xlink "'+item+'": ', {item:item, parentFeatureId:parentFeatureId})
 			return;
 		}
 		if (!item['ID']) {
-			if(DBG)console.log('TODO: SKIP item('+featureType+') - missing ID: ', {item:item, parentFeatureId:parentFeatureId})
+			DBG && console.log('TODO: SKIP item('+featureType+') - missing ID: ', {item:item, parentFeatureId:parentFeatureId})
 			return;
 		}
 		var id = item['ID']
@@ -590,7 +749,7 @@ function dataMakeFetchMoreNode(params) {
 	// 	objectName: objectName,
 	// 	ref: json,
 	// }
-	if(DBG)console.log('DBG dataMakeFetchMoreNode(params)', params)
+	DBG && console.log('DBG dataMakeFetchMoreNode(params)', params)
 	var nodeId = params.parentNodeId+'fetch-more-features-'+params.type+'-on-' + params.objectName;
 	return {
 		id: nodeId,
@@ -607,7 +766,7 @@ function dataMakeFetchMoreNode(params) {
 function dataMakeFetchMoreEdge(parentNodeId, fetchMoreNode) {
 	// @param parentNodeId - from node id
 	// @param fetchMoreNode - from dataMakeFetchMoreNode
-	if(DBG)console.log('DBG dataMakeFetchMoreEdge(parentNodeId, fetchMoreNode)', {parentNodeId:parentNodeId, fetchMoreNode:fetchMoreNode})
+	DBG && console.log('DBG dataMakeFetchMoreEdge(parentNodeId, fetchMoreNode)', {parentNodeId:parentNodeId, fetchMoreNode:fetchMoreNode})
 	return {
 		id: fetchMoreNode.id,
 		from: parentNodeId,
@@ -675,4 +834,10 @@ module.exports = {
 	graphShowHide: graphShowHide,
 	graphRender: graphRender,
 	graphRaportRender: graphRaportRender,
+	/** @example: graphRaportRender({
+	 *		msg: "Pobrano dane",
+	 *		typeName: ('pracownicy' === nameSection) ? 'default_db__x3A__BI_audit_ENERGA_PRACOWNICY:BI_audit_ENERGA_PRACOWNICY' : 'default_db__x3A__BI_audit_ENERGA_RUM_KONTRAHENCI:BI_audit_ENERGA_RUM_KONTRAHENCI',
+	 *		items: items
+	 *	}, graphResultNode)
+	 */
 }