mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 02:24:11 +00:00
Added mydspace results components
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<ds-object-list [config]="config"
|
<ds-object-list [config]="config"
|
||||||
[sortConfig]="sortConfig"
|
[sortConfig]="sortConfig"
|
||||||
[objects]="objects"
|
[objects]="objects"
|
||||||
|
[hasBorder]="hasBorder"
|
||||||
[hideGear]="hideGear"
|
[hideGear]="hideGear"
|
||||||
*ngIf="getViewMode()===viewModeEnum.List">
|
*ngIf="getViewMode()===viewModeEnum.List">
|
||||||
</ds-object-list>
|
</ds-object-list>
|
||||||
@@ -12,4 +13,11 @@
|
|||||||
*ngIf="getViewMode()===viewModeEnum.Grid">
|
*ngIf="getViewMode()===viewModeEnum.Grid">
|
||||||
</ds-object-grid>
|
</ds-object-grid>
|
||||||
|
|
||||||
|
<ds-object-detail [config]="config"
|
||||||
|
[sortConfig]="sortConfig"
|
||||||
|
[objects]="objects"
|
||||||
|
[hideGear]="hideGear"
|
||||||
|
*ngIf="getViewMode()===viewModeEnum.Detail">
|
||||||
|
</ds-object-detail>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,20 +1,22 @@
|
|||||||
|
import {
|
||||||
import {map} from 'rxjs/operators';
|
ChangeDetectorRef,
|
||||||
import { Component, EventEmitter,
|
Component,
|
||||||
|
EventEmitter,
|
||||||
Input,
|
Input,
|
||||||
|
OnChanges,
|
||||||
OnInit,
|
OnInit,
|
||||||
Output, SimpleChanges, OnChanges, ChangeDetectorRef } from '@angular/core';
|
Output,
|
||||||
|
SimpleChanges
|
||||||
|
} from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
|
|
||||||
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
|
||||||
|
|
||||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||||
|
|
||||||
import { ListableObject } from './shared/listable-object.model';
|
import { ListableObject } from './shared/listable-object.model';
|
||||||
import { hasValue, isNotEmpty } from '../empty.util';
|
import { hasValue, isNotEmpty } from '../empty.util';
|
||||||
import { ViewMode } from '../../core/shared/view-mode.model';
|
import { ViewMode } from '../../core/shared/view-mode.model';
|
||||||
@@ -29,6 +31,7 @@ export class ObjectCollectionComponent implements OnChanges, OnInit {
|
|||||||
@Input() objects: RemoteData<ListableObject[]>;
|
@Input() objects: RemoteData<ListableObject[]>;
|
||||||
@Input() config?: PaginationComponentOptions;
|
@Input() config?: PaginationComponentOptions;
|
||||||
@Input() sortConfig: SortOptions;
|
@Input() sortConfig: SortOptions;
|
||||||
|
@Input() hasBorder = false;
|
||||||
@Input() hideGear = false;
|
@Input() hideGear = false;
|
||||||
pageInfo: Observable<PageInfo>;
|
pageInfo: Observable<PageInfo>;
|
||||||
private sub;
|
private sub;
|
||||||
@@ -80,12 +83,16 @@ export class ObjectCollectionComponent implements OnChanges, OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param cdRef
|
||||||
|
* ChangeDetectorRef service provided by Angular.
|
||||||
* @param route
|
* @param route
|
||||||
* Route is a singleton service provided by Angular.
|
* Route is a singleton service provided by Angular.
|
||||||
* @param router
|
* @param router
|
||||||
* Router is a singleton service provided by Angular.
|
* Router is a singleton service provided by Angular.
|
||||||
*/
|
*/
|
||||||
constructor(private cdRef: ChangeDetectorRef, private route: ActivatedRoute,
|
constructor(
|
||||||
|
private cdRef: ChangeDetectorRef,
|
||||||
|
private route: ActivatedRoute,
|
||||||
private router: Router) {
|
private router: Router) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,8 @@
|
|||||||
|
import { ClaimedTask } from '../../../core/tasks/models/claimed-task-object.model';
|
||||||
|
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||||
|
import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type';
|
||||||
|
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
|
||||||
|
|
||||||
|
@searchResultFor(ClaimedTask, MyDSpaceConfigurationValueType.Workflow)
|
||||||
|
export class ClaimedTaskMyDSpaceResult extends SearchResult<ClaimedTask> {
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
import { Item } from '../../../core/shared/item.model';
|
||||||
|
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||||
|
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
|
||||||
|
import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type';
|
||||||
|
|
||||||
|
@searchResultFor(Item, MyDSpaceConfigurationValueType.Workspace)
|
||||||
|
export class ItemMyDSpaceResult extends SearchResult<Item> {
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
export enum MyDspaceItemStatusType {
|
||||||
|
WORKFLOW = 'mydspace.status.workflow',
|
||||||
|
REJECTED = 'mydspace.status.rejected',
|
||||||
|
VALIDATION = 'mydspace.status.validation',
|
||||||
|
WAITING_CONTROLLER = 'mydspace.status.waiting-for-controller',
|
||||||
|
IN_PROGRESS = 'mydspace.status.in-progress',
|
||||||
|
ACCEPTED = 'mydspace.status.accepted'
|
||||||
|
}
|
@@ -0,0 +1,5 @@
|
|||||||
|
<div>
|
||||||
|
<span [className]="badgeClass">
|
||||||
|
{{badgeContent | translate}}
|
||||||
|
</span>
|
||||||
|
</div>
|
@@ -0,0 +1,41 @@
|
|||||||
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
import { MyDspaceItemStatusType } from './my-dspace-item-status-type';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-mydspace-item-status',
|
||||||
|
styleUrls: ['./my-dspace-item-status.component.scss'],
|
||||||
|
templateUrl: './my-dspace-item-status.component.html'
|
||||||
|
})
|
||||||
|
|
||||||
|
export class MyDSpaceItemStatusComponent implements OnInit {
|
||||||
|
|
||||||
|
@Input() status: MyDspaceItemStatusType;
|
||||||
|
public badgeClass: string;
|
||||||
|
public badgeContent: string;
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.badgeContent = this.status;
|
||||||
|
this.badgeClass = 'text-light badge ';
|
||||||
|
switch (this.status) {
|
||||||
|
case MyDspaceItemStatusType.REJECTED:
|
||||||
|
this.badgeClass += 'badge-danger';
|
||||||
|
break;
|
||||||
|
case MyDspaceItemStatusType.VALIDATION:
|
||||||
|
this.badgeClass += 'badge-warning';
|
||||||
|
break;
|
||||||
|
case MyDspaceItemStatusType.WAITING_CONTROLLER:
|
||||||
|
this.badgeClass += 'badge-info';
|
||||||
|
break;
|
||||||
|
case MyDspaceItemStatusType.IN_PROGRESS:
|
||||||
|
this.badgeClass += 'badge-primary';
|
||||||
|
break;
|
||||||
|
case MyDspaceItemStatusType.ACCEPTED:
|
||||||
|
this.badgeClass += 'badge-success';
|
||||||
|
break;
|
||||||
|
case MyDspaceItemStatusType.WORKFLOW:
|
||||||
|
this.badgeClass += 'badge-info';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
<div class="mt-2 mb-2">
|
||||||
|
<span class="text-muted">{{'submission.workflow.tasks.generic.submitter' | translate}} : <span class="badge badge-pill badge-light">{{(submitter | async)?.name}}</span></span>
|
||||||
|
</div>
|
@@ -0,0 +1,29 @@
|
|||||||
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { filter, find, flatMap, map } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { EPerson } from '../../../../core/eperson/models/eperson.model';
|
||||||
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { isNotEmpty, isNotUndefined } from '../../../empty.util';
|
||||||
|
import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-item-submitter',
|
||||||
|
styleUrls: ['./item-submitter.component.scss'],
|
||||||
|
templateUrl: './item-submitter.component.html'
|
||||||
|
})
|
||||||
|
|
||||||
|
export class ItemSubmitterComponent implements OnInit {
|
||||||
|
@Input() object: any;
|
||||||
|
|
||||||
|
submitter: Observable<EPerson>;
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.submitter = (this.object.workflowitem as Observable<RemoteData<Workflowitem>>).pipe(
|
||||||
|
filter((rd: RemoteData<Workflowitem>) => (rd.hasSucceeded && isNotUndefined(rd.payload))),
|
||||||
|
flatMap((rd: RemoteData<Workflowitem>) => rd.payload.submitter as Observable<RemoteData<EPerson>>),
|
||||||
|
find((rd: RemoteData<EPerson>) => rd.hasSucceeded && isNotEmpty(rd.payload)),
|
||||||
|
map((rd: RemoteData<EPerson>) => rd.payload));
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
import { PoolTask } from '../../../core/tasks/models/pool-task-object.model';
|
||||||
|
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||||
|
import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type';
|
||||||
|
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
|
||||||
|
|
||||||
|
@searchResultFor(PoolTask, MyDSpaceConfigurationValueType.Workflow)
|
||||||
|
export class PoolTaskMyDSpaceResult extends SearchResult<PoolTask> {
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
import { Workflowitem } from '../../../core/submission/models/workflowitem.model';
|
||||||
|
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||||
|
import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type';
|
||||||
|
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
|
||||||
|
|
||||||
|
@searchResultFor(Workflowitem, MyDSpaceConfigurationValueType.Workspace)
|
||||||
|
export class WorkflowitemMyDSpaceResult extends SearchResult<Workflowitem> {
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
import { Workspaceitem } from '../../../core/submission/models/workspaceitem.model';
|
||||||
|
import { MyDSpaceConfigurationValueType } from '../../../+my-dspace-page/my-dspace-configuration-value-type';
|
||||||
|
import { searchResultFor } from '../../../+search-page/search-service/search-result-element-decorator';
|
||||||
|
import { SearchResult } from '../../../+search-page/search-result.model';
|
||||||
|
|
||||||
|
@searchResultFor(Workspaceitem, MyDSpaceConfigurationValueType.Workspace)
|
||||||
|
export class WorkspaceitemMyDSpaceResult extends SearchResult<Workspaceitem> {
|
||||||
|
}
|
@@ -0,0 +1,6 @@
|
|||||||
|
<ds-item-detail-preview *ngIf="workFlow"
|
||||||
|
[item]="(workFlow.item | async)?.payload"
|
||||||
|
[object]="object"
|
||||||
|
[status]="status"></ds-item-detail-preview>
|
||||||
|
|
||||||
|
<ds-claimed-task-actions *ngIf="workFlow" [object]="dso"></ds-claimed-task-actions>
|
@@ -0,0 +1,58 @@
|
|||||||
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||||
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
|
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
|
||||||
|
import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
|
||||||
|
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
||||||
|
import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/claimed-task-my-dspace-result.model';
|
||||||
|
import { ClaimedTaskDataService } from '../../../../core/tasks/claimed-task-data.service';
|
||||||
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
|
import { Location, LocationStrategy, PathLocationStrategy } from '@angular/common';
|
||||||
|
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
|
||||||
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-claimtask-my-dspace-result-detail-element',
|
||||||
|
styleUrls: ['../my-dspace-result-detail-element.component.scss'],
|
||||||
|
templateUrl: './ct-my-dspace-result-detail-element.component.html',
|
||||||
|
providers: [Location, {provide: LocationStrategy, useClass: PathLocationStrategy}]
|
||||||
|
})
|
||||||
|
|
||||||
|
@renderElementsFor(ClaimedTaskMyDSpaceResult, ViewMode.Detail)
|
||||||
|
@renderElementsFor(ClaimedTask, ViewMode.Detail)
|
||||||
|
export class ClaimedTaskMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<ClaimedTaskMyDSpaceResult, ClaimedTask> {
|
||||||
|
public status = MyDspaceItemStatusType.VALIDATION;
|
||||||
|
public workFlow: Workflowitem;
|
||||||
|
public rejectForm: FormGroup;
|
||||||
|
|
||||||
|
constructor(private ctDataService: ClaimedTaskDataService,
|
||||||
|
private modalService: NgbModal,
|
||||||
|
private formBuilder: FormBuilder,
|
||||||
|
@Inject('objectElementProvider') public listable: ListableObject) {
|
||||||
|
super(listable);
|
||||||
|
|
||||||
|
this.rejectForm = this.formBuilder.group({
|
||||||
|
reason: ['', Validators.required]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.initWorkflowItem(this.dso.workflowitem as Observable<RemoteData<Workflowitem>>);
|
||||||
|
}
|
||||||
|
|
||||||
|
initWorkflowItem(wfi$: Observable<RemoteData<Workflowitem>>) {
|
||||||
|
wfi$.pipe(
|
||||||
|
find((rd: RemoteData<Workflowitem>) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
|
||||||
|
).subscribe((rd: RemoteData<Workflowitem>) => {
|
||||||
|
this.workFlow = rd.payload;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,58 @@
|
|||||||
|
<div class="item-page" @fadeInOut>
|
||||||
|
<ng-container *ngIf="status">
|
||||||
|
<ds-mydspace-item-status [status]="status"></ds-mydspace-item-status>
|
||||||
|
</ng-container>
|
||||||
|
<div *ngIf="item">
|
||||||
|
<ds-item-page-title-field [item]="item"></ds-item-page-title-field>
|
||||||
|
<div class="row mb-1">
|
||||||
|
<div class="col-xs-12 col-md-4">
|
||||||
|
<ds-metadata-field-wrapper>
|
||||||
|
<ds-thumbnail [thumbnail]="thumbnail$ | async"></ds-thumbnail>
|
||||||
|
</ds-metadata-field-wrapper>
|
||||||
|
<ds-item-page-file-section [item]="item"></ds-item-page-file-section>
|
||||||
|
<ds-item-page-date-field [item]="item"></ds-item-page-date-field>
|
||||||
|
<ds-item-page-author-field [item]="item"></ds-item-page-author-field>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-md-6">
|
||||||
|
<ds-item-page-abstract-field [item]="item"></ds-item-page-abstract-field>
|
||||||
|
<ds-item-page-uri-field [item]="item"></ds-item-page-uri-field>
|
||||||
|
<ds-item-page-collections [item]="item"></ds-item-page-collections>
|
||||||
|
<div>
|
||||||
|
<ng-content></ng-content>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--<ng-container @fadeInOut>
|
||||||
|
<ng-container *ngIf="status">
|
||||||
|
<ds-item-status [status]="status"></ds-item-status>
|
||||||
|
</ng-container>
|
||||||
|
<ds-item-page-title-field [item]="item"></ds-item-page-title-field>
|
||||||
|
|
||||||
|
<div class="row mb-1">
|
||||||
|
<div class="col-xs-12 col-md-4">
|
||||||
|
<ds-metadata-field-wrapper>
|
||||||
|
<ds-thumbnail [thumbnail]="item.getThumbnail()"></ds-thumbnail>
|
||||||
|
</ds-metadata-field-wrapper>
|
||||||
|
<ds-item-page-file-section [item]="item"></ds-item-page-file-section>
|
||||||
|
<ds-item-page-date-field [item]="item"></ds-item-page-date-field>
|
||||||
|
<ds-item-page-author-field [item]="item"></ds-item-page-author-field>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-md-6">
|
||||||
|
<ds-item-page-abstract-field [item]="item"></ds-item-page-abstract-field>
|
||||||
|
<ds-item-page-uri-field [item]="item"></ds-item-page-uri-field>
|
||||||
|
<ds-item-page-collections [item]="item" *ngIf="item.owner"></ds-item-page-collections>
|
||||||
|
<div>
|
||||||
|
|
||||||
|
|
||||||
|
<ng-content></ng-content>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ng-container>-->
|
||||||
|
|
@@ -0,0 +1,32 @@
|
|||||||
|
import { Component, Input } from '@angular/core';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
import { fadeInOut } from '../../../animations/fade';
|
||||||
|
import { Bitstream } from '../../../../core/shared/bitstream.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-item-detail-preview',
|
||||||
|
styleUrls: ['./item-detail-preview.component.scss'],
|
||||||
|
templateUrl: './item-detail-preview.component.html',
|
||||||
|
animations: [fadeInOut]
|
||||||
|
})
|
||||||
|
export class ItemDetailPreviewComponent<T> {
|
||||||
|
|
||||||
|
@Input() item: Item;
|
||||||
|
@Input() object: any;
|
||||||
|
@Input() status: MyDspaceItemStatusType;
|
||||||
|
|
||||||
|
public ALL_STATUS = [];
|
||||||
|
public thumbnail$: Observable<Bitstream>;
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
Object.keys(MyDspaceItemStatusType).forEach((s) => {
|
||||||
|
this.ALL_STATUS.push(MyDspaceItemStatusType[s]);
|
||||||
|
});
|
||||||
|
this.thumbnail$ = this.item.getThumbnail();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,8 @@
|
|||||||
|
<ds-item-detail-preview [item]="dso"
|
||||||
|
[object]="object"
|
||||||
|
[status]="status">
|
||||||
|
</ds-item-detail-preview>
|
||||||
|
|
||||||
|
<ds-item-actions [object]="dso"></ds-item-actions>
|
||||||
|
|
||||||
|
|
@@ -0,0 +1 @@
|
|||||||
|
@import '../../../../../styles/variables';
|
@@ -0,0 +1,21 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
|
import { ItemMyDSpaceResult } from '../../../object-collection/shared/item-my-dspace-result.model';
|
||||||
|
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
|
||||||
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-workspaceitem-my-dspace-result-detail-element',
|
||||||
|
styleUrls: ['../my-dspace-result-detail-element.component.scss', './item-my-dspace-result-detail-element.component.scss'],
|
||||||
|
templateUrl: './item-my-dspace-result-detail-element.component.html'
|
||||||
|
})
|
||||||
|
|
||||||
|
@renderElementsFor(ItemMyDSpaceResult, ViewMode.Detail)
|
||||||
|
export class ItemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<ItemMyDSpaceResult, Item> {
|
||||||
|
|
||||||
|
public status = MyDspaceItemStatusType.ACCEPTED;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1 @@
|
|||||||
|
@import '../../object-grid/search-result-grid-element/search-result-grid-element.component';
|
@@ -0,0 +1,41 @@
|
|||||||
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
|
import { MyDSpaceResult } from '../../../+my-dspace-page/my-dspace-result.model';
|
||||||
|
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||||
|
import { ListableObject } from '../../object-collection/shared/listable-object.model';
|
||||||
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
|
import { Metadata } from '../../../core/shared/metadata.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-my-dspace-result-detail-element',
|
||||||
|
template: ``
|
||||||
|
})
|
||||||
|
|
||||||
|
export class MyDSpaceResultDetailElementComponent<T extends MyDSpaceResult<K>, K extends DSpaceObject> extends AbstractListableElementComponent<T> {
|
||||||
|
dso: K;
|
||||||
|
|
||||||
|
public constructor(@Inject('objectElementProvider') public gridable: ListableObject) {
|
||||||
|
super(gridable);
|
||||||
|
this.dso = this.object.dspaceObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all matching metadata string values from hitHighlights or dso metadata, preferring hitHighlights.
|
||||||
|
*
|
||||||
|
* @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]].
|
||||||
|
* @returns {string[]} the matching string values or an empty array.
|
||||||
|
*/
|
||||||
|
allMetadataValues(keyOrKeys: string | string[]): string[] {
|
||||||
|
return Metadata.allValues([this.object.hitHighlights, this.dso.metadata], keyOrKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the first matching metadata string value from hitHighlights or dso metadata, preferring hitHighlights.
|
||||||
|
*
|
||||||
|
* @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]].
|
||||||
|
* @returns {string} the first matching string value, or `undefined`.
|
||||||
|
*/
|
||||||
|
firstMetadataValue(keyOrKeys: string | string[]): string {
|
||||||
|
return Metadata.firstValue([this.object.hitHighlights, this.dso.metadata], keyOrKeys);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,6 @@
|
|||||||
|
<ds-item-detail-preview *ngIf="workFlow"
|
||||||
|
[item]="(workFlow.item | async)?.payload"
|
||||||
|
[object]="object"
|
||||||
|
[status]="status"></ds-item-detail-preview>
|
||||||
|
|
||||||
|
<ds-pool-task-actions *ngIf="workFlow" [object]="dso"></ds-pool-task-actions>
|
@@ -0,0 +1,46 @@
|
|||||||
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||||
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
|
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
|
||||||
|
import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
|
||||||
|
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
|
||||||
|
import { PoolTaskMyDSpaceResult } from '../../../object-collection/shared/pool-task-my-dspace-result.model';
|
||||||
|
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
|
||||||
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-pooltask-my-dspace-result-detail-element',
|
||||||
|
styleUrls: ['../my-dspace-result-detail-element.component.scss'],
|
||||||
|
templateUrl: './pt-my-dspace-result-detail-element.component.html',
|
||||||
|
})
|
||||||
|
|
||||||
|
@renderElementsFor(PoolTaskMyDSpaceResult, ViewMode.Detail)
|
||||||
|
@renderElementsFor(PoolTask, ViewMode.Detail)
|
||||||
|
export class PoolTaskMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<PoolTaskMyDSpaceResult, PoolTask> {
|
||||||
|
public status = MyDspaceItemStatusType.WAITING_CONTROLLER;
|
||||||
|
public workFlow: Workflowitem;
|
||||||
|
|
||||||
|
constructor(@Inject('objectElementProvider') public listable: ListableObject) {
|
||||||
|
|
||||||
|
super(listable);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.initWorkflowItem(this.dso.workflowitem as Observable<RemoteData<Workflowitem>>);
|
||||||
|
}
|
||||||
|
|
||||||
|
initWorkflowItem(wfi$: Observable<RemoteData<Workflowitem>>) {
|
||||||
|
wfi$.pipe(
|
||||||
|
find((rd: RemoteData<Workflowitem>) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
|
||||||
|
).subscribe((rd: RemoteData<Workflowitem>) => {
|
||||||
|
this.workFlow = rd.payload;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,6 @@
|
|||||||
|
<ds-item-detail-preview [item]="item"
|
||||||
|
[object]="object"
|
||||||
|
[status]="status"></ds-item-detail-preview>
|
||||||
|
|
||||||
|
<ds-workflowitem-actions [object]="dso"></ds-workflowitem-actions>
|
||||||
|
|
@@ -0,0 +1,45 @@
|
|||||||
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
|
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
|
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
|
||||||
|
import { WorkflowitemMyDSpaceResult } from '../../../object-collection/shared/workflowitem-my-dspace-result.model';
|
||||||
|
import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
|
||||||
|
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
|
||||||
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { find } from 'rxjs/operators';
|
||||||
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-workflowitem-my-dspace-result-detail-element',
|
||||||
|
styleUrls: ['../my-dspace-result-detail-element.component.scss'],
|
||||||
|
templateUrl: './wfi-my-dspace-result-detail-element.component.html',
|
||||||
|
})
|
||||||
|
|
||||||
|
@renderElementsFor(WorkflowitemMyDSpaceResult, ViewMode.Detail)
|
||||||
|
@renderElementsFor(Workflowitem, ViewMode.Detail)
|
||||||
|
export class WorkflowitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<WorkflowitemMyDSpaceResult, Workflowitem> {
|
||||||
|
|
||||||
|
public item: Item;
|
||||||
|
public status = MyDspaceItemStatusType.WORKFLOW;
|
||||||
|
|
||||||
|
constructor(@Inject('objectElementProvider') public listable: ListableObject) {
|
||||||
|
super(listable);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.initItem(this.dso.item as Observable<RemoteData<Item>>);
|
||||||
|
}
|
||||||
|
|
||||||
|
initItem(itemObs: Observable<RemoteData<Item>>) {
|
||||||
|
itemObs.pipe(
|
||||||
|
find((rd: RemoteData<any>) => rd.hasSucceeded && isNotUndefined(rd.payload))
|
||||||
|
).subscribe((rd: RemoteData<any>) => {
|
||||||
|
this.item = rd.payload[0];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,5 @@
|
|||||||
|
<ds-item-detail-preview [item]="item"
|
||||||
|
[object]="object"
|
||||||
|
[status]="status"></ds-item-detail-preview>
|
||||||
|
|
||||||
|
<ds-workspaceitem-actions [object]="dso"></ds-workspaceitem-actions>
|
@@ -0,0 +1,44 @@
|
|||||||
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { Workspaceitem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
import { WorkspaceitemMyDSpaceResult } from '../../../object-collection/shared/workspaceitem-my-dspace-result.model';
|
||||||
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
|
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
|
||||||
|
import { MyDSpaceResultDetailElementComponent } from '../my-dspace-result-detail-element.component';
|
||||||
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-workspaceitem-my-dspace-result-detail-element',
|
||||||
|
styleUrls: ['../my-dspace-result-detail-element.component.scss', './wsi-my-dspace-result-detail-element.component.scss'],
|
||||||
|
templateUrl: './wsi-my-dspace-result-detail-element.component.html',
|
||||||
|
})
|
||||||
|
|
||||||
|
@renderElementsFor(WorkspaceitemMyDSpaceResult, ViewMode.Detail)
|
||||||
|
@renderElementsFor(Workspaceitem, ViewMode.Detail)
|
||||||
|
export class WorkspaceitemMyDSpaceResultDetailElementComponent extends MyDSpaceResultDetailElementComponent<WorkspaceitemMyDSpaceResult, Workspaceitem> {
|
||||||
|
public item: Item;
|
||||||
|
status = MyDspaceItemStatusType.IN_PROGRESS;
|
||||||
|
|
||||||
|
constructor(@Inject('objectElementProvider') public listable: ListableObject) {
|
||||||
|
super(listable);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.initItem(this.dso.item as Observable<RemoteData<Item>>);
|
||||||
|
}
|
||||||
|
|
||||||
|
initItem(itemObs: Observable<RemoteData<Item>>) {
|
||||||
|
itemObs.pipe(
|
||||||
|
find((rd: RemoteData<any>) => rd.hasSucceeded && isNotUndefined(rd.payload))
|
||||||
|
).subscribe((rd: RemoteData<any>) => {
|
||||||
|
this.item = rd.payload[0];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
21
src/app/shared/object-detail/object-detail.component.html
Normal file
21
src/app/shared/object-detail/object-detail.component.html
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<ds-pagination
|
||||||
|
[paginationOptions]="config"
|
||||||
|
[pageInfoState]="objects?.payload"
|
||||||
|
[collectionSize]="objects?.payload?.totalElements"
|
||||||
|
[sortOptions]="sortConfig"
|
||||||
|
[hideGear]="hideGear"
|
||||||
|
[hidePagerWhenSinglePage]="hidePagerWhenSinglePage"
|
||||||
|
(pageChange)="onPageChange($event)"
|
||||||
|
(pageSizeChange)="onPageSizeChange($event)"
|
||||||
|
(sortDirectionChange)="onSortDirectionChange($event)"
|
||||||
|
(sortFieldChange)="onSortFieldChange($event)"
|
||||||
|
(paginationChange)="onPaginationChange($event)">
|
||||||
|
<div class="row mt-2" *ngIf="objects?.hasSucceeded" @fadeIn>
|
||||||
|
<div class="col"
|
||||||
|
*ngFor="let object of objects?.payload?.page">
|
||||||
|
<ds-wrapper-detail-element [object]="object"></ds-wrapper-detail-element>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<ds-error *ngIf="objects.hasFailed | async" message="{{'error.objects' | translate}}"></ds-error>
|
||||||
|
<ds-loading *ngIf="objects.isLoading | async" message="{{'loading.objects' | translate}}"></ds-loading>
|
||||||
|
</ds-pagination>
|
28
src/app/shared/object-detail/object-detail.component.scss
Normal file
28
src/app/shared/object-detail/object-detail.component.scss
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
@import '../../../styles/variables';
|
||||||
|
@import '../../../styles/mixins';
|
||||||
|
|
||||||
|
ds-wrapper-detail-element ::ng-deep {
|
||||||
|
div.thumbnail > img {
|
||||||
|
height: $card-thumbnail-height;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.card-title {
|
||||||
|
line-height: $headings-line-height;
|
||||||
|
height: ($headings-line-height*3) +em;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.item-abstract {
|
||||||
|
line-height: $line-height-base;
|
||||||
|
height: ($line-height-base*5)+em;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.item-authors{
|
||||||
|
line-height: $line-height-base;
|
||||||
|
height: ($line-height-base*1.5)+em;
|
||||||
|
}
|
||||||
|
div.card {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
}
|
100
src/app/shared/object-detail/object-detail.component.ts
Normal file
100
src/app/shared/object-detail/object-detail.component.ts
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
import {
|
||||||
|
ChangeDetectionStrategy,
|
||||||
|
Component,
|
||||||
|
EventEmitter,
|
||||||
|
Input,
|
||||||
|
Output,
|
||||||
|
ViewEncapsulation
|
||||||
|
} from '@angular/core';
|
||||||
|
|
||||||
|
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||||
|
import { PaginatedList } from '../../core/data/paginated-list';
|
||||||
|
|
||||||
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
|
import { fadeIn } from '../animations/fade';
|
||||||
|
import { ListableObject } from '../object-collection/shared/listable-object.model';
|
||||||
|
|
||||||
|
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
changeDetection: ChangeDetectionStrategy.Default,
|
||||||
|
encapsulation: ViewEncapsulation.Emulated,
|
||||||
|
selector: 'ds-object-detail',
|
||||||
|
styleUrls: [ './object-detail.component.scss' ],
|
||||||
|
templateUrl: './object-detail.component.html',
|
||||||
|
animations: [fadeIn]
|
||||||
|
})
|
||||||
|
|
||||||
|
export class ObjectDetailComponent {
|
||||||
|
|
||||||
|
@Input() config: PaginationComponentOptions;
|
||||||
|
@Input() sortConfig: SortOptions;
|
||||||
|
@Input() hideGear = false;
|
||||||
|
@Input() hidePagerWhenSinglePage = true;
|
||||||
|
private _objects: RemoteData<PaginatedList<ListableObject>>;
|
||||||
|
@Input() set objects(objects: RemoteData<PaginatedList<ListableObject>>) {
|
||||||
|
this._objects = objects;
|
||||||
|
}
|
||||||
|
get objects() {
|
||||||
|
return this._objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event fired when the page is changed.
|
||||||
|
* Event's payload equals to the newly selected page.
|
||||||
|
*/
|
||||||
|
@Output() change: EventEmitter<{
|
||||||
|
pagination: PaginationComponentOptions,
|
||||||
|
sort: SortOptions
|
||||||
|
}> = new EventEmitter<{
|
||||||
|
pagination: PaginationComponentOptions,
|
||||||
|
sort: SortOptions
|
||||||
|
}>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event fired when the page is changed.
|
||||||
|
* Event's payload equals to the newly selected page.
|
||||||
|
*/
|
||||||
|
@Output() pageChange: EventEmitter<number> = new EventEmitter<number>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event fired when the page wsize is changed.
|
||||||
|
* Event's payload equals to the newly selected page size.
|
||||||
|
*/
|
||||||
|
@Output() pageSizeChange: EventEmitter<number> = new EventEmitter<number>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event fired when the sort direction is changed.
|
||||||
|
* Event's payload equals to the newly selected sort direction.
|
||||||
|
*/
|
||||||
|
@Output() sortDirectionChange: EventEmitter<SortDirection> = new EventEmitter<SortDirection>();
|
||||||
|
|
||||||
|
@Output() paginationChange: EventEmitter<SortDirection> = new EventEmitter<any>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An event fired when the sort field is changed.
|
||||||
|
* Event's payload equals to the newly selected sort field.
|
||||||
|
*/
|
||||||
|
@Output() sortFieldChange: EventEmitter<string> = new EventEmitter<string>();
|
||||||
|
data: any = {};
|
||||||
|
onPageChange(event) {
|
||||||
|
this.pageChange.emit(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPageSizeChange(event) {
|
||||||
|
this.pageSizeChange.emit(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSortDirectionChange(event) {
|
||||||
|
this.sortDirectionChange.emit(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
onSortFieldChange(event) {
|
||||||
|
this.sortFieldChange.emit(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPaginationChange(event) {
|
||||||
|
this.paginationChange.emit(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1 @@
|
|||||||
|
<ng-container *ngComponentOutlet="getDetailElement(); injector: objectInjector;"></ng-container>
|
@@ -0,0 +1,2 @@
|
|||||||
|
@import '../../../../styles/variables';
|
||||||
|
|
@@ -0,0 +1,46 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
|
||||||
|
import { of as observableOf } from 'rxjs';
|
||||||
|
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { RouterStub } from '../../testing/router-stub';
|
||||||
|
|
||||||
|
import { WrapperGridElementComponent } from '../../object-grid/wrapper-grid-element/wrapper-grid-element.component';
|
||||||
|
|
||||||
|
let wrapperGridElementComponent: WrapperGridElementComponent;
|
||||||
|
let fixture: ComponentFixture<WrapperGridElementComponent>;
|
||||||
|
const queryParam = 'test query';
|
||||||
|
const scopeParam = '7669c72a-3f2a-451f-a3b9-9210e7a4c02f';
|
||||||
|
const activatedRouteStub = {
|
||||||
|
queryParams: observableOf({
|
||||||
|
query: queryParam,
|
||||||
|
scope: scopeParam
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('WrapperGridElementComponent', () => {
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ WrapperGridElementComponent ],
|
||||||
|
providers: [
|
||||||
|
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
||||||
|
{ provide: Router, useClass: RouterStub },
|
||||||
|
{ provide: 'objectElementProvider', useFactory: (wrapperGridElementComponent)}
|
||||||
|
],
|
||||||
|
|
||||||
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
|
}).compileComponents(); // compile template and css
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
fixture = TestBed.createComponent(WrapperGridElementComponent);
|
||||||
|
wrapperGridElementComponent = fixture.componentInstance;
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should show the wrapper element containing the cards',() => {
|
||||||
|
expect(fixture.debugElement.query(By.css('ds-collection-grid-element'))).toBeDefined();
|
||||||
|
})
|
||||||
|
});
|
@@ -0,0 +1,32 @@
|
|||||||
|
import { Component, Injector, Input, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { GenericConstructor } from '../../../core/shared/generic-constructor';
|
||||||
|
import { rendersDSOType } from '../../object-collection/shared/dso-element-decorator';
|
||||||
|
import { ListableObject } from '../../object-collection/shared/listable-object.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-wrapper-detail-element',
|
||||||
|
styleUrls: ['./wrapper-detail-element.component.scss'],
|
||||||
|
templateUrl: './wrapper-detail-element.component.html'
|
||||||
|
})
|
||||||
|
export class WrapperDetailElementComponent implements OnInit {
|
||||||
|
@Input() object: ListableObject;
|
||||||
|
objectInjector: Injector;
|
||||||
|
|
||||||
|
constructor(private injector: Injector) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.objectInjector = Injector.create({
|
||||||
|
providers: [{ provide: 'objectElementProvider', useFactory: () => (this.object), deps:[] }],
|
||||||
|
parent: this.injector
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
getDetailElement(): string {
|
||||||
|
const f: GenericConstructor<ListableObject> = this.object.constructor as GenericConstructor<ListableObject>;
|
||||||
|
return rendersDSOType(f, ViewMode.Detail);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,32 @@
|
|||||||
|
<ng-container *ngIf="item" @fadeInOut>
|
||||||
|
<ng-container *ngIf="status">
|
||||||
|
<ds-mydspace-item-status [status]="status"></ds-mydspace-item-status>
|
||||||
|
</ng-container>
|
||||||
|
<ds-truncatable [id]="item.id">
|
||||||
|
<h3 class="h3-title" [innerHTML]="firstMetadataValue('dc.title') || ('mydspace.results.no-title' | translate)" [ngClass]="{'lead': true,'text-muted': !firstMetadataValue('dc.title')}"></h3>
|
||||||
|
<div>
|
||||||
|
<span class="text-muted">
|
||||||
|
<ds-truncatable-part [id]="item.id" [minLines]="1">
|
||||||
|
(<span *ngIf="item.hasMetadata('dc.publisher')" class="item-list-publisher"
|
||||||
|
[innerHTML]="firstMetadataValue('dc.publisher') + ', '"></span>
|
||||||
|
<span class="item-list-date" [innerHTML]="firstMetadataValue('dc.date.issued') || ('mydspace.results.no-date' | translate)"></span>)
|
||||||
|
<span *ngIf="item.hasMetadata(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']);"
|
||||||
|
class="item-list-authors">
|
||||||
|
<span *ngIf="allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']).length === 0">{{'mydspace.results.no-authors' | translate}}</span>
|
||||||
|
<span *ngFor="let author of allMetadataValues(['dc.contributor.author', 'dc.creator', 'dc.contributor.*']); let last=last;">
|
||||||
|
<span [innerHTML]="author"><span [innerHTML]="author"></span></span>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</ds-truncatable-part>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<ds-truncatable-part [id]="item.id" [minLines]="1" class="item-list-abstract">
|
||||||
|
<span [ngClass]="{'text-muted': !firstMetadataValue('dc.description.abstract')}"
|
||||||
|
[innerHTML]="(firstMetadataValue('dc.description.abstract')) || ('mydspace.results.no-abstract' | translate)"></span>
|
||||||
|
</ds-truncatable-part>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</ds-truncatable>
|
||||||
|
<ds-item-submitter *ngIf="showSubmitter" [object]="object.dspaceObject"></ds-item-submitter>
|
||||||
|
</ng-container>
|
@@ -0,0 +1,5 @@
|
|||||||
|
@import '../../../../styles/_variables.scss';
|
||||||
|
|
||||||
|
.h3-title {
|
||||||
|
color: $link-color;
|
||||||
|
}
|
@@ -0,0 +1,41 @@
|
|||||||
|
import { Component, Input } from '@angular/core';
|
||||||
|
|
||||||
|
import { Item } from '../../../core/shared/item.model';
|
||||||
|
import { fadeInOut } from '../../animations/fade';
|
||||||
|
import { MyDspaceItemStatusType } from '../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
import { Metadata } from '../../../core/shared/metadata.model';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-item-list-preview',
|
||||||
|
styleUrls: ['item-list-preview.component.scss'],
|
||||||
|
templateUrl: 'item-list-preview.component.html',
|
||||||
|
animations: [fadeInOut]
|
||||||
|
})
|
||||||
|
|
||||||
|
export class ItemListPreviewComponent {
|
||||||
|
@Input() item: Item;
|
||||||
|
@Input() object: any;
|
||||||
|
@Input() status: MyDspaceItemStatusType;
|
||||||
|
@Input() showSubmitter = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all matching metadata string values from hitHighlights or dso metadata, preferring hitHighlights.
|
||||||
|
*
|
||||||
|
* @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]].
|
||||||
|
* @returns {string[]} the matching string values or an empty array.
|
||||||
|
*/
|
||||||
|
allMetadataValues(keyOrKeys: string | string[]): string[] {
|
||||||
|
return Metadata.allValues([this.object.hitHighlights, this.item.metadata], keyOrKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the first matching metadata string value from hitHighlights or dso metadata, preferring hitHighlights.
|
||||||
|
*
|
||||||
|
* @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]].
|
||||||
|
* @returns {string} the first matching string value, or `undefined`.
|
||||||
|
*/
|
||||||
|
firstMetadataValue(keyOrKeys: string | string[]): string {
|
||||||
|
return Metadata.firstValue([this.object.hitHighlights, this.item.metadata], keyOrKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
<ds-item-list-preview *ngIf="workFlow"
|
||||||
|
[item]="(workFlow.item | async)?.payload"
|
||||||
|
[object]="object"
|
||||||
|
[showSubmitter]="showSubmitter"
|
||||||
|
[status]="status"></ds-item-list-preview>
|
||||||
|
|
||||||
|
<ds-claimed-task-actions *ngIf="workFlow" [object]="dso"></ds-claimed-task-actions>
|
@@ -0,0 +1,42 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { Location, LocationStrategy, PathLocationStrategy } from '@angular/common';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||||
|
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
|
import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
|
||||||
|
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
||||||
|
import { ClaimedTaskMyDSpaceResult } from '../../../object-collection/shared/claimed-task-my-dspace-result.model';
|
||||||
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-claimtask-my-dspace-result-list-element',
|
||||||
|
styleUrls: ['../my-dspace-result-list-element.component.scss'],
|
||||||
|
templateUrl: './ct-my-dspace-result-list-element.component.html',
|
||||||
|
providers: [Location, { provide: LocationStrategy, useClass: PathLocationStrategy }]
|
||||||
|
})
|
||||||
|
|
||||||
|
@renderElementsFor(ClaimedTaskMyDSpaceResult, ViewMode.List)
|
||||||
|
@renderElementsFor(ClaimedTask, ViewMode.List)
|
||||||
|
export class ClaimedTaskMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<ClaimedTaskMyDSpaceResult, ClaimedTask> {
|
||||||
|
public showSubmitter = true;
|
||||||
|
public status = MyDspaceItemStatusType.VALIDATION;
|
||||||
|
public workFlow: Workflowitem;
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.initWorkflowItem(this.dso.workflowitem as Observable<RemoteData<Workflowitem>>);
|
||||||
|
}
|
||||||
|
|
||||||
|
initWorkflowItem(wfi$: Observable<RemoteData<Workflowitem>>) {
|
||||||
|
wfi$.pipe(
|
||||||
|
find((rd: RemoteData<Workflowitem>) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
|
||||||
|
).subscribe((rd: RemoteData<Workflowitem>) => {
|
||||||
|
this.workFlow = rd.payload;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,5 @@
|
|||||||
|
<ds-item-list-preview [item]="dso"
|
||||||
|
[object]="object"
|
||||||
|
[status]="status"></ds-item-list-preview>
|
||||||
|
|
||||||
|
<ds-item-actions [object]="dso"></ds-item-actions>
|
@@ -0,0 +1 @@
|
|||||||
|
@import '../../../../../styles/variables';
|
@@ -0,0 +1,21 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||||
|
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
|
import { ItemMyDSpaceResult } from '../../../object-collection/shared/item-my-dspace-result.model';
|
||||||
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-workspaceitem-my-dspace-result-list-element',
|
||||||
|
styleUrls: ['../my-dspace-result-list-element.component.scss', './item-my-dspace-result-list-element.component.scss'],
|
||||||
|
templateUrl: './item-my-dspace-result-list-element.component.html'
|
||||||
|
})
|
||||||
|
|
||||||
|
@renderElementsFor(ItemMyDSpaceResult, ViewMode.List)
|
||||||
|
export class ItemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<ItemMyDSpaceResult, Item> {
|
||||||
|
|
||||||
|
public status = MyDspaceItemStatusType.ACCEPTED;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1 @@
|
|||||||
|
@import '../search-result-list-element/search-result-list-element.component.scss';
|
@@ -0,0 +1,46 @@
|
|||||||
|
import { Component, Inject } from '@angular/core';
|
||||||
|
|
||||||
|
import { MyDSpaceResult } from '../../../+my-dspace-page/my-dspace-result.model';
|
||||||
|
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||||
|
import { ListableObject } from '../../object-collection/shared/listable-object.model';
|
||||||
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
|
import { Metadata } from '../../../core/shared/metadata.model';
|
||||||
|
import { TruncatableService } from '../../truncatable/truncatable.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-my-dspace-result-list-element',
|
||||||
|
template: ``
|
||||||
|
})
|
||||||
|
|
||||||
|
export class MyDSpaceResultListElementComponent<T extends MyDSpaceResult<K>, K extends DSpaceObject> extends AbstractListableElementComponent<T> {
|
||||||
|
dso: K;
|
||||||
|
dsoIndex: number;
|
||||||
|
|
||||||
|
public constructor(@Inject('objectElementProvider') public listable: ListableObject,
|
||||||
|
@Inject('indexElementProvider') public index: number) {
|
||||||
|
super(listable);
|
||||||
|
this.dso = this.object.dspaceObject;
|
||||||
|
this.dsoIndex = this.index;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all matching metadata string values from hitHighlights or dso metadata, preferring hitHighlights.
|
||||||
|
*
|
||||||
|
* @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]].
|
||||||
|
* @returns {string[]} the matching string values or an empty array.
|
||||||
|
*/
|
||||||
|
allMetadataValues(keyOrKeys: string | string[]): string[] {
|
||||||
|
return Metadata.allValues([this.object.hitHighlights, this.dso.metadata], keyOrKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the first matching metadata string value from hitHighlights or dso metadata, preferring hitHighlights.
|
||||||
|
*
|
||||||
|
* @param {string|string[]} keyOrKeys The metadata key(s) in scope. Wildcards are supported; see [[Metadata]].
|
||||||
|
* @returns {string} the first matching string value, or `undefined`.
|
||||||
|
*/
|
||||||
|
firstMetadataValue(keyOrKeys: string | string[]): string {
|
||||||
|
return Metadata.firstValue([this.object.hitHighlights, this.dso.metadata], keyOrKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,14 @@
|
|||||||
|
<ds-item-list-preview *ngIf="workFlow"
|
||||||
|
[item]="(workFlow.item | async)?.payload"
|
||||||
|
[object]="object"
|
||||||
|
[showSubmitter]="true"
|
||||||
|
[status]="status"></ds-item-list-preview>
|
||||||
|
|
||||||
|
<ds-pool-task-actions [object]="dso">
|
||||||
|
<button type="button"
|
||||||
|
class="btn btn-primary mt-1 mb-3"
|
||||||
|
(click)="view()">
|
||||||
|
<span>{{"mydspace.view-btn" | translate}}</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</ds-pool-task-actions>
|
@@ -0,0 +1,81 @@
|
|||||||
|
import { Component, Inject, OnDestroy, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
import { Observable, Subscription } from 'rxjs';
|
||||||
|
import { find, first } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||||
|
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { hasValue, isNotUndefined } from '../../../empty.util';
|
||||||
|
import { ListableObject } from '../../../object-collection/shared/listable-object.model';
|
||||||
|
import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
|
||||||
|
import { PoolTask } from '../../../../core/tasks/models/pool-task-object.model';
|
||||||
|
import { PoolTaskMyDSpaceResult } from '../../../object-collection/shared/pool-task-my-dspace-result.model';
|
||||||
|
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
|
||||||
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
import { MYDSPACE_ROUTE } from '../../../../+my-dspace-page/my-dspace-page.component';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-pooltask-my-dspace-result-list-element',
|
||||||
|
styleUrls: ['../my-dspace-result-list-element.component.scss'],
|
||||||
|
templateUrl: './pt-my-dspace-result-list-element.component.html',
|
||||||
|
})
|
||||||
|
|
||||||
|
@renderElementsFor(PoolTaskMyDSpaceResult, ViewMode.List)
|
||||||
|
@renderElementsFor(PoolTask, ViewMode.List)
|
||||||
|
export class PoolTaskMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<PoolTaskMyDSpaceResult, PoolTask> implements OnDestroy, OnInit {
|
||||||
|
public status = MyDspaceItemStatusType.WAITING_CONTROLLER;
|
||||||
|
public workFlow: Workflowitem;
|
||||||
|
public viewMode: ViewMode = ViewMode.List;
|
||||||
|
private sub: Subscription;
|
||||||
|
|
||||||
|
constructor(@Inject('objectElementProvider') public listable: ListableObject,
|
||||||
|
@Inject('indexElementProvider') public index: number,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router) {
|
||||||
|
super(listable, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.initWorkflowItem(this.dso.workflowitem as Observable<RemoteData<Workflowitem>>);
|
||||||
|
}
|
||||||
|
|
||||||
|
initWorkflowItem(wfi$: Observable<RemoteData<Workflowitem>>) {
|
||||||
|
wfi$.pipe(
|
||||||
|
find((rd: RemoteData<Workflowitem>) => (rd.hasSucceeded && isNotUndefined(rd.payload)))
|
||||||
|
).subscribe((rd: RemoteData<Workflowitem>) => {
|
||||||
|
this.workFlow = rd.payload;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
switchView() {
|
||||||
|
this.viewMode = (this.viewMode === ViewMode.List) ? ViewMode.Detail : ViewMode.List;
|
||||||
|
}
|
||||||
|
|
||||||
|
view() {
|
||||||
|
this.sub = this.route.queryParams.pipe(
|
||||||
|
first()
|
||||||
|
).subscribe((params) => {
|
||||||
|
const pageSize = params.pageSize || 1;
|
||||||
|
const page = (pageSize * this.dsoIndex ) + 1;
|
||||||
|
|
||||||
|
const navigationExtras: NavigationExtras = {
|
||||||
|
queryParams: {
|
||||||
|
view: ViewMode.Detail,
|
||||||
|
page,
|
||||||
|
pageSize
|
||||||
|
},
|
||||||
|
queryParamsHandling: 'merge'
|
||||||
|
};
|
||||||
|
this.router.navigate([MYDSPACE_ROUTE], navigationExtras);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
if (hasValue(this.sub)) {
|
||||||
|
this.sub.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,6 @@
|
|||||||
|
<ds-item-list-preview [item]="item"
|
||||||
|
[object]="object"
|
||||||
|
[status]="status"></ds-item-list-preview>
|
||||||
|
|
||||||
|
<ds-workflowitem-actions [object]="dso"></ds-workflowitem-actions>
|
||||||
|
|
@@ -0,0 +1,40 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||||
|
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
|
import { WorkflowitemMyDSpaceResult } from '../../../object-collection/shared/workflowitem-my-dspace-result.model';
|
||||||
|
import { Workflowitem } from '../../../../core/submission/models/workflowitem.model';
|
||||||
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-workflowitem-my-dspace-result-list-element',
|
||||||
|
styleUrls: ['../my-dspace-result-list-element.component.scss'],
|
||||||
|
templateUrl: './wfi-my-dspace-result-list-element.component.html',
|
||||||
|
})
|
||||||
|
|
||||||
|
@renderElementsFor(WorkflowitemMyDSpaceResult, ViewMode.List)
|
||||||
|
@renderElementsFor(Workflowitem, ViewMode.List)
|
||||||
|
export class WorkflowitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<WorkflowitemMyDSpaceResult, Workflowitem> {
|
||||||
|
public item: Item;
|
||||||
|
public status = MyDspaceItemStatusType.WORKFLOW;
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.initItem(this.dso.item as Observable<RemoteData<Item>>);
|
||||||
|
}
|
||||||
|
|
||||||
|
initItem(item$: Observable<RemoteData<Item>>) {
|
||||||
|
item$.pipe(
|
||||||
|
find((rd: RemoteData<Item>) => rd.hasSucceeded && isNotUndefined(rd.payload))
|
||||||
|
).subscribe((rd: RemoteData<Item>) => {
|
||||||
|
this.item = rd.payload;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,7 @@
|
|||||||
|
<ds-item-list-preview
|
||||||
|
*ngIf="status && item"
|
||||||
|
[item]="item"
|
||||||
|
[object]="object"
|
||||||
|
[status]="status"></ds-item-list-preview>
|
||||||
|
|
||||||
|
<ds-workspaceitem-actions [object]="dso"></ds-workspaceitem-actions>
|
@@ -0,0 +1,20 @@
|
|||||||
|
@import '../../../../../styles/variables';
|
||||||
|
|
||||||
|
::-webkit-scrollbar-track
|
||||||
|
{
|
||||||
|
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
|
||||||
|
background-color: #F5F5F5;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar
|
||||||
|
{
|
||||||
|
width: 12px;
|
||||||
|
background-color: #F5F5F5;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb
|
||||||
|
{
|
||||||
|
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
|
||||||
|
background-color: #555;
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,39 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { renderElementsFor } from '../../../object-collection/shared/dso-element-decorator';
|
||||||
|
import { MyDSpaceResultListElementComponent, } from '../my-dspace-result-list-element.component';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import { Workspaceitem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
import { WorkspaceitemMyDSpaceResult } from '../../../object-collection/shared/workspaceitem-my-dspace-result.model';
|
||||||
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-workspaceitem-my-dspace-result-list-element',
|
||||||
|
styleUrls: ['../my-dspace-result-list-element.component.scss', './wsi-my-dspace-result-list-element.component.scss'],
|
||||||
|
templateUrl: './wsi-my-dspace-result-list-element.component.html',
|
||||||
|
})
|
||||||
|
|
||||||
|
@renderElementsFor(WorkspaceitemMyDSpaceResult, ViewMode.List)
|
||||||
|
export class WorkspaceitemMyDSpaceResultListElementComponent extends MyDSpaceResultListElementComponent<WorkspaceitemMyDSpaceResult, Workspaceitem> {
|
||||||
|
|
||||||
|
item: Item;
|
||||||
|
status = MyDspaceItemStatusType.IN_PROGRESS;
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.initItem(this.dso.item as Observable<RemoteData<Item>>);
|
||||||
|
}
|
||||||
|
|
||||||
|
initItem(item$: Observable<RemoteData<Item>>) {
|
||||||
|
item$.pipe(
|
||||||
|
find((rd: RemoteData<Item>) => rd.hasSucceeded && isNotUndefined(rd.payload))
|
||||||
|
).subscribe((rd: RemoteData<Item>) => {
|
||||||
|
this.item = rd.payload;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@@ -11,8 +11,8 @@
|
|||||||
(sortFieldChange)="onSortFieldChange($event)"
|
(sortFieldChange)="onSortFieldChange($event)"
|
||||||
(paginationChange)="onPaginationChange($event)">
|
(paginationChange)="onPaginationChange($event)">
|
||||||
<ul *ngIf="objects?.hasSucceeded" class="list-unstyled">
|
<ul *ngIf="objects?.hasSucceeded" class="list-unstyled">
|
||||||
<li *ngFor="let object of objects?.payload?.page" class="mt-4 mb-4">
|
<li *ngFor="let object of objects?.payload?.page; let i = index" class="mt-4 mb-4" [class.border-bottom]="hasBorder">
|
||||||
<ds-wrapper-list-element [object]="object"></ds-wrapper-list-element>
|
<ds-wrapper-list-element [object]="object" [index]="i"></ds-wrapper-list-element>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ds-pagination>
|
</ds-pagination>
|
||||||
|
@@ -25,6 +25,7 @@ export class ObjectListComponent {
|
|||||||
|
|
||||||
@Input() config: PaginationComponentOptions;
|
@Input() config: PaginationComponentOptions;
|
||||||
@Input() sortConfig: SortOptions;
|
@Input() sortConfig: SortOptions;
|
||||||
|
@Input() hasBorder = false;
|
||||||
@Input() hideGear = false;
|
@Input() hideGear = false;
|
||||||
@Input() hidePagerWhenSinglePage = true;
|
@Input() hidePagerWhenSinglePage = true;
|
||||||
private _objects: RemoteData<PaginatedList<ListableObject>>;
|
private _objects: RemoteData<PaginatedList<ListableObject>>;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { Component, Injector, Input, OnInit } from '@angular/core';
|
import { Component, Injector, Input, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import { GenericConstructor } from '../../../core/shared/generic-constructor';
|
import { GenericConstructor } from '../../../core/shared/generic-constructor';
|
||||||
import { rendersDSOType } from '../../object-collection/shared/dso-element-decorator'
|
import { rendersDSOType } from '../../object-collection/shared/dso-element-decorator'
|
||||||
import { ListableObject } from '../../object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../object-collection/shared/listable-object.model';
|
||||||
@@ -11,13 +12,17 @@ import { ViewMode } from '../../../core/shared/view-mode.model';
|
|||||||
})
|
})
|
||||||
export class WrapperListElementComponent implements OnInit {
|
export class WrapperListElementComponent implements OnInit {
|
||||||
@Input() object: ListableObject;
|
@Input() object: ListableObject;
|
||||||
|
@Input() index: number;
|
||||||
objectInjector: Injector;
|
objectInjector: Injector;
|
||||||
|
|
||||||
constructor(private injector: Injector) {}
|
constructor(private injector: Injector) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.objectInjector = Injector.create({
|
this.objectInjector = Injector.create({
|
||||||
providers: [{ provide: 'objectElementProvider', useFactory: () => (this.object), deps:[] }],
|
providers: [
|
||||||
|
{ provide: 'objectElementProvider', useFactory: () => (this.object), deps:[] },
|
||||||
|
{ provide: 'indexElementProvider', useFactory: () => (this.index), deps:[] }
|
||||||
|
],
|
||||||
parent: this.injector
|
parent: this.injector
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user