Skip to content

Commit

Permalink
Fix refresh
Browse files Browse the repository at this point in the history
Resolves #302
  • Loading branch information
ggodlewski authored and horner committed Sep 9, 2022
1 parent 75ab73f commit 3a64088
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion apps/ui/assets/components/FilesTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
</li>
</ul>
<FilesTreeLeaf folderPath="/" v-if="!notRegistered" @selected="$emit('selected', $event)" />
<FilesTreeLeaf folderPath="/" v-if="!notRegistered" @selected="$emit('selected', $event)" ref="rootLeaf" />
</template>
<script>
import {UtilsMixin} from './UtilsMixin.mjs';
Expand All @@ -34,6 +34,9 @@ export default {
}
},
methods: {
refresh() {
this.$refs.rootLeaf.fetchFolder();
}
},
emits: ['collapse', 'sync'],
mounted() {
Expand Down
8 changes: 4 additions & 4 deletions apps/ui/assets/components/FilesTreeLeaf.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,19 @@ export default {
}
},
created() {
this.fetchFolder(this.driveId, this.folderPath);
this.fetchFolder();
},
watch: {
$route() {
this.fetchFolder(this.driveId, this.folderPath);
this.fetchFolder();
}
},
methods: {
isExpanded(file) {
return !!this.expanded[file.fileName];
},
async fetchFolder(driveId, filePath) {
const pathContent = await this.FileClientService.getFile('/' + driveId + filePath);
async fetchFolder() {
const pathContent = await this.FileClientService.getFile('/' + this.driveId + this.folderPath);
this.files = pathContent.files || [];
this.expanded = {};
for (const file of this.files) {
Expand Down
3 changes: 2 additions & 1 deletion apps/ui/assets/pages/FolderView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</template>

<template v-slot:sidebar="{ collapse }">
<FilesTree :folder-path="folderPath" :not-registered="notRegistered" v-if="sidebar" @collapse="collapse" @sync="syncSingle" />
<FilesTree :folder-path="folderPath" :not-registered="notRegistered" v-if="sidebar" @collapse="collapse" @sync="syncSingle" ref="filesTree" />
</template>

<template v-slot:default>
Expand Down Expand Up @@ -111,6 +111,7 @@ export default {
async active_job() {
if (this.active_job === '') {
await this.fetch();
await this.$refs.filesTree.refresh();
}
}
},
Expand Down

0 comments on commit 3a64088

Please sign in to comment.