private setScheduleByTime()

in services/self-service/src/main/resources/webapp/src/app/resources/scheduler/scheduler.component.ts [223:263]


  private setScheduleByTime() {
    const data = {
      startDate: this.schedulerForm.controls.startDate.value,
      finishDate: this.schedulerForm.controls.finishDate.value,
      terminateDate: this.schedulerForm.controls.terminateDate.value
    };
    const terminateDateTime = (data.terminateDate && this.terminateTime)
      ? `${_moment(data.terminateDate).format(this.date_format)} ${SchedulerCalculations.convertTimeFormat(this.terminateTime)}`
      : null;

    if (!this.startTime && !this.endTime && !this.terminateTime && this.enableSchedule) {
      this.timeReqiered = true;
      return false;
    }

    if ((data.terminateDate && !this.terminateTime) || (!data.terminateDate && this.terminateTime)) {
      this.terminateDataReqiered = true;
      return false;
    }

    const selectedDays = Object.keys(this.selectedStartWeekDays);
    const parameters: ScheduleSchema = {
      begin_date: data.startDate ? _moment(data.startDate).format(this.date_format) : null,
      finish_date: data.finishDate ? _moment(data.finishDate).format(this.date_format) : null,
      start_time: this.startTime ? SchedulerCalculations.convertTimeFormat(this.startTime) : null,
      end_time: this.endTime ? SchedulerCalculations.convertTimeFormat(this.endTime) : null,
      start_days_repeat: selectedDays.filter(el => Boolean(this.selectedStartWeekDays[el])).map(day => day.toUpperCase()),
      stop_days_repeat: selectedDays.filter(el => Boolean(this.selectedStopWeekDays[el])).map(day => day.toUpperCase()),
      timezone_offset: this.tzOffset,
      sync_start_required: this.inherit,
      check_inactivity_required: this.enableIdleTime,
      terminate_datetime: terminateDateTime
    };

    if (this.destination.type === 'СOMPUTATIONAL') {
      this.model.confirmAction(this.notebook.project, this.notebook.name, parameters, this.destination.computational_name);
    } else {
      parameters['consider_inactivity'] = this.considerInactivity;
      this.model.confirmAction(this.notebook.project, this.notebook.name, parameters);
    }
  }