summaryrefslogtreecommitdiffstats
path: root/public/src/app/bar-icons/bar-icons.component.ts
blob: adf4b8870147537412d6356bfcdb7f83ba9d7844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { Component, Input, ViewChild } from '@angular/core';
import { Store } from '../store/store';
import { includes } from 'lodash';
import { NgForm } from '@angular/forms';

@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;

  constructor(public store: Store) {}

  onChange(e) {
    this.store.cdumpIsDirty = true;
  }

  isPropertyDdl(property) {
    if (property.hasOwnProperty('constraints')) {
      if (
        includes(
          property.constraints[0].valid_values,
          property.assignment.value
        )
      ) {
        return true;
      } else {
        return false;
      }
    } else {
      return false;
    }
  }

  genrateBarTestId() {
    return `${this.tabName}-bar-icon-container`;
  }

  enableSetting() {
    this.store.expandAdvancedSetting[this.store.tabIndex] = !this.store
      .expandAdvancedSetting[this.store.tabIndex];
  }
}