mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix for manage access dialog focus (#9114)
* Fix for manage access dialog focus * Leverage eventuallyRunOnInitialized
This commit is contained in:
@@ -13,6 +13,7 @@ import { HdfsError } from '../webhdfs';
|
|||||||
import { ApiWrapper } from '../../apiWrapper';
|
import { ApiWrapper } from '../../apiWrapper';
|
||||||
import { IconPathHelper } from '../../iconHelper';
|
import { IconPathHelper } from '../../iconHelper';
|
||||||
import { HdfsFileType } from '../fileStatus';
|
import { HdfsFileType } from '../fileStatus';
|
||||||
|
import { EventEmitter } from 'vscode';
|
||||||
|
|
||||||
const permissionsTypeIconColumnWidth = 35;
|
const permissionsTypeIconColumnWidth = 35;
|
||||||
const permissionsDeleteColumnWidth = 50;
|
const permissionsDeleteColumnWidth = 50;
|
||||||
@@ -49,6 +50,7 @@ export class ManageAccessDialog {
|
|||||||
private posixPermissionCheckboxesMapping: PermissionCheckboxesMapping[] = [];
|
private posixPermissionCheckboxesMapping: PermissionCheckboxesMapping[] = [];
|
||||||
private namedSectionInheritCheckboxes: azdata.CheckBoxComponent[] = [];
|
private namedSectionInheritCheckboxes: azdata.CheckBoxComponent[] = [];
|
||||||
private addUserOrGroupSelectedType: AclType;
|
private addUserOrGroupSelectedType: AclType;
|
||||||
|
private onViewInitializedEvent: EventEmitter<void> = new EventEmitter();
|
||||||
|
|
||||||
constructor(private hdfsPath: string, private fileSource: IFileSource, private readonly apiWrapper: ApiWrapper) {
|
constructor(private hdfsPath: string, private fileSource: IFileSource, private readonly apiWrapper: ApiWrapper) {
|
||||||
this.hdfsModel = new HdfsModel(this.fileSource, this.hdfsPath);
|
this.hdfsModel = new HdfsModel(this.fileSource, this.hdfsPath);
|
||||||
@@ -92,7 +94,6 @@ export class ManageAccessDialog {
|
|||||||
await modelView.initializeModel(this.rootLoadingComponent);
|
await modelView.initializeModel(this.rootLoadingComponent);
|
||||||
this.modelInitialized = true;
|
this.modelInitialized = true;
|
||||||
this.handlePermissionStatusUpdated(this.hdfsModel.permissionStatus);
|
this.handlePermissionStatusUpdated(this.hdfsModel.permissionStatus);
|
||||||
this.addUserOrGroupInput.focus();
|
|
||||||
});
|
});
|
||||||
this.dialog.content = [tab];
|
this.dialog.content = [tab];
|
||||||
}
|
}
|
||||||
@@ -238,6 +239,7 @@ export class ManageAccessDialog {
|
|||||||
.component();
|
.component();
|
||||||
contentContainer.addItem(this.namedUsersAndGroupsPermissionsContainer, { flex: '1', CSSStyles: { 'overflow': 'scroll', 'min-height': '200px' } });
|
contentContainer.addItem(this.namedUsersAndGroupsPermissionsContainer, { flex: '1', CSSStyles: { 'overflow': 'scroll', 'min-height': '200px' } });
|
||||||
this.viewInitialized = true;
|
this.viewInitialized = true;
|
||||||
|
this.onViewInitializedEvent.fire();
|
||||||
}
|
}
|
||||||
|
|
||||||
private handlePermissionStatusUpdated(permissionStatus: PermissionStatus): void {
|
private handlePermissionStatusUpdated(permissionStatus: PermissionStatus): void {
|
||||||
@@ -250,6 +252,7 @@ export class ManageAccessDialog {
|
|||||||
this.initializeView(permissionStatus);
|
this.initializeView(permissionStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.eventuallyRunOnInitialized(() => {
|
||||||
this.stickyCheckbox.checked = permissionStatus.stickyBit;
|
this.stickyCheckbox.checked = permissionStatus.stickyBit;
|
||||||
if (this.hdfsModel.fileStatus.type === HdfsFileType.Directory) {
|
if (this.hdfsModel.fileStatus.type === HdfsFileType.Directory) {
|
||||||
this.inheritDefaultsCheckbox.checked =
|
this.inheritDefaultsCheckbox.checked =
|
||||||
@@ -324,6 +327,9 @@ export class ManageAccessDialog {
|
|||||||
this.namedUsersAndGroupsPermissionsContainer.addItem(namedUsersAndGroupsTable);
|
this.namedUsersAndGroupsPermissionsContainer.addItem(namedUsersAndGroupsTable);
|
||||||
|
|
||||||
this.rootLoadingComponent.loading = false;
|
this.rootLoadingComponent.loading = false;
|
||||||
|
|
||||||
|
this.addUserOrGroupInput.focus();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private createRadioButton(modelBuilder: azdata.ModelBuilder, label: string, name: string, aclEntryType: AclType): azdata.RadioButtonComponent {
|
private createRadioButton(modelBuilder: azdata.ModelBuilder, label: string, name: string, aclEntryType: AclType): azdata.RadioButtonComponent {
|
||||||
@@ -583,6 +589,25 @@ export class ManageAccessDialog {
|
|||||||
|
|
||||||
return sectionHeaderContainer;
|
return sectionHeaderContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runs the specified action when the component is initialized. If already initialized just runs
|
||||||
|
* the action immediately.
|
||||||
|
* @param action The action to be ran when the page is initialized
|
||||||
|
*/
|
||||||
|
protected eventuallyRunOnInitialized(action: () => void): void {
|
||||||
|
if (!this.viewInitialized) {
|
||||||
|
this.onViewInitializedEvent.event(() => {
|
||||||
|
try {
|
||||||
|
action();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Unexpected error running onInitialized action for Manage Access dialog : ${error}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
action();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user