From 59094c9dd936a0c8e9f2778038db0461e4475521 Mon Sep 17 00:00:00 2001 From: Carles Tubio Date: Tue, 15 Oct 2024 18:41:39 +0000 Subject: [PATCH] Updated orders grid without rererendering rows. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ████ ███ To request new features or in case this commit breaks something for you, ████ ███ please, create a new github issue with all possible information for me, ▓███▀█▄ but never share your API Keys! ▒▓██ ███ ░▒▓█ ███ Signed-off-by: Carles Tubio _________________________________________ / Hello, WORLD! \ | | \ pssst.. 1.00000000 BTC = 61581.69 EUR. / ----------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || --- Makefile | 2 +- README.md | 2 +- .../+portfolios/+portfolios.client/Orders.ts | 20 ++++++++++++++----- src/lib/Krypto.ninja-apis.h | 2 +- src/lib/Krypto.ninja-client/Makefile | 4 ++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 15c09e8f6..16a5369a9 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ K ?= K.sh MAJOR = 0 MINOR = 7 PATCH = 0 -BUILD = 34 +BUILD = 35 OBLIGATORY = DISCLAIMER: This is strict non-violent software: \n$\ if you hurt other living creatures, please stop; \n$\ diff --git a/README.md b/README.md index 013255ed7..b5a0d6415 100644 --- a/README.md +++ b/README.md @@ -485,7 +485,7 @@ Pull Requests are welcome, but adhere to the Contributor License Agreement: We have already enough policemen,
if you like adventures choose to be a brave firefighter.




-



Violence should not be the answer to those who
are asking for freedom.




+



Violence should not be the answer to those who
are asking for freedom.









diff --git a/src/bin/+portfolios/+portfolios.client/Orders.ts b/src/bin/+portfolios/+portfolios.client/Orders.ts index 19e7f1444..f72371272 100644 --- a/src/bin/+portfolios/+portfolios.client/Orders.ts +++ b/src/bin/+portfolios/+portfolios.client/Orders.ts @@ -67,6 +67,7 @@ export class OrdersComponent { rowHeight:35, headerHeight:35, domLayout: 'autoHeight', + getRowId: (params: any) => params.data.exchangeId, isExternalFilterPresent: () => !!this.filter, doesExternalFilterPass: (node) => ( !this.filter || node.data.symbol == this.filter @@ -193,11 +194,20 @@ export class OrdersComponent { private addRowData = (o: Models.Order[]) => { if (!this.api) return; - var add = []; this.symbols.forEach(s => s.bids = s.asks = 0); + var add: any[] = [], + update: any[] = [], + remove: any[] = []; + + this.api.forEachNode((rowNode, index) => { + remove.push({exchangeId: rowNode.data.exchangeId}); + }); + o.forEach(o => { - add.push({ + (remove.filter(x => x.exchangeId == o.exchangeId).length + ? update : add + ).push({ symbol: o.symbol, orderId: o.orderId, exchangeId: o.exchangeId, @@ -212,12 +222,12 @@ export class OrdersComponent { time: o.time }); + remove = remove.filter(x => x.exchangeId != o.exchangeId); + this.addSymbol(o.symbol, o.side); }); - this.api.setGridOption('rowData', []); - - if (add.length) this.api.applyTransaction({add: add}); + this.api.applyTransaction({add, update, remove}); if (!this.filter && this.symbols.length) { this.applyFilter(this.symbols[0].symbol) diff --git a/src/lib/Krypto.ninja-apis.h b/src/lib/Krypto.ninja-apis.h index c4c0d6bcd..7a07dc57a 100644 --- a/src/lib/Krypto.ninja-apis.h +++ b/src/lib/Krypto.ninja-apis.h @@ -899,7 +899,7 @@ class GwApiWsFix: public GwApiWs, }; protected: //BO non-free Gw class member functions from lib build-*/lib/K-*.a (it just redefines all virtual gateway functions below). -/**/ virtual string token(const string &crud = "", const string &url = "") const = 0; // return logon message. +/**/ virtual string token(const string &crud = "", const string &url = "") const = 0; // return jwt token. //EO non-free Gw class member functions from lib build-*/lib/K-*.a (it just redefines all virtual gateway functions above). string nonce() const override { return Random::char16Id(); diff --git a/src/lib/Krypto.ninja-client/Makefile b/src/lib/Krypto.ninja-client/Makefile index cb36790bc..1ac1342bd 100644 --- a/src/lib/Krypto.ninja-client/Makefile +++ b/src/lib/Krypto.ninja-client/Makefile @@ -74,7 +74,7 @@ export define PACKAGE_JSON "@angular/platform-browser": "^18.2.7", "@angular/platform-browser-dynamic": "^18.2.7", "@angular/router": "^18.2.7", - "@types/node": "^22.7.4", + "@types/node": "^22.7.5", "ag-grid-angular": "^32.2.2", "ag-grid-community": "^32.2.2", "esbuild": "^0.24.0", @@ -82,7 +82,7 @@ export define PACKAGE_JSON "highcharts-angular": "^4.0.1", "rxjs": "^7.8.1", "sass": "^1.79.4", - "typescript": "^5.6.2", + "typescript": "^5.6.3", "uglify-js": "^3.19.3", "zone.js": "^0.14.10" },