registerEvents()

in source/webapp/src/lib/js/settingsTabPanel.js [545:617]


  registerEvents() {
    $('#settingsTab').off('show.bs.tab').on('show.bs.tab', async () => {
      this.loadSettings();
    });

    $('#debug_window', this.generalForm).off('change').change((event) => {
      event.preventDefault();
      if ($(event.currentTarget).prop('checked')) {
        Storage.setOption('debug_window', true);
        this.systemMessage.show();
      } else {
        Storage.setOption('debug_window', false);
        this.systemMessage.hide();
      }
    });

    $('#pageSize', this.generalForm).off('change').change((event) => {
      event.preventDefault();
      const pageSize = $(event.currentTarget).val();
      Storage.setOption('pageSize', pageSize);
    });

    $('#mapApiKey', this.generalForm).off('change').change((event) => {
      event.preventDefault();
      const mapApiKey = $(event.currentTarget).val();
      Storage.setOption('mapApiKey', mapApiKey);
    });

    Object.keys(SUPPORTED_AIOPTIONS).forEach((option) => {
      const element = $(`#${option}`, this.aiForm);

      element.off('change').change((event) => {
        event.preventDefault();
        if (option === 'languageCode') {
          const language = $(event.currentTarget).val();
          Storage.setOption(option, language);
          this.checkComprehendLanguages(language);
        } else if (option === 'minConfidence') {
          const minConfidence = $(event.currentTarget).val();
          Storage.setOption(option, minConfidence);
        } else {
          const enabled = !!$(event.currentTarget).prop('checked');
          Storage.setOption(option, enabled);
        }
      });
    });

    $('#minConfidence', this.aiForm).off('input').on('input', (event) => {
      const minConfidence = $(event.currentTarget).val();
      $('#minConfidence-text', this.aiForm).val(minConfidence);
    });

    $(`#${SettingsTabPanel.Constants.Id.AIML}`).find('[data-action]').each((key, val) => {
      $(val).off('click').on('click', async (event) => {
        event.preventDefault();
        await this.onAction($(event.currentTarget).data('action'));
      });
    });

    $(`#${SettingsTabPanel.Constants.Id.FaceCollection}`).find('[data-action]').each((key, val) => {
      $(val).off('click').on('click', async (event) => {
        event.preventDefault();
        await this.onAction($(event.currentTarget).data('action'));
      });
    });

    $(`#${SettingsTabPanel.Constants.Id.GroundTruth}`).find('[data-action]').each((key, val) => {
      $(val).off('click').on('click', async (event) => {
        event.preventDefault();
        await this.onAction($(event.currentTarget).data('action'));
      });
    });
  }