added param to task

This commit is contained in:
Marvin Zhang
2019-09-04 20:13:28 +08:00
parent 3eee129a7c
commit eb1a80ec2d
7 changed files with 21 additions and 10 deletions

View File

@@ -19,6 +19,9 @@
/>
</el-select>
</el-form-item>
<el-form-item :label="$t('Parameters')">
<el-input v-model="param" :placeholder="$t('Parameters')"></el-input>
</el-form-item>
</el-form>
<template slot="footer">
<el-button type="plain" size="small" @click="$emit('close')">{{$t('Cancel')}}</el-button>
@@ -42,7 +45,8 @@ export default {
},
data () {
return {
nodeId: ''
nodeId: '',
param: ''
}
},
methods: {
@@ -50,7 +54,7 @@ export default {
this.$emit('close')
},
onConfirm () {
this.$store.dispatch('spider/crawlSpider', { id: this.spiderId, nodeId: this.nodeId })
this.$store.dispatch('spider/crawlSpider', { id: this.spiderId, nodeId: this.nodeId, param: this.param })
.then(() => {
this.$message.success(this.$t('A task has been scheduled successfully'))
})

View File

@@ -15,6 +15,9 @@
<el-form-item :label="$t('Log File Path')">
<el-input v-model="taskForm.log_path" placeholder="Log File Path" disabled></el-input>
</el-form-item>
<el-form-item :label="$t('Parameters')">
<el-input v-model="taskForm.param" placeholder="Parameters" disabled></el-input>
</el-form-item>
<el-form-item :label="$t('Create Time')">
<el-input :value="getTime(taskForm.create_ts)" placeholder="Create Time" disabled></el-input>
</el-form-item>

View File

@@ -247,6 +247,7 @@ export default {
'username already exists': '用户名已存在',
'Deleted successfully': '成功删除',
'Saved successfully': '成功保存',
'Please zip your spider files from the root directory': '爬虫文件请从根目录下开始压缩。',
'English': 'English',
// 登录
'Sign in': '登录',

View File

@@ -101,10 +101,11 @@ const actions = {
})
},
crawlSpider ({ state, dispatch }, payload) {
const { id, nodeId } = payload
const { id, nodeId, param } = payload
return request.put(`/tasks`, {
spider_id: id,
node_id: nodeId
node_id: nodeId,
param: param
})
},
getTaskList ({ state, commit }, id) {

View File

@@ -60,8 +60,8 @@
disabled>
</el-input>
</el-form-item>
<el-form-item :label="$t('Parameters')" prop="params">
<el-input v-model="scheduleForm.params"
<el-form-item :label="$t('Parameters')" prop="param">
<el-input v-model="scheduleForm.param"
:placeholder="$t('Parameters')"></el-input>
</el-form-item>
<el-form-item :label="$t('Schedule Description')" prop="description">
@@ -111,7 +111,7 @@
</template>
</el-table-column>
</template>
<el-table-column :label="$t('Action')" align="left" width="250" fixed="right">
<el-table-column :label="$t('Action')" align="left" width="150px" fixed="right">
<template slot-scope="scope">
<el-tooltip :content="$t('Edit')" placement="top">
<el-button type="warning" icon="el-icon-edit" size="mini" @click="onEdit(scope.row)"></el-button>
@@ -159,6 +159,7 @@ export default {
{ name: 'cron', label: 'schedules.cron', width: '120' },
{ name: 'node_name', label: 'Node', width: '150' },
{ name: 'spider_name', label: 'Spider', width: '150' },
{ name: 'param', label: 'Parameters', width: '150' },
{ name: 'description', label: 'Description', width: 'auto' }
],
isEdit: false,

View File

@@ -93,7 +93,7 @@
</el-upload>
</el-form-item>
</el-form>
<el-alert type="error" title="爬虫文件请从根目录下开始压缩。" :closable="false"></el-alert>
<el-alert type="error" :title="$t('Please zip your spider files from the root directory')" :closable="false"></el-alert>
</el-dialog>
<!--./customized spider dialog-->
@@ -207,7 +207,7 @@
:width="col.width">
</el-table-column>
</template>
<el-table-column :label="$t('Action')" align="left" width="auto" fixed="right">
<el-table-column :label="$t('Action')" align="left" width="150px" fixed="right">
<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>

View File

@@ -119,7 +119,7 @@
:width="col.width">
</el-table-column>
</template>
<el-table-column :label="$t('Action')" align="left" fixed="right">
<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>
@@ -172,6 +172,7 @@ export default {
{ name: 'node_name', label: 'Node', width: '120' },
{ name: 'spider_name', label: 'Spider', width: '120' },
{ name: 'status', label: 'Status', width: '120' },
{ name: 'param', label: 'Parameters', width: '120' },
// { name: 'create_ts', label: 'Create Time', width: '100' },
{ name: 'start_ts', label: 'Start Time', width: '100' },
{ name: 'finish_ts', label: 'Finish Time', width: '100' },