Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made edit metadata tab fields dynamic and added entity type support #3722

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/app/core/shared/context.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,10 @@ export enum Context {
Bitstream = 'bitstream',

CoarNotify = 'coarNotify',

/**
* The Edit Metadata field Context values that are used in the Edit Item Metadata tab.
*/
AddMetadata = 'addMetadata',
EditMetadata = 'editMetadata',
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<ds-dso-edit-metadata-value-headers role="presentation" [dsoType]="dsoType"></ds-dso-edit-metadata-value-headers>
<ds-dso-edit-metadata-value *ngFor="let mdValue of form.fields[mdField]; let idx = index" role="presentation"
[dso]="dso"
[context]="Context.EditMetadata"
[mdValue]="mdValue"
[mdField]="mdField"
[dsoType]="dsoType"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
Observable,
} from 'rxjs';

import { Context } from '../../../core/shared/context.model';
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
import {
DsoEditMetadataChangeType,
Expand Down Expand Up @@ -81,6 +82,8 @@ export class DsoEditMetadataFieldValuesComponent {
*/
public DsoEditMetadataChangeTypeEnum = DsoEditMetadataChangeType;

public readonly Context = Context;

/**
* Drop a value into a new position
* Update the form's value array for the current field to match the dropped position
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import {
Component,
EventEmitter,
Input,
Output,
} from '@angular/core';

import { Context } from '../../../core/shared/context.model';
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
import { DsoEditMetadataValue } from '../dso-edit-metadata-form';
import { EditMetadataValueFieldType } from './dso-edit-metadata-field-type.enum';

@Component({
selector: 'ds-dso-edit-metadata-entity-field',
template: '',
})
export abstract class AbstractDsoEditMetadataValueFieldComponent {

/**
* The optional context
*/
@Input() context: Context;

/**
* The {@link DSpaceObject}
*/
@Input() dso: DSpaceObject;

/**
* The type of the DSO, used to determines i18n messages
*/
@Input() dsoType: string;

/**
* The type of the field
*/
@Input() type: EditMetadataValueFieldType;

/**
* The metadata field
*/
@Input() mdField: string;

/**
* Editable metadata value to show
*/
@Input() mdValue: DsoEditMetadataValue;

/**
* Emits when the user clicked confirm
*/
@Output() confirm: EventEmitter<boolean> = new EventEmitter();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<ds-dynamic-scrollable-dropdown *ngIf="mdValue.editing && (isScrollableVocabulary$ | async)"
[bindId]="mdField"
[group]="group"
[model]="getModel()"
(change)="onChangeAuthorityField($event)">
</ds-dynamic-scrollable-dropdown>
<ds-dynamic-onebox
*ngIf="mdValue.editing && ((isHierarchicalVocabulary$ | async) || (isSuggesterVocabulary$ | async))"
[group]="group"
[model]="getModel()"
(change)="onChangeAuthorityField($event)">
</ds-dynamic-onebox>
<div class="mt-2" *ngIf=" mdValue.editing && (isAuthorityControlled$ | async) && (isSuggesterVocabulary$ | async)">
<div class="btn-group w-75">
<i dsAuthorityConfidenceState
class="fas fa-fw p-0 mr-1 mt-auto mb-auto"
aria-hidden="true"
[authorityValue]="mdValue.newValue.confidence"
[iconMode]="true"
></i>
<input class="form-control form-outline" data-test="authority-input" [(ngModel)]="mdValue.newValue.authority"
[disabled]="!editingAuthority"
[attr.aria-label]="(dsoType + '.edit.metadata.edit.authority.key') | translate"
(change)="onChangeAuthorityKey()"/>
<button class="btn btn-outline-secondary btn-sm ng-star-inserted" id="metadata-confirm-btn"
*ngIf="!editingAuthority"
[title]="dsoType + '.edit.metadata.edit.buttons.open-authority-edition' | translate"
ngbTooltip="{{ dsoType + '.edit.metadata.edit.buttons.open-authority-edition' | translate }}"
(click)="onChangeEditingAuthorityStatus(true)">
<i class="fas fa-lock fa-fw"></i>
</button>
<button class="btn btn-outline-success btn-sm ng-star-inserted" id="metadata-confirm-btn" *ngIf="editingAuthority"
[title]="dsoType + '.edit.metadata.edit.buttons.close-authority-edition' | translate"
ngbTooltip="{{ dsoType + '.edit.metadata.edit.buttons.close-authority-edition' | translate }}"
(click)="onChangeEditingAuthorityStatus(false)">
<i class="fas fa-lock-open fa-fw"></i>
</button>
</div>
</div>
Loading
Loading