import { Component, OnInit } from '@angular/core';
import { TreeNode } from 'primeng/api';
import { AppBreadcrumbService } from 'src/app/app.breadcrumb.service';
import { NodeService } from 'src/app/shared/services/node.service';

@Component({
  selector: 'app-dashboard',
  templateUrl: './dashboard.component.html',
  styleUrls: ['./dashboard.component.scss']
})
export class DashboardComponent implements OnInit {

  files: TreeNode[];
  selectedFiles: TreeNode;

  constructor(private breadcrumbService: AppBreadcrumbService, private nodeService: NodeService) {
    this.breadcrumbService.setItems([
      { label: 'Dashboard' }
    ]);
  }

  ngOnInit(): void {
    this.nodeService.getFiles().then(files => {
      this.files = [{
        label: 'src',
        "expanded":true,
        children: files
      }];
    });

  }

}
