mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add external miaa endpoint property (#11940)
This commit is contained in:
@@ -6,15 +6,17 @@
|
||||
import * as azdata from 'azdata';
|
||||
import * as loc from '../../../localizedConstants';
|
||||
import { IconPathHelper, cssStyles } from '../../../constants';
|
||||
import { KeyValueContainer, KeyValue } from '../../components/keyValueContainer';
|
||||
import { KeyValueContainer, KeyValue, InputKeyValue, MultilineInputKeyValue } from '../../components/keyValueContainer';
|
||||
import { DashboardPage } from '../../components/dashboardPage';
|
||||
import { ControllerModel } from '../../../models/controllerModel';
|
||||
import { MiaaModel } from '../../../models/miaaModel';
|
||||
import { parseIpAndPort } from '../../../common/utils';
|
||||
|
||||
export class MiaaConnectionStringsPage extends DashboardPage {
|
||||
|
||||
private _keyValueContainer!: KeyValueContainer;
|
||||
|
||||
constructor(modelView: azdata.ModelView, private _controllerModel: ControllerModel) {
|
||||
constructor(modelView: azdata.ModelView, private _controllerModel: ControllerModel, private _miaaModel: MiaaModel) {
|
||||
super(modelView);
|
||||
this.disposables.push(this._controllerModel.onRegistrationsUpdated(_ =>
|
||||
this.eventuallyRunOnInitialized(() => this.updateConnectionStrings())));
|
||||
@@ -63,32 +65,28 @@ export class MiaaConnectionStringsPage extends DashboardPage {
|
||||
}
|
||||
|
||||
private getConnectionStrings(): KeyValue[] {
|
||||
/*
|
||||
const instanceRegistration = this._controllerModel.getRegistration(ResourceType.sqlManagedInstances, this._miaaModel.info.namespace, this._miaaModel.info.name);
|
||||
if (!instanceRegistration) {
|
||||
const config = this._miaaModel.config;
|
||||
if (!config?.status.externalEndpoint) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const ip = instanceRegistration.externalIp;
|
||||
const port = instanceRegistration.externalPort;
|
||||
const externalEndpoint = parseIpAndPort(config.status.externalEndpoint);
|
||||
const username = this._miaaModel.username;
|
||||
|
||||
return [
|
||||
new InputKeyValue(this.modelView.modelBuilder, '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(this.modelView.modelBuilder, 'C++ (libpq)', `host=${ip} port=${port} user=${username} password={your_password_here} sslmode=require`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'JDBC', `jdbc:sqlserver://${ip}:${port};user=${username};password={your_password_here};encrypt=true;trustServerCertificate=false;loginTimeout=30;`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'Node.js', `host=${ip} port=${port} dbname=master user=${username} password={your_password_here} sslmode=require`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, '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 InputKeyValue(this.modelView.modelBuilder, 'ADO.NET', `Server=tcp:${externalEndpoint.ip},${externalEndpoint.port};Persist Security Info=False;User ID=${username};Password={your_password_here};MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'C++ (libpq)', `host=${externalEndpoint.ip} port=${externalEndpoint.port} user=${username} password={your_password_here} sslmode=require`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'JDBC', `jdbc:sqlserver://${externalEndpoint.ip}:${externalEndpoint.port};user=${username};password={your_password_here};encrypt=true;trustServerCertificate=false;loginTimeout=30;`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'Node.js', `host=${externalEndpoint.ip} port=${externalEndpoint.port} dbname=master user=${username} password={your_password_here} sslmode=require`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'ODBC', `Driver={ODBC Driver 13 for SQL Server};Server=${externalEndpoint.ip},${externalEndpoint.port};Uid=${username};Pwd={your_password_here};Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;`),
|
||||
new MultilineInputKeyValue(this.modelView.modelBuilder, 'PHP',
|
||||
`$connectionInfo = array("UID" => "${username}", "pwd" => "{your_password_here}", "LoginTimeout" => 30, "Encrypt" => 1, "TrustServerCertificate" => 0);
|
||||
$serverName = "${ip},${port}";
|
||||
$serverName = "${externalEndpoint.ip},${externalEndpoint.port}";
|
||||
$conn = sqlsrv_connect($serverName, $connectionInfo);`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'Python', `dbname='master' user='${username}' host='${ip}' password='{your_password_here}' port='${port}' sslmode='true'`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'Ruby', `host=${ip}; user=${username} password={your_password_here} port=${port} sslmode=require`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'Web App', `Database=master; Data Source=${ip}; User Id=${username}; Password={your_password_here}`)
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'Python', `dbname='master' user='${username}' host='${externalEndpoint.ip}' password='{your_password_here}' port='${externalEndpoint.port}' sslmode='true'`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'Ruby', `host=${externalEndpoint.ip}; user=${username} password={your_password_here} port=${externalEndpoint.port} sslmode=require`),
|
||||
new InputKeyValue(this.modelView.modelBuilder, 'Web App', `Database=master; Data Source=${externalEndpoint.ip}; User Id=${username}; Password={your_password_here}`)
|
||||
];
|
||||
*/
|
||||
return [];
|
||||
}
|
||||
|
||||
private updateConnectionStrings(): void {
|
||||
|
||||
@@ -26,7 +26,7 @@ export class MiaaDashboard extends Dashboard {
|
||||
|
||||
protected async registerTabs(modelView: azdata.ModelView): Promise<(azdata.DashboardTab | azdata.DashboardTabGroup)[]> {
|
||||
const overviewPage = new MiaaDashboardOverviewPage(modelView, this._controllerModel, this._miaaModel);
|
||||
const connectionStringsPage = new MiaaConnectionStringsPage(modelView, this._controllerModel);
|
||||
const connectionStringsPage = new MiaaConnectionStringsPage(modelView, this._controllerModel, this._miaaModel);
|
||||
return [
|
||||
overviewPage.tab,
|
||||
{
|
||||
|
||||
@@ -257,7 +257,6 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
|
||||
this._instanceProperties.region = reg.region || '-';
|
||||
this._instanceProperties.subscriptionId = reg.subscriptionId || '-';
|
||||
this._instanceProperties.vCores = reg.vCores || '';
|
||||
this._instanceProperties.host = reg.externalEndpoint || '-';
|
||||
this.refreshDisplayedProperties();
|
||||
}
|
||||
*/
|
||||
@@ -265,6 +264,7 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
|
||||
|
||||
private handleMiaaConfigUpdated(): void {
|
||||
this._instanceProperties.status = this._miaaModel.config?.status.state || '-';
|
||||
this._instanceProperties.host = this._miaaModel.config?.status.externalEndpoint || '-';
|
||||
this.refreshDisplayedProperties();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user