Skip to content

Commit

Permalink
chore: put max upload size in field config
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed Sep 4, 2024
1 parent aa68983 commit f60b198
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<gn-ui-file-input
[maxSizeMB]="10"
[maxSizeMB]="MAX_UPLOAD_SIZE_MB"
(fileChange)="handleFileChange($event)"
(uploadCancel)="handleUploadCancel()"
[uploadProgress]="uploadProgress"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { TranslateModule, TranslateService } from '@ngx-translate/core'
import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface'
import { Subscription } from 'rxjs'
import { MatDialog } from '@angular/material/dialog'
import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'

@Component({
selector: 'gn-ui-form-field-online-link-resources',
Expand Down Expand Up @@ -63,6 +64,8 @@ export class FormFieldOnlineLinkResourcesComponent {
uploadProgress = undefined
uploadSubscription: Subscription = null

protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB

constructor(
private notificationsService: NotificationsService,
private translateService: TranslateService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<gn-ui-image-input
[maxSizeMB]="5"
[maxSizeMB]="MAX_UPLOAD_SIZE_MB"
[previewUrl]="firstOverview.url"
[altText]="firstOverview.description"
(fileChange)="handleFileChange($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.
import { NotificationsService } from '@geonetwork-ui/feature/notifications'
import { TranslateService } from '@ngx-translate/core'
import { Subscription } from 'rxjs'
import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'

@Component({
selector: 'gn-ui-form-field-overviews',
Expand All @@ -31,6 +32,8 @@ export class FormFieldOverviewsComponent {
uploadProgress = undefined
uploadSubscription: Subscription = null

protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB

get firstOverview() {
return (
this.value[0] ?? {
Expand Down
2 changes: 2 additions & 0 deletions libs/feature/editor/src/lib/fields.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,5 @@ export const OPEN_DATA_LICENSES: string[] = [
'odc-by',
'pddl',
]

export const MAX_UPLOAD_SIZE_MB = 10

0 comments on commit f60b198

Please sign in to comment.