mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-29 09:35:38 -05:00
Fetch arc dc config profile list from azdata (#12678)
This commit is contained in:
@@ -11,8 +11,9 @@ import { apiService } from '../services/apiService';
|
||||
import { throwUnless } from '../utils';
|
||||
import { CacheManager } from './cacheManager';
|
||||
|
||||
export enum OptionsSourceType {
|
||||
ArcControllersOptionsSource = 'ArcControllersOptionsSource'
|
||||
export const enum OptionsSourceType {
|
||||
ArcControllersOptionsSource = 'ArcControllersOptionsSource',
|
||||
ArcControllerConfigProfilesOptionsSource = 'ArcControllerConfigProfilesOptionsSource'
|
||||
}
|
||||
|
||||
export abstract class OptionsSource implements IOptionsSource {
|
||||
@@ -20,14 +21,22 @@ export abstract class OptionsSource implements IOptionsSource {
|
||||
get type(): OptionsSourceType { return this._type; }
|
||||
get variableNames(): { [index: string]: string; } { return this._variableNames; }
|
||||
|
||||
abstract async getOptions(): Promise<string[] | CategoryValue[]>;
|
||||
abstract async getVariableValue(variableName: string, input: string): Promise<string>;
|
||||
abstract getIsPassword(variableName: string): boolean;
|
||||
abstract getOptions(): Promise<string[] | CategoryValue[]>;
|
||||
getVariableValue(variableName: string, controllerLabel: string): Promise<string> {
|
||||
throw new Error(loc.variableValueFetchForUnsupportedVariable(variableName));
|
||||
}
|
||||
|
||||
getIsPassword(variableName: string): boolean {
|
||||
throw new Error(loc.isPasswordFetchForUnsupportedVariable(variableName));
|
||||
}
|
||||
|
||||
constructor(private _variableNames: { [index: string]: string }, private _type: OptionsSourceType) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class that provides options sources for an Arc Data Controller
|
||||
*/
|
||||
export class ArcControllersOptionsSource extends OptionsSource {
|
||||
private _cacheManager = new CacheManager<string, string>();
|
||||
|
||||
@@ -82,3 +91,12 @@ export class ArcControllersOptionsSource extends OptionsSource {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class that provides options sources for an Arc Data Controller's Config Profiles
|
||||
*/
|
||||
export class ArcControllerConfigProfilesOptionsSource extends OptionsSource {
|
||||
async getOptions(): Promise<string[]> {
|
||||
return (await apiService.azdataApi.azdata.arc.dc.config.list()).result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user