{{$t('Add Schedule')}}
@@ -233,7 +259,121 @@ export default {
showCron: false,
expression: '',
spiderList: [],
- nodeList: []
+ nodeList: [],
+ isShowCron: false,
+
+ // tutorial
+ tourSteps: [
+ {
+ target: '.table',
+ content: this.$t('This is a list of schedules (cron jobs) to periodically run spider tasks. You can add/modify/edit your schedules here.
For more information, please refer to the
Documentation (Chinese) for detail.')
+ },
+ {
+ target: '.btn-add',
+ content: this.$t('You can add a new schedule by clicking this button.')
+ }
+ ],
+ tourCallbacks: {
+ onStop: () => {
+ this.$utils.tour.finishTour('schedule-list')
+ },
+ onPreviousStep: (currentStep) => {
+ if (currentStep === 2) {
+ this.dialogVisible = false
+ }
+ },
+ onNextStep: (currentStep) => {
+ if (currentStep === 1) {
+ this.isEdit = false
+ this.dialogVisible = true
+ this.$store.commit('schedule/SET_SCHEDULE_FORM', { node_ids: [] })
+ }
+ }
+ },
+ tourAddSteps: [
+ {
+ target: '.add-form',
+ content: this.$t('You should fill the form before adding the new schedule.'),
+ params: {
+ placement: 'right'
+ }
+ },
+ {
+ target: '#schedule-name',
+ content: this.$t('The name of the schedule'),
+ params: {
+ placement: 'right'
+ }
+ },
+ {
+ target: '#run-type',
+ content: this.$t('The type of how to run the task.
Please refer to the
Documentation (Chinese) for detailed explanation for the options.
Let\'s select
Selected Nodes for example.'),
+ params: {
+ placement: 'right'
+ }
+ },
+ {
+ target: '#spider-id',
+ content: this.$t('The spider to run'),
+ params: {
+ placement: 'right'
+ }
+ },
+ {
+ target: '#cron',
+ content: this.$t('
Cron expression for the schedule.
If you are not sure what a cron expression is, please refer to this
Article.'),
+ params: {
+ placement: 'right'
+ }
+ },
+ {
+ target: '#change-crontab',
+ content: this.$t('You can select the correct options in the cron config box to configure the cron expression.'),
+ params: {
+ placement: 'top'
+ }
+ },
+ {
+ target: '#param',
+ content: this.$t('The parameters which will be passed into the spider program.'),
+ params: {
+ placement: 'right'
+ }
+ },
+ {
+ target: '#schedule-description',
+ content: this.$t('The description for the schedule'),
+ params: {
+ placement: 'right'
+ }
+ },
+ {
+ target: '#btn-submit',
+ content: this.$t('Once you have filled all fields, click this button to submit.'),
+ params: {
+ placement: 'right'
+ }
+ }
+ ],
+ tourAddCallbacks: {
+ onStop: () => {
+ this.$utils.tour.finishTour('schedule-list-add')
+ },
+ onPreviousStep: (currentStep) => {
+ if (currentStep === 4) {
+ this.isShowCron = false
+ } else if (currentStep === 6) {
+ this.isShowCron = true
+ }
+ },
+ onNextStep: (currentStep) => {
+ if (currentStep === 3) {
+ this.isShowCron = true
+ } else if (currentStep === 5) {
+ this.isShowCron = false
+ }
+ }
+ }
}
},
computed: {
@@ -274,6 +414,12 @@ export default {
this.dialogVisible = true
this.$store.commit('schedule/SET_SCHEDULE_FORM', { node_ids: [] })
this.$st.sendEv('定时任务', '添加定时任务')
+
+ if (!this.$utils.tour.isFinishedTour('schedule-list-add')) {
+ setTimeout(() => {
+ this.$tours['schedule-list-add'].start()
+ }, 500)
+ }
},
onAddSubmit () {
this.$refs.scheduleForm.validate(res => {
@@ -377,6 +523,13 @@ export default {
.then(response => {
this.spiderList = response.data.data.list || []
})
+ },
+ mounted () {
+ if (!this.isDisabledSpiderSchedule) {
+ if (!this.$utils.tour.isFinishedTour('schedule-list')) {
+ this.$tours['schedule-list'].start()
+ }
+ }
}
}