• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { BaseElement, element } from '../../../../base-ui/BaseElement';
17import '../../../../base-ui/select/LitSelect';
18import '../../../../base-ui/select/LitSelectOption';
19import '../../../../base-ui/icon/LitIcon';
20import { LitIcon } from '../../../../base-ui/icon/LitIcon';
21import '../../../../base-ui/popover/LitPopoverV';
22import { LitCheckBox } from '../../../../base-ui/checkbox/LitCheckBox';
23import { LitSelect } from '../../../../base-ui/select/LitSelect';
24import {queryTransferList} from "../../../database/sql/Perf.sql";
25import { TabPaneFilterHtml } from './TabPaneFilter.html';
26
27export interface FilterData {
28  inputValue: string;
29  firstSelect: string | null | undefined;
30  secondSelect: string | null | undefined;
31  thirdSelect: string | null | undefined;
32  mark: boolean | null | undefined;
33  icon: string | null;
34  type: string;
35}
36
37export interface MiningData {
38  type: string;
39  item: any | null | undefined;
40  remove?: Array<any> | null | undefined;
41}
42
43@element('tab-pane-filter')
44export class TabPaneFilter extends BaseElement {
45  private filterInputEL: HTMLInputElement | null | undefined;
46  private firstSelectEL: HTMLSelectElement | null | undefined;
47  private secondSelectEL: HTMLSelectElement | null | undefined;
48  private thirdSelectEL: LitSelect | null | undefined;
49  private markButtonEL: HTMLButtonElement | null | undefined;
50  private iconEL: LitIcon | null | undefined;
51  private statisticsName: HTMLDivElement | null | undefined;
52  private getFilter: ((e: FilterData) => void) | undefined;
53  private getMining: ((e: MiningData) => void) | undefined;
54  private getLibrary: ((e: MiningData) => void) | undefined;
55  private getCallTree: ((e: any) => void) | undefined;
56  private getCallTreeConstraints: ((e: any) => void) | undefined;
57  private getStatisticsType: ((e: any) => void) | undefined;
58  private getCallTransfer: ((e: any) => void) | undefined;
59
60  private cutList: Array<any> | undefined;
61  private libraryList: Array<any> | undefined;
62  private transferChecked: string | undefined;
63  private isStatisticsMem: Boolean = false;
64
65  get isStatisticsMemory() {
66    return this.isStatisticsMem;
67  }
68  set isStatisticsMemory(value) {
69    let hideThreadEL = this.shadowRoot?.querySelector('.popover .tree-check:nth-child(4)');
70    if (value) {
71      hideThreadEL?.classList.add('hide');
72    } else {
73      if (hideThreadEL!.classList.contains('hide')) {
74        hideThreadEL!.classList.remove('hide');
75      }
76    }
77  }
78
79  filterData(type: string, data: object = {}) {
80    return {
81      type: type,
82      inputValue: this.filterInputEL!.value,
83      firstSelect: this.firstSelectEL?.value,
84      secondSelect: this.secondSelectEL?.value,
85      thirdSelect: this.thirdSelectEL?.value,
86      mark: false,
87      icon: this.icon,
88      ...data,
89    };
90  }
91
92  showThird(b: boolean): void {
93    if (b) {
94      if (this.thirdSelectEL?.value) {
95        this.setAttribute('third', '');
96      } else {
97        this.removeAttribute('third');
98      }
99    } else {
100      this.removeAttribute('third');
101    }
102  }
103
104  disabledTransfer(b: boolean, str?: string): void {
105    if (b) {
106      this.setAttribute('disableTransfer', '');
107    } else {
108      if (str === 'perf') {
109        this.setAttribute('perf', 'perf');
110      }
111      this.removeAttribute('disableTransfer');
112    }
113  }
114
115  initElements(): void {
116    this.cutList = [];
117    this.libraryList = [];
118    this.filterInputEL = this.shadowRoot?.querySelector('#pane-filter-input');
119    this.markButtonEL = this.shadowRoot?.querySelector('#mark');
120    this.iconEL = this.shadowRoot?.querySelector<LitIcon>('#icon');
121    this.statisticsName = this.shadowRoot?.querySelector<HTMLDivElement>('.statistics-name');
122    let transferEL = this.shadowRoot?.querySelector<HTMLDivElement>('.transfer-text');
123    transferEL!.onclick = (): void => {
124      this.getTransferList();
125    };
126    this.setSelectList();
127    this.initializeCallTree();
128    this.initializeTreeConstraints();
129    this.initializeMining();
130    this.initializeLibrary();
131    this.initBaseElListener();
132    this.queryElListener();
133  }
134
135  private queryElListener(): void {
136    this.shadowRoot!.querySelectorAll<HTMLDivElement>('.mining-button').forEach(
137      (e: HTMLDivElement, idx: number): void => {
138        this.miningButtonClickListener(e, idx);
139      }
140    );
141    this.shadowRoot!.querySelector<HTMLDivElement>('.library-button')!.onclick = (ev): void => {
142      const restoreList = this.libraryList!.filter((item) => item.highlight === true);
143      const list = this.libraryList!.filter((item) => item.highlight === false);
144      this.libraryList = list;
145      if (this.getLibrary) {
146        this.getLibrary({
147          type: 'button',
148          item: 'restore',
149          remove: restoreList,
150        });
151      }
152      this.initializeLibrary();
153    };
154    this.shadowRoot!.querySelector<HTMLDivElement>('#data-mining')!.onclick = (e): void => {
155      if (this.getMining) {
156        this.getMining({ type: 'button', item: 'symbol' });
157      }
158    };
159    this.shadowRoot!.querySelector<HTMLDivElement>('#data-library')!.onclick = (e): void => {
160      if (this.getLibrary) {
161        this.getLibrary({ type: 'button', item: 'library' });
162      }
163    };
164    this.shadowRoot!.querySelector<HTMLDivElement>('.sort')!.onclick = (e): void => {
165      let statisticsType = this.statisticsName!.textContent === 'Statistics by Operation';
166      this.statisticsName!.textContent = statisticsType ? 'Statistics by Thread' : 'Statistics by Operation';
167      if (this.getStatisticsType) {
168        this.getStatisticsType(statisticsType ? 'thread' : 'operation');
169      }
170    };
171  }
172
173  private initBaseElListener(): void {
174    this.iconEL!.onclick = (): void => {
175      if (this.iconEL!.name === 'statistics') {
176        this.iconEL!.name = 'menu';
177        this.iconEL!.size = 18;
178        if (this.getFilter) {
179          this.getFilter(this.filterData('icon'));
180        }
181        if (this.getAttribute('perf') === 'perf') {
182          this.disabledTransfer(false);
183        }
184      } else if (this.iconEL!.name === 'menu') {
185        this.iconEL!.name = 'statistics';
186        this.iconEL!.size = 16;
187        if (this.getFilter) {
188          this.getFilter(this.filterData('icon'));
189        }
190        if (this.getAttribute('perf') === 'perf') {
191          this.disabledTransfer(true);
192        }
193      }
194    };
195    this.markButtonEL!.onclick = (): void => {
196      if (this.getFilter) {
197        this.getFilter(this.filterData('mark', { mark: true }));
198      }
199    }
200    this.filterInputEL?.addEventListener('keyup', (event: any): void => {
201      if (event.keyCode === 13 && this.getFilter) {
202        this.getFilter(
203          this.filterData('inputValue', {
204            inputValue: event.target.value,
205          })
206        );
207      }
208      event.stopPropagation();
209    });
210    this.filterInputEL?.addEventListener('keypress', (event: any): void => {
211      event.stopPropagation();
212    });
213  }
214
215  private miningButtonClickListener(e: HTMLDivElement, idx: number): void {
216    e!.onclick = (ev): void => {
217      if (idx === 0) {
218        const restoreList = this.cutList!.filter((item: any): boolean => item.highlight === true);
219        const list = this.cutList!.filter((item): boolean => item.highlight === false);
220        this.cutList = list;
221        if (this.getMining) {
222          this.getMining({
223            type: 'button',
224            item: 'restore',
225            remove: restoreList,
226          });
227        }
228        this.initializeMining();
229      }
230    };
231  }
232
233  set firstSelect(value: string) {
234    this.firstSelectEL!.value = value;
235  }
236
237  get firstSelect(): string {
238    return this.firstSelectEL?.value || '';
239  }
240
241  set secondSelect(value: string) {
242    this.secondSelectEL!.value = value;
243  }
244
245  get secondSelect(): string {
246    return this.secondSelectEL?.value || '';
247  }
248
249  set filterValue(value: string) {
250    this.filterInputEL!.value = value;
251  }
252
253  get filterValue(): string {
254    return this.filterInputEL!.value;
255  }
256
257  set thirdSelect(value: string) {
258    this.thirdSelectEL!.value = value;
259  }
260
261  get thirdSelect(): string {
262    return this.thirdSelectEL?.value || '';
263  }
264
265  get inputPlaceholder(): string {
266    return this.getAttribute('inputPlaceholder') || 'Detail Filter';
267  }
268
269  get icon(): string {
270    if (this.getAttribute('icon') != 'false') {
271      if (this.iconEL!.name == 'statistics') {
272        return 'tree';
273      } else if (this.iconEL!.name == 'menu') {
274        return 'block';
275      } else {
276        return '';
277      }
278    } else {
279      return '';
280    }
281  }
282
283  set icon(value: string) {
284    if (value == 'block') {
285      this.iconEL!.name = 'menu';
286      this.iconEL!.size = 18;
287    } else if (value == 'tree') {
288      this.iconEL!.name = 'statistics';
289      this.iconEL!.size = 16;
290    }
291  }
292
293  get disabledMining(): boolean {
294    return this.hasAttribute('disabledMining');
295  }
296
297  set disabledMining(value: boolean) {
298    if (value) {
299      this.setAttribute('disabledMining', '');
300    } else {
301      this.removeAttribute('disabledMining');
302    }
303  }
304
305  setFilterModuleSelect(module: string, styleName: any, value: any): void {
306    this.shadowRoot!.querySelector<HTMLDivElement>(module)!.style[styleName] = value;
307  }
308
309  getCallTreeData(getCallTree: (v: any) => void): void {
310    this.getCallTree = getCallTree;
311  }
312
313  getCallTransferData(getCallTransfer: (v: any) => void): void {
314    this.getCallTransfer = getCallTransfer;
315  }
316
317  getCallTreeConstraintsData(getCallTreeConstraints: (v: any) => void): void {
318    this.getCallTreeConstraints = getCallTreeConstraints;
319  }
320
321  getFilterData(getFilter: (v: FilterData) => void): void {
322    this.getFilter = getFilter;
323  }
324
325  getStatisticsTypeData(getStatisticsType: (v: any) => void): void {
326    this.getStatisticsType = getStatisticsType;
327  }
328
329  setSelectList(
330    firstList: Array<any> | null | undefined = ['All Allocations', 'Created & Existing', 'Created & Destroyed'],
331    secondList: Array<any> | null | undefined = ['All Heap & Anonymous VM', 'All Heap', 'All Anonymous VM'],
332    firstTitle = 'Allocation Lifespan',
333    secondTitle = 'Allocation Type',
334    thirdList: Array<any> | null | undefined = null,
335    thirdTitle = 'Responsible Library'
336  ): void {
337    let sLE = this.shadowRoot?.querySelector('#load');
338    let html = ``;
339    html = this.getSelectFirstListHtml(firstTitle, firstList, html);
340    html = this.getSelectSecondListHtml(secondTitle, secondList, html);
341    let thtml = this.getSelectThirdListHtml(thirdTitle, thirdList);
342    if (!firstList && !secondList) {
343      this.thirdSelectEL!.outerHTML = thtml;
344      this.thirdSelectEL = this.shadowRoot?.querySelector('#third-select');
345      this.thirdSelectEL!.onchange = (e): void => {
346        if (this.getFilter) {
347          this.getFilter(this.filterData('thirdSelect'));
348        }
349      };
350      return;
351    }
352    if (!firstList) {
353      this.secondSelectEL!.outerHTML = html;
354    } else if (!secondList) {
355      this.firstSelectEL!.outerHTML = html;
356    } else {
357      sLE!.innerHTML = html + thtml;
358    }
359    this.thirdSelectEL = this.shadowRoot?.querySelector('#third-select');
360    this.thirdSelectEL!.outerHTML = thtml;
361    this.thirdSelectEL = this.shadowRoot?.querySelector('#third-select');
362
363    this.firstSelectEL = this.shadowRoot?.querySelector('#first-select');
364    this.secondSelectEL = this.shadowRoot?.querySelector('#second-select');
365    this.initSelectElListener();
366  }
367
368  private getSelectThirdListHtml(thirdTitle: string, thirdList: Array<any> | null | undefined): string {
369    let thtml = '';
370    if (thirdList) {
371      this.setAttribute('third', '');
372    }
373    thtml += `<lit-select show-search default-value="" id="third-select" class="spacing" placeholder="please choose">`;
374    if (thirdList) {
375      if (thirdTitle !== '') {
376        thtml += `<lit-select-option  value="${thirdTitle}" disabled>${thirdTitle}</lit-select-option>`;
377      }
378      thirdList!.forEach((a, b) => {
379        thtml += `<lit-select-option value="${b}">${a}</lit-select-option>`;
380      });
381    }
382    thtml += `</lit-select>`;
383    return thtml;
384  }
385
386  private getSelectSecondListHtml(secondTitle: string, secondList: Array<any> | null | undefined, html: string): string {
387    if (secondList) {
388      html += `<lit-select default-value="" id="second-select" class="spacing" placeholder="please choose">`;
389      if (secondTitle != '') {
390        html += `<lit-select-option value="${secondTitle}" disabled>${secondTitle}</lit-select-option>`;
391      }
392      secondList!.forEach((a, b) => {
393        html += `<lit-select-option value="${b}">${a}</lit-select-option>`;
394      });
395      html += `</lit-select>`;
396    }
397    return html;
398  }
399
400  private getSelectFirstListHtml(firstTitle: string, firstList: Array<any> | null | undefined, html: string): string {
401    if (firstList) {
402      html += `<lit-select default-value="" id="first-select" class="spacing" placeholder="please choose">`;
403      if (firstTitle != '') {
404        html += `<lit-select-option value="${firstTitle}" disabled>${firstTitle}</lit-select-option>`;
405      }
406      firstList!.forEach((a, b) => {
407        html += `<lit-select-option value="${b}">${a}</lit-select-option>`;
408      });
409      html += `</lit-select>`;
410    }
411    return html;
412  }
413
414  private initSelectElListener(): void{
415    this.firstSelectEL!.onchange = (e): void => {
416      if (this.getFilter) {
417        this.getFilter(this.filterData('firstSelect'));
418      }
419    };
420    this.secondSelectEL!.onchange = (e): void => {
421      if (this.getFilter) {
422        this.getFilter(this.filterData('secondSelect'));
423      }
424    };
425    this.thirdSelectEL!.onchange = (e): void => {
426      if (this.getFilter) {
427        this.getFilter(this.filterData('thirdSelect'));
428      }
429    };
430  }
431
432  setOptionsList(list: Array<any>) {
433    let divEl = this.shadowRoot!.querySelector('#check-popover > div');
434    divEl!.innerHTML = '';
435    for (let text of list) {
436      let idName = text.replace(/\s/g, '');
437      idName = idName[0].toLocaleLowerCase() + idName.slice(1);
438      divEl!.innerHTML += `<div class="check-wrap"><lit-check-box class="lit-check-box" id=${idName} not-close></lit-check-box><div>${text}</div></div>`;
439    }
440  }
441
442  private treeCheckClickSwitch(idx: number, check: boolean, row: NodeListOf<Element>): void{
443    let checkList = [];
444    for (let index = 0; index < 5; index++) {
445      if (idx === index) {
446        checkList.push(row[index].querySelector<LitCheckBox>('lit-check-box')!.checked)
447      } else {
448        checkList.push(check);
449      }
450    }
451    this.getCallTree!({
452      checks: [checkList[0], checkList[1], checkList[2], checkList[3], checkList[4]],
453      value: idx,
454    });
455  }
456
457  initializeCallTree() {
458    let row = this.shadowRoot!.querySelectorAll('.tree-check');
459    row.forEach((e, idx): void => {
460      let check = e.querySelector<LitCheckBox>('lit-check-box');
461      e.querySelector('div')!.onclick = (ev): void => {
462        if (this.getCallTree) {
463          this.treeCheckClickSwitch(idx, !check!.checked, row);
464        }
465        check!.checked = !check!.checked;
466      };
467      check!.onchange = (ev: any): void => {
468        if (this.getCallTree) {
469          this.treeCheckClickSwitch(idx, ev.target.checked, row);
470        }
471      };
472    });
473  }
474
475  initializeTreeTransfer(): void {
476    let radioList = this.shadowRoot!.querySelectorAll<HTMLInputElement>('.radio');
477    let divElement = this.shadowRoot!.querySelectorAll<HTMLDivElement>('.tree-radio');
478
479    if (this.transferChecked && this.transferChecked !== 'count') {
480      radioList![Number(this.transferChecked)].checked = true;
481    } else if (this.transferChecked && this.transferChecked === 'count') {
482      radioList![radioList.length - 1].checked = true;
483    }
484
485    divElement!.forEach((divEl, idx) => {
486      divEl.addEventListener('click', () => {
487        let filterData = this.getFilterTreeData();
488        if (filterData.callTree[0] === true || filterData.callTree[1] === true) {
489          let row = this.shadowRoot!.querySelectorAll<LitCheckBox>('.tree-check lit-check-box');
490          row[0].checked = false;
491          row[1].checked = false;
492        }
493        if (filterData.callTreeConstraints.checked === true) {
494          let check = this.shadowRoot!.querySelector<LitCheckBox>('#constraints-check');
495          let inputs = this.shadowRoot!.querySelectorAll<HTMLInputElement>('.constraints-input');
496          check!.checked = false;
497          inputs[0].value = '0';
498          inputs[1].value = '∞';
499        }
500        this.filterInputEL!.value = '';
501        this.transferChecked = radioList![idx].value;
502        radioList![idx].checked = true;
503        if (this.getCallTransfer) {
504          this.getCallTransfer({
505            value: radioList![idx].value,
506          });
507        }
508      });
509    });
510  }
511
512  refreshTreeTransfer(): void {
513    let radioList = this.shadowRoot!.querySelectorAll<HTMLInputElement>('.radio');
514    if (this.transferChecked && this.transferChecked !== 'count') {
515      radioList![Number(this.transferChecked)].checked = false;
516    } else if (this.transferChecked && this.transferChecked === 'count') {
517      radioList![radioList.length - 1].checked = false;
518    }
519    this.transferChecked = '';
520  }
521
522  initializeTreeConstraints(): void {
523    let inputs = this.shadowRoot!.querySelectorAll<HTMLInputElement>('.constraints-input');
524    let check = this.shadowRoot!.querySelector<LitCheckBox>('#constraints-check');
525    check!.onchange = (ev: any): void => {
526      inputs.forEach((e: any, idx: number): void => {
527        if (inputs[idx].value === '') {
528          inputs[idx].value = idx === 0 ? '0' : '∞';
529        }
530        ev.target.checked ? e.removeAttribute('disabled') : e.setAttribute('disabled', '');
531      });
532      if (this.getCallTreeConstraints) {
533        this.getCallTreeConstraints({
534          checked: ev.target.checked,
535          min: inputs[0].value,
536          max: inputs[1].value,
537        });
538      }
539    };
540    inputs.forEach((e: HTMLInputElement, idx: number): void => {
541      e.oninput = function () {
542        // @ts-ignore
543        this.value = this.value.replace(/\D/g, '');
544      };
545      e.addEventListener('keyup', (event: any): void => {
546        event.stopPropagation();
547        if (event.keyCode === 13) {
548          if (event?.target.value === '') {
549            inputs[idx].value = idx === 0 ? '0' : '∞';
550          }
551          if (this.getCallTreeConstraints) {
552            this.getCallTreeConstraints({
553              checked: check!.checked,
554              min: idx === 0 ? event?.target.value : inputs[0].value,
555              max: idx === 1 ? event?.target.value : inputs[1].value,
556            });
557          }
558        }
559      });
560    });
561  }
562
563  initializeMining(): void {
564    let html = ``;
565    this.cutList!.forEach((a: any, b: number): void => {
566      html += `<div style="display: flex;padding: 4px 7px;" class="mining-checked" ${a.highlight ? 'highlight' : ''}>
567                        <lit-check-box class="lit-check-box" not-close ${
568                          a.checked ? 'checked' : ''
569                        } style="display: flex"></lit-check-box>
570                        <div id="title" title="${a.name}">${a.name}</div></div>`;
571    });
572
573    this.shadowRoot!.querySelector<HTMLDivElement>('#mining-row')!.innerHTML = html;
574
575    let row = this.shadowRoot!.querySelector('#mining-row')!.childNodes;
576    row!.forEach((e: any, idx: number): void => {
577      e!.querySelector('#title')!.onclick = (ev: any): void => {
578        if (e.getAttribute('highlight') === '') {
579          e.removeAttribute('highlight');
580          this.cutList![idx].highlight = false;
581        } else {
582          e.setAttribute('highlight', '');
583          this.cutList![idx].highlight = true;
584        }
585      };
586      // @ts-ignore
587      e!.querySelector<LitCheckBox>('lit-check-box')!.onchange = (ev): void => {
588        // @ts-ignore
589        this.cutList[idx].checked = e!.querySelector<LitCheckBox>('lit-check-box')!.checked;
590        if (this.getMining) {
591          this.getMining({ type: 'check', item: this.cutList![idx] });
592        }
593      };
594    });
595  }
596
597  initializeLibrary(): void {
598    let html = ``;
599    this.libraryList!.forEach((a: any, b: number): void => {
600      html += `<div style="display: flex;padding: 4px 7px;" class="library-checked" ${a.highlight ? 'highlight' : ''}>
601                        <lit-check-box class="lit-check-box" not-close ${
602                          a.checked ? 'checked' : ''
603                        } style="display: flex"></lit-check-box>
604                        <div id="title" title="${a.name}">${a.name}</div></div>`;
605    });
606
607    this.shadowRoot!.querySelector<HTMLDivElement>('#library-row')!.innerHTML = html;
608
609    let row = this.shadowRoot!.querySelector('#library-row')!.childNodes;
610    row!.forEach((e: any, idx: number): void => {
611      e!.querySelector('#title')!.onclick = (ev: any): void => {
612        if (e.getAttribute('highlight') === '') {
613          e.removeAttribute('highlight');
614          this.libraryList![idx].highlight = false;
615        } else {
616          e.setAttribute('highlight', '');
617          this.libraryList![idx].highlight = true;
618        }
619      };
620
621      // @ts-ignore
622      e!.querySelector<LitCheckBox>('lit-check-box')!.onchange = (ev: any): void => {
623        // @ts-ignore
624        this.libraryList[idx].checked = e!.querySelector<LitCheckBox>('lit-check-box')!.checked;
625        if (this.getLibrary) {
626          this.getLibrary({
627            type: 'check',
628            item: this.libraryList![idx],
629          });
630        }
631      };
632    });
633  }
634
635  getDataMining(getMining: (v: MiningData) => void): void {
636    this.getMining = getMining;
637  }
638
639  getDataLibrary(getLibrary: (v: MiningData) => void): void {
640    this.getLibrary = getLibrary;
641  }
642
643  addDataMining(data: any, type: string): number {
644    let list: Array<any> = (type === 'symbol' ? this.cutList : this.libraryList) || [];
645    let idx = list!.findIndex((e) => e.name === data.name);
646    if (idx === -1) {
647      list!.push({
648        type: type,
649        name: data.name,
650        checked: true,
651        select: '1',
652        data: data,
653        highlight: false,
654      });
655    } else {
656      list![idx] = {
657        type: type,
658        name: data.name,
659        checked: true,
660        select: '1',
661        data: data,
662        highlight: false,
663      };
664    }
665    this.initializeMining();
666    this.initializeLibrary();
667    return idx;
668  }
669
670  getFilterTreeData(): {
671    callTree: boolean[];
672    callTreeConstraints: {
673      checked: boolean;
674      inputs: string[];
675    };
676    dataMining: any[] | undefined;
677    dataLibrary: any[] | undefined;
678  } {
679    let row = this.shadowRoot!.querySelectorAll<LitCheckBox>('.tree-check lit-check-box');
680    let inputs = this.shadowRoot!.querySelectorAll<HTMLInputElement>('.constraints-input');
681    let check = this.shadowRoot!.querySelector<LitCheckBox>('#constraints-check');
682    let data = {
683      callTree: [row[0]!.checked, row[1]!.checked, row[2]!.checked, row[3]!.checked, row[4]!.checked],
684      callTreeConstraints: {
685        checked: check!.checked,
686        inputs: [inputs[0].value == '' ? '0' : inputs[0].value, inputs[1].value == '' ? '∞' : inputs[1].value],
687      },
688      dataMining: this.cutList,
689      dataLibrary: this.libraryList,
690    };
691    return data;
692  }
693
694  async getTransferList(): Promise<void> {
695    let dataCmd: { id: number; cmdStr: string }[] = (await queryTransferList()) as { id: number; cmdStr: string }[];
696    let html = '';
697    dataCmd.forEach((item: { id: number; cmdStr: string }): void => {
698      html += `<div id="cycles-btn" class="tree-radio">
699      <input name="transfer" class="radio" type="radio" value="${item.id}" style="margin-right:8px" />${item.cmdStr}</div>`;
700    });
701    html += `<div id="cycles-btn" class="tree-radio">
702    <input name="transfer" class="radio" type="radio" value="count" style="margin-right:8px" />Count</div>`;
703    this.shadowRoot!.querySelector<HTMLDivElement>('#transfer-list')!.innerHTML = html;
704    this.initializeTreeTransfer();
705  }
706
707  initializeFilterTree(callTree: boolean = true, treeConstraints: boolean = true, mining: boolean = true): void {
708    if (callTree) {
709      let row = this.shadowRoot!.querySelectorAll('.tree-check');
710      row.forEach((e: Element, idx: number): void => {
711        let check = e.querySelector<LitCheckBox>('lit-check-box');
712        check!.checked = false;
713      });
714    }
715    if (treeConstraints) {
716      let inputs = this.shadowRoot!.querySelectorAll<HTMLInputElement>('.constraints-input');
717      if (inputs.length > 0) {
718        inputs[0].value = '0';
719        inputs[1].value = '∞';
720      }
721      let check = this.shadowRoot!.querySelector<LitCheckBox>('#constraints-check');
722      check!.checked = false;
723    }
724    if (mining) {
725      this.cutList = [];
726      this.libraryList = [];
727      this.initializeMining();
728      this.initializeLibrary();
729    }
730  }
731
732  initHtml(): string {
733    return TabPaneFilterHtml(this.inputPlaceholder);
734  }
735}
736