[DSC-1111] Start implementation refactoring

This commit is contained in:
Giuseppe Digilio
2024-02-13 12:05:30 +01:00
committed by Mattia Vianelli
parent b017f9ad16
commit 6d98bf9d3a
4 changed files with 13 additions and 14 deletions

View File

@@ -12,7 +12,7 @@ import {
import { Collection } from '../../core/shared/collection.model';
import { ComColFormComponent } from '../../shared/comcol/comcol-forms/comcol-form/comcol-form.component';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { CommunityDataService } from '../../core/data/community-data.service';
import { CollectionDataService } from '../../core/data/collection-data.service';
import { AuthService } from '../../core/auth/auth.service';
import { RequestService } from '../../core/data/request.service';
import { ObjectCacheService } from '../../core/cache/object-cache.service';
@@ -60,7 +60,7 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> imp
protected translate: TranslateService,
protected notificationsService: NotificationsService,
protected authService: AuthService,
protected dsoService: CommunityDataService,
protected dsoService: CollectionDataService,
protected requestService: RequestService,
protected objectCache: ObjectCacheService,
protected entityTypeService: EntityTypeDataService,

View File

@@ -4,8 +4,7 @@
<span>{{type.value + '.edit.logo.label' | translate}}</span>
</div>
<ng-container *ngVar="(dso?.logo | async)?.payload as logo">
<div *ngIf="logo" [ngClass]="{'alert-danger': markLogoForDeletion}" class="col-12 d-inline-block alert"
id="logo-section">
<div class="col-12 d-inline-block alert" [ngClass]="{'alert-danger': markLogoForDeletion}" id="logo-section" *ngIf="logo">
<div class="row">
<div class="col-8 d-inline-block">
<ds-comcol-page-logo [alternateText]="type.value + '.logo.alt'" [logo]="logo"></ds-comcol-page-logo>
@@ -44,8 +43,11 @@
</ng-container>
</div>
</div>
<ds-form (submitForm)="onSubmit()" *ngIf="formModel" [displayCancel]="false" [formId]="'comcol-form-id'"
[formModel]="formModel">
<ds-form *ngIf="formModel"
[formId]="'comcol-form-id'"
[formModel]="formModel"
[displayCancel]="false"
(submitForm)="onSubmit()">
<button (click)="back.emit()" before class="btn btn-outline-secondary" type="button">
<i class="fas fa-arrow-left" aria-hidden="true"></i> {{ type.value + '.edit.return' | translate }}
</button>

View File

@@ -75,7 +75,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
* @type {UploaderOptions}
*/
uploadFilesOptions: UploaderOptions = Object.assign(new UploaderOptions(), {
autoUpload: false
autoUpload: true
});
/**
@@ -155,9 +155,9 @@ export class ComColFormComponent<T extends Collection | Community> implements On
this.uploadFilesOptions.url = href;
this.uploadFilesOptions.authToken = this.authService.buildAuthHeader();
// If the object already contains a logo, send out a PUT request instead of POST for setting a new logo
if (hasValue(logoRD.payload)) {
this.uploadFilesOptions.method = RestRequestMethod.PUT;
}
// if (hasValue(logoRD.payload)) {
// this.uploadFilesOptions.method = RestRequestMethod.PUT;
// }
this.initializedUploaderOptions.next(true);
})
);
@@ -317,7 +317,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
this.refreshCache();
}
this.notificationsService.success(null, this.translate.get(this.type.value + '.edit.logo.notifications.add.success'));
this.finish.emit();
// this.finish.emit();
}
/**

View File

@@ -130,9 +130,6 @@ export class UploaderComponent {
ngAfterViewInit() {
this.uploader.onAfterAddingAll = ((items) => {
this.onFileSelected.emit(items);
if (this.uploader.queue.length > 0) {
this.uploader.uploadAll();
}
});
if (isUndefined(this.onBeforeUpload)) {
this.onBeforeUpload = () => {return;};