mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
66156: Removal of redundant fields, message update and aciveTab as observable
This commit is contained in:
@@ -822,9 +822,9 @@
|
||||
|
||||
"item.page.relationships.isJournalOfPublication": "Publications",
|
||||
|
||||
"item.page.relationships.isOrgUnitOfPerson": "Persons",
|
||||
"item.page.relationships.isOrgUnitOfPerson": "Authors",
|
||||
|
||||
"item.page.relationships.isOrgUnitOfProject": "Projects",
|
||||
"item.page.relationships.isOrgUnitOfProject": "Research Projects",
|
||||
|
||||
"item.page.subject": "Keywords",
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<ngb-tabset *ngIf="relationTypes.length > 1" [destroyOnHide]="true" #tabs="ngbTabset" [activeId]="activeTab" (tabChange)="onTabChange($event)">
|
||||
<ngb-tabset *ngIf="relationTypes.length > 1" [destroyOnHide]="true" #tabs="ngbTabset" [activeId]="activeTab$ | async" (tabChange)="onTabChange($event)">
|
||||
<ngb-tab *ngFor="let relationType of relationTypes" title="{{'item.page.relationships.' + relationType.label | translate}}" [id]="relationType.filter">
|
||||
<ng-template ngbTabContent>
|
||||
<div class="mt-4">
|
||||
|
@@ -8,6 +8,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MockRouter } from '../../../../shared/mocks/mock-router';
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { VarDirective } from '../../../../shared/utils/var.directive';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
|
||||
describe('TabbedRelatedEntitiesSearchComponent', () => {
|
||||
let comp: TabbedRelatedEntitiesSearchComponent;
|
||||
@@ -34,11 +35,7 @@ describe('TabbedRelatedEntitiesSearchComponent', () => {
|
||||
{
|
||||
provide: ActivatedRoute,
|
||||
useValue: {
|
||||
snapshot: {
|
||||
queryParams: {
|
||||
tab: mockRelationType
|
||||
}
|
||||
}
|
||||
queryParams: observableOf({ tab: mockRelationType })
|
||||
},
|
||||
},
|
||||
{ provide: Router, useValue: router }
|
||||
@@ -56,7 +53,9 @@ describe('TabbedRelatedEntitiesSearchComponent', () => {
|
||||
});
|
||||
|
||||
it('should initialize the activeTab depending on the current query parameters', () => {
|
||||
expect(comp.activeTab).toEqual(mockRelationType);
|
||||
comp.activeTab$.subscribe((activeTab) => {
|
||||
expect(activeTab).toEqual(mockRelationType);
|
||||
});
|
||||
});
|
||||
|
||||
describe('onTabChange', () => {
|
||||
|
@@ -1,6 +1,8 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-tabbed-related-entities-search',
|
||||
@@ -42,7 +44,7 @@ export class TabbedRelatedEntitiesSearchComponent implements OnInit {
|
||||
/**
|
||||
* The active tab
|
||||
*/
|
||||
activeTab: string;
|
||||
activeTab$: Observable<string>;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
@@ -52,7 +54,9 @@ export class TabbedRelatedEntitiesSearchComponent implements OnInit {
|
||||
* If the url contains a "tab" query parameter, set this tab to be the active tab
|
||||
*/
|
||||
ngOnInit(): void {
|
||||
this.activeTab = this.route.snapshot.queryParams.tab;
|
||||
this.activeTab$ = this.route.queryParams.pipe(
|
||||
map((params) => params.tab)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -24,16 +24,6 @@
|
||||
</ds-generic-item-page-field>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<ds-related-items
|
||||
[parentItem]="object"
|
||||
[relationType]="'isPersonOfOrgUnit'"
|
||||
[label]="'relationships.isPersonOf' | translate">
|
||||
</ds-related-items>
|
||||
<ds-related-items
|
||||
[parentItem]="object"
|
||||
[relationType]="'isProjectOfOrgUnit'"
|
||||
[label]="'relationships.isProjectOf' | translate">
|
||||
</ds-related-items>
|
||||
<ds-related-items
|
||||
[parentItem]="object"
|
||||
[relationType]="'isPublicationOfOrgUnit'"
|
||||
|
@@ -53,18 +53,6 @@
|
||||
<div class="relationships-item-page">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<ds-related-items
|
||||
class="col-12 col-md-4"
|
||||
[parentItem]="object"
|
||||
[relationType]="'isPersonOfOrgUnit'"
|
||||
[label]="'relationships.isPersonOf' | translate">
|
||||
</ds-related-items>
|
||||
<ds-related-items
|
||||
class="col-12 col-md-4"
|
||||
[parentItem]="object"
|
||||
[relationType]="'isProjectOfOrgUnit'"
|
||||
[label]="'relationships.isProjectOf' | translate">
|
||||
</ds-related-items>
|
||||
<ds-related-items
|
||||
class="col-12 col-md-4"
|
||||
[parentItem]="object"
|
||||
|
Reference in New Issue
Block a user