mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-09 19:13:08 +00:00
fixed issues with sending name variant update requests to the server
This commit is contained in:
@@ -52,7 +52,6 @@ import { MetadataFieldWrapperComponent } from './field-components/metadata-field
|
|||||||
RelatedItemsComponent,
|
RelatedItemsComponent,
|
||||||
ItemComponent,
|
ItemComponent,
|
||||||
GenericItemPageFieldComponent,
|
GenericItemPageFieldComponent,
|
||||||
MetadataRepresentationListComponent,
|
|
||||||
RelatedEntitiesSearchComponent
|
RelatedEntitiesSearchComponent
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
@@ -62,7 +61,6 @@ import { MetadataFieldWrapperComponent } from './field-components/metadata-field
|
|||||||
GenericItemPageFieldComponent,
|
GenericItemPageFieldComponent,
|
||||||
RelatedEntitiesSearchComponent,
|
RelatedEntitiesSearchComponent,
|
||||||
RelatedItemsComponent,
|
RelatedItemsComponent,
|
||||||
MetadataRepresentationListComponent,
|
|
||||||
ItemPageTitleFieldComponent
|
ItemPageTitleFieldComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
|
@@ -106,7 +106,7 @@ export class MetadataRepresentationListComponent implements OnInit {
|
|||||||
return leftItem.payload;
|
return leftItem.payload;
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
map((item: Item) => Object.assign(new ItemMetadataRepresentation(), item))
|
map((item: Item) => Object.assign(new ItemMetadataRepresentation(metadatum), item))
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
|
@@ -9,7 +9,7 @@ import { RelationshipService } from '../../../../../core/data/relationship.servi
|
|||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
|
|
||||||
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.Submission)
|
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.Workspace)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-person-search-result-list-submission-element',
|
selector: 'ds-person-search-result-list-submission-element',
|
||||||
styleUrls: ['./person-search-result-list-submission-element.component.scss'],
|
styleUrls: ['./person-search-result-list-submission-element.component.scss'],
|
||||||
|
@@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
<ng-container #componentViewContainer></ng-container>
|
<ng-container #componentViewContainer></ng-container>
|
||||||
|
|
||||||
<small *ngIf="hasHint && (!showErrorMessages || errorMessages.length === 0)"
|
<small *ngIf="hasHint && (!showErrorMessages || errorMessages.length === 0)"
|
||||||
class="text-muted" [innerHTML]="model.hint | translate" [ngClass]="getClass('element', 'hint')"></small>
|
class="text-muted" [innerHTML]="model.hint | translate" [ngClass]="getClass('element', 'hint')"></small>
|
||||||
|
|
||||||
<div *ngIf="showErrorMessages" [ngClass]="[getClass('element', 'errors'), getClass('grid', 'errors')]">
|
<div *ngIf="showErrorMessages" [ngClass]="[getClass('element', 'errors'), getClass('grid', 'errors')]">
|
||||||
<small *ngFor="let message of errorMessages" class="invalid-feedback d-block">{{ message | translate:model.validators }}</small>
|
<small *ngFor="let message of errorMessages" class="invalid-feedback d-block">{{ message | translate:model.validators }}</small>
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
<span class="d-inline-block align-middle ml-1">
|
<span class="d-inline-block align-middle ml-1">
|
||||||
<ds-metadata-representation-loader [mdRepresentation]="(modelValueMDRepresentation | async)[i]"></ds-metadata-representation-loader>
|
<ds-listable-object-component-loader [context]="context" [object]="v" [index]="i"></ds-listable-object-component-loader>
|
||||||
</span>
|
</span>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</li>
|
</li>
|
||||||
|
@@ -57,7 +57,7 @@ import { DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER } from './models/date-picker/dat
|
|||||||
import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP } from './models/lookup/dynamic-lookup.model';
|
import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP } from './models/lookup/dynamic-lookup.model';
|
||||||
import { DynamicListCheckboxGroupModel } from './models/list/dynamic-list-checkbox-group.model';
|
import { DynamicListCheckboxGroupModel } from './models/list/dynamic-list-checkbox-group.model';
|
||||||
import { DynamicListRadioGroupModel } from './models/list/dynamic-list-radio-group.model';
|
import { DynamicListRadioGroupModel } from './models/list/dynamic-list-radio-group.model';
|
||||||
import { hasValue, isNotEmpty, isNotUndefined } from '../../../empty.util';
|
import { hasValue, isNotEmpty, isNotEmptyOperator, isNotUndefined } from '../../../empty.util';
|
||||||
import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME } from './models/lookup/dynamic-lookup-name.model';
|
import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME } from './models/lookup/dynamic-lookup-name.model';
|
||||||
import { DsDynamicTagComponent } from './models/tag/dynamic-tag.component';
|
import { DsDynamicTagComponent } from './models/tag/dynamic-tag.component';
|
||||||
import { DsDatePickerComponent } from './models/date-picker/date-picker.component';
|
import { DsDatePickerComponent } from './models/date-picker/date-picker.component';
|
||||||
@@ -178,7 +178,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
|||||||
relationships$: Observable<SearchResult<Item>[]>;
|
relationships$: Observable<SearchResult<Item>[]>;
|
||||||
hasRelationLookup: boolean;
|
hasRelationLookup: boolean;
|
||||||
modalRef: NgbModalRef;
|
modalRef: NgbModalRef;
|
||||||
modelValueMDRepresentation;
|
item$: Observable<Item>;
|
||||||
listId: string;
|
listId: string;
|
||||||
searchConfig: string;
|
searchConfig: string;
|
||||||
/* tslint:disable:no-output-rename */
|
/* tslint:disable:no-output-rename */
|
||||||
@@ -216,19 +216,20 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
|||||||
this.hasRelationLookup = hasValue(this.model.relationship);
|
this.hasRelationLookup = hasValue(this.model.relationship);
|
||||||
if (this.hasRelationLookup) {
|
if (this.hasRelationLookup) {
|
||||||
this.listId = 'list-' + this.model.relationship.relationshipType;
|
this.listId = 'list-' + this.model.relationship.relationshipType;
|
||||||
this.submissionObjectService
|
this.item$ = this.submissionObjectService
|
||||||
.findById(this.model.submissionId).pipe(
|
.findById(this.model.submissionId).pipe(
|
||||||
getSucceededRemoteData(),
|
getSucceededRemoteData(),
|
||||||
getRemoteDataPayload(),
|
getRemoteDataPayload(),
|
||||||
switchMap((submissionObject: SubmissionObject) => (submissionObject.item as Observable<RemoteData<Item>>).pipe(getSucceededRemoteData(), getRemoteDataPayload())),
|
switchMap((submissionObject: SubmissionObject) => (submissionObject.item as Observable<RemoteData<Item>>).pipe(getSucceededRemoteData(), getRemoteDataPayload())));
|
||||||
|
|
||||||
|
this.item$.pipe(
|
||||||
switchMap((item: Item) => this.relationService.getRelatedItemsByLabel(item, this.model.relationship.relationshipType)),
|
switchMap((item: Item) => this.relationService.getRelatedItemsByLabel(item, this.model.relationship.relationshipType)),
|
||||||
map((items: PaginatedList<Item>) => items.page.map((item) => Object.assign(new SearchResult(), { indexableObject: item }))),
|
map((items: RemoteData<PaginatedList<Item>>) => items.payload.page.map((item) => Object.assign(new SearchResult(), { indexableObject: item }))),
|
||||||
).subscribe((relatedItems: SearchResult<Item>[]) => this.selectableListService.select(this.listId, relatedItems));
|
).subscribe((relatedItems: SearchResult<Item>[]) => this.selectableListService.select(this.listId, relatedItems));
|
||||||
|
|
||||||
this.relationships$ = this.selectableListService.getSelectableList(this.listId).pipe(
|
this.relationships$ = this.selectableListService.getSelectableList(this.listId).pipe(
|
||||||
map((listState: SelectableListState) => hasValue(listState) && hasValue(listState.selection) ? listState.selection : []),
|
map((listState: SelectableListState) => hasValue(listState) && hasValue(listState.selection) ? listState.selection : []),
|
||||||
) as Observable<SearchResult<Item>[]>;
|
) as Observable<SearchResult<Item>[]>;
|
||||||
this.modelValueMDRepresentation = this.relationships$.pipe(map((result: SearchResult<DSpaceObject>[]) => result.map((element: SearchResult<DSpaceObject>) => Object.assign(new ItemMetadataRepresentation(), element.indexableObject))));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,13 +275,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
|||||||
}
|
}
|
||||||
|
|
||||||
openLookup() {
|
openLookup() {
|
||||||
this.submissionObjectService
|
this.item$.subscribe((item: Item) => {
|
||||||
.findById(this.model.submissionId).pipe(
|
|
||||||
getSucceededRemoteData(),
|
|
||||||
getRemoteDataPayload(),
|
|
||||||
switchMap((submissionObject: SubmissionObject) =>
|
|
||||||
(submissionObject.item as Observable<RemoteData<Item>>).pipe(getSucceededRemoteData(), getRemoteDataPayload()))
|
|
||||||
).subscribe((item: Item) => {
|
|
||||||
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent, { size: 'lg' });
|
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent, { size: 'lg' });
|
||||||
const modalComp = this.modalRef.componentInstance;
|
const modalComp = this.modalRef.componentInstance;
|
||||||
modalComp.repeatable = this.model.repeatable;
|
modalComp.repeatable = this.model.repeatable;
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
import { Component, NgZone, OnInit } from '@angular/core';
|
import { Component, NgZone, OnInit } from '@angular/core';
|
||||||
import { combineLatest, Observable, Subscription } from 'rxjs';
|
import { combineLatest, Observable, Subscription } from 'rxjs';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { hasValue, hasValueOperator } from '../../../../empty.util';
|
import { hasValue } from '../../../../empty.util';
|
||||||
import { map, skip, switchMap, take, tap } from 'rxjs/operators';
|
import { map, skip, switchMap, take } from 'rxjs/operators';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../../+my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../../+my-dspace-page/my-dspace-page.component';
|
||||||
import { SearchConfigurationService } from '../../../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../../../core/shared/search/search-configuration.service';
|
||||||
import { SelectableListService } from '../../../../object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../../../object-list/selectable-list/selectable-list.service';
|
||||||
@@ -12,7 +12,6 @@ import { RelationshipOptions } from '../../models/relationship-options.model';
|
|||||||
import { SearchResult } from '../../../../search/search-result.model';
|
import { SearchResult } from '../../../../search/search-result.model';
|
||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../../core/shared/operators';
|
import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../../core/shared/operators';
|
||||||
import { RemoteData } from '../../../../../core/data/remote-data';
|
|
||||||
import { AddRelationshipAction, RemoveRelationshipAction } from './relationship.actions';
|
import { AddRelationshipAction, RemoveRelationshipAction } from './relationship.actions';
|
||||||
import { RelationshipService } from '../../../../../core/data/relationship.service';
|
import { RelationshipService } from '../../../../../core/data/relationship.service';
|
||||||
import { RelationshipTypeService } from '../../../../../core/data/relationship-type.service';
|
import { RelationshipTypeService } from '../../../../../core/data/relationship-type.service';
|
||||||
@@ -21,8 +20,6 @@ import { AppState } from '../../../../../app.reducer';
|
|||||||
import { Context } from '../../../../../core/shared/context.model';
|
import { Context } from '../../../../../core/shared/context.model';
|
||||||
import { Relationship } from '../../../../../core/shared/item-relationships/relationship.model';
|
import { Relationship } from '../../../../../core/shared/item-relationships/relationship.model';
|
||||||
import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
||||||
import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model';
|
|
||||||
import { NameVariantListState } from './name-variant.reducer';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-dynamic-lookup-relation-modal',
|
selector: 'ds-dynamic-lookup-relation-modal',
|
||||||
@@ -62,7 +59,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit {
|
|||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.selection$ = this.selectableListService.getSelectableList(this.listId).pipe(map((listState: SelectableListState) => hasValue(listState) && hasValue(listState.selection) ? listState.selection : []));
|
this.selection$ = this.selectableListService.getSelectableList(this.listId).pipe(map((listState: SelectableListState) => hasValue(listState) && hasValue(listState.selection) ? listState.selection : []));
|
||||||
if (this.relationshipOptions.nameVariants) {
|
if (this.relationshipOptions.nameVariants) {
|
||||||
this.context = Context.Submission;
|
this.context = Context.Workspace;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -168,6 +168,7 @@ import { PublicationSearchResultGridElementComponent } from './object-grid/searc
|
|||||||
import { ListableObjectDirective } from './object-collection/shared/listable-object/listable-object.directive';
|
import { ListableObjectDirective } from './object-collection/shared/listable-object/listable-object.directive';
|
||||||
import { SearchLabelComponent } from './search/search-labels/search-label/search-label.component';
|
import { SearchLabelComponent } from './search/search-labels/search-label/search-label.component';
|
||||||
import { ItemMetadataRepresentationListElementComponent } from './object-list/metadata-representation-list-element/item/item-metadata-representation-list-element.component';
|
import { ItemMetadataRepresentationListElementComponent } from './object-list/metadata-representation-list-element/item/item-metadata-representation-list-element.component';
|
||||||
|
import { MetadataRepresentationListComponent } from '../+item-page/simple/metadata-representation-list/metadata-representation-list.component';
|
||||||
|
|
||||||
const MODULES = [
|
const MODULES = [
|
||||||
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
||||||
@@ -319,7 +320,8 @@ const COMPONENTS = [
|
|||||||
ItemTypeBadgeComponent,
|
ItemTypeBadgeComponent,
|
||||||
ItemSelectComponent,
|
ItemSelectComponent,
|
||||||
CollectionSelectComponent,
|
CollectionSelectComponent,
|
||||||
MetadataRepresentationLoaderComponent
|
MetadataRepresentationLoaderComponent,
|
||||||
|
MetadataRepresentationListComponent,
|
||||||
];
|
];
|
||||||
|
|
||||||
const ENTRY_COMPONENTS = [
|
const ENTRY_COMPONENTS = [
|
||||||
|
Reference in New Issue
Block a user