Commit 57c2bf3f authored by Florent POITTEVIN's avatar Florent POITTEVIN
Browse files

chore: update to solidify 1.5.18 and add upload file size limit

parent 8219c16f
......@@ -14924,9 +14924,9 @@
}
},
"solidify-frontend": {
"version": "1.5.17",
"resolved": "https://nexus.unige.ch/repository/npm-all/solidify-frontend/-/solidify-frontend-1.5.17.tgz",
"integrity": "sha512-e+WSG2nc6psV5/mWESWoVrAnZ0BDf0fnGXnjLqRUO3QXyIUWSQscXS4VgRvzmRJYGO6zHRw7O8liAXgu2OP3IA==",
"version": "1.5.18",
"resolved": "https://nexus.unige.ch/repository/npm-all/solidify-frontend/-/solidify-frontend-1.5.18.tgz",
"integrity": "sha512-RuSi+ojIoL45H6mB1Lt6Qey7Q4rTIYijUKxX/iDuONKCA5KduVdB9Ogrx7NPLdnVzIRyqpUmmMvnzxWwrRuWaQ==",
"requires": {
"tslib": "^2.0.0"
}
......
......@@ -3,6 +3,7 @@ import {
Injectable,
} from "@angular/core";
import {ApiEnum} from "@app/shared/enums/api.enum";
import {AppSystemPropertyState} from "@app/stores/system-property/app-system-property.state";
import {DepositDataFile} from "@deposit/models/deposit-data-file.model";
import {DlcmFileUploadWrapper} from "@deposit/models/dlcm-file-upload-wrapper.model";
import {DepositDataFileAction} from "@deposit/stores/data-file/deposit-data-file.action";
......@@ -11,6 +12,7 @@ import {
depositUploadActionNameSpace,
} from "@deposit/stores/upload/deposit-upload.action";
import {DlcmEnvironment} from "@environments/environment.defaults.model";
import {TranslateService} from "@ngx-translate/core";
import {
Actions,
State,
......@@ -24,6 +26,7 @@ import {
isNullOrUndefined,
LABEL_TRANSLATE,
LabelTranslateInterface,
MemoizedUtil,
NotificationService,
Override,
StringUtil,
......@@ -48,17 +51,19 @@ export class DepositUploadState extends UploadState<DepositUploadStateModel, Dep
private readonly _TYPE_KEY: string = "type";
private readonly _FOLDER_KEY: string = "folder";
constructor(protected apiService: ApiService,
protected store: Store,
protected notificationService: NotificationService,
protected actions$: Actions,
constructor(protected readonly apiService: ApiService,
protected readonly store: Store,
protected readonly notificationService: NotificationService,
protected readonly actions$: Actions,
@Inject(ENVIRONMENT) protected readonly _environment: DlcmEnvironment,
@Inject(LABEL_TRANSLATE) protected readonly _labelTranslateInterface: LabelTranslateInterface,
protected readonly _translate: TranslateService,
) {
super(apiService, store, notificationService, actions$, {
nameSpace: depositUploadActionNameSpace,
callbackAfterAllUploadFinished: action => store.dispatch(new DepositDataFileAction.Refresh(action.parentId)),
}, _environment, _labelTranslateInterface);
fileSizeLimit: () => +MemoizedUtil.selectSnapshot(this.store, AppSystemPropertyState, state => state.current.fileSizeLimit),
}, _environment, _labelTranslateInterface, _translate);
}
protected get _urlResource(): string {
......
......@@ -109,10 +109,11 @@ export const labelTranslateSolidify: LabelTranslateInterface = {
doNotSeparate: LabelTranslateEnum.doNotSeparate,
separate: LabelTranslateEnum.separate,
notificationUploadInProgress: LabelTranslateEnum.notificationUploadInProgress,
notificationUploadCancelled: LabelTranslateEnum.notificationUploadCancelled,
notificationUploadSuccess: LabelTranslateEnum.notificationUploadSuccess,
notificationUploadFail: LabelTranslateEnum.notificationUploadFail,
notificationUploadErrorDuplicateFileFail: LabelTranslateEnum.notificationUploadErrorDuplicateFileFail,
notificationUploadCancelled: LabelTranslateEnum.notificationUploadCancelled,
notificationUploadFileSizeLimitXExceeded: LabelTranslateEnum.notificationUploadFileSizeLimitXExceeded,
semicolon: LabelTranslateEnum.semicolon,
underscore: LabelTranslateEnum.underscore,
dash: LabelTranslateEnum.dash,
......
......@@ -455,6 +455,7 @@ export class LabelTranslateEnum {
static notificationUploadSuccess: string = MARK_AS_TRANSLATABLE("general.notification.upload.success");
static notificationUploadFail: string = MARK_AS_TRANSLATABLE("general.notification.upload.fail");
static notificationUploadErrorDuplicateFileFail: string = MARK_AS_TRANSLATABLE("general.notification.upload.errorDuplicateFileFail");
static notificationUploadFileSizeLimitXExceeded: string = MARK_AS_TRANSLATABLE("general.notification.upload.fileSizeLimitXExceeded");
static notificationPreviewDownloadFail: string = MARK_AS_TRANSLATABLE("general.notification.previewDownloadFail");
static notificationPreviewFileNotSupported: string = MARK_AS_TRANSLATABLE("general.notification.previewFileNotSupported");
static notificationPreviewFileContentTypeNotSupported: string = MARK_AS_TRANSLATABLE("general.notification.previewFileContentTypeNotSupported");
......
......@@ -23,11 +23,11 @@ import {BaseFormDefinition} from "@shared/models/base-form-definition.model";
import {KeyValueInfo} from "@shared/models/key-value-info.model";
import {sharedLicenseActionNameSpace} from "@shared/stores/license/shared-license.action";
import {SharedLicenseState} from "@shared/stores/license/shared-license.state";
import {FileUtil} from "@shared/utils/file.util";
import {
AbstractFormPresentational,
DateUtil,
EnumUtil,
FileUtil,
isNullOrUndefined,
KeyValue,
MARK_AS_TRANSLATABLE,
......
import {
isNullOrUndefined,
isNumber,
StringUtil,
} from "solidify-frontend";
export class FileUtil {
static transformFileSize(size: number): string {
if (isNullOrUndefined(size) || !isNumber(size)) {
return StringUtil.stringEmpty;
}
let extension: string;
let newSize: number;
if (size < 1024) {
newSize = size;
extension = " B";
} else if (size < (1024 * 1024)) {
newSize = size / 1024;
extension = " KB";
} else if (size < (1024 * 1024 * 1024)) {
newSize = size / (1024 * 1024);
extension = " MB";
} else if (size < (1024 * 1024 * 1024 * 1024)) {
newSize = size / (1024 * 1024 * 1024);
extension = " GB";
} else {
newSize = size / (1024 * 1024 * 1024 * 1024);
extension = " TB";
}
return newSize.toFixed(1) + extension;
}
}
......@@ -1433,6 +1433,7 @@
"cancelled": "general.notification.upload.cancelled",
"errorDuplicateFileFail": "general.notification.upload.errorDuplicateFileFail",
"fail": "general.notification.upload.fail",
"fileSizeLimitXExceeded": "general.notification.upload.fileSizeLimitXExceeded",
"inProgress": "general.notification.upload.inProgress",
"success": "general.notification.upload.success"
}
......
......@@ -1433,6 +1433,7 @@
"cancelled": "The file upload has been cancelled",
"errorDuplicateFileFail": "You can't upload a file with the same name in the same directory",
"fail": "A problem was encountered during the upload",
"fileSizeLimitXExceeded": "The file size limit set at {{size}} is exceeded",
"inProgress": "You have a file upload in progress! If you leave, the upload may be interrupted.",
"success": "Upload successful"
}
......@@ -2153,4 +2154,4 @@
"title": "User guide",
"tooltipClose": "Close user guide"
}
}
}
\ No newline at end of file
......@@ -1433,6 +1433,7 @@
"cancelled": "L'envoi du fichier a été annulé avec succès",
"errorDuplicateFileFail": "Vous ne pouvez pas uploader un fichier avec le même nom dans le même répertoire",
"fail": "Il y a eu un problème avec l'envoi du fichier",
"fileSizeLimitXExceeded": "La taille limite du fichier fixé à {{size}} est dépassée",
"inProgress": "Vous avez des envois de fichier en cours ! Si vous partez, l'envoi sera potentiellement interrompu.",
"success": "Fichier envoyé avec succès"
}
......@@ -2153,4 +2154,4 @@
"title": "Guide d'utilisation",
"tooltipClose": "Fermer le guide d'utilisation"
}
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment