Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 111x 3x 3x 3x 3x 3x 3x 108x | import { Component, OnInit, ViewChild, inject } from '@angular/core';
import { CustomView } from '../../models/customView';
import { TableModule } from 'primeng/table';
import { TagModule } from 'primeng/tag';
import { ContextMenu, ContextMenuModule } from 'primeng/contextmenu';
import { MenuItem } from 'primeng/api';
import { Router, RouterModule } from '@angular/router';
import { TwinpadApiService } from '../../services/twinpad-api.service';
@Component({
selector: 'app-custom-views',
imports: [TableModule, TagModule, RouterModule, ContextMenuModule],
templateUrl: './custom-views.component.html',
styleUrl: './custom-views.component.scss'
})
export class CustomViewsComponent implements OnInit {
private twinpadApiService = inject(TwinpadApiService);
private router = inject(Router);
@ViewChild("contextMenu", { static: true }) contextMenu!: ContextMenu;
customViews: CustomView[];
rightClickedCustomView: CustomView | undefined;
items: MenuItem[] = [
{ label: "Open custom view in new tab",
icon: "pi pi-link",
command: () => {
if (this.rightClickedCustomView === undefined) {
return;
}
const url = this.router.serializeUrl(
this.router.createUrlTree(["/custom-views", this.rightClickedCustomView.id])
);
window.open(url, "_blank");
}},
{ label: "Open custom view in new window",
icon: "pi pi-external-link",
command: () => {
if (this.rightClickedCustomView === undefined) {
return;
}
const url = this.router.serializeUrl(
this.router.createUrlTree(["/custom-views", this.rightClickedCustomView.id])
);
window.open(url, "_blank", "popup");
}},
];
ngOnInit(): void {
this.twinpadApiService.getProfile().subscribe({
next: value => {
this.twinpadApiService.getCustomViewsFromUserId(value.id).subscribe({
next: value => {
this.customViews = value;
},
error: error => {
console.log(error.error);
}
});
},
error: error => {
console.log(error.error);
}
});
}
onContextMenu(event: MouseEvent, customView: CustomView) {
event.preventDefault();
this.contextMenu.show(event);
this.rightClickedCustomView = customView;
}
onHide() {
this.rightClickedCustomView = undefined;
}
}
|