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