Skip to content

Commit

Permalink
#23 Replace account operations by operations-table
Browse files Browse the repository at this point in the history
  • Loading branch information
ihorml committed Nov 9, 2022
1 parent 57496e6 commit f093d98
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 92 deletions.
38 changes: 9 additions & 29 deletions app/sections/accounts/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@
<div class="panel-heading clearfix">
<h3 class="panel-title pull-left">
<span data-translate="Full account history"></span>
<img src="images/filter.svg" ng-click="showFilters = !showFilters" class="operations-filter"/>
</h3>
<div class="pull-right">
<div class="input-group">
Expand All @@ -526,34 +527,13 @@ <h3 class="panel-title pull-left">
</div>
</div>
</div>
<div class="panel-body table-responsive">

<responsive-table data-data="operations"
data-columns="operationsColumns"
data-loading="operationsLoading"
data-template="account-operations-table.html"
data-loading-error="operationsLoadingError"
></responsive-table>

<footer class="table-footer">
<div class="row">
<div class="col-md-6 page-num-info">
</div>
<div class="col-md-6 text-right pagination-container">
<ul
uib-pagination class="pagination-sm"
ng-model="currentPage"
total-items="account.total_ops"
max-size="4"
ng-change="currentPage===undefined || select(currentPage)"
items-per-page="20"
rotate="false"
previous-text="&lsaquo;" next-text="&rsaquo;"
boundary-links="true"
></ul>
</div>
</div>
</footer>
</div>

<loading ng-if="!account.name"></loading>
<operations-table ng-if="!!account.name"
show-filters="showFilters"
group-by-account-id="account.id"
date-from="now-1y"
filter-by-account-id-enabled="false"
/>
</div>
</div>
63 changes: 0 additions & 63 deletions app/sections/accounts/accounts.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,69 +77,6 @@ import {sha256} from "js-sha256";
$scope.account = new_account;
}

$scope.operationsColumns = [
{
title: $filter('translate')('Operation'),
index: 'operation_text',
},
{
title: $filter('translate')('ID'),
index: 'operation_id',
},
{
title: $filter('translate')('Date and time'),
index: 'time',
hidden: ['xs']
},
{
title: $filter('translate')('Block'),
index: 'block_num',
hidden: ['xs', 'sm']
},
{
title: $filter('translate')('Type'),
index: 'type',
hidden: ['xs', 'sm', 'md']
}
];
$scope.select = function(page_operations) {
const page = page_operations - 1;
const limit = 20;
const from = page * limit;

$scope.operationsLoading = true;
$scope.operationsLoadingError = false;
accountService.getAccountHistory(fullAccount.account.id, limit, from, function (returnData) {
$scope.operationsLoading = false;
$scope.operations = returnData;
$scope.currentPage = page_operations;
if (page_operations == 1) {
let new_account = {
total_ops: 0
};
if (returnData.length > 0) {
new_account.total_ops = returnData[0].sequence;
}
if ($scope.account) {
$scope.account = Object.assign(new_account, $scope.account);
} else {
$scope.account = new_account;
}
}
}).catch(err => {
$scope.operationsLoadingError = true;
let new_account = {
total_ops: -1,
};
if ($scope.account) {
$scope.account = Object.assign(new_account, $scope.account);
} else {
$scope.account = new_account;
}
throw err;
});
}
$scope.select(1);
// initial sort of fullAccount.balances by balance
fullAccount.balances = $filter("orderBy")(fullAccount.balances, 'float_balance', true);

Expand Down

0 comments on commit f093d98

Please sign in to comment.