Refactor & Clean up

This commit is contained in:
syuilo 2018-11-09 08:13:34 +09:00
parent ba845f5218
commit 60ef3e3563
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
154 changed files with 438 additions and 481 deletions

View file

@ -117,7 +117,7 @@ export default Vue.extend({
};
},
mounted() {
this.connection = (this as any).os.stream.useSharedConnection('drive');
this.connection = this.$root.stream.useSharedConnection('drive');
this.connection.on('fileCreated', this.onStreamDriveFileCreated);
this.connection.on('fileUpdated', this.onStreamDriveFileUpdated);
@ -290,7 +290,7 @@ export default Vue.extend({
const file = JSON.parse(driveFile);
if (this.files.some(f => f.id == file.id)) return;
this.removeFile(file.id);
(this as any).api('drive/files/update', {
this.$root.api('drive/files/update', {
fileId: file.id,
folderId: this.folder ? this.folder.id : null
});
@ -306,7 +306,7 @@ export default Vue.extend({
if (this.folder && folder.id == this.folder.id) return false;
if (this.folders.some(f => f.id == folder.id)) return false;
this.removeFolder(folder.id);
(this as any).api('drive/folders/update', {
this.$root.api('drive/folders/update', {
folderId: folder.id,
parentId: this.folder ? this.folder.id : null
}).then(() => {
@ -339,7 +339,7 @@ export default Vue.extend({
title: this.$t('url-upload'),
placeholder: this.$t('url-of-file')
}).then(url => {
(this as any).api('drive/files/upload_from_url', {
this.$root.api('drive/files/upload_from_url', {
url: url,
folderId: this.folder ? this.folder.id : undefined
});
@ -359,7 +359,7 @@ export default Vue.extend({
title: this.$t('create-folder'),
placeholder: this.$t('folder-name')
}).then(name => {
(this as any).api('drive/folders/create', {
this.$root.api('drive/folders/create', {
name: name,
parentId: this.folder ? this.folder.id : undefined
}).then(folder => {
@ -400,7 +400,7 @@ export default Vue.extend({
newWindow(folder) {
if (document.body.clientWidth > 800) {
(this as any).os.new(MkDriveWindow, {
this.$root.new(MkDriveWindow, {
folder: folder
});
} else {
@ -420,7 +420,7 @@ export default Vue.extend({
this.fetching = true;
(this as any).api('drive/folders/show', {
this.$root.api('drive/folders/show', {
folderId: target
}).then(folder => {
this.folder = folder;
@ -522,7 +522,7 @@ export default Vue.extend({
const filesMax = 30;
//
(this as any).api('drive/folders', {
this.$root.api('drive/folders', {
folderId: this.folder ? this.folder.id : null,
limit: foldersMax + 1
}).then(folders => {
@ -535,7 +535,7 @@ export default Vue.extend({
});
//
(this as any).api('drive/files', {
this.$root.api('drive/files', {
folderId: this.folder ? this.folder.id : null,
limit: filesMax + 1
}).then(files => {
@ -565,7 +565,7 @@ export default Vue.extend({
const max = 30;
//
(this as any).api('drive/files', {
this.$root.api('drive/files', {
folderId: this.folder ? this.folder.id : null,
untilId: this.files[this.files.length - 1].id,
limit: max + 1