mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-25 17:42:25 +01:00
加入重试
This commit is contained in:
@@ -34,7 +34,8 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="spiderForm.is_scrapy && !multiple" :label="$t('Scrapy Spider')" prop="spider" required inline-message>
|
||||
<el-form-item v-if="spiderForm.is_scrapy && !multiple" :label="$t('Scrapy Spider')" prop="spider" required
|
||||
inline-message>
|
||||
<el-select v-model="form.spider" :placeholder="$t('Scrapy Spider')" :disabled="isLoading">
|
||||
<el-option
|
||||
v-for="s in spiderForm.spider_names"
|
||||
@@ -67,15 +68,30 @@
|
||||
<el-input v-model="form.param" :placeholder="$t('Parameters')"></el-input>
|
||||
</template>
|
||||
</el-form-item>
|
||||
<el-form-item class="disclaimer-wrapper">
|
||||
<el-form-item class="checkbox-wrapper">
|
||||
<div>
|
||||
<el-checkbox v-model="isAllowDisclaimer"/>
|
||||
<span style="margin-left: 5px">我已阅读并同意 <a href="javascript:"
|
||||
@click="onClickDisclaimer">《免责声明》</a> 所有内容</span>
|
||||
<span v-if="lang === 'zh'" style="margin-left: 5px">
|
||||
我已阅读并同意
|
||||
<a href="javascript:" @click="onClickDisclaimer">
|
||||
《免责声明》
|
||||
</a>
|
||||
所有内容
|
||||
</span>
|
||||
<span v-else style="margin-left: 5px">
|
||||
I have read and agree all content in
|
||||
<a href="javascript:" @click="onClickDisclaimer">
|
||||
Disclaimer
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="!spiderForm.is_long_task && !multiple">
|
||||
<el-checkbox v-model="isRedirect"/>
|
||||
<span style="margin-left: 5px">跳转到任务详情页</span>
|
||||
<span style="margin-left: 5px">{{$t('Redirect to task detail')}}</span>
|
||||
</div>
|
||||
<div v-if="false">
|
||||
<el-checkbox v-model="isRetry"/>
|
||||
<span style="margin-left: 5px">{{$t('Retry (Maximum 5 Times)')}}</span>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -129,6 +145,7 @@ export default {
|
||||
nodeList: []
|
||||
},
|
||||
isAllowDisclaimer: true,
|
||||
isRetry: false,
|
||||
isRedirect: true,
|
||||
isLoading: false,
|
||||
isParametersVisible: false,
|
||||
@@ -142,6 +159,9 @@ export default {
|
||||
...mapState('setting', [
|
||||
'setting'
|
||||
]),
|
||||
...mapState('lang', [
|
||||
'lang'
|
||||
]),
|
||||
isConfirmDisabled () {
|
||||
if (this.isLoading) return true
|
||||
if (!this.isAllowDisclaimer) return true
|
||||
@@ -309,7 +329,7 @@ export default {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.crawl-confirm-dialog >>> .disclaimer-wrapper a {
|
||||
.crawl-confirm-dialog >>> .checkbox-wrapper a {
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
|
||||
@@ -266,6 +266,9 @@ export default {
|
||||
'Empty results': '空结果',
|
||||
'Navigate to Spider': '导航到爬虫',
|
||||
'Navigate to Node': '导航到节点',
|
||||
'Restart': '重新运行',
|
||||
'Redirect to task detail': '跳转到任务详情页',
|
||||
'Retry (Maximum 5 Times)': '是否重试(最多 5 次)',
|
||||
|
||||
// 任务列表
|
||||
'Node': '节点',
|
||||
|
||||
@@ -142,6 +142,12 @@ const actions = {
|
||||
ids: ids
|
||||
})
|
||||
},
|
||||
restartTask ({ state, dispatch }, id) {
|
||||
return request.post(`/tasks/${id}/restart`)
|
||||
.then(() => {
|
||||
dispatch('getTaskList')
|
||||
})
|
||||
},
|
||||
getTaskLog ({ state, commit }, id) {
|
||||
return request.get(`/tasks/${id}/log`)
|
||||
.then(response => {
|
||||
|
||||
@@ -143,11 +143,15 @@
|
||||
:width="col.width">
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column :label="$t('Action')" align="left" fixed="right" width="120px">
|
||||
<el-table-column :label="$t('Action')" align="left" fixed="right" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip :content="$t('View')" placement="top">
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="onView(scope.row)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('Restart')" placement="top">
|
||||
<el-button type="warning" icon="el-icon-refresh" size="mini"
|
||||
@click="onRestart(scope.row, $event)"></el-button>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('Remove')" placement="top">
|
||||
<el-button type="danger" icon="el-icon-delete" size="mini"
|
||||
@click="onRemove(scope.row, $event)"></el-button>
|
||||
@@ -359,6 +363,23 @@ export default {
|
||||
this.$st.sendEv('任务列表', '删除任务')
|
||||
})
|
||||
},
|
||||
onRestart (row, ev) {
|
||||
ev.stopPropagation()
|
||||
this.$confirm(this.$t('Are you sure to restart this task?'), this.$t('Notification'), {
|
||||
confirmButtonText: this.$t('Confirm'),
|
||||
cancelButtonText: this.$t('Cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$store.dispatch('task/restartTask', row._id)
|
||||
.then(() => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: this.$t('Restarted successfully')
|
||||
})
|
||||
})
|
||||
this.$st.sendEv('任务列表', '重新开始任务')
|
||||
})
|
||||
},
|
||||
onView (row) {
|
||||
this.$router.push(`/tasks/${row._id}`)
|
||||
this.$st.sendEv('任务列表', '查看任务')
|
||||
|
||||
Reference in New Issue
Block a user