1 import {Component, OnInit, ViewChild} from '@angular/core';
2 import {Router, ActivatedRoute, ParamMap} from '@angular/router';
3 import {NgbTabset, NgbTabChangeEvent} from '@ng-bootstrap/ng-bootstrap';
4 import {IdlObject} from '@eg/core/idl.service';
5 import {PcrudService} from '@eg/core/pcrud.service';
6 import {OrgService} from '@eg/core/org.service';
9 templateUrl: 'match-set.component.html'
11 export class MatchSetComponent implements OnInit {
18 private router: Router,
19 private route: ActivatedRoute,
20 private pcrud: PcrudService,
21 private org: OrgService
23 this.route.paramMap.subscribe((params: ParamMap) => {
24 this.matchSetId = +params.get('id');
25 this.matchSetTab = params.get('matchSetTab');
30 this.pcrud.retrieve('vms', this.matchSetId)
31 .toPromise().then(ms => {
32 ms.owner(this.org.get(ms.owner()));
37 // Changing a tab in the UI means changing the route.
38 // Changing the route ultimately results in changing the tab.
39 onTabChange(evt: NgbTabChangeEvent) {
40 this.matchSetTab = evt.nextId;
42 // prevent tab changing until after route navigation
46 `/staff/cat/vandelay/match_sets/${this.matchSetId}/${this.matchSetTab}`;
48 this.router.navigate([url]);