2018-02-18 04:35:18 +01:00
|
|
|
<template>
|
2018-09-17 22:35:06 +02:00
|
|
|
<mk-window ref="window" @closed="destroyDom" width="800px" height="500px" :popout-url="popout">
|
2019-02-18 01:48:00 +01:00
|
|
|
<template v-slot:header>
|
2018-11-08 19:44:35 +01:00
|
|
|
<p v-if="usage" :class="$style.info"><b>{{ usage.toFixed(1) }}%</b> {{ $t('used') }}</p>
|
|
|
|
<span :class="$style.title"><fa icon="cloud"/>{{ $t('@.drive') }}</span>
|
2018-02-18 15:51:41 +01:00
|
|
|
</template>
|
2018-11-11 21:35:09 +01:00
|
|
|
<x-drive :class="$style.browser" multiple :init-folder="folder" ref="browser"/>
|
2018-02-18 04:35:18 +01:00
|
|
|
</mk-window>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-08 19:44:35 +01:00
|
|
|
import i18n from '../../../i18n';
|
2018-02-18 04:35:18 +01:00
|
|
|
import { url } from '../../../config';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-08 19:44:35 +01:00
|
|
|
i18n: i18n('desktop/views/components/drive-window.vue'),
|
2018-11-11 21:35:09 +01:00
|
|
|
components: {
|
|
|
|
XDrive: () => import('./drive.vue').then(m => m.default),
|
|
|
|
},
|
2018-02-18 04:35:18 +01:00
|
|
|
props: ['folder'],
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
usage: null
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-11-09 00:13:34 +01:00
|
|
|
this.$root.api('drive').then(info => {
|
2018-02-18 04:35:18 +01:00
|
|
|
this.usage = info.usage / info.capacity * 100;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
popout() {
|
2018-03-14 08:12:36 +01:00
|
|
|
const folder = (this.$refs.browser as any) ? (this.$refs.browser as any).folder : null;
|
2018-02-18 04:35:18 +01:00
|
|
|
if (folder) {
|
|
|
|
return `${url}/i/drive/folder/${folder.id}`;
|
|
|
|
} else {
|
|
|
|
return `${url}/i/drive`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" module>
|
2018-02-18 15:51:41 +01:00
|
|
|
.title
|
2018-11-05 17:40:11 +01:00
|
|
|
> [data-icon]
|
2018-02-18 04:35:18 +01:00
|
|
|
margin-right 4px
|
|
|
|
|
|
|
|
.info
|
|
|
|
position absolute
|
|
|
|
top 0
|
|
|
|
left 16px
|
|
|
|
margin 0
|
|
|
|
font-size 80%
|
|
|
|
|
2018-02-20 15:26:41 +01:00
|
|
|
.browser
|
|
|
|
height 100%
|
|
|
|
|
2018-02-18 04:35:18 +01:00
|
|
|
</style>
|
|
|
|
|