diff --git a/framework/docs b/framework/docs index 49a7758..4365799 160000 --- a/framework/docs +++ b/framework/docs @@ -1 +1 @@ -Subproject commit 49a7758a95a6616707f3f74eaa5dafde36a97e1e +Subproject commit 436579920cdb64826b975be65c90dd08fb664e43 diff --git a/framework/public/devUI/assets/js/uc_balancehelper.js b/framework/public/devUI/assets/js/uc_balancehelper.js index 7eff3d4..8ae95c7 100644 --- a/framework/public/devUI/assets/js/uc_balancehelper.js +++ b/framework/public/devUI/assets/js/uc_balancehelper.js @@ -14,22 +14,102 @@ $(document).ready(function() { } }); $.getJSON("/api/balancing/peers?assetId="+assetId,function(data) { + window.peersFrom = {}; + window.peersTo = {}; + let einspeiser_html = ''; $('#einspeiser').html(einspeiser_html); $('#bezieher').html(bezieher_html); + $('.removeAsset').off(); + $('.removeAsset').click(function() { + let balancerule = {}; + + balancerule["from"] = "eaf_generic_balancegroup"; + + $.ajax({ + type: 'POST', + url: '/api/asset/upsert', + data: JSON.stringify({ + assetId: $(this).attr('date-assetId'), + type: 'balance', //realy? maybe we could split here + balancerule: balancerule + }), + contentType: 'application/json', + success: function(response) { + renderPeers(window.assetId); + } + }); + }); }); } + const addBalanceRule = function (assetId,rule) { + let balancerule = {}; + + balancerule[rule] = window.assetId; + console.log(balancerule); + $.ajax({ + type: 'POST', + url: '/api/asset/upsert', + data: JSON.stringify({ + assetId: assetId, + type: 'balance', //realy? maybe we could split here + balancerule: balancerule + }), + contentType: 'application/json', + success: function(response) { + renderPeers(window.assetId); + } + }); + } + + $('#searchForm').submit(function(e) { + e.preventDefault(); + $.getJSON("/api/metering/assets?q="+$('#addSearch').val(), function(data) { + let html = ''; + html += '
'; + html += '

Einspeiser

'; + html += '

Bezieher

'; + html += '
'; + + for(let i=0;i'; + html += '
'; + let state = ""; + if(typeof window.peersFrom[data[i].meterId] !== 'undefined') { + state = " disabled='disabled' "; + } + html += '
'; + state = ""; + if(typeof window.peersTo[data[i].meterId] !== 'undefined') { + state = " disabled='disabled' "; + } + html += '
'; + html += '
'; + } + $('#addSearchResult').html(html); + $('.btnAddEinspeiser').off(); + $('.btnAddEinspeiser').click(function() { + addBalanceRule($(this).attr('data-assetId'),'to'); + }); + $('.btnAddBezieher').off(); + $('.btnAddBezieher').click(function() { + addBalanceRule($(this).attr('data-assetId'),'from'); + }); + }); + }); if($.urlParam('assetId')) { window.assetId = $.urlParam('assetId'); renderPeers(window.assetId); diff --git a/framework/public/devUI/assets/js/uc_balancing.js b/framework/public/devUI/assets/js/uc_balancing.js index af8c1f3..f4647eb 100644 --- a/framework/public/devUI/assets/js/uc_balancing.js +++ b/framework/public/devUI/assets/js/uc_balancing.js @@ -303,4 +303,7 @@ $(document).ready(function() { // console.log(balancerule); }); + $('#balancingHelper').click(function(e) { + location.href="./uc_balancehelper.html?assetId="+window.assetId; + }) }); \ No newline at end of file diff --git a/framework/public/devUI/uc_balancehelper.html b/framework/public/devUI/uc_balancehelper.html index d8cb0c3..03dcf3a 100644 --- a/framework/public/devUI/uc_balancehelper.html +++ b/framework/public/devUI/uc_balancehelper.html @@ -45,6 +45,15 @@

Bezieher

+
+
+

Hinzufügen

+
+
Messstelle
+
+
+
+
@@ -122,7 +131,7 @@
@@ -119,7 +120,7 @@