2018-05-30 09:39:26 +00:00
|
|
|
import {
|
|
|
|
AfterContentInit, Component, Input,
|
|
|
|
EventEmitter,
|
2018-05-30 14:05:58 +00:00
|
|
|
Output,
|
|
|
|
OnChanges,
|
|
|
|
SimpleChanges
|
2018-05-30 09:39:26 +00:00
|
|
|
} from '@angular/core';
|
2018-05-30 14:05:58 +00:00
|
|
|
import { Anim } from './animation';
|
2018-06-01 07:32:16 +00:00
|
|
|
import { TreeNode } from 'primeng/primeng';
|
2018-05-30 09:39:26 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'of-discovery-result',
|
|
|
|
templateUrl: './search-result.component.html',
|
2018-05-30 14:05:58 +00:00
|
|
|
animations: Anim
|
2018-05-30 09:39:26 +00:00
|
|
|
})
|
2018-05-30 14:05:58 +00:00
|
|
|
export class SearchResultComponent implements OnChanges {
|
2018-05-30 09:39:26 +00:00
|
|
|
|
|
|
|
@Output() stop = new EventEmitter();
|
2018-05-30 14:05:58 +00:00
|
|
|
@Input() started: boolean;
|
|
|
|
|
2018-06-01 07:32:16 +00:00
|
|
|
zoneNode: TreeNode[] = [];
|
|
|
|
hostNode: TreeNode[] = [];
|
2018-05-30 09:39:26 +00:00
|
|
|
|
|
|
|
constructor(
|
|
|
|
) {
|
2018-06-01 07:32:16 +00:00
|
|
|
this.zoneNode.push({
|
|
|
|
label: 'zone',
|
|
|
|
children: this.hostNode,
|
|
|
|
expanded: true
|
|
|
|
});
|
2018-05-30 09:39:26 +00:00
|
|
|
}
|
2018-05-30 14:05:58 +00:00
|
|
|
|
|
|
|
ngOnChanges(changes: SimpleChanges): void {
|
|
|
|
}
|
|
|
|
|
|
|
|
onStop() {
|
|
|
|
this.stop.emit();
|
|
|
|
}
|
|
|
|
|
2018-06-01 07:32:16 +00:00
|
|
|
test() {
|
2018-05-30 14:05:58 +00:00
|
|
|
}
|
|
|
|
|
2018-06-01 07:32:16 +00:00
|
|
|
addHostNode() {
|
|
|
|
const idx = Math.floor(Math.random() * (this.hostNode.length - 1));
|
|
|
|
this.hostNode.splice(idx, 0, {
|
|
|
|
label: 'host',
|
|
|
|
expanded: true,
|
|
|
|
children: []
|
|
|
|
});
|
|
|
|
}
|
|
|
|
addServiceNode() {
|
|
|
|
const idx = Math.floor(Math.random() * (this.hostNode.length - 1));
|
|
|
|
this.hostNode[idx].children.push({
|
|
|
|
label: 'service',
|
|
|
|
});
|
|
|
|
}
|
2018-05-30 09:39:26 +00:00
|
|
|
}
|