diff --git a/samples/irs-demo/src/main/resources/irsweb/js/controllers/Home.js b/samples/irs-demo/src/main/resources/irsweb/js/controllers/Home.js index 6a99583728..d4c26de109 100644 --- a/samples/irs-demo/src/main/resources/irsweb/js/controllers/Home.js +++ b/samples/irs-demo/src/main/resources/irsweb/js/controllers/Home.js @@ -16,8 +16,19 @@ define(['angular', 'utils/semantic', 'services/NodeApi'], (angular, semantic, no $scope.date = newDate }, handleHttpFail); }; + /* Extract the common name from an X500 name */ + $scope.renderX500Name = (x500Name) => { + var name = x500Name + x500Name.split(',').forEach(function(element) { + var keyValue = element.split('='); + if (keyValue[0].toUpperCase() == 'CN') { + name = keyValue[1]; + } + }); + return name; + }; nodeService.getDate().then((date) => $scope.date = date); nodeService.getDeals().then((deals) => $scope.deals = deals); }); -}); \ No newline at end of file +}); diff --git a/samples/irs-demo/src/main/resources/irsweb/view/home.html b/samples/irs-demo/src/main/resources/irsweb/view/home.html index b543a35c4e..7ab4d05107 100644 --- a/samples/irs-demo/src/main/resources/irsweb/view/home.html +++ b/samples/irs-demo/src/main/resources/irsweb/view/home.html @@ -46,9 +46,9 @@ {{deal.ref}} - {{deal.fixedLeg.fixedRatePayer}} + {{renderX500Name(deal.fixedLeg.fixedRatePayer)}} {{deal.fixedLeg.notional.quantity | number}} {{deal.fixedLeg.notional.token}} - {{deal.floatingLeg.floatingRatePayer}} + {{renderX500Name(deal.floatingLeg.floatingRatePayer)}} {{deal.floatingLeg.notional.quantity | number}} {{deal.floatingLeg.notional.token}} diff --git a/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/app.component.js b/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/app.component.js index 9aaee0cd55..53138a1896 100644 --- a/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/app.component.js +++ b/samples/simm-valuation-demo/src/main/resources/simmvaluationweb/app/app.component.js @@ -24,11 +24,26 @@ var AppComponent = (function () { AppComponent.prototype.refreshValue = function (value) { this.counterparty = this.httpWrapperService.setCounterparty(value.id); }; + AppComponent.prototype.renderX500Name = function (x500Name) { + var name = x500Name + x500Name.split(',').forEach(function(element) { + var keyValue = element.split('='); + if (keyValue[0].toUpperCase() == 'CN') { + name = keyValue[1]; + } + }); + return name; + }; AppComponent.prototype.ngOnInit = function () { var _this = this; this.httpWrapperService.getAbsolute("whoami").toPromise().then(function (data) { - _this.whoAmI = data.self.text; - _this.counterParties = data.counterparties; + _this.whoAmI = _this.renderX500Name(data.self.text); + _this.counterParties = data.counterparties.map(function(x) { + return { + id: x.id, + text: _this.renderX500Name(x.text) + }; + }); if (_this.counterParties.length == 0) { console.log("/whoami is returning no counterparties, the whole app won't run", data); }