Display party names as common name only

Display party names as common name only in IRS & SIMM samples. This doesn't change the UI where it takes in names (i.e. in IRS), as that requires significantly more infrastructure.
This commit is contained in:
Ross Nicoll 2017-06-06 16:24:51 +01:00 committed by GitHub
parent 71072eafb5
commit f1f4498ebc
3 changed files with 31 additions and 5 deletions

View File

@ -16,6 +16,17 @@ define(['angular', 'utils/semantic', 'services/NodeApi'], (angular, semantic, no
$scope.date = newDate $scope.date = newDate
}, handleHttpFail); }, 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.getDate().then((date) => $scope.date = date);
nodeService.getDeals().then((deals) => $scope.deals = deals); nodeService.getDeals().then((deals) => $scope.deals = deals);

View File

@ -46,9 +46,9 @@
<tbody> <tbody>
<tr class="center aligned" ng-repeat="deal in deals"> <tr class="center aligned" ng-repeat="deal in deals">
<td><a href="#/deal/{{deal.ref}}">{{deal.ref}}</a></td> <td><a href="#/deal/{{deal.ref}}">{{deal.ref}}</a></td>
<td class="single line">{{deal.fixedLeg.fixedRatePayer}}</td> <td class="single line">{{renderX500Name(deal.fixedLeg.fixedRatePayer)}}</td>
<td class="single line">{{deal.fixedLeg.notional.quantity | number}} {{deal.fixedLeg.notional.token}}</td> <td class="single line">{{deal.fixedLeg.notional.quantity | number}} {{deal.fixedLeg.notional.token}}</td>
<td class="single line">{{deal.floatingLeg.floatingRatePayer}}</td> <td class="single line">{{renderX500Name(deal.floatingLeg.floatingRatePayer)}}</td>
<td class="single line">{{deal.floatingLeg.notional.quantity | number}} {{deal.floatingLeg.notional.token}}</td> <td class="single line">{{deal.floatingLeg.notional.quantity | number}} {{deal.floatingLeg.notional.token}}</td>
</tr> </tr>
</tbody> </tbody>

View File

@ -24,11 +24,26 @@ var AppComponent = (function () {
AppComponent.prototype.refreshValue = function (value) { AppComponent.prototype.refreshValue = function (value) {
this.counterparty = this.httpWrapperService.setCounterparty(value.id); 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 () { AppComponent.prototype.ngOnInit = function () {
var _this = this; var _this = this;
this.httpWrapperService.getAbsolute("whoami").toPromise().then(function (data) { this.httpWrapperService.getAbsolute("whoami").toPromise().then(function (data) {
_this.whoAmI = data.self.text; _this.whoAmI = _this.renderX500Name(data.self.text);
_this.counterParties = data.counterparties; _this.counterParties = data.counterparties.map(function(x) {
return {
id: x.id,
text: _this.renderX500Name(x.text)
};
});
if (_this.counterParties.length == 0) { if (_this.counterParties.length == 0) {
console.log("/whoami is returning no counterparties, the whole app won't run", data); console.log("/whoami is returning no counterparties, the whole app won't run", data);
} }