Files
azuredatastudio/src/sql/workbench/services/connection/browser/advancedPropertiesController.ts
Anthony Dresser 506c6a5e5f More Layering (#9139)
* move handling generated files to the serilization classes

* remove unneeded methods

* add more folders to strictire compile, add more strict compile options

* update ci

* wip

* add more layering and fix issues

* add more strictness

* remove unnecessary assertion

* add missing checks

* fix indentation

* wip

* remove jsdoc

* fix layering

* fix compile

* fix compile errors

* wip

* wip

* finish layering

* fix css

* more layering

* rip

* reworking results serializer

* move some files around

* move capabilities to platform wip

* implement capabilities register provider

* fix capabilities service

* fix usage of the regist4ry

* add contribution

* wip

* wip

* wip

* remove no longer good parts

* fix strict-nulls

* fix issues with startup

* another try

* fix startup

* fix imports

* fix tests

* fix tests

* fix more tests

* fix tests

* fix more tests

* fix broken test

* fix tabbing

* fix naming

* wip

* finished layering

* fix imports

* fix valid layers

* fix layers
2020-02-15 01:54:23 -06:00

62 lines
2.5 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { OptionsDialog } from 'sql/workbench/browser/modal/optionsDialog';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import * as azdata from 'azdata';
import { localize } from 'vs/nls';
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
export class AdvancedPropertiesController {
private _advancedDialog: OptionsDialog;
private _options: { [name: string]: any };
constructor(private _onCloseAdvancedProperties: () => void,
@IInstantiationService private _instantiationService: IInstantiationService
) {
}
private handleOnOk(): void {
this._options = this._advancedDialog.optionValues;
}
public showDialog(providerOptions: azdata.ConnectionOption[], options: { [name: string]: any }): void {
this._options = options;
let serviceOptions = providerOptions.map(option => AdvancedPropertiesController.connectionOptionToServiceOption(option));
this.advancedDialog.open(serviceOptions, this._options);
}
public get advancedDialog() {
if (!this._advancedDialog) {
this._advancedDialog = this._instantiationService.createInstance(
OptionsDialog, localize('connectionAdvancedProperties', "Advanced Properties"), TelemetryKeys.ConnectionAdvancedProperties, { hasBackButton: true, cancelLabel: localize('advancedProperties.discard', "Discard") });
this._advancedDialog.onCloseEvent(() => this._onCloseAdvancedProperties());
this._advancedDialog.onOk(() => this.handleOnOk());
this._advancedDialog.render();
}
return this._advancedDialog;
}
public set advancedDialog(dialog: OptionsDialog) {
this._advancedDialog = dialog;
}
public static connectionOptionToServiceOption(connectionOption: azdata.ConnectionOption): azdata.ServiceOption {
return {
name: connectionOption.name,
displayName: connectionOption.displayName,
description: connectionOption.description,
groupName: connectionOption.groupName,
valueType: connectionOption.valueType,
defaultValue: connectionOption.defaultValue,
objectType: undefined,
categoryValues: connectionOption.categoryValues,
isRequired: connectionOption.isRequired,
isArray: undefined,
};
}
}