mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Fixed issues with badges and moved access status into ds-badges
This commit is contained in:
@@ -19,7 +19,7 @@ import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-
|
||||
import { getMockThemeService } from '../../../../../shared/mocks/theme-service.mock';
|
||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||
import { AccessStatusDataService } from '../../../../../core/data/access-status-data.service';
|
||||
import { AccessStatusObject } from '../../../../../shared/object-list/access-status-badge/access-status.model';
|
||||
import { AccessStatusObject } from '../../../../../shared/object-collection/shared/badges/access-status-badge/access-status.model';
|
||||
import { AuthService } from '../../../../../core/auth/auth.service';
|
||||
import { AuthServiceStub } from '../../../../../shared/testing/auth-service.stub';
|
||||
import { FileService } from '../../../../../core/shared/file.service';
|
||||
|
@@ -167,7 +167,7 @@ import { SequenceService } from './shared/sequence.service';
|
||||
import { CoreState } from './core-state.model';
|
||||
import { GroupDataService } from './eperson/group-data.service';
|
||||
import { SubmissionAccessesModel } from './config/models/config-submission-accesses.model';
|
||||
import { AccessStatusObject } from '../shared/object-list/access-status-badge/access-status.model';
|
||||
import { AccessStatusObject } from '../shared/object-collection/shared/badges/access-status-badge/access-status.model';
|
||||
import { AccessStatusDataService } from './data/access-status-data.service';
|
||||
import { LinkHeadService } from './services/link-head.service';
|
||||
import { ResearcherProfileDataService } from './profile/researcher-profile-data.service';
|
||||
|
@@ -3,8 +3,8 @@ import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { AccessStatusObject } from 'src/app/shared/object-list/access-status-badge/access-status.model';
|
||||
import { ACCESS_STATUS } from 'src/app/shared/object-list/access-status-badge/access-status.resource-type';
|
||||
import { AccessStatusObject } from 'src/app/shared/object-collection/shared/badges/access-status-badge/access-status.model';
|
||||
import { ACCESS_STATUS } from 'src/app/shared/object-collection/shared/badges/access-status-badge/access-status.resource-type';
|
||||
import { Observable } from 'rxjs';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { Item } from '../shared/item.model';
|
||||
|
@@ -15,4 +15,11 @@ export enum Context {
|
||||
AdminWorkflowSearch = 'adminWorkflowSearch',
|
||||
SideBarSearchModal = 'sideBarSearchModal',
|
||||
SideBarSearchModalCurrent = 'sideBarSearchModalCurrent',
|
||||
MyDSpaceArchived = 'mydspaceArchived',
|
||||
MyDSpaceWorkspace = 'mydspaceWorkspace',
|
||||
MyDSpaceWorkflow = 'mydspaceWorkflow',
|
||||
MyDSpaceDeclined = 'mydspaceDeclined',
|
||||
MyDSpaceApproved = 'mydspaceApproved',
|
||||
MyDSpaceWaitingController = 'mydspaceWaitingController',
|
||||
MyDSpaceValidation = 'mydspaceValidation',
|
||||
}
|
||||
|
@@ -21,8 +21,8 @@ import { Version } from './version.model';
|
||||
import { VERSION } from './version.resource-type';
|
||||
import { BITSTREAM } from './bitstream.resource-type';
|
||||
import { Bitstream } from './bitstream.model';
|
||||
import { ACCESS_STATUS } from 'src/app/shared/object-list/access-status-badge/access-status.resource-type';
|
||||
import { AccessStatusObject } from 'src/app/shared/object-list/access-status-badge/access-status.model';
|
||||
import { ACCESS_STATUS } from 'src/app/shared/object-collection/shared/badges/access-status-badge/access-status.resource-type';
|
||||
import { AccessStatusObject } from 'src/app/shared/object-collection/shared/badges/access-status-badge/access-status.model';
|
||||
import { HandleObject } from './handle-object.model';
|
||||
|
||||
/**
|
||||
|
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||
</ds-truncatable-part>
|
||||
|
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||
</ds-truncatable-part>
|
||||
|
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||
</ds-truncatable-part>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer"
|
||||
|
@@ -12,7 +12,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer"
|
||||
|
@@ -11,7 +11,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
|
||||
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
|
||||
|
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||
</ds-truncatable-part>
|
||||
|
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||
</ds-truncatable-part>
|
||||
|
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||
</ds-truncatable-part>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer"
|
||||
|
@@ -18,7 +18,7 @@
|
||||
</span>
|
||||
</div>
|
||||
<div [ngClass]="showThumbnails ? 'col-9 col-md-10' : 'col-12'">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer"
|
||||
|
@@ -19,7 +19,7 @@
|
||||
</div>
|
||||
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'"
|
||||
rel="noopener noreferrer"
|
||||
[routerLink]="[itemPageRoute]" class="lead item-list-title dont-break-out"
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<ng-container *ngIf="showAccessStatus">
|
||||
<div *ngIf="accessStatus$ | async as accessStatus">
|
||||
<span *ngIf="accessStatus$ | async as accessStatus">
|
||||
<span class="badge badge-secondary">{{ accessStatus | translate }}</span>
|
||||
</div>
|
||||
</span>
|
||||
</ng-container>
|
@@ -1,10 +1,10 @@
|
||||
import { Item } from '../../../core/shared/item.model';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TruncatePipe } from '../../utils/truncate.pipe';
|
||||
import { TruncatePipe } from '../../../../utils/truncate.pipe';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { AccessStatusBadgeComponent } from './access-status-badge.component';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../remote-data.utils';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../remote-data.utils';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AccessStatusObject } from './access-status.model';
|
||||
import { AccessStatusDataService } from 'src/app/core/data/access-status-data.service';
|
||||
@@ -50,7 +50,8 @@ describe('ItemAccessStatusBadgeComponent', () => {
|
||||
});
|
||||
|
||||
item = Object.assign(new Item(), {
|
||||
uuid: 'item-uuid'
|
||||
uuid: 'item-uuid',
|
||||
type: 'item'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -69,7 +70,7 @@ describe('ItemAccessStatusBadgeComponent', () => {
|
||||
environment.item.showAccessStatuses = true;
|
||||
fixture = TestBed.createComponent(AccessStatusBadgeComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.item = item;
|
||||
component.object = item;
|
||||
fixture.detectChanges();
|
||||
environment.item.showAccessStatuses = false;
|
||||
}
|
@@ -2,10 +2,13 @@ import { Component, Input } from '@angular/core';
|
||||
import { catchError, map } from 'rxjs/operators';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { AccessStatusObject } from './access-status.model';
|
||||
import { hasValue } from '../../empty.util';
|
||||
import { hasValue } from '../../../../empty.util';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { Item } from 'src/app/core/shared/item.model';
|
||||
import { AccessStatusDataService } from 'src/app/core/data/access-status-data.service';
|
||||
import { DSpaceObject } from '../../../../../core/shared/dspace-object.model';
|
||||
import { ITEM_TYPE } from '../../../../../core/shared/item-relationships/item-type.resource-type';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { ITEM } from '../../../../../core/shared/item.resource-type';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-access-status-badge',
|
||||
@@ -16,7 +19,7 @@ import { AccessStatusDataService } from 'src/app/core/data/access-status-data.se
|
||||
*/
|
||||
export class AccessStatusBadgeComponent {
|
||||
|
||||
@Input() item: Item;
|
||||
@Input() object: DSpaceObject;
|
||||
accessStatus$: Observable<string>;
|
||||
|
||||
/**
|
||||
@@ -33,15 +36,17 @@ export class AccessStatusBadgeComponent {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.showAccessStatus = environment.item.showAccessStatuses;
|
||||
if (!this.showAccessStatus || this.item == null) {
|
||||
if (this.object.type.toString() !== ITEM.value || !this.showAccessStatus || this.object == null) {
|
||||
// Do not show the badge if the feature is inactive or if the item is null.
|
||||
return;
|
||||
}
|
||||
if (this.item.accessStatus == null) {
|
||||
|
||||
const item = this.object as Item;
|
||||
if (item.accessStatus == null) {
|
||||
// In case the access status has not been loaded, do it individually.
|
||||
this.item.accessStatus = this.accessStatusDataService.findAccessStatusFor(this.item);
|
||||
item.accessStatus = this.accessStatusDataService.findAccessStatusFor(item);
|
||||
}
|
||||
this.accessStatus$ = this.item.accessStatus.pipe(
|
||||
this.accessStatus$ = item.accessStatus.pipe(
|
||||
map((accessStatusRD) => {
|
||||
if (accessStatusRD.statusCode !== 401 && hasValue(accessStatusRD.payload)) {
|
||||
return accessStatusRD.payload;
|
@@ -0,0 +1,30 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { ThemedComponent } from '../../../../theme-support/themed.component';
|
||||
import { AccessStatusBadgeComponent } from './access-status-badge.component';
|
||||
import { DSpaceObject } from '../../../../../core/shared/dspace-object.model';
|
||||
|
||||
/**
|
||||
* Themed wrapper for AccessStatusBadgeComponent
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-themed-access-status-badge',
|
||||
styleUrls: [],
|
||||
templateUrl: '../../../../theme-support/themed.component.html',
|
||||
})
|
||||
export class ThemedAccessStatusBadgeComponent extends ThemedComponent<AccessStatusBadgeComponent> {
|
||||
@Input() object: DSpaceObject;
|
||||
|
||||
protected inAndOutputNames: (keyof AccessStatusBadgeComponent & keyof this)[] = ['object'];
|
||||
|
||||
protected getComponentName(): string {
|
||||
return 'AccessStatusBadgeComponent';
|
||||
}
|
||||
|
||||
protected importThemedComponent(themeName: string): Promise<any> {
|
||||
return import(`../../../../../../themes/${themeName}/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component`);
|
||||
}
|
||||
|
||||
protected importUnthemedComponent(): Promise<any> {
|
||||
return import(`./access-status-badge.component`);
|
||||
}
|
||||
}
|
@@ -1,5 +1,10 @@
|
||||
<ds-themed-status-badge [object]="object"></ds-themed-status-badge>
|
||||
<ng-container *ngIf="myDSpaceStatus">
|
||||
<ds-themed-my-dspace-status-badge [status]="myDSpaceStatus"></ds-themed-my-dspace-status-badge>
|
||||
<ng-container *ngIf="isMyDSpaceStatus">
|
||||
<ds-themed-my-dspace-status-badge [context]="context"></ds-themed-my-dspace-status-badge>
|
||||
</ng-container>
|
||||
<ds-themed-type-badge [object]="object"></ds-themed-type-badge>
|
||||
<div>
|
||||
<ds-themed-type-badge class="pr-1" [object]="object"></ds-themed-type-badge>
|
||||
<ng-container *ngIf="showAccessStatus">
|
||||
<ds-themed-access-status-badge [object]="object"></ds-themed-access-status-badge>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
@@ -1,7 +1,17 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||
import { MyDspaceItemStatusType } from './my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { calcPossibleSecurityContexts } from '@angular/compiler/src/template_parser/binding_parser';
|
||||
|
||||
const MY_DSPACE_STATUS_CONTEXTS = [
|
||||
Context.MyDSpaceArchived,
|
||||
Context.MyDSpaceWorkspace,
|
||||
Context.MyDSpaceWorkflow,
|
||||
Context.MyDSpaceDeclined,
|
||||
Context.MyDSpaceApproved,
|
||||
Context.MyDSpaceWaitingController,
|
||||
Context.MyDSpaceValidation
|
||||
];
|
||||
@Component({
|
||||
selector: 'ds-badges',
|
||||
templateUrl: './badges.component.html',
|
||||
@@ -9,5 +19,9 @@ import { MyDspaceItemStatusType } from './my-dspace-status-badge/my-dspace-item-
|
||||
})
|
||||
export class BadgesComponent {
|
||||
@Input() object: DSpaceObject;
|
||||
@Input() myDSpaceStatus?: MyDspaceItemStatusType;
|
||||
@Input() context?: Context;
|
||||
@Input() showAccessStatus = false;
|
||||
get isMyDSpaceStatus(): boolean {
|
||||
return MY_DSPACE_STATUS_CONTEXTS.includes(this.context);
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div>
|
||||
<span [className]="badgeClass">
|
||||
{{badgeContent | translate}}
|
||||
{{('mydspace.status.' + badgeContent) | translate}}
|
||||
</span>
|
||||
</div>
|
||||
|
@@ -12,6 +12,7 @@ import { MyDspaceItemStatusType } from './my-dspace-item-status-type';
|
||||
import { TranslateLoaderMock } from '../../../../mocks/translate-loader.mock';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../../remote-data.utils';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
|
||||
let component: MyDSpaceStatusBadgeComponent;
|
||||
let fixture: ComponentFixture<MyDSpaceStatusBadgeComponent>;
|
||||
@@ -52,37 +53,37 @@ describe('MyDSpaceItemStatusComponent', () => {
|
||||
});
|
||||
|
||||
it('should init badge content and class', () => {
|
||||
component.status = MyDspaceItemStatusType.VALIDATION;
|
||||
component.context = Context.MyDSpaceValidation;
|
||||
fixture.detectChanges();
|
||||
expect(component.badgeContent).toBe(MyDspaceItemStatusType.VALIDATION);
|
||||
expect(component.badgeContent).toBe(Context.MyDSpaceValidation);
|
||||
expect(component.badgeClass).toBe('text-light badge badge-warning');
|
||||
});
|
||||
|
||||
it('should init badge content and class', () => {
|
||||
component.status = MyDspaceItemStatusType.WAITING_CONTROLLER;
|
||||
component.context = Context.MyDSpaceWaitingController;
|
||||
fixture.detectChanges();
|
||||
expect(component.badgeContent).toBe(MyDspaceItemStatusType.WAITING_CONTROLLER);
|
||||
expect(component.badgeContent).toBe(Context.MyDSpaceWaitingController);
|
||||
expect(component.badgeClass).toBe('text-light badge badge-info');
|
||||
});
|
||||
|
||||
it('should init badge content and class', () => {
|
||||
component.status = MyDspaceItemStatusType.WORKSPACE;
|
||||
component.context = Context.MyDSpaceWorkspace;
|
||||
fixture.detectChanges();
|
||||
expect(component.badgeContent).toBe(MyDspaceItemStatusType.WORKSPACE);
|
||||
expect(component.badgeContent).toBe(Context.MyDSpaceWorkspace);
|
||||
expect(component.badgeClass).toBe('text-light badge badge-primary');
|
||||
});
|
||||
|
||||
it('should init badge content and class', () => {
|
||||
component.status = MyDspaceItemStatusType.ARCHIVED;
|
||||
component.context = Context.MyDSpaceArchived;
|
||||
fixture.detectChanges();
|
||||
expect(component.badgeContent).toBe(MyDspaceItemStatusType.ARCHIVED);
|
||||
expect(component.badgeContent).toBe(Context.MyDSpaceArchived);
|
||||
expect(component.badgeClass).toBe('text-light badge badge-success');
|
||||
});
|
||||
|
||||
it('should init badge content and class', () => {
|
||||
component.status = MyDspaceItemStatusType.WORKFLOW;
|
||||
component.context = Context.MyDSpaceWorkflow;
|
||||
fixture.detectChanges();
|
||||
expect(component.badgeContent).toBe(MyDspaceItemStatusType.WORKFLOW);
|
||||
expect(component.badgeContent).toBe(Context.MyDSpaceWorkflow);
|
||||
expect(component.badgeClass).toBe('text-light badge badge-info');
|
||||
});
|
||||
});
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { MyDspaceItemStatusType } from './my-dspace-item-status-type';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component represents a badge with mydspace item status
|
||||
@@ -12,9 +12,9 @@ import { MyDspaceItemStatusType } from './my-dspace-item-status-type';
|
||||
export class MyDSpaceStatusBadgeComponent implements OnInit {
|
||||
|
||||
/**
|
||||
* This mydspace item status
|
||||
* This mydspace item context
|
||||
*/
|
||||
@Input() status: MyDspaceItemStatusType;
|
||||
@Input() context: Context;
|
||||
|
||||
/**
|
||||
* This badge class
|
||||
@@ -30,22 +30,22 @@ export class MyDSpaceStatusBadgeComponent implements OnInit {
|
||||
* Initialize badge content and class
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.badgeContent = this.status;
|
||||
this.badgeContent = this.context;
|
||||
this.badgeClass = 'text-light badge ';
|
||||
switch (this.status) {
|
||||
case MyDspaceItemStatusType.VALIDATION:
|
||||
switch (this.context) {
|
||||
case Context.MyDSpaceValidation:
|
||||
this.badgeClass += 'badge-warning';
|
||||
break;
|
||||
case MyDspaceItemStatusType.WAITING_CONTROLLER:
|
||||
case Context.MyDSpaceWaitingController:
|
||||
this.badgeClass += 'badge-info';
|
||||
break;
|
||||
case MyDspaceItemStatusType.WORKSPACE:
|
||||
case Context.MyDSpaceWorkspace:
|
||||
this.badgeClass += 'badge-primary';
|
||||
break;
|
||||
case MyDspaceItemStatusType.ARCHIVED:
|
||||
case Context.MyDSpaceArchived:
|
||||
this.badgeClass += 'badge-success';
|
||||
break;
|
||||
case MyDspaceItemStatusType.WORKFLOW:
|
||||
case Context.MyDSpaceWorkflow:
|
||||
this.badgeClass += 'badge-info';
|
||||
break;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
import { ThemedComponent } from '../../../../theme-support/themed.component';
|
||||
import { MyDspaceItemStatusType } from './my-dspace-item-status-type';
|
||||
import { MyDSpaceStatusBadgeComponent } from './my-dspace-status-badge.component';
|
||||
|
||||
/**
|
||||
@@ -12,9 +12,9 @@ import { MyDSpaceStatusBadgeComponent } from './my-dspace-status-badge.component
|
||||
templateUrl: '../../../../theme-support/themed.component.html',
|
||||
})
|
||||
export class ThemedMyDSpaceStatusBadgeComponent extends ThemedComponent<MyDSpaceStatusBadgeComponent> {
|
||||
@Input() status: MyDspaceItemStatusType;
|
||||
@Input() context: Context;
|
||||
|
||||
protected inAndOutputNames: (keyof MyDSpaceStatusBadgeComponent & keyof this)[] = ['status'];
|
||||
protected inAndOutputNames: (keyof MyDSpaceStatusBadgeComponent & keyof this)[] = ['context'];
|
||||
|
||||
protected getComponentName(): string {
|
||||
return 'MyDSpaceStatusBadgeComponent';
|
||||
|
@@ -2,7 +2,7 @@ import { Component, Input } from '@angular/core';
|
||||
import { BadgesComponent } from './badges.component';
|
||||
import { ThemedComponent } from '../../../theme-support/themed.component';
|
||||
import { DSpaceObject } from '../../../../core/shared/dspace-object.model';
|
||||
import { MyDspaceItemStatusType } from './my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
|
||||
/**
|
||||
* Themed wrapper for BadgesComponent
|
||||
@@ -14,9 +14,10 @@ import { MyDspaceItemStatusType } from './my-dspace-status-badge/my-dspace-item-
|
||||
})
|
||||
export class ThemedBadgesComponent extends ThemedComponent<BadgesComponent> {
|
||||
@Input() object: DSpaceObject;
|
||||
@Input() myDSpaceStatus: MyDspaceItemStatusType;
|
||||
@Input() context: Context;
|
||||
@Input() showAccessStatus = false;
|
||||
|
||||
protected inAndOutputNames: (keyof BadgesComponent & keyof this)[] = ['object', 'myDSpaceStatus'];
|
||||
protected inAndOutputNames: (keyof BadgesComponent & keyof this)[] = ['object', 'context', 'showAccessStatus'];
|
||||
|
||||
protected getComponentName(): string {
|
||||
return 'BadgesComponent';
|
||||
|
@@ -1,3 +1,3 @@
|
||||
<div *ngIf="typeMessage">
|
||||
<span *ngIf="typeMessage">
|
||||
<span class="badge badge-info">{{ typeMessage | translate }}</span>
|
||||
</div>
|
||||
</span>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<ds-item-detail-preview [item]="item$?.value"
|
||||
[object]="object"
|
||||
[showSubmitter]="showSubmitter"
|
||||
[status]="status">
|
||||
[context]="childContext">
|
||||
</ds-item-detail-preview>
|
||||
|
||||
<ds-claimed-task-actions [item]="item$.value"
|
||||
|
@@ -1,5 +1,12 @@
|
||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, flush, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||
import {
|
||||
ComponentFixture,
|
||||
fakeAsync,
|
||||
flush,
|
||||
TestBed,
|
||||
tick,
|
||||
waitForAsync
|
||||
} from '@angular/core/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { of as observableOf } from 'rxjs';
|
||||
@@ -7,7 +14,6 @@ import { of as observableOf } from 'rxjs';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { ClaimedTaskSearchResultDetailElementComponent } from './claimed-task-search-result-detail-element.component';
|
||||
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { ClaimedTaskSearchResult } from '../../../object-collection/shared/claimed-task-search-result.model';
|
||||
@@ -16,6 +22,7 @@ import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { getMockLinkService } from '../../../mocks/link-service.mock';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
let component: ClaimedTaskSearchResultDetailElementComponent;
|
||||
let fixture: ComponentFixture<ClaimedTaskSearchResultDetailElementComponent>;
|
||||
@@ -99,8 +106,8 @@ describe('ClaimedTaskSearchResultDetailElementComponent', () => {
|
||||
expect(component.item$.value).toEqual(item);
|
||||
}));
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.VALIDATION);
|
||||
it('should have the correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceValidation);
|
||||
});
|
||||
|
||||
it('should forward claimed-task-actions processComplete event to reloadObject event emitter', fakeAsync(() => {
|
||||
|
@@ -8,7 +8,6 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
||||
import { SearchResultDetailElementComponent } from '../search-result-detail-element.component';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { ClaimedTaskSearchResult } from '../../../object-collection/shared/claimed-task-search-result.model';
|
||||
import { followLink } from '../../../utils/follow-link-config.model';
|
||||
@@ -17,6 +16,7 @@ import { Item } from '../../../../core/shared/item.model';
|
||||
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
||||
import { isNotEmpty } from '../../../empty.util';
|
||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component renders claimed task object for the search result in the detail view.
|
||||
@@ -41,9 +41,9 @@ export class ClaimedTaskSearchResultDetailElementComponent extends SearchResultD
|
||||
public showSubmitter = true;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent child context
|
||||
*/
|
||||
public status = MyDspaceItemStatusType.VALIDATION;
|
||||
public childContext = Context.MyDSpaceValidation;
|
||||
|
||||
/**
|
||||
* The workflowitem object that belonging to the result object
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<div *ngIf="item" class="item-page" @fadeInOut>
|
||||
<ds-themed-badges [object]="object" [myDSpaceStatus]="status"></ds-themed-badges>
|
||||
<ds-themed-badges [object]="object" [context]="context"></ds-themed-badges>
|
||||
<div *ngIf="item">
|
||||
<ds-item-page-title-field [item]="item">
|
||||
</ds-item-page-title-field>
|
||||
|
@@ -6,12 +6,12 @@ import { BitstreamDataService } from '../../../../core/data/bitstream-data.servi
|
||||
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { getFirstSucceededRemoteListPayload } from '../../../../core/shared/operators';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { fadeInOut } from '../../../animations/fade';
|
||||
import { Bitstream } from '../../../../core/shared/bitstream.model';
|
||||
import { FileService } from '../../../../core/shared/file.service';
|
||||
import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service';
|
||||
import { SearchResult } from '../../../search/models/search-result.model';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component show metadata for the given item object in the detail view.
|
||||
@@ -23,7 +23,6 @@ import { SearchResult } from '../../../search/models/search-result.model';
|
||||
animations: [fadeInOut]
|
||||
})
|
||||
export class ItemDetailPreviewComponent {
|
||||
|
||||
/**
|
||||
* The item to display
|
||||
*/
|
||||
@@ -35,9 +34,9 @@ export class ItemDetailPreviewComponent {
|
||||
@Input() object: SearchResult<any>;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent context
|
||||
*/
|
||||
@Input() status: MyDspaceItemStatusType;
|
||||
@Input() context: Context;
|
||||
|
||||
/**
|
||||
* A boolean representing if to show submitter information
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<ds-item-detail-preview [item]="dso"
|
||||
[object]="object"
|
||||
[status]="status">
|
||||
[context]="childContext">
|
||||
</ds-item-detail-preview>
|
||||
|
||||
<ds-item-actions [object]="dso"></ds-item-actions>
|
||||
|
@@ -6,8 +6,8 @@ import { of as observableOf } from 'rxjs';
|
||||
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { ItemSearchResultDetailElementComponent } from './item-search-result-detail-element.component';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
|
||||
let component: ItemSearchResultDetailElementComponent;
|
||||
let fixture: ComponentFixture<ItemSearchResultDetailElementComponent>;
|
||||
@@ -68,7 +68,7 @@ describe('ItemSearchResultDetailElementComponent', () => {
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.ARCHIVED);
|
||||
it('should have the correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceArchived);
|
||||
});
|
||||
});
|
||||
|
@@ -3,7 +3,6 @@ import { Component } from '@angular/core';
|
||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { SearchResultDetailElementComponent } from '../search-result-detail-element.component';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
@@ -22,8 +21,8 @@ import { Context } from '../../../../core/shared/context.model';
|
||||
export class ItemSearchResultDetailElementComponent extends SearchResultDetailElementComponent<ItemSearchResult, Item> {
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent context
|
||||
*/
|
||||
public status = MyDspaceItemStatusType.ARCHIVED;
|
||||
public childContext = Context.MyDSpaceArchived;
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<ds-item-detail-preview [item]="item$?.value"
|
||||
[object]="object"
|
||||
[showSubmitter]="showSubmitter"
|
||||
[status]="status"></ds-item-detail-preview>
|
||||
[context]="childContext"></ds-item-detail-preview>
|
||||
|
||||
<ds-pool-task-actions [item]="item$.value"
|
||||
[object]="dso"
|
||||
|
@@ -6,7 +6,6 @@ import { of as observableOf } from 'rxjs';
|
||||
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { PoolSearchResultDetailElementComponent } from './pool-search-result-detail-element.component';
|
||||
@@ -16,6 +15,7 @@ import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { getMockLinkService } from '../../../mocks/link-service.mock';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
|
||||
let component: PoolSearchResultDetailElementComponent;
|
||||
let fixture: ComponentFixture<PoolSearchResultDetailElementComponent>;
|
||||
@@ -101,8 +101,8 @@ describe('PoolSearchResultDetailElementComponent', () => {
|
||||
expect(component.item$.value).toEqual(item);
|
||||
}));
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.WAITING_CONTROLLER);
|
||||
it('should have the correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceWaitingController);
|
||||
});
|
||||
|
||||
it('should forward pool-task-actions processCompleted event to the reloadedObject event emitter', fakeAsync(() => {
|
||||
|
@@ -6,7 +6,6 @@ import { mergeMap, tap } from 'rxjs/operators';
|
||||
import { RemoteData } from '../../../../core/data/remote-data';
|
||||
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
|
||||
import { SearchResultDetailElementComponent } from '../search-result-detail-element.component';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
@@ -17,6 +16,7 @@ import { Item } from '../../../../core/shared/item.model';
|
||||
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
||||
import { isNotEmpty } from '../../../empty.util';
|
||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component renders pool task object for the search result in the detail view.
|
||||
@@ -41,9 +41,9 @@ export class PoolSearchResultDetailElementComponent extends SearchResultDetailEl
|
||||
public showSubmitter = true;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent child context
|
||||
*/
|
||||
public status = MyDspaceItemStatusType.WAITING_CONTROLLER;
|
||||
public childContext = Context.MyDSpaceWaitingController;
|
||||
|
||||
/**
|
||||
* The workflowitem object that belonging to the result object
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<ds-item-detail-preview [item]="item"
|
||||
[object]="object"
|
||||
[status]="status"></ds-item-detail-preview>
|
||||
[context]="childContext"></ds-item-detail-preview>
|
||||
|
||||
<ds-workflowitem-actions [object]="dso"></ds-workflowitem-actions>
|
||||
|
||||
|
@@ -7,13 +7,13 @@ import { of as observableOf } from 'rxjs';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { WorkflowItemSearchResultDetailElementComponent } from './workflow-item-search-result-detail-element.component';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||
import { getMockLinkService } from '../../../mocks/link-service.mock';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
let component: WorkflowItemSearchResultDetailElementComponent;
|
||||
let fixture: ComponentFixture<WorkflowItemSearchResultDetailElementComponent>;
|
||||
@@ -87,7 +87,7 @@ describe('WorkflowItemSearchResultDetailElementComponent', () => {
|
||||
expect(component.item).toEqual(item);
|
||||
});
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.WORKFLOW);
|
||||
it('should have the correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceWorkflow);
|
||||
});
|
||||
});
|
||||
|
@@ -4,7 +4,6 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
import { SearchResultDetailElementComponent } from '../search-result-detail-element.component';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { Observable } from 'rxjs';
|
||||
import { RemoteData } from '../../../../core/data/remote-data';
|
||||
import { find } from 'rxjs/operators';
|
||||
@@ -13,6 +12,7 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista
|
||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { followLink } from '../../../utils/follow-link-config.model';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component renders workflowitem object for the search result in the detail view.
|
||||
@@ -32,9 +32,9 @@ export class WorkflowItemSearchResultDetailElementComponent extends SearchResult
|
||||
public item: Item;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent child context
|
||||
*/
|
||||
public status = MyDspaceItemStatusType.WORKFLOW;
|
||||
public childContext = Context.MyDSpaceWorkflow;
|
||||
|
||||
constructor(
|
||||
protected linkService: LinkService
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<ds-item-detail-preview [item]="item"
|
||||
[object]="object"
|
||||
[status]="status"></ds-item-detail-preview>
|
||||
[context]="childContext"></ds-item-detail-preview>
|
||||
|
||||
<ds-workspaceitem-actions [object]="dso"></ds-workspaceitem-actions>
|
||||
|
@@ -7,13 +7,13 @@ import { of as observableOf } from 'rxjs';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { WorkspaceItemSearchResultDetailElementComponent } from './workspace-item-search-result-detail-element.component';
|
||||
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||
import { getMockLinkService } from '../../../mocks/link-service.mock';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
|
||||
let component: WorkspaceItemSearchResultDetailElementComponent;
|
||||
let fixture: ComponentFixture<WorkspaceItemSearchResultDetailElementComponent>;
|
||||
@@ -87,7 +87,7 @@ describe('WorkspaceItemSearchResultDetailElementComponent', () => {
|
||||
expect(component.item).toEqual(item);
|
||||
});
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.WORKSPACE);
|
||||
it('should have the correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceWorkspace);
|
||||
});
|
||||
});
|
||||
|
@@ -8,12 +8,12 @@ import { Item } from '../../../../core/shared/item.model';
|
||||
import { RemoteData } from '../../../../core/data/remote-data';
|
||||
import { isNotUndefined } from '../../../empty.util';
|
||||
import { SearchResultDetailElementComponent } from '../search-result-detail-element.component';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { WorkspaceItemSearchResult } from '../../../object-collection/shared/workspace-item-search-result.model';
|
||||
import { followLink } from '../../../utils/follow-link-config.model';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component renders workspace item object for the search result in the detail view.
|
||||
@@ -33,9 +33,9 @@ export class WorkspaceItemSearchResultDetailElementComponent extends SearchResul
|
||||
public item: Item;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent child context
|
||||
*/
|
||||
status = MyDspaceItemStatusType.WORKSPACE;
|
||||
public childContext = Context.MyDSpaceWorkspace;
|
||||
|
||||
constructor(
|
||||
protected linkService: LinkService
|
||||
|
@@ -8,7 +8,7 @@
|
||||
</ds-thumbnail>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<h4 class="card-title">{{dso.name}}</h4>
|
||||
<p *ngIf="dso.shortDescription" class="card-text">{{dso.shortDescription}}</p>
|
||||
<div *ngIf="linkType != linkTypes.None" class="text-center">
|
||||
|
@@ -8,7 +8,7 @@
|
||||
</ds-thumbnail>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<h4 class="card-title">{{dso.name}}</h4>
|
||||
<p *ngIf="dso.shortDescription" class="card-text">{{dso.shortDescription}}</p>
|
||||
<div *ngIf="linkType != linkTypes.None" class="text-center">
|
||||
|
@@ -16,8 +16,7 @@
|
||||
</div>
|
||||
</span>
|
||||
<div class="card-body">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-access-status-badge [item]="dso"></ds-access-status-badge>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context" [showAccessStatus]="true"></ds-themed-badges>
|
||||
<ds-truncatable [id]="dso.id">
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="3" type="h4">
|
||||
<h4 class="card-title" [innerHTML]="dsoTitle"></h4>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<ds-themed-item-list-preview *ngIf="workflowitem"
|
||||
[item]="(workflowitem?.item | async)?.payload"
|
||||
[object]="object"
|
||||
[status]="status"
|
||||
[context]="childContext"
|
||||
[showSubmitter]="showSubmitter"></ds-themed-item-list-preview>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
@@ -12,13 +12,13 @@ import { getMockLinkService } from '../../../../mocks/link-service.mock';
|
||||
import { VarDirective } from '../../../../utils/var.directive';
|
||||
import { TruncatableService } from '../../../../truncatable/truncatable.service';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { MyDspaceItemStatusType } from '../../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { ClaimedApprovedTaskSearchResult } from '../../../../object-collection/shared/claimed-approved-task-search-result.model';
|
||||
import { ClaimedApprovedSearchResultListElementComponent } from './claimed-approved-search-result-list-element.component';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../../../environments/environment';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
|
||||
let component: ClaimedApprovedSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<ClaimedApprovedSearchResultListElementComponent>;
|
||||
@@ -100,8 +100,8 @@ describe('ClaimedApprovedSearchResultListElementComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.APPROVED);
|
||||
it('should have the correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceApproved);
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -4,7 +4,6 @@ import { ClaimedApprovedTaskSearchResult } from '../../../../object-collection/s
|
||||
import { listableObjectComponent } from '../../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { TruncatableService } from '../../../../truncatable/truncatable.service';
|
||||
import { MyDspaceItemStatusType } from '../../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { Observable } from 'rxjs';
|
||||
import { RemoteData } from '../../../../../core/data/remote-data';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
@@ -14,6 +13,7 @@ import { ClaimedTaskSearchResult } from '../../../../object-collection/shared/cl
|
||||
import { ClaimedTask } from '../../../../../core/tasks/models/claimed-task-object.model';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component renders claimed task approved object for the search result in the list view.
|
||||
@@ -32,9 +32,9 @@ export class ClaimedApprovedSearchResultListElementComponent extends SearchResul
|
||||
public showSubmitter = true;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent child context
|
||||
*/
|
||||
public status = MyDspaceItemStatusType.APPROVED;
|
||||
public childContext = Context.MyDSpaceApproved;
|
||||
|
||||
/**
|
||||
* The workflowitem object that belonging to the result object
|
||||
|
@@ -14,11 +14,11 @@ import { getMockLinkService } from '../../../../mocks/link-service.mock';
|
||||
import { VarDirective } from '../../../../utils/var.directive';
|
||||
import { TruncatableService } from '../../../../truncatable/truncatable.service';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { MyDspaceItemStatusType } from '../../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../../../environments/environment';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
|
||||
let component: ClaimedDeclinedSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<ClaimedDeclinedSearchResultListElementComponent>;
|
||||
@@ -100,8 +100,8 @@ describe('ClaimedDeclinedSearchResultListElementComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.DECLINED);
|
||||
it('should have the correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceDeclined);
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<ds-themed-item-list-preview *ngIf="workflowitem"
|
||||
[item]="(workflowitem?.item | async)?.payload"
|
||||
[object]="object"
|
||||
[status]="status"
|
||||
[context]="childContext"
|
||||
[showSubmitter]="showSubmitter"></ds-themed-item-list-preview>
|
||||
</div>
|
||||
</ng-container>
|
||||
|
@@ -5,7 +5,6 @@ import { ClaimedDeclinedTaskSearchResult } from '../../../../object-collection/s
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { TruncatableService } from '../../../../truncatable/truncatable.service';
|
||||
import { MyDspaceItemStatusType } from '../../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { Observable } from 'rxjs';
|
||||
import { RemoteData } from '../../../../../core/data/remote-data';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
@@ -15,6 +14,7 @@ import { ClaimedTaskSearchResult } from '../../../../object-collection/shared/cl
|
||||
import { ClaimedTask } from '../../../../../core/tasks/models/claimed-task-object.model';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component renders claimed task declined object for the search result in the list view.
|
||||
@@ -33,9 +33,9 @@ export class ClaimedDeclinedSearchResultListElementComponent extends SearchResul
|
||||
public showSubmitter = true;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent child context
|
||||
*/
|
||||
public status = MyDspaceItemStatusType.DECLINED;
|
||||
public childContext = Context.MyDSpaceDeclined;
|
||||
|
||||
/**
|
||||
* The workflowitem object that belonging to the result object
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<ds-themed-item-list-preview [item]="item$.value"
|
||||
[object]="object"
|
||||
[showSubmitter]="showSubmitter"
|
||||
[status]="status"></ds-themed-item-list-preview>
|
||||
[context]="childContext"></ds-themed-item-list-preview>
|
||||
|
||||
<div class="row">
|
||||
<div [ngClass]="showThumbnails ? 'offset-3 offset-md-2 pl-3' : ''">
|
||||
|
@@ -1,5 +1,12 @@
|
||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, flush, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||
import {
|
||||
ComponentFixture,
|
||||
fakeAsync,
|
||||
flush,
|
||||
TestBed,
|
||||
tick,
|
||||
waitForAsync
|
||||
} from '@angular/core/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { of as observableOf } from 'rxjs';
|
||||
@@ -7,7 +14,6 @@ import { of as observableOf } from 'rxjs';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { ClaimedSearchResultListElementComponent } from './claimed-search-result-list-element.component';
|
||||
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { ClaimedTaskSearchResult } from '../../../object-collection/shared/claimed-task-search-result.model';
|
||||
@@ -21,6 +27,7 @@ import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../../environments/environment';
|
||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
let component: ClaimedSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<ClaimedSearchResultListElementComponent>;
|
||||
@@ -105,8 +112,8 @@ describe('ClaimedSearchResultListElementComponent', () => {
|
||||
expect(component.item$.value).toEqual(item);
|
||||
}));
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.VALIDATION);
|
||||
it('should have the correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceValidation);
|
||||
});
|
||||
|
||||
it('should forward claimed-task-actions processComplete event to reloadObject event emitter', fakeAsync(() => {
|
||||
|
@@ -5,7 +5,6 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista
|
||||
import { ClaimedTaskSearchResult } from '../../../object-collection/shared/claimed-task-search-result.model';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { BehaviorSubject, EMPTY, Observable } from 'rxjs';
|
||||
import { RemoteData } from '../../../../core/data/remote-data';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
@@ -21,6 +20,7 @@ import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { mergeMap, tap } from 'rxjs/operators';
|
||||
import { isNotEmpty } from '../../../empty.util';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-claimed-search-result-list-element',
|
||||
@@ -36,9 +36,9 @@ export class ClaimedSearchResultListElementComponent extends SearchResultListEle
|
||||
public showSubmitter = true;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent child context
|
||||
*/
|
||||
public status = MyDspaceItemStatusType.VALIDATION;
|
||||
public childContext = Context.MyDSpaceValidation;
|
||||
|
||||
/**
|
||||
* The item object that belonging to the result object
|
||||
|
@@ -6,8 +6,7 @@
|
||||
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||
<div *ngIf="item" @fadeInOut>
|
||||
<div class="d-flex">
|
||||
<ds-themed-badges [object]="item" [myDSpaceStatus]="status"></ds-themed-badges>
|
||||
<ds-access-status-badge [item]="item" class="pl-1"></ds-access-status-badge>
|
||||
<ds-themed-badges [object]="item" [context]="context" [showAccessStatus]="true"></ds-themed-badges>
|
||||
</div>
|
||||
<ds-truncatable [id]="item.id">
|
||||
<h3 [innerHTML]="dsoTitle" [ngClass]="{'lead': true,'text-muted': !item.firstMetadataValue('dc.title')}"></h3>
|
||||
|
@@ -2,10 +2,10 @@ import { Component, Inject, Input, OnInit } from '@angular/core';
|
||||
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { fadeInOut } from '../../../animations/fade';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { SearchResult } from '../../../search/models/search-result.model';
|
||||
import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component show metadata for the given item object in the list view.
|
||||
@@ -29,9 +29,9 @@ export class ItemListPreviewComponent implements OnInit {
|
||||
@Input() object: SearchResult<any>;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent context
|
||||
*/
|
||||
@Input() status: MyDspaceItemStatusType;
|
||||
@Input() context: Context;
|
||||
|
||||
/**
|
||||
* A boolean representing if to show submitter information
|
||||
|
@@ -2,8 +2,8 @@ import { Component, Input } from '@angular/core';
|
||||
import { ThemedComponent } from '../../../theme-support/themed.component';
|
||||
import { ItemListPreviewComponent } from './item-list-preview.component';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { SearchResult } from '../../../search/models/search-result.model';
|
||||
import { Context } from 'src/app/core/shared/context.model';
|
||||
|
||||
/**
|
||||
* Themed wrapper for ItemListPreviewComponent
|
||||
@@ -14,13 +14,13 @@ import { SearchResult } from '../../../search/models/search-result.model';
|
||||
templateUrl: '../../../theme-support/themed.component.html',
|
||||
})
|
||||
export class ThemedItemListPreviewComponent extends ThemedComponent<ItemListPreviewComponent> {
|
||||
protected inAndOutputNames: (keyof ItemListPreviewComponent & keyof this)[] = ['item', 'object', 'status', 'showSubmitter'];
|
||||
protected inAndOutputNames: (keyof ItemListPreviewComponent & keyof this)[] = ['item', 'object', 'context', 'showSubmitter'];
|
||||
|
||||
@Input() item: Item;
|
||||
|
||||
@Input() object: SearchResult<any>;
|
||||
|
||||
@Input() status: MyDspaceItemStatusType;
|
||||
@Input() context: Context;
|
||||
|
||||
@Input() showSubmitter = false;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<ds-themed-item-list-preview [item]="dso"
|
||||
[object]="object"
|
||||
[status]="status"></ds-themed-item-list-preview>
|
||||
[context]="childContext"></ds-themed-item-list-preview>
|
||||
|
||||
<div class="row">
|
||||
<div [ngClass]="showThumbnails ? 'offset-3 offset-md-2 pl-3' : ''">
|
||||
|
@@ -1,11 +1,10 @@
|
||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { waitForAsync, ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { of as observableOf } from 'rxjs';
|
||||
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
||||
import { ItemSearchResultListElementSubmissionComponent } from './item-search-result-list-element-submission.component';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
@@ -14,6 +13,7 @@ import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { environment } from '../../../../../environments/environment';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
let component: ItemSearchResultListElementSubmissionComponent;
|
||||
let fixture: ComponentFixture<ItemSearchResultListElementSubmissionComponent>;
|
||||
@@ -77,8 +77,8 @@ describe('ItemMyDSpaceResultListElementComponent', () => {
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.ARCHIVED);
|
||||
it('should have correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceArchived);
|
||||
});
|
||||
|
||||
it('should forward item-actions processComplete event to reloadObject event emitter', fakeAsync(() => {
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
@@ -21,9 +20,10 @@ import { SearchResultListElementComponent } from '../../search-result-list-eleme
|
||||
@listableObjectComponent(ItemSearchResult, ViewMode.ListElement, Context.Workflow)
|
||||
export class ItemSearchResultListElementSubmissionComponent extends SearchResultListElementComponent<ItemSearchResult, Item> implements OnInit {
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent child context
|
||||
*/
|
||||
public status = MyDspaceItemStatusType.ARCHIVED;
|
||||
public childContext = Context.MyDSpaceArchived;
|
||||
|
||||
|
||||
/**
|
||||
* Display thumbnails if required by configuration
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<ds-themed-item-list-preview [item]="item$.value"
|
||||
[object]="object"
|
||||
[showSubmitter]="showSubmitter"
|
||||
[status]="status"></ds-themed-item-list-preview>
|
||||
[context]="childContext"></ds-themed-item-list-preview>
|
||||
<div class="row">
|
||||
<div [ngClass]="showThumbnails ? 'offset-3 offset-md-2 pl-3' : ''">
|
||||
<ds-pool-task-actions id="actions"
|
||||
|
@@ -1,5 +1,12 @@
|
||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, flush, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||
import {
|
||||
ComponentFixture,
|
||||
fakeAsync,
|
||||
flush,
|
||||
TestBed,
|
||||
tick,
|
||||
waitForAsync
|
||||
} from '@angular/core/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { of as observableOf } from 'rxjs';
|
||||
@@ -7,7 +14,6 @@ import { of as observableOf } from 'rxjs';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { PoolSearchResultListElementComponent } from './pool-search-result-list-element.component';
|
||||
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { PoolTaskSearchResult } from '../../../object-collection/shared/pool-task-search-result.model';
|
||||
@@ -20,6 +26,7 @@ import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
let component: PoolSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<PoolSearchResultListElementComponent>;
|
||||
@@ -111,8 +118,8 @@ describe('PoolSearchResultListElementComponent', () => {
|
||||
expect(component.item$.value).toEqual(item);
|
||||
}));
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.WAITING_CONTROLLER);
|
||||
it('should have correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceWaitingController);
|
||||
});
|
||||
|
||||
it('should forward pool-task-actions processCompleted event to the reloadedObject event emitter', fakeAsync(() => {
|
||||
|
@@ -7,7 +7,6 @@ import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
import { RemoteData } from '../../../../core/data/remote-data';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { PoolTaskSearchResult } from '../../../object-collection/shared/pool-task-search-result.model';
|
||||
import {
|
||||
@@ -22,6 +21,7 @@ import { ObjectCacheService } from '../../../../core/cache/object-cache.service'
|
||||
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { isNotEmpty } from '../../../empty.util';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component renders pool task object for the search result in the list view.
|
||||
@@ -41,9 +41,9 @@ export class PoolSearchResultListElementComponent extends SearchResultListElemen
|
||||
public showSubmitter = true;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent child Context
|
||||
*/
|
||||
public status = MyDspaceItemStatusType.WAITING_CONTROLLER;
|
||||
public childContext = Context.MyDSpaceWaitingController;
|
||||
|
||||
/**
|
||||
* The item object that belonging to the result object
|
||||
|
@@ -1,12 +1,8 @@
|
||||
<ng-container *ngIf="derivedSearchResult$ | async">
|
||||
<div class="row">
|
||||
<div [ngClass]="showThumbnails ? 'offset-3 offset-md-2 pl-3' : ''">
|
||||
<ds-mydspace-item-status [status]="status"></ds-mydspace-item-status>
|
||||
</div>
|
||||
</div>
|
||||
<ds-listable-object-component-loader
|
||||
[viewMode]="ViewModes.ListElement"
|
||||
[object]="derivedSearchResult$ | async" [linkType]="LinkTypes.None"></ds-listable-object-component-loader>
|
||||
[object]="derivedSearchResult$ | async" [linkType]="LinkTypes.None"
|
||||
[context]="childContext"></ds-listable-object-component-loader>
|
||||
<div class="row">
|
||||
<div [ngClass]="showThumbnails ? 'offset-3 offset-md-2 pl-3' : ''">
|
||||
<ds-workflowitem-actions [object]="dso" (processCompleted)="reloadedObject.emit($event.reloadedObject)"></ds-workflowitem-actions>
|
||||
|
@@ -10,7 +10,6 @@ import { ItemDataService } from '../../../../core/data/item-data.service';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
import { getMockLinkService } from '../../../mocks/link-service.mock';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
@@ -19,6 +18,7 @@ import { By } from '@angular/platform-browser';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
let component: WorkflowItemSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<WorkflowItemSearchResultListElementComponent>;
|
||||
@@ -105,8 +105,8 @@ describe('WorkflowItemSearchResultListElementComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.WORKFLOW);
|
||||
it('should have the correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceWorkflow);
|
||||
});
|
||||
|
||||
it('should forward workflowitem-actions processCompleted event to the reloadedObject event emitter', fakeAsync(() => {
|
||||
|
@@ -8,7 +8,6 @@ import { Item } from '../../../../core/shared/item.model';
|
||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { followLink } from '../../../utils/follow-link-config.model';
|
||||
@@ -18,6 +17,7 @@ import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interfac
|
||||
import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators';
|
||||
import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model';
|
||||
import { CollectionElementLinkType } from '../../../object-collection/collection-element-link.type';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component renders workflowitem object for the search result in the list view.
|
||||
@@ -40,9 +40,9 @@ export class WorkflowItemSearchResultListElementComponent extends SearchResultLi
|
||||
derivedSearchResult$: Observable<ItemSearchResult>;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent child context
|
||||
*/
|
||||
public status = MyDspaceItemStatusType.WORKFLOW;
|
||||
public childContext = Context.MyDSpaceWorkflow;
|
||||
|
||||
/**
|
||||
* Display thumbnails if required by configuration
|
||||
|
@@ -1,12 +1,8 @@
|
||||
<ng-container *ngIf="derivedSearchResult$ | async">
|
||||
<div class="row">
|
||||
<div [ngClass]="showThumbnails ? 'offset-3 offset-md-2 pl-3' : ''">
|
||||
<ds-mydspace-item-status [status]="status"></ds-mydspace-item-status>
|
||||
</div>
|
||||
</div>
|
||||
<ds-listable-object-component-loader
|
||||
[viewMode]="ViewModes.ListElement"
|
||||
[object]="derivedSearchResult$ | async" [linkType]="LinkTypes.None"></ds-listable-object-component-loader>
|
||||
[object]="derivedSearchResult$ | async" [linkType]="LinkTypes.None"
|
||||
[context]="childContext"></ds-listable-object-component-loader>
|
||||
<div class="row">
|
||||
<div [ngClass]="showThumbnails ? 'offset-3 offset-md-2 pl-3' : ''">
|
||||
<ds-workspaceitem-actions [object]="dso" (processCompleted)="reloadedObject.emit($event.reloadedObject)"></ds-workspaceitem-actions>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { waitForAsync, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { of as observableOf } from 'rxjs';
|
||||
@@ -10,7 +10,6 @@ import { ItemDataService } from '../../../../core/data/item-data.service';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||
import { getMockLinkService } from '../../../mocks/link-service.mock';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||
import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
@@ -19,6 +18,7 @@ import { By } from '@angular/platform-browser';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
let component: WorkspaceItemSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<WorkspaceItemSearchResultListElementComponent>;
|
||||
@@ -104,8 +104,8 @@ describe('WorkspaceItemSearchResultListElementComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should have properly status', () => {
|
||||
expect(component.status).toEqual(MyDspaceItemStatusType.WORKSPACE);
|
||||
it('should have correct child context', () => {
|
||||
expect(component.childContext).toEqual(Context.MyDSpaceWorkspace);
|
||||
});
|
||||
|
||||
it('should forward workspaceitem-actions processCompleted event to the reloadedObject event emitter', fakeAsync(() => {
|
||||
|
@@ -7,7 +7,6 @@ import { Item } from '../../../../core/shared/item.model';
|
||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/badges/my-dspace-status-badge/my-dspace-item-status-type';
|
||||
import { WorkspaceItemSearchResult } from '../../../object-collection/shared/workspace-item-search-result.model';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
||||
@@ -18,6 +17,7 @@ import { map } from 'rxjs/operators';
|
||||
import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators';
|
||||
import { CollectionElementLinkType } from '../../../object-collection/collection-element-link.type';
|
||||
import { followLink } from '../../../utils/follow-link-config.model';
|
||||
import { Context } from '../../../../core/shared/context.model';
|
||||
|
||||
/**
|
||||
* This component renders workspaceitem object for the search result in the list view.
|
||||
@@ -40,9 +40,9 @@ export class WorkspaceItemSearchResultListElementComponent extends SearchResult
|
||||
derivedSearchResult$: Observable<ItemSearchResult>;
|
||||
|
||||
/**
|
||||
* Represent item's status
|
||||
* Represent child context
|
||||
*/
|
||||
status = MyDspaceItemStatusType.WORKSPACE;
|
||||
public childContext = Context.MyDSpaceWorkspace;
|
||||
|
||||
/**
|
||||
* Display thumbnails if required by configuration
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<div class="row">
|
||||
<div *ngIf="showThumbnails" class="offset-3 offset-md-2 "></div>
|
||||
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/collections/' + dso.id]" class="lead" [innerHTML]="dsoTitle"></a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="dsoTitle"></span>
|
||||
<div *ngIf="dso.shortDescription" class="text-muted abstract-text" [innerHTML]="firstMetadataValue('dc.description.abstract')"></div>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<div class="row">
|
||||
<div *ngIf="showThumbnails" class="offset-md-2"></div>
|
||||
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context"></ds-themed-badges>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/communities/' + dso.id]" class="lead" [innerHTML]="dsoTitle"></a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="dsoTitle"></span>
|
||||
<div *ngIf="dso.shortDescription" class="text-muted abstract-text" [innerHTML]="firstMetadataValue('dc.description.abstract')"></div>
|
||||
|
@@ -12,8 +12,7 @@
|
||||
</div>
|
||||
<div [ngClass]="showThumbnails ? 'col-9' : 'col-md-12'">
|
||||
<div class="d-flex">
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso"></ds-themed-badges>
|
||||
<ds-access-status-badge [item]="dso" class="pl-1"></ds-access-status-badge>
|
||||
<ds-themed-badges *ngIf="showLabel" [object]="dso" [context]="context" [showAccessStatus]="true"></ds-themed-badges>
|
||||
</div>
|
||||
|
||||
<ds-truncatable [id]="dso.id" *ngIf="object !== undefined && object !== null">
|
||||
|
@@ -204,7 +204,7 @@ import {
|
||||
} from './input-suggestions/dso-input-suggestions/dso-input-suggestions.component';
|
||||
import { ItemGridElementComponent } from './object-grid/item-grid-element/item-types/item/item-grid-element.component';
|
||||
import { TypeBadgeComponent } from './object-collection/shared/badges/type-badge/type-badge.component';
|
||||
import { AccessStatusBadgeComponent } from './object-list/access-status-badge/access-status-badge.component';
|
||||
import { AccessStatusBadgeComponent } from './object-collection/shared/badges/access-status-badge/access-status-badge.component';
|
||||
import {
|
||||
MetadataRepresentationLoaderComponent
|
||||
} from './metadata-representation/metadata-representation-loader.component';
|
||||
@@ -328,6 +328,7 @@ import { ThemedBadgesComponent } from './object-collection/shared/badges/themed-
|
||||
import { ThemedStatusBadgeComponent } from './object-collection/shared/badges/status-badge/themed-status-badge.component';
|
||||
import { ThemedTypeBadgeComponent } from './object-collection/shared/badges/type-badge/themed-type-badge.component';
|
||||
import { ThemedMyDSpaceStatusBadgeComponent } from './object-collection/shared/badges/my-dspace-status-badge/themed-my-dspace-status-badge.component';
|
||||
import { ThemedAccessStatusBadgeComponent } from './object-collection/shared/badges/access-status-badge/themed-access-status-badge.component';
|
||||
|
||||
const MODULES = [
|
||||
CommonModule,
|
||||
@@ -463,6 +464,7 @@ const COMPONENTS = [
|
||||
ComcolMetadataComponent,
|
||||
TypeBadgeComponent,
|
||||
AccessStatusBadgeComponent,
|
||||
ThemedAccessStatusBadgeComponent,
|
||||
ThemedTypeBadgeComponent,
|
||||
StatusBadgeComponent,
|
||||
ThemedStatusBadgeComponent,
|
||||
|
@@ -2830,15 +2830,15 @@
|
||||
|
||||
"mydspace.show.workspace": "Your Submissions",
|
||||
|
||||
"mydspace.status.archived": "Archived",
|
||||
"mydspace.status.mydspaceArchived": "Archived",
|
||||
|
||||
"mydspace.status.validation": "Validation",
|
||||
"mydspace.status.mydspaceValidation": "Validation",
|
||||
|
||||
"mydspace.status.waiting-for-controller": "Waiting for controller",
|
||||
"mydspace.status.mydspaceWaitingController": "Waiting for controller",
|
||||
|
||||
"mydspace.status.workflow": "Workflow",
|
||||
"mydspace.status.mydspaceWorkflow": "Workflow",
|
||||
|
||||
"mydspace.status.workspace": "Workspace",
|
||||
"mydspace.status.mydspaceWorkspace": "Workspace",
|
||||
|
||||
"mydspace.title": "MyDSpace",
|
||||
|
||||
|
@@ -0,0 +1,11 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { AccessStatusBadgeComponent as BaseComponent } from 'src/app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-access-status-badge',
|
||||
// styleUrls: ['./access-status-badge.component.scss'],
|
||||
// templateUrl: './access-status-badge.component.html',
|
||||
templateUrl: '../../../../../../../../app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component.html',
|
||||
})
|
||||
export class AccessStatusBadgeComponent extends BaseComponent {
|
||||
}
|
@@ -120,6 +120,7 @@ import { MyDSpaceStatusBadgeComponent } from './app/shared/object-collection/sha
|
||||
import { TypeBadgeComponent } from './app/shared/object-collection/shared/badges/type-badge/type-badge.component';
|
||||
import { StatusBadgeComponent } from './app/shared/object-collection/shared/badges/status-badge/status-badge.component';
|
||||
import { BadgesComponent } from './app/shared/object-collection/shared/badges/badges.component';
|
||||
import { AccessStatusBadgeComponent } from './app/shared/object-collection/shared/badges/access-status-badge/access-status-badge.component';
|
||||
|
||||
const DECLARATIONS = [
|
||||
FileSectionComponent,
|
||||
@@ -180,6 +181,7 @@ const DECLARATIONS = [
|
||||
StatusBadgeComponent,
|
||||
TypeBadgeComponent,
|
||||
MyDSpaceStatusBadgeComponent,
|
||||
AccessStatusBadgeComponent,
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
Reference in New Issue
Block a user