Skip to content

Commit

Permalink
Easify file list relaod
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed May 17, 2022
1 parent 9f84313 commit 3c9eafe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export interface AppFolderHandlingResult {
activeFiles: Ref<Array<Resource>>

loadFolderForFileContext(context: MaybeRef<FileContext>): Promise<any>
loadFolder(absoluteDirPath: string): void
}

export function useAppFolderHandling(options: AppFolderHandlingOptions): AppFolderHandlingResult {
Expand Down Expand Up @@ -76,7 +75,6 @@ export function useAppFolderHandling(options: AppFolderHandlingOptions): AppFold
return {
isFolderLoading,
loadFolderForFileContext,
loadFolder,
activeFiles
}
}
25 changes: 5 additions & 20 deletions packages/web-runtime/src/components/Topbar/Notifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,11 @@
</template>
<script>
import { mapGetters, mapActions } from 'vuex'
import { useAppDefaults } from 'web-pkg/src/composables'
import { bus } from 'web-pkg/src/instance'
export default {
setup() {
return {
...useAppDefaults({
applicationName: 'runtime'
})
}
},
computed: {
...mapGetters(['activeNotifications', 'configuration', 'user']),
...mapGetters(['activeNotifications', 'configuration']),
notificationsLabel() {
return this.$gettext('Notifications')
Expand All @@ -95,23 +88,15 @@ export default {
json.ocs.data.forEach((item) => {
const currentPath = this.$route.params.item ? `/${this.$route.params.item}` : '/'
const { state, path, file_target: fileTarget } = item
// accepted federated share
if (state === 0 && fileTarget) {
let shareRoot = fileTarget.substring(0, fileTarget.lastIndexOf('/') + 1)
if (shareRoot !== '/') {
// remove trailing slash
shareRoot = shareRoot.replace(/\/+$/, '')
}
if (shareRoot === currentPath) {
this.loadFolder(`files/${this.user.id}/${currentPath}`)
return
}
bus.publish('app.files.list.load')
}
if (path) {
const itemPath = path.slice(0, path.lastIndexOf('/') + 1)
if (itemPath === currentPath) this.loadFolder(`files/${this.user.id}/${itemPath}`)
if (itemPath === currentPath) bus.publish('app.files.list.load')
}
})
})
Expand Down

0 comments on commit 3c9eafe

Please sign in to comment.