prepareForm()

in frontend/src/app/modules/config-editor/components/config-editor/config-editor.component.ts [347:395]


  prepareForm() {
    if (this.mappings?.db_type !== 'RAC') {
      delete this.configEditorForm.value.rac_config_values;
      delete this.configEditorForm.controls.rac_config_values;
    } else {
      this.configEditorForm.setValidators(this.checkScanIpValidator());
      this.racNodes.updateValueAndValidity();

      this.configEditorForm.value.rac_config_values.rac_nodes.forEach((racNode: Node) => {
        if (racNode.node_id) {
          this.targets.forEach(target => {
            if (target.id === racNode.node_id) {
              racNode.node_ip = target.client_ip + '';
            }
          });
        }
      });
    }

    let oracleRootPrev = ''
    this.ldspFaDevices.controls.map( element => {
      if(element.value.purpose === 'software'){
        oracleRootPrev = `${element.value.mount_point}`
      }
    })

    let swap_blk_device = null;
    this.ldspFaDevices.controls.map((e, i) => {
      if(e.value.purpose === 'swap' && e.value.blk_device) {
        swap_blk_device = e.value.blk_device;
        this.configEditorForm.value.data_mounts_values.splice(i, 1);
      }
    })

    if(swap_blk_device) {
      this.configEditorForm.get('misc_config_values')?.get('swap_blk_device')?.setValue(swap_blk_device);
    }
    else {
      this.configEditorForm.get('misc_config_values')?.get('swap_blk_device')?.setValue('');
    }

    this.configEditorForm.get('misc_config_values')?.get('oracle_root')?.setValue(oracleRootPrev + '/app');

    const localSwapNameValidation = this.ldspFaDevices.controls.find((device: any) => device.get('purpose')!.value === 'swap');
    if (localSwapNameValidation) {
      localSwapNameValidation.get('name')?.setErrors(null);
      localSwapNameValidation.get('mount_point')?.setErrors(null);
    }
  }