client/webserver/site/src/js/forms.js
/*
   * fileInputChanged will read the selected file and attempt to load the
   * configuration settings. All loaded settings will be made visible for
   * inspection by the user.
   */
fileInputChanged will read the selected file and attempt to load the
configuration settings. All loaded settings will be made visible for
inspection by the user.
fileInputChanged will read the selected file and attempt to load the configuration settings . All loaded settings will be made visible for inspection by the user .
async fileInputChanged () {
    if (!this.fileInput.value) return
    app.loading(this.form)
    const config = await this.fileInput.files[0].text()
    if (!config) return
    const res = await postJSON('/api/parseconfig', {
      configtext: config
    })
    app.loaded()
    if (!app.checkResponse(res)) {
      this.errMsg.textContent = res.msg
      Doc.show(this.errMsg)
      return
    }
    if (Object.keys(res.map).length === 0) return
    this.dynamicOpts.append(...this.setConfig(res.map))
    this.reorder(this.dynamicOpts)
    const [loadedOpts, defaultOpts] = [this.loadedSettings.children.length, this.defaultSettings.children.length]
    if (loadedOpts === 0) Doc.hide(this.loadedSettings, this.loadedSettingsMsg)
    if (defaultOpts === 0) Doc.hide(this.defaultSettings, this.defaultSettingsMsg)
    if (loadedOpts + defaultOpts === 0) Doc.hide(this.showOther, this.otherSettings)
  }
async fileInputChanged ( ) { if ( ! this . fileInput . value ) return app . loading ( this . form ) const config = await this . fileInput . files [ 0 ] . text ( ) if ( ! config ) return const res = await postJSON ( '/api/parseconfig' , { configtext : config } ) app . loaded ( ) if ( ! app . checkResponse ( res ) ) { this . errMsg . textContent = res . msg Doc . show ( this . errMsg ) return } if ( Object . keys ( res . map ) . length === 0 ) return this . dynamicOpts . append ( ... this . setConfig ( res . map ) ) this . reorder ( this . dynamicOpts ) const [ loadedOpts , defaultOpts ] = [ this . loadedSettings . children . length , this . defaultSettings . children . length ] if ( loadedOpts === 0 ) Doc . hide ( this . loadedSettings , this . loadedSettingsMsg ) if ( defaultOpts === 0 ) Doc . hide ( this . defaultSettings , this . defaultSettingsMsg ) if ( loadedOpts + defaultOpts === 0 ) Doc . hide ( this . showOther , this . otherSettings ) }
fileInputChanged will read the selected file and attempt to load the
 configuration settings.
fileInputChanged will read the selected file and attempt to load the configuration settings .