Skip to content

Commit

Permalink
added param to task
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Zhang committed Sep 4, 2019
1 parent 4893439 commit 5013233
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
8 changes: 6 additions & 2 deletions frontend/src/components/Common/CrawlConfirmDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -42,15 +45,16 @@ export default {
},
data () {
return {
nodeId: ''
nodeId: '',
param: ''
}
},
methods: {
beforeClose () {
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'))
})
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/InfoView/TaskInfoView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/i18n/zh.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': '登录',
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/store/modules/spider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/views/schedule/ScheduleList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/views/spider/SpiderList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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-->

Expand Down Expand Up @@ -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>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/views/task/TaskList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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' },
Expand Down

0 comments on commit 5013233

Please sign in to comment.