Added last scrape date to stats page.

This commit is contained in:
DebaucheryLibrarian 2021-02-10 04:20:58 +01:00
parent b6022a3e90
commit 23335f8bd9
2 changed files with 28 additions and 2 deletions

View File

@ -3,7 +3,17 @@
<div class="content-inner"> <div class="content-inner">
<h1 class="heading">Stats</h1> <h1 class="heading">Stats</h1>
<span class="version">traxxx {{ version }}</span> <dl class="stat-table">
<div class="stat-row">
<dt class="stat-label">Version</dt>
<dd class="stat-value">{{ version }}</dd>
</div>
<div class="stat-row">
<dt class="stat-label">Content updated</dt>
<dd class="stat-value">{{ formatDate(lastScrape, 'YYYY-MM-DD HH:mm') }}</dd>
</div>
</dl>
<dl class="stat-table"> <dl class="stat-table">
<div class="stat-row"> <div class="stat-row">
@ -46,6 +56,7 @@ async function mounted() {
this.totalActors = stats.totalActors; this.totalActors = stats.totalActors;
this.totalNetworks = stats.totalNetworks; this.totalNetworks = stats.totalNetworks;
this.totalChannels = stats.totalChannels; this.totalChannels = stats.totalChannels;
this.lastScrape = stats.lastScrape;
this.version = VERSION; // eslint-disable-line no-undef this.version = VERSION; // eslint-disable-line no-undef
} }
@ -75,6 +86,10 @@ export default {
padding: 1rem; padding: 1rem;
} }
.stat-table {
margin: 0 0 1rem 0;
}
.stat-row { .stat-row {
width: 20rem; width: 20rem;
max-width: 100%; max-width: 100%;

View File

@ -167,7 +167,17 @@ function initUiActions(_store, _router) {
channels, channels,
} = await graphql(` } = await graphql(`
query Stats { query Stats {
scenes: releasesConnection { totalCount } scenes: releasesConnection(
last: 1,
orderBy: BATCH_BY_CREATED_BATCH_ID__CREATED_AT_ASC
) {
totalCount
scenes: nodes {
batch: createdBatch {
createdAt
}
}
}
movies: moviesConnection { totalCount } movies: moviesConnection { totalCount }
actors: actorsConnection { totalCount } actors: actorsConnection { totalCount }
networks: entitiesConnection(filter: { type: { equalTo: "network" } }) { totalCount } networks: entitiesConnection(filter: { type: { equalTo: "network" } }) { totalCount }
@ -181,6 +191,7 @@ function initUiActions(_store, _router) {
totalActors: actors.totalCount, totalActors: actors.totalCount,
totalNetworks: networks.totalCount, totalNetworks: networks.totalCount,
totalChannels: channels.totalCount, totalChannels: channels.totalCount,
lastScrape: new Date(scenes.scenes[0]?.batch.createdAt),
}; };
} }