feat: update

parent 4e7f081f
......@@ -15,7 +15,6 @@ import {ElementSettingsComponent} from './settings/settings.component';
import {ElementDialogAlertComponent} from './dialog/dialog.service';
import {ElementGuacamoleComponent} from './guacamole/guacamole.component';
import {ElementAssetTreeComponent} from './asset-tree/asset-tree.component';
import {ElementTreeComponent} from './tree/tree.component';
export const ElementComponents = [
ElementLeftbarComponent,
......@@ -34,5 +33,4 @@ export const ElementComponents = [
ElementDialogAlertComponent,
ElementGuacamoleComponent,
ElementAssetTreeComponent,
ElementTreeComponent
];
<div *ngFor="let node of TreeData">
<div *ngIf="node.leafs?.length>0">
{{node.id}}
<elements-tree [TreeData]="node.leafs"></elements-tree>
</div>
<div *ngIf="node.leafs?.length==0">
{{node.id}}
</div>
</div>
<!--<ul class="filetree ">-->
<!--<li *ngFor="let hostGroup of HostGroups | SearchFilter: q; let i = index ">-->
<!--<input type="checkbox" id="hostgroup-{{i}}">-->
<!--<label for="hostgroup-{{i}}" matTooltip="{{hostGroup.name}}" [matTooltipPosition]="TooltipPosition">{{hostGroup.name}}</label>-->
<!--</li>-->
<!--</ul>-->
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ElementTreeComponent } from './tree.component';
describe('R ', () => {
let component: ElementTreeComponent;
let fixture: ComponentFixture<ElementTreeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ElementTreeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ElementTreeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import {Component, Input, OnInit} from '@angular/core';
import {HttpService} from '../../app.service';
export interface Assets {
name: string;
id: string;
type: string;
}
export interface Groups {
id: string;
key: string;
name: string;
value: string;
parent: string;
assets_granted: Array<Assets>;
}
export class TreeStruct {
id: string;
leafs: Array<TreeStruct>;
static create(id, parent: string) {
const tmp = new TreeStruct();
tmp.id = id;
tmp.leafs = [];
return tmp;
}
}
@Component({
selector: 'elements-tree',
templateUrl: './tree.component.html',
styleUrls: ['./tree.component.scss']
})
export class ElementTreeComponent implements OnInit {
@Input() TreeData: Array<TreeStruct>;
constructor(private _http: HttpService) {
}
ngOnInit() {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment