mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 21:00:16 +02:00
parent
1f9b7cf947
commit
4085f1fdaa
5 changed files with 81 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ import * as lineClamp from 'vue-line-clamp'
|
||||||
import Vuelidate from 'vuelidate'
|
import Vuelidate from 'vuelidate'
|
||||||
import { sync } from 'vuex-router-sync'
|
import { sync } from 'vuex-router-sync'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
|
import actuator from './plugins/actuator.plugin'
|
||||||
import httpPlugin from './plugins/http.plugin'
|
import httpPlugin from './plugins/http.plugin'
|
||||||
import komgaBooks from './plugins/komga-books.plugin'
|
import komgaBooks from './plugins/komga-books.plugin'
|
||||||
import komgaFileSystem from './plugins/komga-filesystem.plugin'
|
import komgaFileSystem from './plugins/komga-filesystem.plugin'
|
||||||
|
|
@ -24,6 +25,7 @@ Vue.use(komgaSeries, { http: Vue.prototype.$http })
|
||||||
Vue.use(komgaBooks, { http: Vue.prototype.$http })
|
Vue.use(komgaBooks, { http: Vue.prototype.$http })
|
||||||
Vue.use(komgaUsers, { store: store, http: Vue.prototype.$http })
|
Vue.use(komgaUsers, { store: store, http: Vue.prototype.$http })
|
||||||
Vue.use(komgaLibraries, { store: store, http: Vue.prototype.$http })
|
Vue.use(komgaLibraries, { store: store, http: Vue.prototype.$http })
|
||||||
|
Vue.use(actuator, { http: Vue.prototype.$http })
|
||||||
|
|
||||||
Vue.prototype.$_ = _
|
Vue.prototype.$_ = _
|
||||||
|
|
||||||
|
|
|
||||||
17
komga-webui/src/plugins/actuator.plugin.ts
Normal file
17
komga-webui/src/plugins/actuator.plugin.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
import ActuatorService from '@/services/actuator.service'
|
||||||
|
import { AxiosInstance } from 'axios'
|
||||||
|
import _Vue from 'vue'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
install (
|
||||||
|
Vue: typeof _Vue,
|
||||||
|
{ http }: { http: AxiosInstance }) {
|
||||||
|
Vue.prototype.$actuator = new ActuatorService(http)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module 'vue/types/vue' {
|
||||||
|
interface Vue {
|
||||||
|
$actuator: ActuatorService;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
komga-webui/src/services/actuator.service.ts
Normal file
23
komga-webui/src/services/actuator.service.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { AxiosInstance } from 'axios'
|
||||||
|
|
||||||
|
const API_ACTUATOR = '/actuator'
|
||||||
|
|
||||||
|
export default class ActuatorService {
|
||||||
|
private http: AxiosInstance;
|
||||||
|
|
||||||
|
constructor (http: AxiosInstance) {
|
||||||
|
this.http = http
|
||||||
|
}
|
||||||
|
|
||||||
|
async getInfo (): Promise<ActuatorInfo> {
|
||||||
|
try {
|
||||||
|
return (await this.http.get(`${API_ACTUATOR}/info`)).data
|
||||||
|
} catch (e) {
|
||||||
|
let msg = 'An error occurred while trying to retrieve actuator info'
|
||||||
|
if (e.response.data.message) {
|
||||||
|
msg += `: ${e.response.data.message}`
|
||||||
|
}
|
||||||
|
throw new Error(msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
komga-webui/src/types/actuator.ts
Normal file
22
komga-webui/src/types/actuator.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
interface ActuatorInfo {
|
||||||
|
git: ActuatorGit,
|
||||||
|
build: ActuatorBuild
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ActuatorGit {
|
||||||
|
commit: ActuatorGitCommit,
|
||||||
|
branch: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ActuatorGitCommit {
|
||||||
|
time: Date,
|
||||||
|
id: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ActuatorBuild {
|
||||||
|
version: string,
|
||||||
|
artifact: string,
|
||||||
|
name: string,
|
||||||
|
group: string,
|
||||||
|
time: Date
|
||||||
|
}
|
||||||
|
|
@ -96,6 +96,16 @@
|
||||||
</v-list-item-content>
|
</v-list-item-content>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
</v-list>
|
</v-list>
|
||||||
|
|
||||||
|
<v-spacer/>
|
||||||
|
|
||||||
|
<template v-slot:append>
|
||||||
|
<div v-if="isAdmin && !$_.isEmpty(info)"
|
||||||
|
class="pa-2 pb-6 caption"
|
||||||
|
>
|
||||||
|
<div>v{{ info.build.version }}-{{ info.git.branch }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</v-navigation-drawer>
|
</v-navigation-drawer>
|
||||||
|
|
||||||
<v-content>
|
<v-content>
|
||||||
|
|
@ -115,7 +125,13 @@ export default Vue.extend({
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
drawerVisible: this.$vuetify.breakpoint.lgAndUp,
|
drawerVisible: this.$vuetify.breakpoint.lgAndUp,
|
||||||
modalAddLibrary: false
|
modalAddLibrary: false,
|
||||||
|
info: {} as ActuatorInfo
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async created () {
|
||||||
|
if (this.isAdmin) {
|
||||||
|
this.info = await this.$actuator.getInfo()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue