mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
change userName to match what the azure account display name is (#11484)
* change userName to match what the azure account display name is * Handle undefined value
This commit is contained in:
@@ -197,6 +197,10 @@ export class SelectBox extends vsSelectBox {
|
|||||||
return this._selectedOption;
|
return this._selectedOption;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get label(): string | undefined {
|
||||||
|
return this._dialogOptions.find(s => s.value === this._selectedOption).text;
|
||||||
|
}
|
||||||
|
|
||||||
public get values(): string[] {
|
public get values(): string[] {
|
||||||
return this._dialogOptions.map(s => s.value);
|
return this._dialogOptions.map(s => s.value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
import * as assert from 'assert';
|
import * as assert from 'assert';
|
||||||
import { SelectBox, SelectOptionItemSQL } from 'sql/base/browser/ui/selectBox/selectBox';
|
import { SelectBox, SelectOptionItemSQL } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||||
import { deepClone, equals } from 'vs/base/common/objects';
|
import { deepClone, equals } from 'vs/base/common/objects';
|
||||||
|
import { isUndefined } from 'vs/base/common/types';
|
||||||
|
|
||||||
const options: SelectOptionItemSQL[] = [
|
const options: SelectOptionItemSQL[] = [
|
||||||
{ text: 't1', value: 'v1' },
|
{ text: 't1', value: 'v1' },
|
||||||
@@ -45,6 +46,7 @@ suite('Select Box tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
assert(sb.value === options[0].value);
|
assert(sb.value === options[0].value);
|
||||||
|
assert(sb.label === options[0].text);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('values get auto populated', () => {
|
test('values get auto populated', () => {
|
||||||
@@ -53,4 +55,18 @@ suite('Select Box tests', () => {
|
|||||||
|
|
||||||
assert(equals(sb.values, newOptions.map(s => s.text)));
|
assert(equals(sb.values, newOptions.map(s => s.text)));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('value did not contain label', () => {
|
||||||
|
const newOptions = deepClone(options).map(s => { return { text: s.text, value: undefined }; });
|
||||||
|
delete newOptions[0].text;
|
||||||
|
const sb = new SelectBox(newOptions, undefined, undefined, undefined, undefined);
|
||||||
|
|
||||||
|
|
||||||
|
sb.onSelect({
|
||||||
|
index: 0,
|
||||||
|
selected: options[0].value
|
||||||
|
});
|
||||||
|
|
||||||
|
assert(isUndefined(sb.label));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -816,7 +816,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get userName(): string {
|
public get userName(): string {
|
||||||
return this.authenticationType === AuthenticationType.AzureMFA ? this._azureAccountDropdown.value : this._userNameInputBox.value;
|
return this.authenticationType === AuthenticationType.AzureMFA ? this._azureAccountDropdown.label : this._userNameInputBox.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get password(): string {
|
public get password(): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user