Skip to content

Commit

Permalink
fix transaction part of generator (hyperledger-archives#4383)
Browse files Browse the repository at this point in the history
Fix the angular generator to support transaction
invocation and also remove the rubbish that was
cut and paste from asset or participant page
which was completely irrelevant

Signed-off-by: Dave Kelsey <[email protected]>
  • Loading branch information
Dave Kelsey authored Sep 17, 2018
1 parent 9bdfe4c commit 13108a6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ module.exports = [{
target,
secure: true,
changeOrigin: true,
ws: true,
ws: false,
bypass: function (req, res, proxyOptions) {
const accept = req.headers.accept || '';
if (accept.indexOf('html') !== -1) {
return '/index.html';
}
}
}];
}];
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="addTransactionModalLabel">Create Transaction</h4>
<p class="modal-intro">Enter the required values below.</p>
<p class="modal-intro">Enter the required values below.</p>
</div>
<form [formGroup]="myForm">
<div class="modal-body">


<% for(var x=0;x<currentTransaction.properties.length;x++){ %>
<% for(var x = 0;x < currentTransaction.properties.length;x++){ %>

<% if(currentTransaction.properties[x].enum === true){ %>
<label for="<%=currentTransaction.properties[x].name%>"><%=currentTransaction.properties[x].name%></label>
Expand All @@ -45,7 +45,7 @@ <h4 class="modal-title" id="addTransactionModalLabel">Create Transaction</h4>
</label>
<%}%>
</div>
<%}else{%>
<%}else if (currentTransaction.properties[x].name != 'timestamp' && currentTransaction.properties[x].name != 'transactionId'){%>
<div class="form-group text-left">
<label for="<%=currentTransaction.properties[x].name%>"><%=currentTransaction.properties[x].name%></label>
<% if(currentTransaction.properties[x].type == 'Boolean'){ %>
Expand All @@ -66,124 +66,21 @@ <h4 class="modal-title" id="addTransactionModalLabel">Create Transaction</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button (click)="addTransaction(myForm);" type="submit" class="btn btn-success" data-dismiss="modal">Confirm</button>

</div>
</form>
</div>
</div>
</div>




<div class="modal fade" id="updateTransactionModal" tabindex="-1" role="dialog" aria-labelledby="updateTransactionModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="updateTransactionModalLabel">Update Transaction</h4>
</div>
<form [formGroup]="myForm">
<div class="modal-body">


<% for(var x=0;x<currentTransaction.properties.length;x++){ %>
<div class="form-group text-left">
<label for="<%=currentTransaction.properties[x].name%>"><%=currentTransaction.properties[x].name%></label>

<% if(currentTransaction.properties[x].type == 'Boolean'){ %>
<input [ngModel]="<%=currentTransaction.properties[x].name%>" formControlName="<%=currentTransaction.properties[x].name%>" type="checkbox" class="form-control">
<%}else if(currentTransaction.properties[x].type == 'Double'){%>
<input [ngModel]="<%=currentTransaction.properties[x].name%>" formControlName="<%=currentTransaction.properties[x].name%>" type="number" step='any' class="form-control">
<%}else if(currentTransaction.properties[x].type == 'Integer' || currentTransaction.properties[x].type == 'Long'){%>
<input [ngModel]="<%=currentTransaction.properties[x].name%>" formControlName="<%=currentTransaction.properties[x].name%>" type="number" class="form-control">
<%}else if(currentTransaction.properties[x].type == 'String' || currentTransaction.properties[x].type == 'DateTime'){%>%>
<input [ngModel]="<%=currentTransaction.properties[x].name%>"formControlName="<%=currentTransaction.properties[x].name%>" type="text" class="form-control">
<%}else{%>
<% if(currentTransaction.properties[x].enum === true){ %>
<div class="row">
<div class="col-xs-12 checkbox">
<% for(var y=0;y<currentTransaction.properties[x].enumValues.length;y++){ %>
<label>
<input
<% if(currentTransaction.properties[x].array === false){ %>
formControlName="<%=currentTransaction.properties[x].name%>"
[ngModel]="<%=currentTransaction.properties[x].name%>"
<% } %>
name="<%=currentTransaction.properties[x].name%>"
value="<%=currentTransaction.properties[x].enumValues[y].name%>"
type="<%=currentTransaction.properties[x].array ? 'checkbox' : 'radio'%>"
<% if(currentTransaction.properties[x].array){ %>
(change)="changeArrayValue('<%=currentTransaction.properties[x].name%>', '<%=currentTransaction.properties[x].enumValues[y].name%>')"
[checked]="hasArrayValue('<%=currentTransaction.properties[x].name%>', '<%=currentTransaction.properties[x].enumValues[y].name%>')"
<% } %>
/>
<%=currentTransaction.properties[x].enumValues[y].name%>
</label>
<%}%>
</div>
</div>
<%}else{%>
<textarea [ngModel]="<%=currentTransaction.properties[x].name%>" formControlName="<%=currentTransaction.properties[x].name%>" class="form-control" rows="3"></textarea>
<%}%>
<%}%>

</div>
<%}%>


</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button (click)="updateTransaction(myForm)" type="submit" class="btn btn-success" data-dismiss="modal">Submit</button>
<button (click)="addTransaction(myForm);" type="submit" class="btn btn-success" data-dismiss="modal">Confirm</button>
</div>
</form>
</div>
</div>
</div>



<div class="modal fade" id="deleteTransactionModal" tabindex="-1" role="dialog" aria-labelledby="deleteTransactionModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="deleteTransactionModalLabel">Delete Transaction</h4>
</div>
<form [formGroup]="myForm" (ngSubmit)="deleteTransaction()">
<div class="modal-body">
Are you sure you want to delete this Transaction?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
<button (click)="deleteTransaction()" type="submit" class="btn btn-danger" data-dismiss="modal">Yes</button>
</div>
</form>
</div>
</div>
</div>











<div class="container col-md-6">
<div *ngIf="errorMessage" class="alert alert-danger" role="alert">
<strong>Error:</strong> {{errorMessage}}
</div>

<div class="row">
<div class="col-md-12">
<h1 class="transaction-title" id='transactionName'><%= currentTransaction.name %></h1>
<p class="invoke_cancel" id='invoke_cancel'>Invoke</p>
</div>
</div>
<br>
Expand All @@ -194,17 +91,16 @@ <h1 class="transaction-title" id='transactionName'><%= currentTransaction.name %
When invoked, this transaction will have the following attributes:
<br>
<ul>
<% for(var y=0;y<currentTransaction.properties.length;y++){ %>

<% if (!(currentTransaction.properties[y].name.toString() === 'transactionId') || !(currentTransaction.properties[y].name.toString() === 'timestamp')) { %>
<% for(var y = 0;y < currentTransaction.properties.length;y++){ %>
<% if (!(currentTransaction.properties[y].name.toString() === 'transactionId') && !(currentTransaction.properties[y].name.toString() === 'timestamp')) { %>
<li><span class="attribute"><b><%=currentTransaction.properties[y].name%></b></span></li>
<%}%>
<%}%>
</ul>
</div>
</div>
<button type="button" class="btn btn-primary invokeTransactionBtn" data-toggle="modal">Invoke</button>
<button (click)="resetForm();" type="button" class="btn btn-primary" data-toggle="modal" data-target="#addTransactionModal">Invoke</button>
</div>
</div>
</div>

Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ import {Event} from './org.hyperledger.composer.system';
context: '/',
secure: true,
target: 'https://dogescoolrestserver.dogecorp.com:3000',
ws: true
ws: false
}
], 'proxy configuration is wrong');
});
Expand All @@ -386,7 +386,7 @@ import {Event} from './org.hyperledger.composer.system';
context: '/',
secure: true,
target: 'https://doges-other-rest-server.dogecorp.com:9999',
ws: true
ws: false
}
], 'proxy configuration is wrong');
});
Expand Down Expand Up @@ -415,7 +415,7 @@ import {Event} from './org.hyperledger.composer.system';
context: '/',
secure: true,
target: 'https://doges-other-rest-server.dogecorp.com:9999',
ws: true
ws: false
}
], 'proxy configuration is wrong');
});
Expand Down Expand Up @@ -444,7 +444,7 @@ import {Event} from './org.hyperledger.composer.system';
context: '/',
secure: true,
target: 'https://dogescoolrestserver.dogecorp.com:3000',
ws: true
ws: false
}
], 'proxy configuration is wrong');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ describe('hyperledger-composer:angular for digitalPropertyNetwork running agains
context : '/',
secure : true,
target : 'http://localhost:3000',
ws : true
ws : false
}
], 'proxy configuration is wrong');
});
Expand All @@ -299,7 +299,7 @@ describe('hyperledger-composer:angular for digitalPropertyNetwork running agains
context : '/',
secure : true,
target : 'https://doges-other-rest-server.dogecorp.com:9999',
ws : true
ws : false
}
], 'proxy configuration is wrong');
});
Expand Down Expand Up @@ -328,7 +328,7 @@ describe('hyperledger-composer:angular for digitalPropertyNetwork running agains
context : '/',
secure : true,
target : 'https://doges-other-rest-server.dogecorp.com:9999',
ws : true
ws : false
}
], 'proxy configuration is wrong');
});
Expand Down Expand Up @@ -357,7 +357,7 @@ describe('hyperledger-composer:angular for digitalPropertyNetwork running agains
context : '/',
secure : true,
target : 'http://localhost:3000',
ws : true
ws : false
}
], 'proxy configuration is wrong');
});
Expand Down

0 comments on commit 13108a6

Please sign in to comment.