Merge branch 'develop' of https://github.com/crawlab-team/crawlab into develop

This commit is contained in:
marvzhang
2020-01-17 13:43:44 +08:00

View File

@@ -33,10 +33,14 @@
<div class="file-tree-wrapper">
<el-tree
:data="computedFileTree"
ref="tree"
node-key="path"
:highlight-current="true"
:default-expanded-keys="expandedPaths"
@node-contextmenu="onFileRightClick"
@node-click="onFileClick"
@node-expand="onDirClick"
@node-collapse="onDirClick"
>
<span class="custom-tree-node" slot-scope="{ node, data }">
<el-popover v-model="isShowCreatePopoverDict[data.path]" trigger="manual" placement="right"
@@ -167,7 +171,8 @@ export default {
],
activeFileNode: {},
dirDialogVisible: false,
fileDialogVisible: false
fileDialogVisible: false,
nodeExpandedDict: {}
}
},
computed: {
@@ -190,6 +195,17 @@ export default {
let nodes = this.sortFiles(this.fileTree.children)
nodes = this.filterFiles(nodes)
return nodes
},
expandedPaths () {
return Object.keys(this.nodeExpandedDict)
.map(path => {
return {
path,
expanded: this.nodeExpandedDict[path]
}
})
.filter(d => d.expanded)
.map(d => d.path)
}
},
methods: {
@@ -289,6 +305,12 @@ export default {
this.currentFilePath = data.path
this.onItemClick(data)
},
onDirClick (data, node) {
const vm = this
setTimeout(() => {
vm.$set(vm.nodeExpandedDict, data.path, node.expanded)
}, 0)
},
sortFiles (nodes) {
nodes.forEach(node => {
if (node.is_dir) {