mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 16:06:19 -05:00
Display tags statistics.
This commit is contained in:
parent
f865d9fb0f
commit
b06682bc46
3 changed files with 40 additions and 1 deletions
|
|
@ -2,7 +2,16 @@ import React, {useContext} from 'react';
|
|||
import {Divider, Input, SegmentGroup, StatisticLabel, StatisticValue, TableCell, TableRow} from "semantic-ui-react";
|
||||
import {Link, Route, Routes} from "react-router-dom";
|
||||
import {decryptOTP, encryptOTP} from "../api";
|
||||
import {APIButton, ErrorMessage, humanFileSize, mimetypeColor, PageContainer, toLocaleString, useTitle} from "./Common";
|
||||
import {
|
||||
APIButton,
|
||||
ErrorMessage,
|
||||
humanFileSize,
|
||||
humanNumber,
|
||||
mimetypeColor,
|
||||
PageContainer,
|
||||
toLocaleString,
|
||||
useTitle
|
||||
} from "./Common";
|
||||
import {ThemeContext} from "../contexts/contexts";
|
||||
import {Button, Header, Loader, Segment, Statistic, StatisticGroup, Table, TextArea} from "./Theme";
|
||||
import {useStatistics, useVINDecoder} from "../hooks/customHooks";
|
||||
|
|
@ -224,6 +233,9 @@ function StatisticsPage() {
|
|||
video_count,
|
||||
zip_count,
|
||||
total_size,
|
||||
tagged_files,
|
||||
tagged_zims,
|
||||
tags_count,
|
||||
} = file_statistics;
|
||||
const {db_size} = global_statistics;
|
||||
return <>
|
||||
|
|
@ -280,6 +292,24 @@ function StatisticsPage() {
|
|||
</StatisticGroup>
|
||||
</Segment>
|
||||
|
||||
<Header as='h2'>Tags</Header>
|
||||
<Segment>
|
||||
<StatisticGroup>
|
||||
<Statistic>
|
||||
<StatisticValue>{humanNumber(tags_count)}</StatisticValue>
|
||||
<StatisticLabel>Tags</StatisticLabel>
|
||||
</Statistic>
|
||||
<Statistic>
|
||||
<StatisticValue>{humanNumber(tagged_files)}</StatisticValue>
|
||||
<StatisticLabel>Tagged Files</StatisticLabel>
|
||||
</Statistic>
|
||||
<Statistic>
|
||||
<StatisticValue>{humanNumber(tagged_zims)}</StatisticValue>
|
||||
<StatisticLabel>Tagged Zims</StatisticLabel>
|
||||
</Statistic>
|
||||
</StatisticGroup>
|
||||
</Segment>
|
||||
|
||||
<Header as='h2'>Database</Header>
|
||||
<Segment>
|
||||
<StatisticGroup>
|
||||
|
|
|
|||
|
|
@ -893,6 +893,9 @@ def get_file_statistics():
|
|||
COUNT(id) FILTER (WHERE file_group.mimetype LIKE 'image/%') AS "image_count",
|
||||
COUNT(id) FILTER (WHERE file_group.mimetype LIKE 'audio/%') AS "audio_count",
|
||||
COUNT(id) FILTER (WHERE file_group.mimetype = 'application/epub+zip' OR file_group.mimetype = 'application/x-mobipocket-ebook') AS "ebook_count",
|
||||
(SELECT COUNT(DISTINCT tag_file.file_group_id) FROM tag_file) AS "tagged_files",
|
||||
(SELECT COUNT(DISTINCT tag_zim.zim_entry) FROM tag_zim) AS "tagged_zims",
|
||||
(SELECT COUNT(*) FROM tag) AS "tags_count",
|
||||
SUM(size)::BIGINT AS "total_size",
|
||||
(SELECT COUNT(*) FROM archive) AS archive_count
|
||||
FROM
|
||||
|
|
|
|||
|
|
@ -228,6 +228,9 @@ def test_file_statistics(test_session, test_client, test_directory, example_pdf,
|
|||
'total_count': 0,
|
||||
'video_count': 0,
|
||||
'zip_count': 0,
|
||||
'tagged_files': 0,
|
||||
'tagged_zims': 0,
|
||||
'tags_count': 0,
|
||||
}
|
||||
|
||||
test_client.post('/api/files/refresh')
|
||||
|
|
@ -245,6 +248,9 @@ def test_file_statistics(test_session, test_client, test_directory, example_pdf,
|
|||
'total_count': 5, # extracted cover
|
||||
'video_count': 1,
|
||||
'zip_count': 0,
|
||||
'tagged_files': 0,
|
||||
'tagged_zims': 0,
|
||||
'tags_count': 0,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue