mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add real MIAA connection string values (#10838)
* Add real MIAA connection string values * Add MiaaModel and fix some strings * Remove unused var * Test to print env vars * Add tests * fixes
This commit is contained in:
@@ -26,3 +26,12 @@ export function resourceTypeToDisplayName(resourceType: string | undefined): str
|
||||
}
|
||||
return resourceType;
|
||||
}
|
||||
|
||||
export function parseEndpoint(endpoint?: string): { ip: string, port: string } {
|
||||
endpoint = endpoint || '';
|
||||
const separatorIndex = endpoint.indexOf(':');
|
||||
return {
|
||||
ip: endpoint.substr(0, separatorIndex),
|
||||
port: endpoint.substr(separatorIndex + 1)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import * as loc from './localizedConstants';
|
||||
import { IconPathHelper } from './constants';
|
||||
@@ -12,6 +13,7 @@ import { ControllerModel } from './models/controllerModel';
|
||||
import { PostgresModel } from './models/postgresModel';
|
||||
import { ControllerDashboard } from './ui/dashboards/controller/controllerDashboard';
|
||||
import { MiaaDashboard } from './ui/dashboards/miaa/miaaDashboard';
|
||||
import { MiaaModel } from './models/miaaModel';
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext): Promise<void> {
|
||||
IconPathHelper.setExtensionContext(context);
|
||||
@@ -38,10 +40,28 @@ export async function activate(context: vscode.ExtensionContext): Promise<void>
|
||||
// Controller information
|
||||
const controllerUrl = '';
|
||||
const auth = new BasicAuth('', '');
|
||||
const connection = await azdata.connection.openConnectionDialog(['MSSQL']);
|
||||
const connectionProfile: azdata.IConnectionProfile = {
|
||||
serverName: connection.options['serverName'],
|
||||
databaseName: connection.options['databaseName'],
|
||||
authenticationType: connection.options['authenticationType'],
|
||||
providerName: 'MSSQL',
|
||||
connectionName: '',
|
||||
userName: connection.options['user'],
|
||||
password: connection.options['password'],
|
||||
savePassword: false,
|
||||
groupFullName: undefined,
|
||||
saveProfile: true,
|
||||
id: connection.connectionId,
|
||||
groupId: undefined,
|
||||
options: connection.options
|
||||
};
|
||||
const instanceName = '';
|
||||
|
||||
try {
|
||||
const controllerModel = new ControllerModel(controllerUrl, auth);
|
||||
const miaaDashboard = new MiaaDashboard(controllerModel);
|
||||
const miaaModel = new MiaaModel(connectionProfile, instanceName);
|
||||
const miaaDashboard = new MiaaDashboard(controllerModel, miaaModel);
|
||||
|
||||
await Promise.all([
|
||||
miaaDashboard.showDashboard(),
|
||||
|
||||
@@ -52,7 +52,7 @@ export const description = localize('arc.description', "Description");
|
||||
export const yes = localize('arc.yes', "Yes");
|
||||
export const no = localize('arc.no', "No");
|
||||
export const feedback = localize('arc.feedback', "Feedback");
|
||||
export const selectConnectionString = localize('arc.selectConnectionString', "Select from available client connection strings below");
|
||||
export const selectConnectionString = localize('arc.selectConnectionString', "Select from available client connection strings below.");
|
||||
export const vCores = localize('arc.vCores', "vCores");
|
||||
export const ram = localize('arc.ram', "RAM");
|
||||
export const refresh = localize('arc.refresh', "Refresh");
|
||||
|
||||
@@ -5,20 +5,26 @@
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { Authentication } from '../controller/auth';
|
||||
import { EndpointsRouterApi, EndpointModel, RegistrationRouterApi, RegistrationResponse, TokenRouterApi } from '../controller/generated/v1/api';
|
||||
import { ResourceType } from '../common/utils';
|
||||
import { EndpointsRouterApi, EndpointModel, RegistrationRouterApi, RegistrationResponse, TokenRouterApi, SqlInstanceRouterApi } from '../controller/generated/v1/api';
|
||||
import { ResourceType, parseEndpoint } from '../common/utils';
|
||||
|
||||
export interface Registration extends RegistrationResponse {
|
||||
externalIp?: string;
|
||||
externalPort?: string;
|
||||
}
|
||||
|
||||
export class ControllerModel {
|
||||
private _endpointsRouter: EndpointsRouterApi;
|
||||
private _tokenRouter: TokenRouterApi;
|
||||
private _registrationRouter: RegistrationRouterApi;
|
||||
private _sqlInstanceRouter: SqlInstanceRouterApi;
|
||||
private _endpoints: EndpointModel[] = [];
|
||||
private _namespace: string = '';
|
||||
private _registrations: RegistrationResponse[] = [];
|
||||
private _controllerRegistration: RegistrationResponse | undefined = undefined;
|
||||
private _registrations: Registration[] = [];
|
||||
private _controllerRegistration: Registration | undefined = undefined;
|
||||
|
||||
private readonly _onEndpointsUpdated = new vscode.EventEmitter<EndpointModel[]>();
|
||||
private readonly _onRegistrationsUpdated = new vscode.EventEmitter<RegistrationResponse[]>();
|
||||
private readonly _onRegistrationsUpdated = new vscode.EventEmitter<Registration[]>();
|
||||
public onEndpointsUpdated = this._onEndpointsUpdated.event;
|
||||
public onRegistrationsUpdated = this._onRegistrationsUpdated.event;
|
||||
public endpointsLastUpdated?: Date;
|
||||
@@ -33,6 +39,9 @@ export class ControllerModel {
|
||||
|
||||
this._registrationRouter = new RegistrationRouterApi(controllerUrl);
|
||||
this._registrationRouter.setDefaultAuthentication(auth);
|
||||
|
||||
this._sqlInstanceRouter = new SqlInstanceRouterApi(controllerUrl);
|
||||
this._sqlInstanceRouter.setDefaultAuthentication(auth);
|
||||
}
|
||||
|
||||
public async refresh(): Promise<void> {
|
||||
@@ -44,7 +53,7 @@ export class ControllerModel {
|
||||
}),
|
||||
this._tokenRouter.apiV1TokenPost().then(async response => {
|
||||
this._namespace = response.body.namespace!;
|
||||
this._registrations = (await this._registrationRouter.apiV1RegistrationListResourcesNsGet(this._namespace)).body;
|
||||
this._registrations = (await this._registrationRouter.apiV1RegistrationListResourcesNsGet(this._namespace)).body.map(mapRegistrationResponse);
|
||||
this._controllerRegistration = this._registrations.find(r => r.instanceType === ResourceType.dataControllers);
|
||||
this.registrationsLastUpdated = new Date();
|
||||
this._onRegistrationsUpdated.fire(this._registrations);
|
||||
@@ -64,15 +73,15 @@ export class ControllerModel {
|
||||
return this._namespace;
|
||||
}
|
||||
|
||||
public registrations(): RegistrationResponse[] {
|
||||
public registrations(): Registration[] {
|
||||
return this._registrations;
|
||||
}
|
||||
|
||||
public get controllerRegistration(): RegistrationResponse | undefined {
|
||||
public get controllerRegistration(): Registration | undefined {
|
||||
return this._controllerRegistration;
|
||||
}
|
||||
|
||||
public getRegistration(type: string, namespace: string, name: string): RegistrationResponse | undefined {
|
||||
public getRegistration(type: string, namespace: string, name: string): Registration | undefined {
|
||||
return this._registrations.find(r => {
|
||||
// Resources deployed outside the controller's namespace are named in the format 'namespace_name'
|
||||
let instanceName = r.instanceName!;
|
||||
@@ -86,4 +95,17 @@ export class ControllerModel {
|
||||
return r.instanceType === type && r.instanceNamespace === namespace && instanceName === name;
|
||||
});
|
||||
}
|
||||
|
||||
public miaaDelete(name: string): void {
|
||||
this._sqlInstanceRouter.apiV1HybridSqlNsNameDelete(this._namespace, name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps a RegistrationResponse to a Registration,
|
||||
* @param response The RegistrationResponse to map
|
||||
*/
|
||||
function mapRegistrationResponse(response: RegistrationResponse): Registration {
|
||||
const parsedEndpoint = parseEndpoint(response.externalEndpoint);
|
||||
return { ...response, externalIp: parsedEndpoint.ip, externalPort: parsedEndpoint.port };
|
||||
}
|
||||
|
||||
28
extensions/arc/src/models/miaaModel.ts
Normal file
28
extensions/arc/src/models/miaaModel.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export class MiaaModel {
|
||||
private readonly _onPasswordUpdated = new vscode.EventEmitter<string>();
|
||||
public onPasswordUpdated = this._onPasswordUpdated.event;
|
||||
public passwordLastUpdated?: Date;
|
||||
|
||||
constructor(public connectionProfile: azdata.IConnectionProfile, private _name: string) {
|
||||
}
|
||||
|
||||
/** Returns the service's name */
|
||||
public get name(): string {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
|
||||
/** Refreshes the model */
|
||||
public async refresh() {
|
||||
await Promise.all([
|
||||
]);
|
||||
}
|
||||
}
|
||||
45
extensions/arc/src/test/common/utils.test.ts
Normal file
45
extensions/arc/src/test/common/utils.test.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as should from 'should';
|
||||
import 'mocha';
|
||||
import { resourceTypeToDisplayName, ResourceType, parseEndpoint } from '../../common/utils';
|
||||
|
||||
import * as loc from '../../localizedConstants';
|
||||
|
||||
describe('resourceTypeToDisplayName Method Tests', () => {
|
||||
it('Display Name should be correct for valid ResourceType', function (): void {
|
||||
should(resourceTypeToDisplayName(ResourceType.dataControllers)).equal(loc.dataControllersType);
|
||||
should(resourceTypeToDisplayName(ResourceType.postgresInstances)).equal(loc.pgSqlType);
|
||||
should(resourceTypeToDisplayName(ResourceType.sqlManagedInstances)).equal(loc.miaaType);
|
||||
});
|
||||
|
||||
it('Display Name should be correct for unknown value', function (): void {
|
||||
should(resourceTypeToDisplayName('Unknown Type')).equal('Unknown Type');
|
||||
});
|
||||
|
||||
it('Display Name should be correct for empty value', function (): void {
|
||||
should(resourceTypeToDisplayName('')).equal('undefined');
|
||||
});
|
||||
|
||||
it('Display Name should be correct for undefined value', function (): void {
|
||||
should(resourceTypeToDisplayName(undefined)).equal('undefined');
|
||||
});
|
||||
});
|
||||
|
||||
describe('parseEndpoint Method Tests', () => {
|
||||
it('Should parse valid endpoint correctly', function (): void {
|
||||
should(parseEndpoint('127.0.0.1:1337')).deepEqual({ ip: '127.0.0.1', port: '1337'});
|
||||
});
|
||||
|
||||
it('Should parse empty endpoint correctly', function (): void {
|
||||
should(parseEndpoint('')).deepEqual({ ip: '', port: ''});
|
||||
});
|
||||
|
||||
it('Should parse undefined endpoint correctly', function (): void {
|
||||
should(parseEndpoint('')).deepEqual({ ip: '', port: ''});
|
||||
});
|
||||
});
|
||||
|
||||
48
extensions/arc/src/test/index.ts
Normal file
48
extensions/arc/src/test/index.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'path';
|
||||
const testRunner = require('vscodetestcover');
|
||||
|
||||
const suite = 'arc Extension Tests';
|
||||
|
||||
const mochaOptions: any = {
|
||||
ui: 'bdd',
|
||||
useColors: true,
|
||||
timeout: 10000
|
||||
};
|
||||
|
||||
// set relevant mocha options from the environment
|
||||
if (process.env.ADS_TEST_GREP) {
|
||||
mochaOptions.grep = process.env.ADS_TEST_GREP;
|
||||
console.log(`setting options.grep to: ${mochaOptions.grep}`);
|
||||
}
|
||||
if (process.env.ADS_TEST_INVERT_GREP) {
|
||||
mochaOptions.invert = parseInt(process.env.ADS_TEST_INVERT_GREP);
|
||||
console.log(`setting options.invert to: ${mochaOptions.invert}`);
|
||||
}
|
||||
if (process.env.ADS_TEST_TIMEOUT) {
|
||||
mochaOptions.timeout = parseInt(process.env.ADS_TEST_TIMEOUT);
|
||||
console.log(`setting options.timeout to: ${mochaOptions.timeout}`);
|
||||
}
|
||||
if (process.env.ADS_TEST_RETRIES) {
|
||||
mochaOptions.retries = parseInt(process.env.ADS_TEST_RETRIES);
|
||||
console.log(`setting options.retries to: ${mochaOptions.retries}`);
|
||||
}
|
||||
|
||||
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
|
||||
mochaOptions.reporter = 'mocha-multi-reporters';
|
||||
mochaOptions.reporterOptions = {
|
||||
reporterEnabled: 'spec, mocha-junit-reporter',
|
||||
mochaJunitReporterReporterOptions: {
|
||||
testsuitesTitle: `${suite} ${process.platform}`,
|
||||
mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
testRunner.configure(mochaOptions, { coverConfig: '../../coverConfig.json' });
|
||||
|
||||
export = testRunner;
|
||||
@@ -58,11 +58,15 @@ export class TextKeyValue extends KeyValue {
|
||||
}
|
||||
|
||||
/** Implementation of KeyValue where the value is a readonly copyable input field */
|
||||
export class InputKeyValue extends KeyValue {
|
||||
export abstract class BaseInputKeyValue extends KeyValue {
|
||||
constructor(key: string, value: string, private multiline: boolean) { super(key, value); }
|
||||
|
||||
getValueComponent(modelBuilder: azdata.ModelBuilder): azdata.Component {
|
||||
const container = modelBuilder.flexContainer().withLayout({ alignItems: 'center' }).component();
|
||||
container.addItem(modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
|
||||
value: this.value, readOnly: true
|
||||
value: this.value,
|
||||
readOnly: true,
|
||||
multiline: this.multiline
|
||||
}).component());
|
||||
|
||||
const copy = modelBuilder.button().withProperties<azdata.ButtonProperties>({
|
||||
@@ -79,6 +83,16 @@ export class InputKeyValue extends KeyValue {
|
||||
}
|
||||
}
|
||||
|
||||
/** Implementation of KeyValue where the value is a single line readonly copyable input field */
|
||||
export class InputKeyValue extends BaseInputKeyValue {
|
||||
constructor(key: string, value: string) { super(key, value, false); }
|
||||
}
|
||||
|
||||
/** Implementation of KeyValue where the value is a multi line readonly copyable input field */
|
||||
export class MultilineInputKeyValue extends BaseInputKeyValue {
|
||||
constructor(key: string, value: string) { super(key, value, true); }
|
||||
}
|
||||
|
||||
/** Implementation of KeyValue where the value is a clickable link */
|
||||
export class LinkKeyValue extends KeyValue {
|
||||
constructor(key: string, value: string, private onClick: (e: any) => any) {
|
||||
|
||||
@@ -6,14 +6,23 @@
|
||||
import * as azdata from 'azdata';
|
||||
import * as loc from '../../../localizedConstants';
|
||||
import { IconPathHelper, cssStyles } from '../../../constants';
|
||||
import { KeyValueContainer, KeyValue, InputKeyValue } from '../../components/keyValueContainer';
|
||||
import { KeyValueContainer, KeyValue, InputKeyValue, MultilineInputKeyValue } from '../../components/keyValueContainer';
|
||||
import { DashboardPage } from '../../components/dashboardPage';
|
||||
import { ControllerModel } from '../../../models/controllerModel';
|
||||
import { ControllerModel, Registration } from '../../../models/controllerModel';
|
||||
import { ResourceType } from '../../../common/utils';
|
||||
import { MiaaModel } from '../../../models/miaaModel';
|
||||
|
||||
export class MiaaConnectionStringsPage extends DashboardPage {
|
||||
|
||||
constructor(modelView: azdata.ModelView, private _controllerModel: ControllerModel) {
|
||||
private _keyValueContainer!: KeyValueContainer;
|
||||
private _instanceRegistration: Registration | undefined;
|
||||
|
||||
constructor(modelView: azdata.ModelView, private _controllerModel: ControllerModel, private _miaaModel: MiaaModel) {
|
||||
super(modelView);
|
||||
this._controllerModel.onRegistrationsUpdated(registrations => {
|
||||
this._instanceRegistration = registrations.find(reg => reg.instanceType === ResourceType.sqlManagedInstances && reg.instanceName === this._miaaModel.name);
|
||||
this.eventuallyRunOnInitialized(() => this.updateConnectionStrings());
|
||||
});
|
||||
this.refresh().catch(err => console.error(err));
|
||||
}
|
||||
|
||||
@@ -44,40 +53,48 @@ export class MiaaConnectionStringsPage extends DashboardPage {
|
||||
}).component());
|
||||
|
||||
const info = this.modelView.modelBuilder.text().withProperties<azdata.TextComponentProperties>({
|
||||
value: `${loc.selectConnectionString}. `,
|
||||
value: `${loc.selectConnectionString}`,
|
||||
CSSStyles: { ...cssStyles.text, 'margin-block-start': '0px', 'margin-block-end': '0px' }
|
||||
}).component();
|
||||
|
||||
const link = this.modelView.modelBuilder.hyperlink().withProperties<azdata.HyperlinkComponentProperties>({
|
||||
label: loc.learnAboutPostgresClients,
|
||||
url: 'http://example.com', // TODO link to documentation
|
||||
}).component();
|
||||
|
||||
content.addItem(
|
||||
this.modelView.modelBuilder.flexContainer().withItems([info, link]).withLayout({ flexWrap: 'wrap' }).component(),
|
||||
this.modelView.modelBuilder.flexContainer().withItems([info]).withLayout({ flexWrap: 'wrap' }).component(),
|
||||
{ CSSStyles: { display: 'inline-flex', 'margin-bottom': '25px' } });
|
||||
|
||||
const endpoint = { ip: '127.0.0.1', port: '1337' }; //{ ip?: string, port?: number } = this.databaseModel.endpoint();
|
||||
const password = 'mypassword'; //this.databaseModel.password();
|
||||
|
||||
const pairs: KeyValue[] = [
|
||||
new InputKeyValue('ADO.NET', `Server=${endpoint.ip};Database=postgres;Port=${endpoint.port};User Id=postgres;Password=${password};Ssl Mode=Require;`),
|
||||
new InputKeyValue('C++ (libpq)', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`),
|
||||
new InputKeyValue('JDBC', `jdbc:postgresql://${endpoint.ip}:${endpoint.port}/postgres?user=postgres&password=${password}&sslmode=require`),
|
||||
new InputKeyValue('Node.js', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`),
|
||||
new InputKeyValue('PHP', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`),
|
||||
new InputKeyValue('psql', `psql "host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`),
|
||||
new InputKeyValue('Python', `dbname='postgres' user='postgres' host='${endpoint.ip}' password='${password}' port='${endpoint.port}' sslmode='true'`),
|
||||
new InputKeyValue('Ruby', `host=${endpoint.ip}; dbname=postgres user=postgres password=${password} port=${endpoint.port} sslmode=require`),
|
||||
new InputKeyValue('Web App', `Database=postgres; Data Source=${endpoint.ip}; User Id=postgres; Password=${password}`)
|
||||
];
|
||||
|
||||
const keyValueContainer = new KeyValueContainer(this.modelView.modelBuilder, pairs);
|
||||
content.addItem(keyValueContainer.container);
|
||||
this._keyValueContainer = new KeyValueContainer(this.modelView.modelBuilder, []);
|
||||
content.addItem(this._keyValueContainer.container);
|
||||
this.updateConnectionStrings();
|
||||
this.initialized = true;
|
||||
return root;
|
||||
}
|
||||
|
||||
protected get toolbarContainer(): azdata.ToolbarContainer {
|
||||
return this.modelView.modelBuilder.toolbarContainer().component();
|
||||
}
|
||||
|
||||
private updateConnectionStrings(): void {
|
||||
if (!this._instanceRegistration) {
|
||||
return;
|
||||
}
|
||||
|
||||
const ip = this._instanceRegistration.externalIp;
|
||||
const port = this._instanceRegistration.externalPort;
|
||||
const username = this._miaaModel.connectionProfile.userName;
|
||||
|
||||
const pairs: KeyValue[] = [
|
||||
new InputKeyValue('ADO.NET', `Server=tcp:${ip},${port};Persist Security Info=False;User ID=${username};Password={your_password_here};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;`),
|
||||
new InputKeyValue('C++ (libpq)', `host=${ip} port=${port} user=${username} password={your_password_here} sslmode=require`),
|
||||
new InputKeyValue('JDBC', `jdbc:sqlserver://${ip}:${port};user=${username};password={your_password_here};encrypt=true;trustServerCertificate=false;loginTimeout=30;`),
|
||||
new InputKeyValue('Node.js', `host=${ip} port=${port} dbname=master user=${username} password={your_password_here} sslmode=require`),
|
||||
new InputKeyValue('ODBC', `Driver={ODBC Driver 13 for SQL Server};Server=${ip},${port};Uid=${username};Pwd={your_password_here};Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;`),
|
||||
new MultilineInputKeyValue('PHP',
|
||||
`$connectionInfo = array("UID" => "${username}", "pwd" => "{your_password_here}", "LoginTimeout" => 30, "Encrypt" => 1, "TrustServerCertificate" => 0);
|
||||
$serverName = "${ip},${port}";
|
||||
$conn = sqlsrv_connect($serverName, $connectionInfo);`),
|
||||
new InputKeyValue('Python', `dbname='master' user='${username}' host='${ip}' password='{your_password_here}' port='${port}' sslmode='true'`),
|
||||
new InputKeyValue('Ruby', `host=${ip}; user=${username} password={your_password_here} port=${port} sslmode=require`),
|
||||
new InputKeyValue('Web App', `Database=master; Data Source=${ip}; User Id=${username}; Password={your_password_here}`)
|
||||
];
|
||||
this._keyValueContainer.refresh(pairs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,17 @@ import { MiaaDashboardOverviewPage } from './miaaDashboardOverviewPage';
|
||||
import { ControllerModel } from '../../../models/controllerModel';
|
||||
import * as loc from '../../../localizedConstants';
|
||||
import { MiaaConnectionStringsPage } from './miaaConnectionStringsPage';
|
||||
import { MiaaModel } from '../../../models/miaaModel';
|
||||
|
||||
export class MiaaDashboard extends Dashboard {
|
||||
|
||||
constructor(private _controllerModel: ControllerModel) {
|
||||
constructor(private _controllerModel: ControllerModel, private _miaaModel: MiaaModel) {
|
||||
super(loc.miaaDashboard);
|
||||
}
|
||||
|
||||
protected async registerTabs(modelView: azdata.ModelView): Promise<(azdata.DashboardTab | azdata.DashboardTabGroup)[]> {
|
||||
const overviewPage = new MiaaDashboardOverviewPage(modelView, this._controllerModel);
|
||||
const connectionStringsPage = new MiaaConnectionStringsPage(modelView, this._controllerModel);
|
||||
const connectionStringsPage = new MiaaConnectionStringsPage(modelView, this._controllerModel, this._miaaModel);
|
||||
return [
|
||||
overviewPage.tab,
|
||||
{
|
||||
|
||||
@@ -86,18 +86,17 @@ export class PostgresConnectionStringsPage extends DashboardPage {
|
||||
|
||||
private refresh() {
|
||||
const endpoint: { ip?: string, port?: number } = this._postgresModel.endpoint();
|
||||
const password = this._postgresModel.password();
|
||||
|
||||
this.keyValueContainer?.refresh([
|
||||
new InputKeyValue('ADO.NET', `Server=${endpoint.ip};Database=postgres;Port=${endpoint.port};User Id=postgres;Password=${password};Ssl Mode=Require;`),
|
||||
new InputKeyValue('C++ (libpq)', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`),
|
||||
new InputKeyValue('JDBC', `jdbc:postgresql://${endpoint.ip}:${endpoint.port}/postgres?user=postgres&password=${password}&sslmode=require`),
|
||||
new InputKeyValue('Node.js', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`),
|
||||
new InputKeyValue('PHP', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`),
|
||||
new InputKeyValue('psql', `psql "host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password=${password} sslmode=require`),
|
||||
new InputKeyValue('Python', `dbname='postgres' user='postgres' host='${endpoint.ip}' password='${password}' port='${endpoint.port}' sslmode='true'`),
|
||||
new InputKeyValue('Ruby', `host=${endpoint.ip}; dbname=postgres user=postgres password=${password} port=${endpoint.port} sslmode=require`),
|
||||
new InputKeyValue('Web App', `Database=postgres; Data Source=${endpoint.ip}; User Id=postgres; Password=${password}`)
|
||||
new InputKeyValue('ADO.NET', `Server=${endpoint.ip};Database=postgres;Port=${endpoint.port};User Id=postgres;Password={your_password_here};Ssl Mode=Require;`),
|
||||
new InputKeyValue('C++ (libpq)', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password={your_password_here} sslmode=require`),
|
||||
new InputKeyValue('JDBC', `jdbc:postgresql://${endpoint.ip}:${endpoint.port}/postgres?user=postgres&password={your_password_here}&sslmode=require`),
|
||||
new InputKeyValue('Node.js', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password={your_password_here} sslmode=require`),
|
||||
new InputKeyValue('PHP', `host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password={your_password_here} sslmode=require`),
|
||||
new InputKeyValue('psql', `psql "host=${endpoint.ip} port=${endpoint.port} dbname=postgres user=postgres password={your_password_here} sslmode=require"`),
|
||||
new InputKeyValue('Python', `dbname='postgres' user='postgres' host='${endpoint.ip}' password='{your_password_here}' port='${endpoint.port}' sslmode='true'`),
|
||||
new InputKeyValue('Ruby', `host=${endpoint.ip}; dbname=postgres user=postgres password={your_password_here} port=${endpoint.port} sslmode=require`),
|
||||
new InputKeyValue('Web App', `Database=postgres; Data Source=${endpoint.ip}; User Id=postgres; Password={your_password_here}`)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user