mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fix other fields being editable in password reprompt for Arc (#14117)
This commit is contained in:
@@ -6,14 +6,13 @@ import * as azdata from 'azdata';
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as loc from '../../localizedConstants';
|
||||
import { IReadOnly } from '../dialogs/connectControllerDialog';
|
||||
|
||||
export interface RadioOptionsInfo {
|
||||
values?: string[],
|
||||
defaultValue: string
|
||||
}
|
||||
|
||||
export class FilePicker implements IReadOnly {
|
||||
export class FilePicker {
|
||||
private _flexContainer: azdata.FlexContainer;
|
||||
public readonly filePathInputBox: azdata.InputBoxComponent;
|
||||
public readonly filePickerButton: azdata.ButtonComponent;
|
||||
@@ -64,21 +63,8 @@ export class FilePicker implements IReadOnly {
|
||||
return this.filePathInputBox?.value;
|
||||
}
|
||||
|
||||
get readOnly(): boolean {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
set readOnly(value: boolean) {
|
||||
this.enabled = value;
|
||||
}
|
||||
|
||||
get enabled(): boolean {
|
||||
return !!this._flexContainer.enabled && this._flexContainer.items.every(r => r.enabled);
|
||||
}
|
||||
|
||||
set enabled(value: boolean) {
|
||||
this._flexContainer.items.forEach(r => r.enabled = value);
|
||||
this._flexContainer.enabled = value;
|
||||
get items(): azdata.Component[] {
|
||||
return this._flexContainer.items;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,14 +5,13 @@
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { getErrorMessage } from '../../common/utils';
|
||||
import { IReadOnly } from '../dialogs/connectControllerDialog';
|
||||
|
||||
export interface RadioOptionsInfo {
|
||||
values?: string[],
|
||||
defaultValue: string
|
||||
}
|
||||
|
||||
export class RadioOptionsGroup implements IReadOnly {
|
||||
export class RadioOptionsGroup {
|
||||
static id: number = 1;
|
||||
private _divContainer!: azdata.DivContainer;
|
||||
private _loadingBuilder: azdata.LoadingComponentBuilder;
|
||||
@@ -68,23 +67,6 @@ export class RadioOptionsGroup implements IReadOnly {
|
||||
return this._currentRadioOption?.value;
|
||||
}
|
||||
|
||||
get readOnly(): boolean {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
set readOnly(value: boolean) {
|
||||
this.enabled = value;
|
||||
}
|
||||
|
||||
get enabled(): boolean {
|
||||
return !!this._divContainer.enabled && this._divContainer.items.every(r => r.enabled);
|
||||
}
|
||||
|
||||
set enabled(value: boolean) {
|
||||
this._divContainer.items.forEach(r => r.enabled = value);
|
||||
this._divContainer.enabled = value;
|
||||
}
|
||||
|
||||
get items(): azdata.Component[] {
|
||||
return this._divContainer.items;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,7 @@ import { getCurrentClusterContext, getDefaultKubeConfigPath, getKubeConfigCluste
|
||||
import { FilePicker } from '../components/filePicker';
|
||||
|
||||
export type ConnectToControllerDialogModel = { controllerModel: ControllerModel, password: string };
|
||||
export interface IReadOnly {
|
||||
readOnly?: boolean
|
||||
}
|
||||
|
||||
abstract class ControllerDialogBase extends InitializingComponent {
|
||||
protected _toDispose: vscode.Disposable[] = [];
|
||||
protected modelBuilder!: azdata.ModelBuilder;
|
||||
@@ -70,7 +68,7 @@ abstract class ControllerDialogBase extends InitializingComponent {
|
||||
}
|
||||
|
||||
protected abstract fieldToFocusOn(): azdata.Component;
|
||||
protected readonlyFields(): IReadOnly[] { return []; }
|
||||
protected readonlyFields(): azdata.Component[] { return []; }
|
||||
|
||||
protected initializeFields(controllerInfo: ControllerInfo | undefined, password: string | undefined) {
|
||||
this.urlInputBox = this.modelBuilder.inputBox()
|
||||
@@ -140,7 +138,7 @@ abstract class ControllerDialogBase extends InitializingComponent {
|
||||
}]).withLayout({ width: '100%' }).component();
|
||||
await view.initializeModel(formModel);
|
||||
await this.fieldToFocusOn().focus();
|
||||
this.readonlyFields().forEach(f => f.readOnly = true);
|
||||
this.readonlyFields().forEach(f => f.enabled = false);
|
||||
this.initialized = true;
|
||||
});
|
||||
|
||||
@@ -255,11 +253,11 @@ export class PasswordToControllerDialog extends ControllerDialogBase {
|
||||
return this.passwordInputBox;
|
||||
}
|
||||
|
||||
protected readonlyFields() {
|
||||
protected readonlyFields(): azdata.Component[] {
|
||||
return [
|
||||
this.urlInputBox,
|
||||
this.kubeConfigInputBox,
|
||||
this.clusterContextRadioGroup,
|
||||
...this.kubeConfigInputBox.items,
|
||||
...this.clusterContextRadioGroup.items,
|
||||
this.nameInputBox,
|
||||
this.usernameInputBox
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user