mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 06:13:38 +00:00
[PM-8381] Assign collections (#9854)
* initial add of assign collections component * grab cipherId from query params * add organization selection for moving a cipher * add multi-select for collections * add transfer of cipher to an organization * temp: do not show assign collections while a cipher already has an organization * account for initial collections for a cipher * block assign-collections route with feature flag * replace hardcoded string with i18n * separate out async calls to switchMap to avoid async subscribe * use local cipher rather than decrypting again * use anchor for better semantics * migrate form submission to bitSubmit directive * swap to "assign" rather than "save" * integrate with base AssignCollections component * clean up messages file * remove unneeded takeUntilDestroyed * remove unneeded bitFormButton * remove unused translations * lint fix * refactor assign-collections component to take in a button reference - This allows consuming components to not have to worry about loading/disabled states - The base AssignCollections component will change the submit button when supplied
This commit is contained in:
@@ -28,6 +28,7 @@ import { CollectionView } from "@bitwarden/common/vault/models/view/collection.v
|
||||
import {
|
||||
AsyncActionsModule,
|
||||
BitSubmitDirective,
|
||||
ButtonComponent,
|
||||
ButtonModule,
|
||||
DialogModule,
|
||||
FormFieldModule,
|
||||
@@ -86,11 +87,10 @@ export class AssignCollectionsComponent implements OnInit {
|
||||
|
||||
@Input() params: CollectionAssignmentParams;
|
||||
|
||||
@Output()
|
||||
formLoading = new EventEmitter<boolean>();
|
||||
|
||||
@Output()
|
||||
formDisabled = new EventEmitter<boolean>();
|
||||
/**
|
||||
* Submit button instance that will be disabled or marked as loading when the form is submitting.
|
||||
*/
|
||||
@Input() submitBtn?: ButtonComponent;
|
||||
|
||||
@Output()
|
||||
editableItemCountChange = new EventEmitter<number>();
|
||||
@@ -177,11 +177,19 @@ export class AssignCollectionsComponent implements OnInit {
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
this.bitSubmit.loading$.pipe(takeUntil(this.destroy$)).subscribe((loading) => {
|
||||
this.formLoading.emit(loading);
|
||||
if (!this.submitBtn) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.submitBtn.loading = loading;
|
||||
});
|
||||
|
||||
this.bitSubmit.disabled$.pipe(takeUntil(this.destroy$)).subscribe((disabled) => {
|
||||
this.formDisabled.emit(disabled);
|
||||
if (!this.submitBtn) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.submitBtn.disabled = disabled;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user