[Monitor Dashboard | Trunk]: Manage stakeholders: Add fragment for tabs

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@60289 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Konstantinos Triantafyllou 2021-01-25 13:24:42 +00:00
parent f560a56c5b
commit e3d9aa4852
2 changed files with 26 additions and 7 deletions

View File

@ -1,10 +1,10 @@
<div page-content>
<div header>
<ul *ngIf="isCurator()" class="uk-tab customTabs admin" uk-tab>
<li [class.uk-active]="tab === 'all'"><a (click)="changeTab('all')"><span class="title">All</span></a></li>
<li [class.uk-active]="tab === 'templates'"><a (click)="changeTab('templates')"><span class="title">Profile templates</span></a>
<li [class.uk-active]="tab === 'all'"><a routerLink="./"><span class="title">All</span></a></li>
<li [class.uk-active]="tab === 'templates'"><a routerLink="./" fragment="templates"><span class="title">Profile templates</span></a>
</li>
<li [class.uk-active]="tab === 'profiles'"><a (click)="changeTab('profiles')"><span
<li [class.uk-active]="tab === 'profiles'"><a routerLink="./" fragment="profiles"><span
class="title">Profiles</span></a></li>
</ul>
<!--<div class="uk-grid uk-margin-medium" uk-grid>

View File

@ -13,6 +13,9 @@ import {UserManagementService} from "../openaireLibrary/services/user-management
import {Session} from "../openaireLibrary/login/utils/helper.class";
import {EditStakeholderComponent} from "../general/edit-stakeholder/edit-stakeholder.component";
import {properties} from "../../environments/environment";
import {ActivatedRoute} from "@angular/router";
type Tab = 'all' | 'templates'| 'profiles';
declare var UIkit;
@ -56,16 +59,24 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
@ViewChild('deleteStakeholderModal') deleteStakeholderModal: AlertModal;
@ViewChild('editStakeholderComponent') editStakeholderComponent: EditStakeholderComponent;
tab: "all" | "templates" | "profiles" = "all";
tab: Tab = 'all';
constructor(private stakeholderService: StakeholderService,
private userManagementService: UserManagementService,
private propertiesService: EnvironmentSpecificService,
private route: ActivatedRoute,
private title: Title,
private fb: FormBuilder) {
}
ngOnInit(): void {
this.subscriptions.push(this.route.fragment.subscribe((fragment: Tab) => {
if (this.isTab(fragment)) {
this.tab = fragment;
} else {
this.tab = 'all';
}
}));
this.buildFilters();
this.properties = properties;
this.title.setTitle('Manage profiles');
@ -112,7 +123,6 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
keyword: this.fb.control('')
});
this.subscriptions.push(this.filters.get('status').valueChanges.subscribe(value => {
console.debug(value);
this.onStatusChange(value);
}));
this.subscriptions.push(this.filters.get('keyword').valueChanges.subscribe(value => {
@ -261,7 +271,16 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
return Session.isPortalAdministrator(this.user);
}
changeTab(tab: "all" | "templates" | "profiles") {
this.tab = tab;
private isTab(tab: Tab): boolean {
switch (tab) {
case "all":
return true;
case "profiles":
return true;
case "templates":
return true;
default:
return false;
}
}
}