renderConfigurationForm()

in widgets/time-tracking-report/src/app/widget.js [373:418]


  renderConfigurationForm() {
    const submitForm = async (selectedReportId, refreshPeriod, youTrack) => {
      const {yAxis} = this.state;
      const reportIsChanged = selectedReportId !== (this.state.report || {}).id;
      this.setState({
        youTrack,
        isLoading: reportIsChanged,
        report: reportIsChanged ? null : this.state.report,
        error: ReportModel.ErrorTypes.OK
      }, async () => {
        const reportWithData = await this.loadReportWithAppliedConfigSettings(
          selectedReportId, yAxis, youTrack
        );
        if (reportWithData) {
          this.setState({
            report: reportWithData,
            isLoading: false,
            isNewWidget: false,
            refreshPeriod
          }, async () =>
            await Promise.all([
              this.recalculateIfRequired(),
              this.saveConfig()
            ])
          );
        }
      });
    };

    const {
      report, refreshPeriod, youTrack
    } = this.state;

    return (
      <Configuration
        reportId={(report || {}).id}
        refreshPeriod={refreshPeriod}
        onSubmit={submitForm}
        onCancel={this.cancelConfig}
        onGetReportDraft={ReportModel.NewReport.timeTracking}
        dashboardApi={this.props.dashboardApi}
        youTrackId={youTrack.id}
        youTrackMinVersion="2020.1.3111"
      />
    );
  }