async initializeExistingWidget()

in packages/issue-dashboard-widgets/widgets/due-dates-calendar/app/due_dates_calendar_widget.js [204:253]


  async initializeExistingWidget(youTrackService) {
    const search = this.props.configWrapper.getFieldValue('search');
    const context = this.props.configWrapper.getFieldValue('context');
    const refreshPeriod =
          this.props.configWrapper.getFieldValue('refreshPeriod');
    const title = this.props.configWrapper.getFieldValue('title');
    const view = this.props.configWrapper.getFieldValue('view');


    const scheduleField =
        this.props.configWrapper.getFieldValue('scheduleField') ||
        DEFAULT_SCHEDULE_FIELD;

    const eventEndField =
        this.props.configWrapper.getFieldValue('eventEndField') ||
        scheduleField;

    const colorField =
        this.props.configWrapper.getFieldValue('colorField') ||
        DEFAULT_COLOR_FIELD;

    const isDateAndTime =
        this.props.configWrapper.getFieldValue('isDateAndTime');

    const canResize = scheduleField !== eventEndField;

    this.setState({
      title,
      search: search || '',
      context,
      date: new Date(),
      view,
      scheduleField,
      eventEndField,
      isDateAndTime,
      colorField,
      canResize,
      refreshPeriod:
        refreshPeriod || DueDatesCalendarWidget.DEFAULT_REFRESH_PERIOD
    });
    await this.showListFromCache(search, context);

    if (youTrackService && youTrackService.id) {
      const onYouTrackSpecified = async () => {
        await this.loadIssues(search, context);
        this.setState({isLoading: false});
      };
      this.setYouTrack(youTrackService, onYouTrackSpecified);
    }
  }