diff --git a/komga-webui/src/locales/en.json b/komga-webui/src/locales/en.json index 2c9a2f2f0..2decea4fd 100644 --- a/komga-webui/src/locales/en.json +++ b/komga-webui/src/locales/en.json @@ -42,10 +42,10 @@ }, "book_card": { "error": "Error", + "no_release_date": "No release date", "unknown": "To be analyzed", "unread": "Unread", - "unsupported": "Unsupported", - "no_release_date": "No release date" + "unsupported": "Unsupported" }, "book_import": { "button_browse": "Browse", @@ -563,6 +563,13 @@ "HARDLINK": "Hardlink/Copy Files", "MOVE": "Move Files" }, + "historical_event_type": { + "BookConverted": "Book converted", + "BookFileDeleted": "Book file deleted", + "BookImported": "Book imported", + "DuplicatePageDeleted": "Duplicate page deleted", + "SeriesFolderDeleted": "Series folder deleted" + }, "media_status": { "ERROR": "Error", "OUTDATED": "Outdated", @@ -642,6 +649,16 @@ "filter": "filter", "sort": "sort" }, + "history": { + "header": { + "book": "Book", + "date": "Date", + "details": "Details", + "series": "Series", + "type": "Type" + }, + "title": "History" + }, "home": { "theme": "Theme", "translation": "Translation" diff --git a/komga-webui/src/main.ts b/komga-webui/src/main.ts index ba507ec44..d655cf062 100644 --- a/komga-webui/src/main.ts +++ b/komga-webui/src/main.ts @@ -27,6 +27,7 @@ import komgaOauth2 from './plugins/komga-oauth2.plugin' import komgaLogin from './plugins/komga-login.plugin' import komgaPageHashes from './plugins/komga-pagehashes.plugin' import komgaMetrics from './plugins/komga-metrics.plugin' +import komgaHistory from './plugins/komga-history.plugin' import vuetify from './plugins/vuetify' import logger from './plugins/logger.plugin' import './public-path' @@ -70,6 +71,7 @@ Vue.use(komgaOauth2, {http: Vue.prototype.$http}) Vue.use(komgaLogin, {http: Vue.prototype.$http}) Vue.use(komgaPageHashes, {http: Vue.prototype.$http}) Vue.use(komgaMetrics, {http: Vue.prototype.$http}) +Vue.use(komgaHistory, {http: Vue.prototype.$http}) Vue.config.productionTip = false diff --git a/komga-webui/src/plugins/komga-history.plugin.ts b/komga-webui/src/plugins/komga-history.plugin.ts new file mode 100644 index 000000000..96c45034e --- /dev/null +++ b/komga-webui/src/plugins/komga-history.plugin.ts @@ -0,0 +1,17 @@ +import {AxiosInstance} from 'axios' +import _Vue from 'vue' +import KomgaHistoryService from '@/services/komga-history.service' + +export default { + install( + Vue: typeof _Vue, + {http}: { http: AxiosInstance }) { + Vue.prototype.$komgaHistory = new KomgaHistoryService(http) + }, +} + +declare module 'vue/types/vue' { + interface Vue { + $komgaHistory: KomgaHistoryService; + } +} diff --git a/komga-webui/src/router.ts b/komga-webui/src/router.ts index a92098460..aaab3b4e4 100644 --- a/komga-webui/src/router.ts +++ b/komga-webui/src/router.ts @@ -128,6 +128,12 @@ const router = new Router({ }, ], }, + { + path: '/history', + name: 'history', + component: () => import(/* webpackChunkName: "history" */ './views/HistoryView.vue'), + }, + { path: '/account', name: 'account', diff --git a/komga-webui/src/services/komga-history.service.ts b/komga-webui/src/services/komga-history.service.ts new file mode 100644 index 000000000..b7ff3e2b4 --- /dev/null +++ b/komga-webui/src/services/komga-history.service.ts @@ -0,0 +1,29 @@ +import {AxiosInstance} from 'axios' +import {HistoricalEventDto} from '@/types/komga-history' + +const qs = require('qs') + +const API_HISTORY = '/api/v1/history' + +export default class KomgaHistoryService { + private http: AxiosInstance + + constructor(http: AxiosInstance) { + this.http = http + } + + async getAll(pageRequest?: PageRequest): Promise> { + try { + return (await this.http.get(API_HISTORY, { + params: pageRequest, + paramsSerializer: params => qs.stringify(params, {indices: false}), + })).data + } catch (e) { + let msg = 'An error occurred while trying to retrieve historical events' + if (e.response.data.message) { + msg += `: ${e.response.data.message}` + } + throw new Error(msg) + } + } +} diff --git a/komga-webui/src/types/komga-history.ts b/komga-webui/src/types/komga-history.ts new file mode 100644 index 000000000..48a4a5497 --- /dev/null +++ b/komga-webui/src/types/komga-history.ts @@ -0,0 +1,7 @@ +export interface HistoricalEventDto { + type: string, + timestamp: string, + bookId?: string, + seriesId?: string, + properties: Record[], +} diff --git a/komga-webui/src/views/HistoryView.vue b/komga-webui/src/views/HistoryView.vue new file mode 100644 index 000000000..7e34a3aa9 --- /dev/null +++ b/komga-webui/src/views/HistoryView.vue @@ -0,0 +1,221 @@ + + + + + diff --git a/komga-webui/src/views/HomeView.vue b/komga-webui/src/views/HomeView.vue index 7ef6d2848..ea031f53f 100644 --- a/komga-webui/src/views/HomeView.vue +++ b/komga-webui/src/views/HomeView.vue @@ -105,6 +105,15 @@ + + + mdi-clock-time-four-outline + + + {{ $t('history.title') }} + + + mdi-cog