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