mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2024-11-28 13:08:53 +03:00
perf: Add qbit refresh interval setting (#923)
This commit is contained in:
parent
31ad072c7f
commit
d2cae697b8
11 changed files with 42 additions and 21 deletions
|
@ -44,6 +44,16 @@
|
|||
<v-checkbox v-model="settings.showShutdownButton" hide-details class="ma-0 pa-0" :label="$t('modals.settings.vueTorrent.general.showShutdownButton')" />
|
||||
</v-list-item>
|
||||
|
||||
<v-list-item class="mb-3">
|
||||
<v-text-field
|
||||
v-model="settings.refreshInterval"
|
||||
type="number"
|
||||
dense
|
||||
outlined
|
||||
:hint="$t('modals.settings.vueTorrent.general.refreshIntervalHint')"
|
||||
:label="$t('modals.settings.vueTorrent.general.refreshInterval')" />
|
||||
</v-list-item>
|
||||
|
||||
<v-list-item class="mb-3">
|
||||
<v-row>
|
||||
<v-col cols="12" sm="6" md="3">
|
||||
|
@ -86,7 +96,9 @@
|
|||
</v-col>
|
||||
<v-col cols="6" md="2" class="d-flex align-center justify-start">
|
||||
<h3>
|
||||
<a target="_blank" :href="`https://github.com/WDaan/VueTorrent/releases/tag/v${version}`">{{ version }}</a>
|
||||
<span v-if="!version">undefined</span>
|
||||
<a v-else-if="version.endsWith('-dev')" target="_blank" href="https://github.com/WDaan/VueTorrent/">{{ version }}</a>
|
||||
<a v-else target="_blank" :href="`https://github.com/WDaan/VueTorrent/releases/tag/v${version}`">{{ version }}</a>
|
||||
</h3>
|
||||
</v-col>
|
||||
|
||||
|
|
|
@ -161,8 +161,7 @@ export function getVersion() {
|
|||
return 'import.meta.env.VITE_PACKAGE_VERSION'
|
||||
}
|
||||
|
||||
// return import.meta.env['VITE_PACKAGE_VERSION']
|
||||
return 'undefined'
|
||||
return `${import.meta.env['VITE_PACKAGE_VERSION']}-dev`
|
||||
}
|
||||
|
||||
export function getBaseURL() {
|
||||
|
|
|
@ -269,6 +269,8 @@
|
|||
"dateFormat": "Date Format",
|
||||
"openSideBarOnStart": "Open Side Bar on launch",
|
||||
"showShutdownButton": "Show shutdown button",
|
||||
"refreshInterval": "qBittorrent API refresh interval",
|
||||
"refreshIntervalHint": "In milliseconds",
|
||||
"currentVersion": "Current Version",
|
||||
"qbittorrentVersion": "QBittorrent Version",
|
||||
"registerMagnet": "Register magnet links",
|
||||
|
|
|
@ -42,6 +42,7 @@ export const StoreStateSchema: JSONSchemaType<PersistentStoreState> = {
|
|||
dateFormat: { type: 'string' },
|
||||
openSideBarOnStart: { type: 'boolean' },
|
||||
showShutdownButton: { type: 'boolean' },
|
||||
refreshInterval: { type: 'number' },
|
||||
busyDesktopTorrentProperties: { $ref: '/schemas/desktopDashboardProperties' },
|
||||
doneDesktopTorrentProperties: { $ref: '/schemas/desktopDashboardProperties' },
|
||||
busyMobileCardProperties: { $ref: '/schemas/mobileDashboardProperties' },
|
||||
|
@ -65,6 +66,7 @@ export const StoreStateSchema: JSONSchemaType<PersistentStoreState> = {
|
|||
'dateFormat',
|
||||
'openSideBarOnStart',
|
||||
'showShutdownButton',
|
||||
'refreshInterval',
|
||||
'busyDesktopTorrentProperties',
|
||||
'doneDesktopTorrentProperties',
|
||||
'busyMobileCardProperties',
|
||||
|
|
|
@ -9,7 +9,7 @@ export default {
|
|||
INIT_INTERVALS: async (store: Store<StoreState>) => {
|
||||
store.state.intervals[0] = setInterval(() => {
|
||||
store.commit('updateMainData')
|
||||
}, 2000)
|
||||
}, store.state.webuiSettings.refreshInterval)
|
||||
},
|
||||
LOGIN: async (store: Store<StoreState>, payload: LoginPayload) => {
|
||||
const res = await qbit.login(payload)
|
||||
|
|
|
@ -81,7 +81,6 @@ export default new Vuex.Store<StoreState>({
|
|||
plugins: [vuexPersist.plugin],
|
||||
state: {
|
||||
authenticated: false,
|
||||
oldSettingsDetected: false,
|
||||
categories: [],
|
||||
dashboard: {
|
||||
currentPage: 1,
|
||||
|
@ -93,6 +92,7 @@ export default new Vuex.Store<StoreState>({
|
|||
isUpdatingMainData: false,
|
||||
latestSelectedTorrent: -1,
|
||||
modals: [],
|
||||
oldSettingsDetected: false,
|
||||
rid: 0,
|
||||
rss: {
|
||||
feeds: [],
|
||||
|
@ -135,6 +135,7 @@ export default new Vuex.Store<StoreState>({
|
|||
dateFormat: 'DD/MM/YYYY, HH:mm:ss',
|
||||
openSideBarOnStart: true,
|
||||
showShutdownButton: true,
|
||||
refreshInterval: 2000,
|
||||
busyDesktopTorrentProperties: JSON.parse(JSON.stringify(desktopPropertiesTemplate)),
|
||||
doneDesktopTorrentProperties: JSON.parse(JSON.stringify(desktopPropertiesTemplate)),
|
||||
busyMobileCardProperties: JSON.parse(JSON.stringify(mobilePropertiesTemplate)),
|
||||
|
|
|
@ -28,6 +28,7 @@ export default interface WebUISettings {
|
|||
dateFormat: string
|
||||
openSideBarOnStart: boolean
|
||||
showShutdownButton: boolean
|
||||
refreshInterval: number
|
||||
busyDesktopTorrentProperties: TorrentProperty[]
|
||||
doneDesktopTorrentProperties: TorrentProperty[]
|
||||
busyMobileCardProperties: TorrentProperty[]
|
||||
|
|
|
@ -16,19 +16,19 @@ export function generateMultiple(count: number = 1): Torrent[] {
|
|||
export function generateTorrent(data: any): Torrent {
|
||||
return new Torrent({
|
||||
name: data.name,
|
||||
hash: faker.datatype.uuid(),
|
||||
size: faker.datatype.number({ min: 1000000, max: 50000000000 }),
|
||||
hash: faker.string.uuid(),
|
||||
size: faker.number.int({ min: 1000000, max: 50000000000 }),
|
||||
tags: [],
|
||||
progress: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
||||
progress: faker.number.int({ min: 0, max: 1, precision: 0.01 }),
|
||||
state: faker.helpers.arrayElement(['done', 'downloading', 'fail', 'paused', 'queued', 'seeding', 'checking', 'stalled', 'metadata', 'moving']),
|
||||
eta: faker.datatype.number({ min: 1000, max: 900000 }),
|
||||
availability: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
||||
eta: faker.number.int({ min: 1000, max: 900000 }),
|
||||
availability: faker.number.int({ min: 0, max: 1, precision: 0.01 }),
|
||||
added_on: faker.date.recent(),
|
||||
ratio: faker.datatype.number({ min: 0, max: 1, precision: 0.01 }),
|
||||
num_leechs: faker.datatype.number({ min: 1, max: 20 }),
|
||||
num_complete: faker.datatype.number({ min: 1, max: 500 }),
|
||||
num_seeds: faker.datatype.number({ min: 1, max: 25 }),
|
||||
num_incomplete: faker.datatype.number({ min: 1, max: 500 }),
|
||||
ratio: faker.number.int({ min: 0, max: 1, precision: 0.01 }),
|
||||
num_leechs: faker.number.int({ min: 1, max: 20 }),
|
||||
num_complete: faker.number.int({ min: 1, max: 500 }),
|
||||
num_seeds: faker.number.int({ min: 1, max: 25 }),
|
||||
num_incomplete: faker.number.int({ min: 1, max: 500 }),
|
||||
save_path: faker.system.filePath(),
|
||||
category: faker.helpers.arrayElement(['ISO', 'Other', 'Movie', 'Music', 'TV'])
|
||||
})
|
||||
|
|
|
@ -330,6 +330,11 @@ export default {
|
|||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$store.commit('FETCH_CATEGORIES')
|
||||
this.$store.commit('FETCH_TAGS')
|
||||
if (this.input) this.searchFilterEnabled = true
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch('INIT_INTERVALS')
|
||||
document.addEventListener('keydown', this.handleKeyboardShortcut)
|
||||
|
@ -342,11 +347,6 @@ export default {
|
|||
this.$store.dispatch('ALERT_OLD_SETTINGS')
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$store.commit('FETCH_CATEGORIES')
|
||||
this.$store.commit('FETCH_TAGS')
|
||||
if (this.input) this.searchFilterEnabled = true
|
||||
},
|
||||
beforeDestroy() {
|
||||
this.$store.commit('REMOVE_INTERVALS')
|
||||
document.removeEventListener('keydown', this.handleKeyboardShortcut)
|
||||
|
|
|
@ -20,6 +20,7 @@ describe('General', () => {
|
|||
$store: {
|
||||
getters: { getAppVersion: vi.fn() },
|
||||
state: {
|
||||
version: 'test',
|
||||
webuiSettings: {
|
||||
showCurrentSpeed: 100,
|
||||
showSpeedGraph: true,
|
||||
|
|
|
@ -33,6 +33,9 @@ exports[`General > render correctly 1`] = `
|
|||
<v-list-item-stub data-v-7da6d3e2=\\"\\" activeclass=\\"\\" tag=\\"div\\" class=\\"mb-3\\">
|
||||
<v-checkbox-stub data-v-7da6d3e2=\\"\\" errorcount=\\"1\\" errormessages=\\"\\" messages=\\"\\" rules=\\"\\" successmessages=\\"\\" backgroundcolor=\\"\\" hidedetails=\\"true\\" ripple=\\"true\\" valuecomparator=\\"[Function]\\" indeterminateicon=\\"$checkboxIndeterminate\\" officon=\\"$checkboxOff\\" onicon=\\"$checkboxOn\\" class=\\"ma-0 pa-0\\"></v-checkbox-stub>
|
||||
</v-list-item-stub>
|
||||
<v-list-item-stub data-v-7da6d3e2=\\"\\" activeclass=\\"\\" tag=\\"div\\" class=\\"mb-3\\">
|
||||
<v-text-field-stub data-v-7da6d3e2=\\"\\" errorcount=\\"1\\" errormessages=\\"\\" messages=\\"\\" rules=\\"\\" successmessages=\\"\\" backgroundcolor=\\"\\" dense=\\"true\\" loaderheight=\\"2\\" clearicon=\\"$clear\\" outlined=\\"true\\" type=\\"number\\"></v-text-field-stub>
|
||||
</v-list-item-stub>
|
||||
<v-list-item-stub data-v-7da6d3e2=\\"\\" activeclass=\\"\\" tag=\\"div\\" class=\\"mb-3\\">
|
||||
<v-row-stub data-v-7da6d3e2=\\"\\" tag=\\"div\\">
|
||||
<v-col-stub data-v-7da6d3e2=\\"\\" cols=\\"12\\" sm=\\"6\\" md=\\"3\\" tag=\\"div\\">
|
||||
|
@ -55,7 +58,7 @@ exports[`General > render correctly 1`] = `
|
|||
<h3 data-v-7da6d3e2=\\"\\"></h3>
|
||||
</v-col-stub>
|
||||
<v-col-stub data-v-7da6d3e2=\\"\\" cols=\\"6\\" md=\\"2\\" tag=\\"div\\" class=\\"d-flex align-center justify-start\\">
|
||||
<h3 data-v-7da6d3e2=\\"\\"><a data-v-7da6d3e2=\\"\\" target=\\"_blank\\" href=\\"https://github.com/WDaan/VueTorrent/releases/tag/vundefined\\"></a></h3>
|
||||
<h3 data-v-7da6d3e2=\\"\\"><span data-v-7da6d3e2=\\"\\">undefined</span></h3>
|
||||
</v-col-stub>
|
||||
<v-col-stub data-v-7da6d3e2=\\"\\" cols=\\"6\\" md=\\"2\\" tag=\\"div\\" class=\\"d-flex align-center justify-end\\">
|
||||
<h3 data-v-7da6d3e2=\\"\\"></h3>
|
||||
|
|
Loading…
Reference in a new issue