44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { Router } from '@angular/router';
|
|
import { Subscription } from 'rxjs';
|
|
import { SettingsService } from 'src/app/services/settings.service';
|
|
import { ViewService } from 'src/app/services/view.service';
|
|
|
|
@Component({
|
|
selector: 'ui-viewmenu',
|
|
templateUrl: 'viewmenu.ui.html',
|
|
styleUrls: ['./viewmenu.ui.scss']
|
|
})
|
|
export class UiViewMenu implements OnInit {
|
|
|
|
|
|
views: any[] = [];
|
|
settings: any;
|
|
settingsSubscription: Subscription;
|
|
|
|
constructor(private viewService: ViewService, private settingsService: SettingsService, private router: Router) {
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
this.settingsSubscription = this.settingsService.settings.subscribe({
|
|
next: (settings) => {
|
|
this.settings = settings;
|
|
this.viewService.views.subscribe({
|
|
next: (data: any) => {
|
|
this.views = data.content;
|
|
}
|
|
})
|
|
this.viewService.getViews();
|
|
}
|
|
})
|
|
}
|
|
|
|
edit(name, event) {
|
|
this.router.navigateByUrl('/v/' + name + '/edit');
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
|
|
}
|
|
|