mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fixed default value for radio options builder if using resourceType displayName (#20070)
Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
@@ -285,7 +285,7 @@ export interface IOptionsSource {
|
|||||||
export interface OptionsInfo {
|
export interface OptionsInfo {
|
||||||
values?: string[] | azdata.CategoryValue[],
|
values?: string[] | azdata.CategoryValue[],
|
||||||
source?: IOptionsSource,
|
source?: IOptionsSource,
|
||||||
defaultValue: string,
|
defaultValue: string | ResourceTypeOptionValue,
|
||||||
optionsType?: OptionsType
|
optionsType?: OptionsType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import { OptionsInfo, FieldInfo, instanceOfDynamicEnablementInfo } from '../interfaces';
|
import { OptionsInfo, FieldInfo, instanceOfDynamicEnablementInfo, ResourceTypeOptionValue } from '../interfaces';
|
||||||
import { getErrorMessage } from '../common/utils';
|
import { getErrorMessage } from '../common/utils';
|
||||||
|
|
||||||
export class RadioGroupLoadingComponentBuilder implements azdata.ComponentBuilder<azdata.LoadingComponent, azdata.LoadingComponentProperties> {
|
export class RadioGroupLoadingComponentBuilder implements azdata.ComponentBuilder<azdata.LoadingComponent, azdata.LoadingComponentProperties> {
|
||||||
@@ -45,7 +45,14 @@ export class RadioGroupLoadingComponentBuilder implements azdata.ComponentBuilde
|
|||||||
}
|
}
|
||||||
|
|
||||||
let options: (string[] | azdata.CategoryValue[]) = optionsInfo.values!;
|
let options: (string[] | azdata.CategoryValue[]) = optionsInfo.values!;
|
||||||
let defaultValue: string = optionsInfo.defaultValue!;
|
let defaultValue: string | ResourceTypeOptionValue = optionsInfo.defaultValue!;
|
||||||
|
if (optionsInfo.defaultValue) {
|
||||||
|
if ((<ResourceTypeOptionValue>optionsInfo.defaultValue).displayName) {
|
||||||
|
defaultValue = (<ResourceTypeOptionValue>optionsInfo.defaultValue).displayName;
|
||||||
|
} else {
|
||||||
|
defaultValue = optionsInfo.defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
options.forEach((op: string | azdata.CategoryValue) => {
|
options.forEach((op: string | azdata.CategoryValue) => {
|
||||||
const option: azdata.CategoryValue = (typeof op === 'string')
|
const option: azdata.CategoryValue = (typeof op === 'string')
|
||||||
? { name: op, displayName: op }
|
? { name: op, displayName: op }
|
||||||
|
|||||||
Reference in New Issue
Block a user