mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-22 17:31:03 +01:00
点击爬虫跳转相应文件 pipelines.py
This commit is contained in:
@@ -409,6 +409,23 @@ export default {
|
||||
this.isShowDelete = false
|
||||
this.showFile = false
|
||||
this.$st.sendEv('爬虫详情', '文件', '删除')
|
||||
},
|
||||
clickPipeline () {
|
||||
const filename = 'pipelines.py'
|
||||
for (let i = 0; i < this.computedFileTree.length; i++) {
|
||||
const dataLv1 = this.computedFileTree[i]
|
||||
const nodeLv1 = this.$refs['tree'].getNode(dataLv1.path)
|
||||
if (dataLv1.is_dir) {
|
||||
for (let j = 0; j < dataLv1.children.length; j++) {
|
||||
const nodeLv2 = dataLv1.children[j]
|
||||
if (nodeLv2.path.match(filename)) {
|
||||
this.onFileClick(nodeLv2)
|
||||
nodeLv1.expanded = true
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
async created () {
|
||||
|
||||
@@ -349,6 +349,7 @@
|
||||
v-for="s in spiderScrapyPipelines"
|
||||
:key="s"
|
||||
class="item"
|
||||
@click="$emit('click-pipeline')"
|
||||
>
|
||||
<i class="el-icon-star-on"></i>
|
||||
{{s}}
|
||||
|
||||
@@ -26,13 +26,18 @@
|
||||
<git-settings/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane v-if="isScrapy" :label="$t('Scrapy Settings')" name="scrapy-settings">
|
||||
<spider-scrapy/>
|
||||
<spider-scrapy
|
||||
@click-spider="onClickScrapySpider"
|
||||
@click-pipeline="onClickScrapyPipeline"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane v-if="isConfigurable" :label="$t('Config')" name="config">
|
||||
<config-list ref="config"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('Files')" name="files">
|
||||
<file-list/>
|
||||
<file-list
|
||||
ref="file-list"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane :label="$t('Environment')" name="environment">
|
||||
<environment-list/>
|
||||
@@ -162,7 +167,8 @@ export default {
|
||||
}
|
||||
this.$utils.tour.nextStep('spider-detail', currentStep)
|
||||
}
|
||||
}
|
||||
},
|
||||
redirectType: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -227,6 +233,20 @@ export default {
|
||||
this.$store.dispatch('spider/getSpiderScrapySettings', this.$route.params.id),
|
||||
this.$store.dispatch('spider/getSpiderScrapyPipelines', this.$route.params.id)
|
||||
])
|
||||
},
|
||||
async onClickScrapySpider () {
|
||||
this.redirectType = 'spider'
|
||||
this.activeTabName = 'files'
|
||||
await this.$store.dispatch('spider/getFileTree')
|
||||
if (this.currentPath) {
|
||||
await this.$store.dispatch('file/getFileContent', { path: this.currentPath })
|
||||
}
|
||||
},
|
||||
async onClickScrapyPipeline () {
|
||||
this.redirectType = 'pipeline'
|
||||
this.activeTabName = 'files'
|
||||
await this.$store.dispatch('spider/getFileTree')
|
||||
this.$refs['file-list'].clickPipeline()
|
||||
}
|
||||
},
|
||||
async created () {
|
||||
|
||||
Reference in New Issue
Block a user