55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
|
import { Button } from 'primeng/button';
|
|
import { Product, ProductService } from '@/app/pages/service/product.service';
|
|
import { FormsModule } from '@angular/forms';
|
|
import { TableModule } from 'primeng/table';
|
|
import { CoolifyService } from '@/app/core/service/coolify.service';
|
|
import { Project } from '@/app/core/domain/Project';
|
|
|
|
@Component({
|
|
selector: 'app-teste',
|
|
imports: [FormsModule, TableModule, Button],
|
|
templateUrl: './teste.html',
|
|
styleUrl: './teste.scss'
|
|
})
|
|
export class Teste implements OnInit {
|
|
layout: 'list' | 'grid' = 'list';
|
|
|
|
isLoadingTable: boolean = true;
|
|
|
|
projects: Project[] = [];
|
|
project: Project = new Project();
|
|
|
|
constructor(
|
|
private productService: ProductService,
|
|
private nexusService: CoolifyService,
|
|
private cd: ChangeDetectorRef,
|
|
) {}
|
|
|
|
ngOnInit() {
|
|
|
|
this.buscarProjects();
|
|
}
|
|
|
|
buscarProjects() {
|
|
this.isLoadingTable = true;
|
|
|
|
this.nexusService.getProjects()
|
|
.subscribe((data) => {
|
|
if (data && data.length > 0) {
|
|
this.projects = [...data];
|
|
this.isLoadingTable = false;
|
|
console.log(data);
|
|
this.cd.detectChanges();
|
|
}
|
|
else {
|
|
console.log('Nada aqui', data);
|
|
}
|
|
})
|
|
}
|
|
|
|
detalhes(project: Project): void {
|
|
console.log('Projeto enviado: ',project);
|
|
}
|
|
}
|