blob: bf930f3e21a1cf936a34aebe5b102b6d847d6291 [file] [log] [blame]
import { Component, Input, ViewChild } from '@angular/core';
import { NgForm } from '@angular/forms';
import { includes } from 'lodash';
import { Store } from '../store/store';
@Component({
selector: 'app-bar-icons',
templateUrl: './bar-icons.component.html',
styleUrls: ['./bar-icons.component.scss']
})
export class BarIconsComponent {
configuration;
@Input() tabName: string;
@ViewChild('cdumpConfForm') cdumpConfForm: NgForm;
dropDownTypes = {
none: 1,
regularDDL: 2,
booleanDDL: 3
};
constructor(public store: Store) {}
onChange(e) {
this.store.cdumpIsDirty = true;
}
isPropertyDdl(property) {
if (property.hasOwnProperty('constraints')) {
if (includes(property.constraints[0].valid_values, property.value)) {
return this.dropDownTypes.regularDDL;
} else if (
property.hasOwnProperty('type') &&
property.type === 'boolean'
) {
if (!(property.value === 'false')) {
property.value = true;
}
return this.dropDownTypes.booleanDDL;
}
}
return this.dropDownTypes.none;
}
genrateBarTestId() {
return `${this.tabName}-bar-icon-container`;
}
enableSetting() {
this.store.expandAdvancedSetting[this.store.tabIndex] = !this.store
.expandAdvancedSetting[this.store.tabIndex];
}
}