]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix legacy tab backbone fileinfo change
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Wed, 23 Oct 2019 16:40:48 +0000 (18:40 +0200)
committerDaniel Calviño Sánchez <danxuliu@gmail.com>
Tue, 29 Oct 2019 12:20:08 +0000 (13:20 +0100)
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
apps/files/src/components/LegacyTab.vue
apps/files/src/views/Sidebar.vue

index 9a85ee7f0730fca567b4434930abf5d580d09a75..54a24edcdd7dc89e4cc2e896b4fd5e03880dbd4f 100644 (file)
@@ -40,7 +40,6 @@ export default {
                },
                name: {
                        type: String,
-                       default: '',
                        required: true
                },
                fileInfo: {
@@ -74,10 +73,16 @@ export default {
                        }
                }
        },
+       beforeMount() {
+               this.setFileInfo(this.fileInfo)
+       },
        mounted() {
                // append the backbone element and set the FileInfo
                this.component.$el.appendTo(this.$el)
        },
+       beforeDestroy() {
+               this.component.remove()
+       },
        methods: {
                setFileInfo(fileInfo) {
                        this.component.setFileInfo(new OCA.Files.FileInfoModel(fileInfo))
index 879f71d8a12920c443abd1b145769b43531da5f7..02913d36877a1bf5a60fa28ed24e5d2845dc2ba1 100644 (file)
@@ -26,6 +26,7 @@
                ref="sidebar"
                v-bind="appSidebar"
                @close="onClose"
+               @update:active="setActiveTab"
                @update:starred="toggleStarred"
                @[defaultActionListener].stop.prevent="onDefaultAction">
                <!-- TODO: create a standard to allow multiple elements here? -->
@@ -50,6 +51,7 @@
                                :key="tab.id"
                                :component="tabComponent(tab).component"
                                :name="tab.name"
+                               :dav-path="davPath"
                                :file-info="fileInfo" />
                </template>
        </AppSidebar>
@@ -121,13 +123,8 @@ export default {
                 * @param {string} id the tab id to set as active
                 * @returns {string} the current active tab
                 */
-               activeTab: {
-                       get: function() {
-                               return this.Sidebar.activeTab
-                       },
-                       set: function(id) {
-                               OCA.Files.Sidebar.activeTab = id
-                       }
+               activeTab() {
+                       return this.Sidebar.activeTab
                },
 
                /**
@@ -294,6 +291,15 @@ export default {
                        }
                },
 
+               /**
+                * Set current active tab
+                *
+                * @param {string} id tab unique id
+                */
+               setActiveTab(id) {
+                       OCA.Files.Sidebar.activeTab = id
+               },
+
                /**
                 * Toggle favourite state
                 * TODO: better implementation