mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
DSC-1111 Fixed issue on create comcol
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<ds-collection-form (submitForm)="onSubmit($event)"
|
||||
[isCreation]="true"
|
||||
(back)="navigateToHome()"
|
||||
(finish)="navigateToNewPage()"></ds-collection-form>
|
||||
</div>
|
||||
|
@@ -17,6 +17,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<ds-collection-form [dso]="(dsoRD$ | async)?.payload"
|
||||
[isCreation]="false"
|
||||
(submitForm)="onSubmit($event)"
|
||||
(back)="navigateToHomePage()"
|
||||
(finish)="navigateToHomePage()"></ds-collection-form>
|
||||
|
@@ -2,12 +2,13 @@
|
||||
<div class="row">
|
||||
<div class="col-12 pb-4">
|
||||
<ng-container *ngVar="(parentRD$ | async)?.payload as parent">
|
||||
<h2 *ngIf="!parent" id="header" class="border-bottom pb-2">{{ 'community.create.head' | translate }}</h2>
|
||||
<h2 *ngIf="!parent" id="header" class="border-bottom p-2">{{ 'community.create.head' | translate }}</h2>
|
||||
<h2 *ngIf="parent" id="sub-header" class="border-bottom pb-2">{{ 'community.create.sub-head' | translate:{ parent: dsoNameService.getName(parent) } }}</h2>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
<ds-community-form (submitForm)="onSubmit($event)"
|
||||
[isCreation]="true"
|
||||
(back)="navigateToHome()"
|
||||
(finish)="navigateToNewPage()"></ds-community-form>
|
||||
</div>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<ds-community-form [dso]="(dsoRD$ | async)?.payload"
|
||||
[isCreation]="false"
|
||||
(submitForm)="onSubmit($event)"
|
||||
(back)="navigateToHomePage()"
|
||||
(finish)="navigateToHomePage()"></ds-community-form>
|
||||
|
||||
|
@@ -47,6 +47,11 @@ export class ComColFormComponent<T extends Collection | Community> implements On
|
||||
*/
|
||||
@Input() dso: T;
|
||||
|
||||
/**
|
||||
* Boolean that represents if the comcol is being created or already exists
|
||||
*/
|
||||
@Input() isCreation!: boolean;
|
||||
|
||||
/**
|
||||
* Type of DSpaceObject that the form represents
|
||||
*/
|
||||
@@ -77,7 +82,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
|
||||
* @type {UploaderOptions}
|
||||
*/
|
||||
uploadFilesOptions: UploaderOptions = Object.assign(new UploaderOptions(), {
|
||||
autoUpload: true
|
||||
autoUpload: false
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -86,6 +91,8 @@ export class ComColFormComponent<T extends Collection | Community> implements On
|
||||
@Output() submitForm: EventEmitter<{
|
||||
dso: T,
|
||||
operations: Operation[],
|
||||
uploader?: FileUploader,
|
||||
deleteLogo?: boolean,
|
||||
}> = new EventEmitter();
|
||||
|
||||
/**
|
||||
@@ -128,6 +135,8 @@ export class ComColFormComponent<T extends Collection | Community> implements On
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.uploadFilesOptions.autoUpload = !this.isCreation;
|
||||
|
||||
if (hasValue(this.formModel)) {
|
||||
this.formModel.forEach(
|
||||
(fieldModel: DynamicInputModel) => {
|
||||
@@ -201,12 +210,20 @@ export class ComColFormComponent<T extends Collection | Community> implements On
|
||||
}
|
||||
});
|
||||
|
||||
this.submitForm.emit({
|
||||
dso: updatedDSO,
|
||||
operations: operations,
|
||||
});
|
||||
|
||||
this.finish.emit();
|
||||
if (!this.isCreation) {
|
||||
this.submitForm.emit({
|
||||
dso: updatedDSO,
|
||||
operations: operations,
|
||||
});
|
||||
this.finish.emit();
|
||||
} else {
|
||||
this.submitForm.emit({
|
||||
dso: updatedDSO,
|
||||
deleteLogo: false,
|
||||
uploader: hasValue(this.uploaderComponent) ? this.uploaderComponent.uploader : undefined,
|
||||
operations: operations,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -327,7 +344,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
|
||||
/**
|
||||
* Fetches the latest data for the dso
|
||||
*/
|
||||
private fetchUpdatedDso(): Observable<DSpaceObject | null> {
|
||||
private fetchUpdatedDso(): Observable<DSpaceObject | null> {
|
||||
return this.dsoService.findById(this.dso.id, false, true, followLink('logo')).pipe(
|
||||
tap((rd: RemoteData<T>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
@@ -340,13 +357,16 @@ private fetchUpdatedDso(): Observable<DSpaceObject | null> {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* The request was successful, display a success notification
|
||||
*/
|
||||
public onCompleteItem() {
|
||||
if (hasValue(this.dso.id)) {
|
||||
this.refreshDsoCache();
|
||||
}
|
||||
if (this.isCreation) {
|
||||
this.finish.emit();
|
||||
}
|
||||
this.notificationsService.success(null, this.translate.get(this.type.value + '.edit.logo.notifications.add.success'));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user