mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
74199: Admin search dialogs - intermediate commit
This commit is contained in:
@@ -13,4 +13,5 @@ export enum Context {
|
|||||||
EntitySearchModal = 'EntitySearchModal',
|
EntitySearchModal = 'EntitySearchModal',
|
||||||
AdminSearch = 'adminSearch',
|
AdminSearch = 'adminSearch',
|
||||||
AdminWorkflowSearch = 'adminWorkflowSearch',
|
AdminWorkflowSearch = 'adminWorkflowSearch',
|
||||||
|
SideBarSearchModal = 'sideBarSearchModal',
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,6 @@
|
|||||||
title="{{ listEntry.indexableObject.name }}"
|
title="{{ listEntry.indexableObject.name }}"
|
||||||
(click)="onSelect.emit(listEntry.indexableObject)" #listEntryElement>
|
(click)="onSelect.emit(listEntry.indexableObject)" #listEntryElement>
|
||||||
<ds-listable-object-component-loader [object]="listEntry" [viewMode]="viewMode"
|
<ds-listable-object-component-loader [object]="listEntry" [viewMode]="viewMode"
|
||||||
[linkType]=linkTypes.None></ds-listable-object-component-loader>
|
[linkType]=linkTypes.None [context]="context"></ds-listable-object-component-loader>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -21,6 +21,7 @@ import { PaginatedList } from '../../../core/data/paginated-list';
|
|||||||
import { SearchResult } from '../../search/search-result.model';
|
import { SearchResult } from '../../search/search-result.model';
|
||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||||
|
import { Context } from '../../../core/shared/context.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-dso-selector',
|
selector: 'ds-dso-selector',
|
||||||
@@ -85,6 +86,11 @@ export class DSOSelectorComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
linkTypes = CollectionElementLinkType;
|
linkTypes = CollectionElementLinkType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This component's context to display listable objects for
|
||||||
|
*/
|
||||||
|
context = Context.SideBarSearchModal;
|
||||||
|
|
||||||
constructor(private searchService: SearchService) {
|
constructor(private searchService: SearchService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
<span>Test display for sidebar-search list elements</span>
|
@@ -0,0 +1,17 @@
|
|||||||
|
import { listableObjectComponent } from '../../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
|
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { Context } from '../../../../../core/shared/context.model';
|
||||||
|
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
|
||||||
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
|
import { SidebarSearchListElementComponent } from '../../sidebar-search-list-element.component';
|
||||||
|
|
||||||
|
@listableObjectComponent('PublicationSearchResult', ViewMode.ListElement, Context.SideBarSearchModal)
|
||||||
|
@listableObjectComponent(ItemSearchResult, ViewMode.ListElement, Context.SideBarSearchModal)
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-publication-sidebar-search-list-element',
|
||||||
|
templateUrl: '../../sidebar-search-list-element.component.html'
|
||||||
|
})
|
||||||
|
export class PublicationSidebarSearchListElementComponent extends SidebarSearchListElementComponent<ItemSearchResult, Item> {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
<ds-truncatable-part *ngIf="parentTitle$ | async" [maxLines]="1"><div class="text-secondary">{{ parentTitle$ | async }}</div></ds-truncatable-part>
|
||||||
|
<ds-truncatable-part [maxLines]="1"><div class="text-primary">{{ title }}</div></ds-truncatable-part>
|
||||||
|
<ds-truncatable-part [maxLines]="1"><div class="text-secondary">{{ description }}</div></ds-truncatable-part>
|
@@ -0,0 +1,56 @@
|
|||||||
|
import { SearchResult } from '../../search/search-result.model';
|
||||||
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
|
import { SearchResultListElementComponent } from '../search-result-list-element/search-result-list-element.component';
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { hasValue } from '../../empty.util';
|
||||||
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
|
import { TruncatableService } from '../../truncatable/truncatable.service';
|
||||||
|
import { LinkService } from '../../../core/cache/builders/link.service';
|
||||||
|
import { find, map } from 'rxjs/operators';
|
||||||
|
import { ChildHALResource } from '../../../core/shared/child-hal-resource.model';
|
||||||
|
import { followLink } from '../../utils/follow-link-config.model';
|
||||||
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'ds-sidebar-search-list-element',
|
||||||
|
templateUrl: './sidebar-search-list-element.component.html'
|
||||||
|
})
|
||||||
|
export class SidebarSearchListElementComponent<T extends SearchResult<K>, K extends DSpaceObject> extends SearchResultListElementComponent<T, K> {
|
||||||
|
parentTitle$: Observable<string>;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
public constructor(protected truncatableService: TruncatableService,
|
||||||
|
protected linkService: LinkService) {
|
||||||
|
super(truncatableService);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
super.ngOnInit();
|
||||||
|
if (hasValue(this.dso)) {
|
||||||
|
this.parentTitle$ = this.getParentTitle();
|
||||||
|
this.title = this.getTitle();
|
||||||
|
this.description = this.getDescription();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getTitle(): string {
|
||||||
|
return this.firstMetadataValue('dc.title');
|
||||||
|
}
|
||||||
|
|
||||||
|
getDescription(): string {
|
||||||
|
// TODO: Expand description
|
||||||
|
return this.firstMetadataValue('dc.publisher');
|
||||||
|
}
|
||||||
|
|
||||||
|
getParentTitle(): Observable<string> {
|
||||||
|
// TODO: Remove cast to "any" and replace with proper type-check
|
||||||
|
const propertyName = (this.dso as any).getParentLinkKey();
|
||||||
|
return this.linkService.resolveLink(this.dso, followLink(propertyName))[propertyName].pipe(
|
||||||
|
find((parentRD: RemoteData<ChildHALResource & DSpaceObject>) => parentRD.hasSucceeded || parentRD.statusCode === 204),
|
||||||
|
map((parentRD: RemoteData<ChildHALResource & DSpaceObject>) => {
|
||||||
|
return parentRD.payload.firstMetadataValue('dc.title');
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -210,6 +210,8 @@ import { CollectionDropdownComponent } from './collection-dropdown/collection-dr
|
|||||||
import { DsSelectComponent } from './ds-select/ds-select.component';
|
import { DsSelectComponent } from './ds-select/ds-select.component';
|
||||||
import { VocabularyTreeviewComponent } from './vocabulary-treeview/vocabulary-treeview.component';
|
import { VocabularyTreeviewComponent } from './vocabulary-treeview/vocabulary-treeview.component';
|
||||||
import { CurationFormComponent } from '../curation-form/curation-form.component';
|
import { CurationFormComponent } from '../curation-form/curation-form.component';
|
||||||
|
import { PublicationSidebarSearchListElementComponent } from './object-list/sidebar-search-list-element/item-types/publication/publication-sidebar-search-list-element.component';
|
||||||
|
import { SidebarSearchListElementComponent } from './object-list/sidebar-search-list-element/sidebar-search-list-element.component';
|
||||||
|
|
||||||
const MODULES = [
|
const MODULES = [
|
||||||
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
||||||
@@ -483,7 +485,9 @@ const ENTRY_COMPONENTS = [
|
|||||||
CurationFormComponent,
|
CurationFormComponent,
|
||||||
ExportMetadataSelectorComponent,
|
ExportMetadataSelectorComponent,
|
||||||
ConfirmationModalComponent,
|
ConfirmationModalComponent,
|
||||||
VocabularyTreeviewComponent
|
VocabularyTreeviewComponent,
|
||||||
|
SidebarSearchListElementComponent,
|
||||||
|
PublicationSidebarSearchListElementComponent,
|
||||||
];
|
];
|
||||||
|
|
||||||
const SHARED_ITEM_PAGE_COMPONENTS = [
|
const SHARED_ITEM_PAGE_COMPONENTS = [
|
||||||
|
Reference in New Issue
Block a user