mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-02-18 00:02:02 +03:00
perf: Add hook to repaint piece state canvas on update (#869)
This commit is contained in:
parent
194f568036
commit
87038f48b9
2 changed files with 9 additions and 5 deletions
|
@ -326,7 +326,6 @@ export default defineComponent({
|
||||||
name: 'Info',
|
name: 'Info',
|
||||||
mixins: [FullScreenModal],
|
mixins: [FullScreenModal],
|
||||||
props: {
|
props: {
|
||||||
hash: String,
|
|
||||||
torrent: Torrent,
|
torrent: Torrent,
|
||||||
isActive: Boolean
|
isActive: Boolean
|
||||||
},
|
},
|
||||||
|
@ -361,9 +360,14 @@ export default defineComponent({
|
||||||
return this.torrent?.state ? this.torrent.state.toLowerCase() : ''
|
return this.torrent?.state ? this.torrent.state.toLowerCase() : ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
torrent() {
|
||||||
|
this.renderTorrentPieceStates()
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async getTorrentProperties() {
|
async getTorrentProperties() {
|
||||||
const props = await qbit.getTorrentProperties(this.hash as string)
|
const props = await qbit.getTorrentProperties(this.torrent?.hash as string)
|
||||||
this.comment = props.comment
|
this.comment = props.comment
|
||||||
this.createdBy = props.created_by
|
this.createdBy = props.created_by
|
||||||
// @ts-expect-error: TS2339: Property 'dateFormat' does not exist on type 'never'.
|
// @ts-expect-error: TS2339: Property 'dateFormat' does not exist on type 'never'.
|
||||||
|
@ -380,8 +384,8 @@ export default defineComponent({
|
||||||
const canvas: HTMLCanvasElement | null = document.querySelector('#pieceStates canvas')
|
const canvas: HTMLCanvasElement | null = document.querySelector('#pieceStates canvas')
|
||||||
if (canvas === null) return
|
if (canvas === null) return
|
||||||
|
|
||||||
const files = await qbit.getTorrentFiles(this.hash as string)
|
const files = await qbit.getTorrentFiles(this.torrent?.hash as string)
|
||||||
const pieces = await qbit.getTorrentPieceStates(this.hash as string)
|
const pieces = await qbit.getTorrentPieceStates(this.torrent?.hash as string)
|
||||||
if (!pieces) return
|
if (!pieces) return
|
||||||
|
|
||||||
// Source: https://github.com/qbittorrent/qBittorrent/blob/6229b817300344759139d2fedbd59651065a561d/src/webui/www/private/scripts/prop-general.js#L230
|
// Source: https://github.com/qbittorrent/qBittorrent/blob/6229b817300344759139d2fedbd59651065a561d/src/webui/www/private/scripts/prop-general.js#L230
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<v-card-text class="pa-0">
|
<v-card-text class="pa-0">
|
||||||
<v-tabs-items v-model="tab" touchless>
|
<v-tabs-items v-model="tab" touchless>
|
||||||
<v-tab-item eager value="info">
|
<v-tab-item eager value="info">
|
||||||
<Info v-if="torrent" :torrent="torrent" :hash="hash" />
|
<Info v-if="torrent" :is-active="tab === 'info'" :torrent="torrent" />
|
||||||
</v-tab-item>
|
</v-tab-item>
|
||||||
<v-tab-item eager value="trackers">
|
<v-tab-item eager value="trackers">
|
||||||
<Trackers :is-active="tab === 'trackers'" :hash="hash" />
|
<Trackers :is-active="tab === 'trackers'" :hash="hash" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue