mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +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.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",
|
"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">
|
<ngb-tab *ngFor="let relationType of relationTypes" title="{{'item.page.relationships.' + relationType.label | translate}}" [id]="relationType.filter">
|
||||||
<ng-template ngbTabContent>
|
<ng-template ngbTabContent>
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
|
@@ -8,6 +8,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||||||
import { MockRouter } from '../../../../shared/mocks/mock-router';
|
import { MockRouter } from '../../../../shared/mocks/mock-router';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { VarDirective } from '../../../../shared/utils/var.directive';
|
import { VarDirective } from '../../../../shared/utils/var.directive';
|
||||||
|
import { of as observableOf } from 'rxjs';
|
||||||
|
|
||||||
describe('TabbedRelatedEntitiesSearchComponent', () => {
|
describe('TabbedRelatedEntitiesSearchComponent', () => {
|
||||||
let comp: TabbedRelatedEntitiesSearchComponent;
|
let comp: TabbedRelatedEntitiesSearchComponent;
|
||||||
@@ -34,11 +35,7 @@ describe('TabbedRelatedEntitiesSearchComponent', () => {
|
|||||||
{
|
{
|
||||||
provide: ActivatedRoute,
|
provide: ActivatedRoute,
|
||||||
useValue: {
|
useValue: {
|
||||||
snapshot: {
|
queryParams: observableOf({ tab: mockRelationType })
|
||||||
queryParams: {
|
|
||||||
tab: mockRelationType
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ provide: Router, useValue: router }
|
{ provide: Router, useValue: router }
|
||||||
@@ -56,7 +53,9 @@ describe('TabbedRelatedEntitiesSearchComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should initialize the activeTab depending on the current query parameters', () => {
|
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', () => {
|
describe('onTabChange', () => {
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-tabbed-related-entities-search',
|
selector: 'ds-tabbed-related-entities-search',
|
||||||
@@ -42,7 +44,7 @@ export class TabbedRelatedEntitiesSearchComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* The active tab
|
* The active tab
|
||||||
*/
|
*/
|
||||||
activeTab: string;
|
activeTab$: Observable<string>;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private router: Router) {
|
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
|
* If the url contains a "tab" query parameter, set this tab to be the active tab
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
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>
|
</ds-generic-item-page-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-6">
|
<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
|
<ds-related-items
|
||||||
[parentItem]="object"
|
[parentItem]="object"
|
||||||
[relationType]="'isPublicationOfOrgUnit'"
|
[relationType]="'isPublicationOfOrgUnit'"
|
||||||
|
@@ -53,18 +53,6 @@
|
|||||||
<div class="relationships-item-page">
|
<div class="relationships-item-page">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<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
|
<ds-related-items
|
||||||
class="col-12 col-md-4"
|
class="col-12 col-md-4"
|
||||||
[parentItem]="object"
|
[parentItem]="object"
|
||||||
|
Reference in New Issue
Block a user