renderConfigurationForm()

in widgets/agile-charts/src/app/widget.js [296:345]


  renderConfigurationForm() {

    const submitForm = async (settings, refreshPeriod, youTrack) => {
      const reportIsChanged =
        settings.reportId !== (this.state.report || {}).id;
      this.setState({
        youTrack,
        isLoading: reportIsChanged,
        isConfiguring: false,
        report: reportIsChanged ? null : this.state.report,
        error: ReportModel.ErrorTypes.OK
      }, async () => {
        const selectedReportId =
          await AgileProgressDiagramWidget.getSelectedReportId(
            this.fetchYouTrack, settings
          );
        const reportWithData = await this.loadReport(
          selectedReportId, youTrack
        );
        if (reportWithData) {
          this.setState({
            report: reportWithData,
            isLoading: false,
            isCalculationCompleted: false,
            refreshPeriod
          }, async () => await Promise.all([
            this.saveConfig(settings), this.recalculateIfRequired()
          ]));
        }
      });
    };

    const {
      refreshPeriod, youTrack
    } = this.state;
    const settings = this.props.configWrapper.getFieldValue('settings') || {};

    return (
      <Configuration
        reportId={settings.reportId}
        agileId={settings.agileId}
        sprintId={settings.sprintId}
        refreshPeriod={refreshPeriod}
        onSubmit={submitForm}
        onCancel={this.cancelConfig}
        dashboardApi={this.props.dashboardApi}
        youTrackId={youTrack.id}
      />
    );
  }