mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
fix the input box validation (#15634)
* fix the input box validation * fix one more place
This commit is contained in:
@@ -425,7 +425,7 @@ export class InputBox extends Widget {
|
||||
return !!this.validation && !this.validation(this.value);
|
||||
}
|
||||
|
||||
public validate(): boolean { // {{SQL CARBON EDIT}}
|
||||
public validate(): MessageType | undefined {
|
||||
let errorMsg: IMessage | null = null;
|
||||
|
||||
if (this.validation) {
|
||||
@@ -449,8 +449,7 @@ export class InputBox extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
// {{SQL CARBON EDIT}} Candidate for addition to vscode
|
||||
return errorMsg ? errorMsg.type !== MessageType.ERROR : true;
|
||||
return errorMsg?.type;
|
||||
}
|
||||
|
||||
public stylesForType(type: MessageType | undefined): { border: Color | undefined; background: Color | undefined; foreground: Color | undefined } {
|
||||
|
||||
@@ -342,7 +342,7 @@ class TunnelTreeRenderer extends Disposable implements ITreeRenderer<ITunnelGrou
|
||||
inputBox,
|
||||
dom.addStandardDisposableListener(inputBox.inputElement, dom.EventType.KEY_DOWN, (e: IKeyboardEvent) => {
|
||||
if (e.equals(KeyCode.Enter)) {
|
||||
if (inputBox.validate()) { // {{SQL CARBON EDIT}}
|
||||
if (inputBox.validate() !== MessageType.ERROR) {
|
||||
done(true, true);
|
||||
} else {
|
||||
done(false, true);
|
||||
@@ -352,7 +352,7 @@ class TunnelTreeRenderer extends Disposable implements ITreeRenderer<ITunnelGrou
|
||||
}
|
||||
}),
|
||||
dom.addDisposableListener(inputBox.inputElement, dom.EventType.BLUR, () => {
|
||||
done(inputBox.validate(), true); // {{SQL CARBON EDIT}}
|
||||
done(inputBox.validate() !== MessageType.ERROR, true);
|
||||
}),
|
||||
styler
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user