diff --git a/app/src/components/Apps.js b/app/src/components/Apps.js
index efc4a334..b7caf6e5 100644
--- a/app/src/components/Apps.js
+++ b/app/src/components/Apps.js
@@ -3,7 +3,7 @@ import {Divider, SegmentGroup, StatisticLabel, StatisticValue} from "semantic-ui
import {Route, Routes} from "react-router-dom";
import "../static/wrolpi.css";
import {decryptOTP, encryptOTP} from "../api";
-import {PageContainer, useTitle} from "./Common";
+import {mimetypeColor, PageContainer, useTitle} from "./Common";
import {ThemeContext} from "../contexts/contexts";
import {Button, Header, Loader, Segment, Statistic, StatisticGroup, TextArea} from "./Theme";
import {useFileStatistics} from "../hooks/customHooks";
@@ -153,57 +153,74 @@ function FileStatistics() {
const {statistics} = useFileStatistics();
- let body = ;
+ let body = ;
if (statistics === undefined) {
- body =
Failed to fetch statistics
;
+ body = Failed to fetch statistics
;
}
if (statistics !== undefined && statistics !== null) {
- const {total_count, video_count, pdf_count, ebook_count, archive_count, image_count, zip_count} = statistics;
+ const {
+ archive_count,
+ audio_count,
+ ebook_count,
+ image_count,
+ pdf_count,
+ total_count,
+ video_count,
+ zip_count,
+ } = statistics;
body = <>
-
-
- {total_count}
- All Files
-
-
-
-
- {video_count}
- Videos
-
-
- {pdf_count}
- PDFs
-
-
- {ebook_count}
- eBooks
-
-
- {archive_count}
- Archives
-
-
- {image_count}
- Images
-
-
-
-
- {zip_count}
- ZIP
-
-
+
+
+
+ {total_count}
+ All Files
+
+
+
+
+
+
+ {video_count}
+ Videos
+
+
+ {pdf_count}
+ PDFs
+
+
+ {ebook_count}
+ eBooks
+
+
+ {archive_count}
+ Archives
+
+
+ {image_count}
+ Images
+
+
+
+
+
+
+ {zip_count}
+ ZIP
+
+
+ {audio_count}
+ Audio
+
+
+
>;
}
return <>
-
- {body}
-
+ {body}
>
}
diff --git a/wrolpi/files/lib.py b/wrolpi/files/lib.py
index 5b0a1c9c..a936f739 100644
--- a/wrolpi/files/lib.py
+++ b/wrolpi/files/lib.py
@@ -631,7 +631,8 @@ async def get_file_statistics():
COUNT(path) FILTER (WHERE file.mimetype LIKE 'video/%') AS "video_count",
COUNT(path) FILTER (WHERE file.mimetype = 'application/pdf') AS "pdf_count",
COUNT(path) FILTER (WHERE file.mimetype LIKE 'image/%' AND file.associated = FALSE) AS "image_count",
- COUNT(path) FILTER (WHERE file.mimetype = 'application/zip') AS "zip_count"
+ COUNT(path) FILTER (WHERE file.mimetype = 'application/zip') AS "zip_count",
+ COUNT(path) FILTER (WHERE file.mimetype LIKE 'audio/%' AND file.associated = FALSE) AS "audio_count"
FROM
file
''')
diff --git a/wrolpi/files/test/test_api.py b/wrolpi/files/test/test_api.py
index 811d2743..6ec958cb 100644
--- a/wrolpi/files/test/test_api.py
+++ b/wrolpi/files/test/test_api.py
@@ -252,6 +252,7 @@ def test_file_statistics(test_session, test_client, example_pdf, example_mobi, e
assert response.json == {
'statistics': {
'archive_count': 0,
+ 'audio_count': 0,
'ebook_count': 0,
'image_count': 0,
'pdf_count': 0,
@@ -267,6 +268,7 @@ def test_file_statistics(test_session, test_client, example_pdf, example_mobi, e
assert response.json == {
'statistics': {
'archive_count': 0,
+ 'audio_count': 0,
'ebook_count': 2,
'image_count': 0,
'pdf_count': 1,