From bb15d5223c2be56a0ebced7151f41ed817d167ea Mon Sep 17 00:00:00 2001 From: Kevin Jump Date: Tue, 9 Sep 2025 10:39:00 +0100 Subject: [PATCH] add waiting state to the import upload button. --- .../usync-assets/src/lang/files/en-us.ts | 2 ++ .../workspace/components/usync-file-upload.element.ts | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/uSync.Backoffice.Management.Client/usync-assets/src/lang/files/en-us.ts b/uSync.Backoffice.Management.Client/usync-assets/src/lang/files/en-us.ts index 14cbd0646..17a2423d5 100644 --- a/uSync.Backoffice.Management.Client/usync-assets/src/lang/files/en-us.ts +++ b/uSync.Backoffice.Management.Client/usync-assets/src/lang/files/en-us.ts @@ -25,6 +25,8 @@ export default { noChangesImport: 'No changes where made to this item', noChangesReport: 'No changes detected', + importHeader: 'Import from file', + success: 'Success', change: 'Change', changeType: 'Type', diff --git a/uSync.Backoffice.Management.Client/usync-assets/src/workspace/components/usync-file-upload.element.ts b/uSync.Backoffice.Management.Client/usync-assets/src/workspace/components/usync-file-upload.element.ts index e5a523db0..1b173e1bb 100644 --- a/uSync.Backoffice.Management.Client/usync-assets/src/workspace/components/usync-file-upload.element.ts +++ b/uSync.Backoffice.Management.Client/usync-assets/src/workspace/components/usync-file-upload.element.ts @@ -14,12 +14,16 @@ import { UmbTemporaryFileModel, } from '@umbraco-cms/backoffice/temporary-file'; import { uSyncFilePickerChangeEvent, uSyncFilePickerUploadedEvent } from './events'; +import { UUIButtonState } from '@umbraco-cms/backoffice/external/uui'; @customElement('usync-file-upload') export class uSyncFileUploadElement extends UmbLitElement { #fileManager: UmbTemporaryFileManager; #repository: uSyncActionRepository; + @state() + buttonState?: UUIButtonState; + @state() selected: File | null | undefined; @@ -36,6 +40,7 @@ export class uSyncFileUploadElement extends UmbLitElement { value.forEach((file) => { if (file.status === TemporaryFileStatus.SUCCESS) { this.#uploadComplete(file.temporaryUnique); + this.buttonState = 'success'; } }); }); @@ -44,6 +49,8 @@ export class uSyncFileUploadElement extends UmbLitElement { #onUpload() { if (!this.selected) return; + this.buttonState = 'waiting'; + const upload: UmbTemporaryFileModel = { temporaryUnique: UmbId.new(), file: this.selected, @@ -93,7 +100,8 @@ export class uSyncFileUploadElement extends UmbLitElement { type="button" look="primary" @click="${this.#onUpload}" - label="Upload">`; + label="Upload" + .state=${this.buttonState}>`; } static styles = css`