Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakeeyturner authored Mar 15, 2017
2 parents bd1399e + 953e868 commit 2649f91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="resource-header-left">
<h1 >{{_registry.name}}</h1>
</div>
<div *ngIf="_registry.registryType!='Transaction'">
<div *ngIf="!isTransactionRegistry()">
<button type="button" class="primary" (click)="openNewResourceModal()">
<span>+ Create New {{_registry.registryType}}</span>
</button>
Expand All @@ -19,14 +19,14 @@ <h1 >{{_registry.name}}</h1>
<div class="id">{{resource.getIdentifier()}}</div>
<pre checkOverFlow [changed]="resource.getIdentifier()" (hasOverFlow)=hasOverFlow($event)
[ngClass]="{'gradient' : resource.getIdentifier() !== expandedResource && showExpand, 'tiny-gradient' : resource.getIdentifier() === expandedResource || !showExpand}" class="data">{{serialize(resource)}}</pre>
<div class="resource-icon">
<div *ngIf="!isTransactionRegistry()" class="resource-icon">
<button type="button" class="icon" (click)="editResource(resource)">
<svg class="ibm-icon" aria-hidden="true">
<use xlink:href="#icon-edit_32"></use>
</svg>
</button>
</div>
<div class="resource-icon">
<div *ngIf="!isTransactionRegistry()" class="resource-icon">
<button type="button" class="icon" (click)="openDeleteResourceModal(resource)">
<svg class="ibm-icon" aria-hidden="true">
<use xlink:href="#icon-trash_32"></use>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ export class RegistryComponent {
private resources = [];

private expandedResource = null;
private showExpand = true;
private resourceType: string = null;
private showExpand: boolean = true;
private registryType: string = null;

@Input()
set registry(registry: any) {
this._registry = registry;
if (this._registry) {
this.loadResources();
this.registryType = this._registry.registryType;
}
}

Expand All @@ -49,7 +50,7 @@ export class RegistryComponent {
loadResources() {
this._registry.getAll()
.then((resources) => {
if (this._registry instanceof TransactionRegistry){
if (this.isTransactionRegistry()) {
this.resources = resources.sort((a, b) => {
return b.timestamp - a.timestamp;
});
Expand All @@ -64,6 +65,10 @@ export class RegistryComponent {
});
}

private isTransactionRegistry(): boolean {
return this.registryType === "Transaction";
}

serialize(resource: any): string {
let serializer = this.clientService.getBusinessNetwork().getSerializer();
return JSON.stringify(serializer.toJSON(resource), null, 2);
Expand Down

0 comments on commit 2649f91

Please sign in to comment.