logging out + available disk space + torrent download location

This commit is contained in:
Daan Wijns 2020-05-22 21:44:05 +02:00
parent 3456fa83bf
commit bbbe89a290
7 changed files with 119 additions and 73 deletions

View file

@ -57,6 +57,7 @@
<v-text-field
v-model="directory"
:placeholder="savepath"
label="Download Directory"
prepend-icon="folder"
></v-text-field>
@ -83,6 +84,7 @@
</template>
<script>
import { mapGetters } from 'vuex'
import Modal from "@/mixins/Modal";
import qbit from '@/services/qbit'
export default {
@ -111,6 +113,7 @@ export default {
let params= { urls: null};
if(this.files.length) torrents.push(...this.files)
if(this.url) params.urls = this.url
if(this.directory) params.savepath = this.directory
qbit.addTorrents(params, torrents)
@ -121,12 +124,16 @@ export default {
},
},
computed: {
...mapGetters(['getSettings']),
validFile() {
return this.Files.length > 0;
},
phoneLayout() {
return this.$vuetify.breakpoint.xsOnly;
},
savepath(){
return this.getSettings().savePath
}
},
};
</script>

View file

@ -144,6 +144,29 @@
</v-flex>
</v-layout>
</v-card>
<v-card flat style="margin-top: 30px;" color="secondary" class="ml-2 mr-2">
<v-layout row wrap class="pa-3 project nav_upload mx-auto">
<v-flex md6>
<div style="font-size: 0.95em; margin-top: 6px;" class="upload--text">Diskspace</div>
</v-flex>
<v-flex md5 class="ml-4">
<span class="upload--text title">
{{
stats.freeDiskSpace.substring(
0,
stats.freeDiskSpace.indexOf(' ')
)
}}
<span class="font-weight-light caption">{{
stats.freeDiskSpace.substring(
stats.freeDiskSpace.indexOf(' ')
)
}}</span>
</span>
</v-flex>
</v-layout>
</v-card>
</v-flex>
<v-container>
<v-row justify="space-between" style="position:fixed; bottom: 0px; right: 15px;">

View file

@ -6,6 +6,7 @@ export default class Stat {
this.uploaded = this.formatBytes(data.up_info_data, 1)
this.dlspeed = this.formatBytes(data.dl_info_speed, 1)
this.upspeed = this.formatBytes(data.up_info_speed, 1)
this.freeDiskSpace = this.formatBytes(data.free_space_on_disk)
}
}

View file

@ -28,6 +28,10 @@ class Qbit {
return data
}
async logout(){
this.axios.post('/auth/logout')
}
getGlobalTransferInfo() {
return this.axios.get('/transfer/info')
}

View file

@ -34,13 +34,15 @@ export default new Vuex.Store({
addmodal: false,
deletemodal: false,
settingsmodal: false
}
},
settings : {}
},
getters: {
containsTorrent: state => hash =>
state.selected_torrents.includes(hash),
getTheme: state => () => state.darkTheme,
getModalState: state => name => state.modals[name.toLowerCase()]
getModalState: state => name => state.modals[name.toLowerCase()],
getSettings: state => () => state.settings
},
mutations: {
@ -69,6 +71,7 @@ export default new Vuex.Store({
state.darkTheme = !state.darkTheme
},
LOGOUT: state => {
qbit.logout()
state.authenticated = false
},
LOGIN: async (state, payload) => {
@ -118,6 +121,10 @@ export default new Vuex.Store({
)
)
}
},
SET_SETTINGS: async state => {
const {data} = await qbit.getAppPreferences()
state.settings.savePath = data.save_path;
}
},
actions: {
@ -133,9 +140,11 @@ export default new Vuex.Store({
Vue.$toast.success('Successfully logged in!')
context.commit('LOGIN', true)
context.commit('updateMainData')
context.commit('SET_SETTINGS')
return true;
}
Vue.$toast.error('Log in failed 😕')
return false;
}
}

View file

@ -20,6 +20,7 @@
:rules="inputRules"
@keyup.enter.native="Login"
autocomplete="current email"
name="username"
></v-text-field>
<v-text-field
flat
@ -32,6 +33,7 @@
:rules="inputRules"
@keyup.enter.native="Login"
autocomplete="current password"
name="password"
></v-text-field>
<v-spacer></v-spacer>
<v-card-actions class="justify-center">