1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-10 13:23:34 +00:00

[PM-24935] - [Desktop] Fix loading state in cipher form save button (#16368)

* use bitButton for handling loading state

* remove unecessary code
This commit is contained in:
Jordan Aasen
2025-09-09 16:23:27 -07:00
committed by GitHub
parent e35dbba279
commit 8aa9f986f5
4 changed files with 3 additions and 17 deletions

View File

@@ -4,16 +4,12 @@
#submitBtn #submitBtn
form="cipherForm" form="cipherForm"
type="submit" type="submit"
*ngIf="action !== 'view'" [hidden]="action === 'view'"
bitButton
class="primary" class="primary"
appA11yTitle="{{ 'save' | i18n }}" appA11yTitle="{{ 'save' | i18n }}"
> >
<span [hidden]="isSubmitting">{{ "save" | i18n }}</span> {{ "save" | i18n }}
<i
class="bwi bwi-spinner bwi-spin bwi-lg bwi-fw"
[hidden]="!isSubmitting"
aria-hidden="true"
></i>
</button> </button>
<button <button
type="button" type="button"

View File

@@ -24,7 +24,6 @@ export class ItemFooterComponent implements OnInit {
@Input({ required: true }) cipher: CipherView = new CipherView(); @Input({ required: true }) cipher: CipherView = new CipherView();
@Input() collectionId: string | null = null; @Input() collectionId: string | null = null;
@Input({ required: true }) action: string = "view"; @Input({ required: true }) action: string = "view";
@Input() isSubmitting: boolean = false;
@Input() masterPasswordAlreadyPrompted: boolean = false; @Input() masterPasswordAlreadyPrompted: boolean = false;
@Output() onEdit = new EventEmitter<CipherView>(); @Output() onEdit = new EventEmitter<CipherView>();
@Output() onClone = new EventEmitter<CipherView>(); @Output() onClone = new EventEmitter<CipherView>();

View File

@@ -19,7 +19,6 @@
(onClone)="cloneCipher($event)" (onClone)="cloneCipher($event)"
(onDelete)="deleteCipher()" (onDelete)="deleteCipher()"
(onCancel)="cancelCipher($event)" (onCancel)="cancelCipher($event)"
[isSubmitting]="isSubmitting"
[masterPasswordAlreadyPrompted]="cipherRepromptId === cipherId" [masterPasswordAlreadyPrompted]="cipherRepromptId === cipherId"
></app-vault-item-footer> ></app-vault-item-footer>
<div class="content"> <div class="content">
@@ -33,7 +32,6 @@
formId="cipherForm" formId="cipherForm"
[config]="config" [config]="config"
(cipherSaved)="savedCipher($event)" (cipherSaved)="savedCipher($event)"
[beforeSubmit]="onSubmit"
[submitBtn]="footer?.submitBtn" [submitBtn]="footer?.submitBtn"
(formStatusChange$)="formStatusChanged($event)" (formStatusChange$)="formStatusChanged($event)"
> >

View File

@@ -161,7 +161,6 @@ export class VaultV2Component<C extends CipherViewLike>
cipher: CipherView | null = new CipherView(); cipher: CipherView | null = new CipherView();
collections: CollectionView[] | null = null; collections: CollectionView[] | null = null;
config: CipherFormConfig | null = null; config: CipherFormConfig | null = null;
isSubmitting = false;
/** Tracks the disabled status of the edit cipher form */ /** Tracks the disabled status of the edit cipher form */
protected formDisabled: boolean = false; protected formDisabled: boolean = false;
@@ -741,7 +740,6 @@ export class VaultV2Component<C extends CipherViewLike>
await this.vaultItemsComponent?.load(this.activeFilter.buildFilter()).catch(() => {}); await this.vaultItemsComponent?.load(this.activeFilter.buildFilter()).catch(() => {});
await this.go().catch(() => {}); await this.go().catch(() => {});
await this.vaultItemsComponent?.refresh().catch(() => {}); await this.vaultItemsComponent?.refresh().catch(() => {});
this.isSubmitting = false;
} }
async deleteCipher() { async deleteCipher() {
@@ -917,11 +915,6 @@ export class VaultV2Component<C extends CipherViewLike>
}); });
} }
protected onSubmit = async () => {
this.isSubmitting = true;
return Promise.resolve(true);
};
private prefillCipherFromFilter() { private prefillCipherFromFilter() {
if (this.activeFilter.selectedCollectionId != null && this.vaultFilterComponent != null) { if (this.activeFilter.selectedCollectionId != null && this.vaultFilterComponent != null) {
const collections = this.vaultFilterComponent.collections?.fullList.filter( const collections = this.vaultFilterComponent.collections?.fullList.filter(