diff --git a/src-ui/src/app/components/common/share-bundle-dialog/share-bundle-dialog.component.ts b/src-ui/src/app/components/common/share-bundle-dialog/share-bundle-dialog.component.ts index 58f3db592..67efe8281 100644 --- a/src-ui/src/app/components/common/share-bundle-dialog/share-bundle-dialog.component.ts +++ b/src-ui/src/app/components/common/share-bundle-dialog/share-bundle-dialog.component.ts @@ -4,7 +4,10 @@ import { Component, Input, inject } from '@angular/core' import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms' import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons' import { + SHARE_BUNDLE_FILE_VERSION_LABELS, + SHARE_BUNDLE_STATUS_LABELS, ShareBundleCreatePayload, + ShareBundleStatus, ShareBundleSummary, } from 'src/app/data/share-bundle' import { @@ -47,16 +50,7 @@ export class ShareBundleDialogComponent extends ConfirmDialogComponent { createdBundle: ShareBundleSummary | null = null copied = false onOpenManage?: () => void - readonly statusLabels: Record = { - pending: $localize`Pending`, - processing: $localize`Processing`, - ready: $localize`Ready`, - failed: $localize`Failed`, - } - readonly fileVersionLabels: Record = { - [FileVersion.Archive]: $localize`Archive`, - [FileVersion.Original]: $localize`Original`, - } + readonly statuses = ShareBundleStatus constructor() { super() @@ -116,10 +110,10 @@ export class ShareBundleDialogComponent extends ConfirmDialogComponent { } statusLabel(status: ShareBundleSummary['status']): string { - return this.statusLabels[status] ?? status + return SHARE_BUNDLE_STATUS_LABELS[status] ?? status } fileVersionLabel(version: FileVersion): string { - return this.fileVersionLabels[version] ?? version + return SHARE_BUNDLE_FILE_VERSION_LABELS[version] ?? version } } diff --git a/src-ui/src/app/components/common/share-bundle-manage-dialog/share-bundle-manage-dialog.component.ts b/src-ui/src/app/components/common/share-bundle-manage-dialog/share-bundle-manage-dialog.component.ts index 5e3a8bdd2..4a61c9262 100644 --- a/src-ui/src/app/components/common/share-bundle-manage-dialog/share-bundle-manage-dialog.component.ts +++ b/src-ui/src/app/components/common/share-bundle-manage-dialog/share-bundle-manage-dialog.component.ts @@ -5,6 +5,8 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons' import { Subject, catchError, of, switchMap, takeUntil, timer } from 'rxjs' import { + SHARE_BUNDLE_FILE_VERSION_LABELS, + SHARE_BUNDLE_STATUS_LABELS, ShareBundleStatus, ShareBundleSummary, } from 'src/app/data/share-bundle' @@ -41,18 +43,6 @@ export class ShareBundleManageDialogComponent private readonly refresh$ = new Subject() - private readonly statusLabels: Record = { - [ShareBundleStatus.Pending]: $localize`Pending`, - [ShareBundleStatus.Processing]: $localize`Processing`, - [ShareBundleStatus.Ready]: $localize`Ready`, - [ShareBundleStatus.Failed]: $localize`Failed`, - } - - private readonly fileVersionLabels: Record = { - [FileVersion.Archive]: $localize`Archive`, - [FileVersion.Original]: $localize`Original`, - } - ngOnInit(): void { this.refresh$ .pipe( @@ -154,11 +144,11 @@ export class ShareBundleManageDialogComponent } statusLabel(status: ShareBundleStatus): string { - return this.statusLabels[status] ?? status + return SHARE_BUNDLE_STATUS_LABELS[status] ?? status } fileVersionLabel(version: FileVersion): string { - return this.fileVersionLabels[version] ?? version + return SHARE_BUNDLE_FILE_VERSION_LABELS[version] ?? version } close(): void { diff --git a/src-ui/src/app/data/share-bundle.ts b/src-ui/src/app/data/share-bundle.ts index 3c6307730..0bd06e53b 100644 --- a/src-ui/src/app/data/share-bundle.ts +++ b/src-ui/src/app/data/share-bundle.ts @@ -26,3 +26,15 @@ export interface ShareBundleCreatePayload { file_version: FileVersion expiration_days: number | null } + +export const SHARE_BUNDLE_STATUS_LABELS: Record = { + [ShareBundleStatus.Pending]: $localize`Pending`, + [ShareBundleStatus.Processing]: $localize`Processing`, + [ShareBundleStatus.Ready]: $localize`Ready`, + [ShareBundleStatus.Failed]: $localize`Failed`, +} + +export const SHARE_BUNDLE_FILE_VERSION_LABELS: Record = { + [FileVersion.Archive]: $localize`Archive`, + [FileVersion.Original]: $localize`Original`, +}