forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'w2p-119915_made-edit-metadata-tab-fields-dynamic_contri…
…bute-7.6' # Conflicts: # src/app/core/shared/context.model.ts # src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-field-values/dso-edit-metadata-field-values.component.ts # src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.html # src/app/dso-shared/dso-edit-metadata/dso-edit-metadata-value/dso-edit-metadata-value.component.ts # src/app/dso-shared/dso-edit-metadata/dso-edit-metadata.component.ts # src/app/dso-shared/dso-shared.module.ts # src/app/shared/testing/entity-type-data.service.stub.ts
- Loading branch information
Showing
21 changed files
with
497 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...etadata/dso-edit-metadata-value-field/abstract-dso-edit-metadata-value-field.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
...-value-field/dso-edit-metadata-entity-field/dso-edit-metadata-entity-field.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<select class="form-control" [(ngModel)]="mdValue?.newValue.value" (ngModelChange)="confirm.emit(false)"> | ||
<option *ngFor="let entity of (entities$ | async)" [value]="entity.label === 'none' ? undefined : entity.label"> | ||
{{ entity.label }} | ||
</option> | ||
</select> |
Empty file.
36 changes: 36 additions & 0 deletions
36
...lue-field/dso-edit-metadata-entity-field/dso-edit-metadata-entity-field.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
ComponentFixture, | ||
TestBed, | ||
} from '@angular/core/testing'; | ||
|
||
import { EntityTypeDataService } from '../../../../core/data/entity-type-data.service'; | ||
import { EntityTypeDataServiceStub } from '../../../../shared/testing/entity-type-data.service.stub'; | ||
import { DsoEditMetadataEntityFieldComponent } from './dso-edit-metadata-entity-field.component'; | ||
|
||
describe('DsoEditMetadataEntityFieldComponent', () => { | ||
let component: DsoEditMetadataEntityFieldComponent; | ||
let fixture: ComponentFixture<DsoEditMetadataEntityFieldComponent>; | ||
|
||
let entityTypeService: EntityTypeDataServiceStub; | ||
|
||
beforeEach(async () => { | ||
entityTypeService = new EntityTypeDataServiceStub(); | ||
|
||
await TestBed.configureTestingModule({ | ||
declarations: [ | ||
DsoEditMetadataEntityFieldComponent, | ||
], | ||
providers: [ | ||
{ provide: EntityTypeDataService, useValue: entityTypeService }, | ||
], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(DsoEditMetadataEntityFieldComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
42 changes: 42 additions & 0 deletions
42
...ta-value-field/dso-edit-metadata-entity-field/dso-edit-metadata-entity-field.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
Component, | ||
OnInit, | ||
} from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
|
||
import { EntityTypeDataService } from '../../../../core/data/entity-type-data.service'; | ||
import { ItemType } from '../../../../core/shared/item-relationships/item-type.model'; | ||
import { getFirstSucceededRemoteListPayload } from '../../../../core/shared/operators'; | ||
import { AbstractDsoEditMetadataValueFieldComponent } from '../abstract-dso-edit-metadata-value-field.component'; | ||
import { EditMetadataValueFieldType } from '../dso-edit-metadata-field-type.enum'; | ||
import { editMetadataValueFieldComponent } from '../dso-edit-metadata-value-field-loader/dso-edit-metadata-value-field.decorator'; | ||
|
||
/** | ||
* The component used to gather input for entity-type metadata fields | ||
*/ | ||
@Component({ | ||
selector: 'ds-dso-edit-metadata-entity-field', | ||
templateUrl: './dso-edit-metadata-entity-field.component.html', | ||
styleUrls: ['./dso-edit-metadata-entity-field.component.scss'], | ||
}) | ||
@editMetadataValueFieldComponent(EditMetadataValueFieldType.ENTITY_TYPE) | ||
export class DsoEditMetadataEntityFieldComponent extends AbstractDsoEditMetadataValueFieldComponent implements OnInit { | ||
|
||
/** | ||
* List of all the existing entity types | ||
*/ | ||
entities$: Observable<ItemType[]>; | ||
|
||
constructor( | ||
protected entityTypeService: EntityTypeDataService, | ||
) { | ||
super(); | ||
} | ||
|
||
ngOnInit(): void { | ||
this.entities$ = this.entityTypeService.findAll({ elementsPerPage: 100, currentPage: 1 }).pipe( | ||
getFirstSucceededRemoteListPayload(), | ||
); | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
...ared/dso-edit-metadata/dso-edit-metadata-value-field/dso-edit-metadata-field-type.enum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/** | ||
* The edit metadata field tab types | ||
*/ | ||
export enum EditMetadataValueFieldType { | ||
PLAIN_TEXT = 'PLAIN_TEXT', | ||
ENTITY_TYPE = 'ENTITY_TYPE', | ||
} |
6 changes: 6 additions & 0 deletions
6
...data-value-field/dso-edit-metadata-text-field/dso-edit-metadata-text-field.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<textarea [(ngModel)]="mdValue?.newValue.value" | ||
[dsDebounce]="300" | ||
(onDebounce)="confirm.emit(false)" | ||
class="form-control" | ||
rows="5"> | ||
</textarea> |
Empty file.
27 changes: 27 additions & 0 deletions
27
...a-value-field/dso-edit-metadata-text-field/dso-edit-metadata-text-field.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { | ||
ComponentFixture, | ||
TestBed, | ||
} from '@angular/core/testing'; | ||
|
||
import { DsoEditMetadataTextFieldComponent } from './dso-edit-metadata-text-field.component'; | ||
|
||
describe('DsoEditMetadataTextFieldComponent', () => { | ||
let component: DsoEditMetadataTextFieldComponent; | ||
let fixture: ComponentFixture<DsoEditMetadataTextFieldComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ | ||
DsoEditMetadataTextFieldComponent, | ||
], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(DsoEditMetadataTextFieldComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
...tadata-value-field/dso-edit-metadata-text-field/dso-edit-metadata-text-field.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
import { AbstractDsoEditMetadataValueFieldComponent } from '../abstract-dso-edit-metadata-value-field.component'; | ||
import { EditMetadataValueFieldType } from '../dso-edit-metadata-field-type.enum'; | ||
import { editMetadataValueFieldComponent } from '../dso-edit-metadata-value-field-loader/dso-edit-metadata-value-field.decorator'; | ||
|
||
/** | ||
* The component used to gather input for plain-text metadata fields | ||
*/ | ||
@Component({ | ||
selector: 'ds-dso-edit-metadata-text-field', | ||
templateUrl: './dso-edit-metadata-text-field.component.html', | ||
styleUrls: ['./dso-edit-metadata-text-field.component.scss'], | ||
}) | ||
@editMetadataValueFieldComponent(EditMetadataValueFieldType.PLAIN_TEXT) | ||
export class DsoEditMetadataTextFieldComponent extends AbstractDsoEditMetadataValueFieldComponent { | ||
} |
1 change: 1 addition & 0 deletions
1
.../dso-edit-metadata-value-field-loader/dso-edit-metadata-value-field-loader.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<ng-template dsDsoEditMetadataValueFieldDirective></ng-template> |
Oops, something went wrong.