Redesign 1 bcrypt #226
3 changed files with 32 additions and 15 deletions
|
@ -270,7 +270,7 @@ db['getAllChannelClaims'] = (channelId) => {
|
|||
return new Promise((resolve, reject) => {
|
||||
logger.debug(`finding all claims in channel "${channelId}"`);
|
||||
db
|
||||
.sequelize.query(`SELECT name, claimId, outpoint, height, address, contentType, title, description, license, thumbnail FROM Claim WHERE certificateId = '${channelId}' ORDeR BY height DESC;`, { type: db.sequelize.QueryTypes.SELECT })
|
||||
.sequelize.query(`SELECT name, claimId, outpoint, height, address, contentType, title, description, license, thumbnail FROM Claim WHERE certificateId = '${channelId}' ORDER BY height DESC;`, { type: db.sequelize.QueryTypes.SELECT })
|
||||
.then(result => {
|
||||
switch (result.length) {
|
||||
case 0:
|
||||
|
|
|
@ -43,8 +43,14 @@ function getPage (query) {
|
|||
|
||||
function extractPageFromClaims (claims, pageNumber) {
|
||||
logger.debug('claims is array?', Array.isArray(claims));
|
||||
logger.debug('pageNumber is number?', Number.isInteger(pageNumber));
|
||||
return claims.slice(pageNumber * 10, pageNumber + 10);
|
||||
logger.debug(`pageNumber ${pageNumber} is number?`, Number.isInteger(pageNumber));
|
||||
const claimStartIndex = pageNumber * CLAIMS_PER_PAGE;
|
||||
console.log('claim start index:', claimStartIndex);
|
||||
const claimEndIndex = claimStartIndex + 10;
|
||||
console.log('claim end index:', claimEndIndex);
|
||||
const pageOfClaims = claims.slice(claimStartIndex, claimEndIndex);
|
||||
logger.debug('page of claims:', pageOfClaims);
|
||||
return pageOfClaims;
|
||||
}
|
||||
|
||||
function determineTotalPages (totalClaims) {
|
||||
|
@ -183,7 +189,7 @@ module.exports = (app) => {
|
|||
previousPage : determinePreviousPage(paginationPage),
|
||||
currentPage : paginationPage,
|
||||
nextPage : determineNextPage(totalPages, paginationPage),
|
||||
totalPages,
|
||||
totalPages : totalPages,
|
||||
totalResults : result.claims.length,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,13 +1,24 @@
|
|||
<div class="row row--full-height">
|
||||
<h2>{{this.channelName}}<span class="h2--secondary">:{{this.longChannelId}}</span></h2>
|
||||
<p>Page: {{this.currentPage}}/{{this.totalPages}}, Total Files: {{this.totalResults}}</p>
|
||||
<p>
|
||||
<a href="/{{this.channelName}}:{{this.longChannelId}}?p=0">First Page</a> |
|
||||
<a href="/{{this.channelName}}:{{this.longChannelId}}?p={{this.previousPage}}">Last Page</a> |
|
||||
<a href="/{{this.channelName}}:{{this.longChannelId}}?p={{this.nextPage}}">Next Page</a> |
|
||||
<a href="/{{this.channelName}}:{{this.longChannelId}}?p={{this.totalPages}}">Last Page</a>
|
||||
</p>
|
||||
{{#each this.claims}}
|
||||
{{> contentListItem}}
|
||||
{{/each}}
|
||||
<div class="column column--10 align-content-center">
|
||||
<h2>{{this.channelName}}<span class="h2--secondary">:{{this.longChannelId}}</span></h2>
|
||||
</div>
|
||||
<div class="column column--10 align-content-center">
|
||||
<p>Total Pages: {{this.totalPages}}, Total Files: {{this.totalResults}}</p>
|
||||
</div>
|
||||
<div class="row">
|
||||
{{#each this.claims}}
|
||||
{{> contentListItem}}
|
||||
{{/each}}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="column column--3 align-content--left">
|
||||
<a href="/{{this.channelName}}:{{this.longChannelId}}?p=0">First Page [0]</a>
|
||||
</div><div class="column column--4 align-content-center">
|
||||
<a href="/{{this.channelName}}:{{this.longChannelId}}?p={{this.previousPage}}">Previous Page [{{this.previousPage}}]</a> |
|
||||
<a href="/{{this.channelName}}:{{this.longChannelId}}?p={{this.nextPage}}">Next Page [{{this.nextPage}}]</a>
|
||||
</div><div class="column column--3 align-content-right">
|
||||
<a href="/{{this.channelName}}:{{this.longChannelId}}?p={{this.totalPages}}">Last Page [{{this.totalPages}}]</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue