1 import { Component, OnInit } from '@angular/core';
3 import * as _ from 'lodash';
4 import { BsModalRef } from 'ngx-bootstrap/modal';
6 import { IscsiService } from '../../../shared/api/iscsi.service';
9 selector: 'cd-iscsi-target-image-settings-modal',
10 templateUrl: './iscsi-target-image-settings-modal.component.html',
11 styleUrls: ['./iscsi-target-image-settings-modal.component.scss']
13 export class IscsiTargetImageSettingsModalComponent implements OnInit {
16 disk_default_controls: any;
22 constructor(public modalRef: BsModalRef, public iscsiService: IscsiService) {}
25 this.helpText = this.iscsiService.imageAdvancedSettings;
27 this.model = _.cloneDeep(this.imagesSettings[this.image]);
28 _.forEach(this.backstores, (backstore) => {
29 this.model[backstore] = this.model[backstore] || {};
34 const backstore = this.model.backstore;
36 _.forIn(this.model[backstore], (value, key) => {
37 if (!(value === '' || value === null)) {
38 settings[key] = value;
41 this.imagesSettings[this.image]['backstore'] = backstore;
42 this.imagesSettings[this.image][backstore] = settings;
43 this.imagesSettings = { ...this.imagesSettings };