Status dictionary update for MIAA (#21050)

* Status update for miaa structure

* Added examples in comments

Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
Candice Ye
2022-11-01 14:58:27 -07:00
committed by GitHub
parent 3295add69a
commit 3ecea1af34
5 changed files with 197 additions and 174 deletions

View File

@@ -123,7 +123,7 @@ export class MiaaModel extends ResourceModel {
} }
// If we have an external endpoint configured then fetch the databases now // If we have an external endpoint configured then fetch the databases now
if (this._config.status.primaryEndpoint) { if (this._config.status.endpoints.primaryEndpoint) {
this.getDatabases(false).catch(_err => { this.getDatabases(false).catch(_err => {
// If an error occurs still fire the event so callers can know to // If an error occurs still fire the event so callers can know to
// update (e.g. so dashboards don't show the loading icon forever) // update (e.g. so dashboards don't show the loading icon forever)
@@ -205,7 +205,7 @@ export class MiaaModel extends ResourceModel {
} }
protected createConnectionProfile(): azdata.IConnectionProfile { protected createConnectionProfile(): azdata.IConnectionProfile {
const ipAndPort = parseIpAndPort(this.config?.status.primaryEndpoint || ''); const ipAndPort = parseIpAndPort(this.config?.status.endpoints.primaryEndpoint || '');
return { return {
serverName: `${ipAndPort.ip},${ipAndPort.port}`, serverName: `${ipAndPort.ip},${ipAndPort.port}`,
databaseName: '', databaseName: '',

View File

@@ -278,7 +278,7 @@ export class MiaaBackupsPage extends DashboardPage {
} else { } else {
// If we don't have an endpoint then there's no point in showing the connect button - but the logic // If we don't have an endpoint then there's no point in showing the connect button - but the logic
// to display text informing the user of this is already handled by the handleMiaaConfigUpdated // to display text informing the user of this is already handled by the handleMiaaConfigUpdated
if (this._miaaModel?.config?.status.primaryEndpoint) { if (this._miaaModel?.config?.status.endpoints.primaryEndpoint) {
this._connectToServerLoading.loading = false; this._connectToServerLoading.loading = false;
this._connectToServerButton.enabled = true; this._connectToServerButton.enabled = true;
} }

View File

@@ -74,11 +74,11 @@ export class MiaaConnectionStringsPage extends DashboardPage {
private getConnectionStrings(): KeyValue[] { private getConnectionStrings(): KeyValue[] {
const config = this._miaaModel.config; const config = this._miaaModel.config;
if (!config?.status.primaryEndpoint) { if (!config?.status.endpoints.primaryEndpoint) {
return []; return [];
} }
const externalEndpoint = parseIpAndPort(config.status.primaryEndpoint); const externalEndpoint = parseIpAndPort(config.status.endpoints.primaryEndpoint);
const username = this._miaaModel.username ?? '{your_username_here}'; const username = this._miaaModel.username ?? '{your_username_here}';
return [ return [
@@ -97,7 +97,7 @@ $conn = sqlsrv_connect($serverName, $connectionInfo);`),
} }
private updateConnectionStrings(): void { private updateConnectionStrings(): void {
this._connectionStringsMessage.value = !this._miaaModel.config?.status.primaryEndpoint ? loc.noExternalEndpoint : ''; this._connectionStringsMessage.value = !this._miaaModel.config?.status.endpoints.primaryEndpoint ? loc.noExternalEndpoint : '';
this._keyValueContainer.refresh(this.getConnectionStrings()); this._keyValueContainer.refresh(this.getConnectionStrings());
} }
} }

View File

@@ -343,10 +343,10 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
private handleMiaaConfigUpdated(): void { private handleMiaaConfigUpdated(): void {
if (this._miaaModel.config) { if (this._miaaModel.config) {
this._instanceProperties.status = this._miaaModel.config.status.state || '-'; this._instanceProperties.status = this._miaaModel.config.status.state || '-';
this._instanceProperties.externalEndpoint = this._miaaModel.config.status.primaryEndpoint || loc.notConfigured; this._instanceProperties.externalEndpoint = this._miaaModel.config.status.endpoints.primaryEndpoint || loc.notConfigured;
this._instanceProperties.vCores = this._miaaModel.config.spec?.scheduling?.default?.resources?.limits?.cpu?.toString() || ''; this._instanceProperties.vCores = this._miaaModel.config.spec?.scheduling?.default?.resources?.limits?.cpu?.toString() || '';
this._databasesMessage.value = !this._miaaModel.config.status.primaryEndpoint ? loc.noExternalEndpoint : ''; this._databasesMessage.value = !this._miaaModel.config.status.endpoints.primaryEndpoint ? loc.noExternalEndpoint : '';
if (!this._miaaModel.config.status.primaryEndpoint) { if (!this._miaaModel.config.status.endpoints.primaryEndpoint) {
this._databasesContainer.removeItem(this._connectToServerLoading); this._databasesContainer.removeItem(this._connectToServerLoading);
} }
} }
@@ -375,7 +375,7 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
} else { } else {
// If we don't have an endpoint then there's no point in showing the connect button - but the logic // If we don't have an endpoint then there's no point in showing the connect button - but the logic
// to display text informing the user of this is already handled by the handleMiaaConfigUpdated // to display text informing the user of this is already handled by the handleMiaaConfigUpdated
if (this._miaaModel?.config?.status.primaryEndpoint) { if (this._miaaModel?.config?.status.endpoints.primaryEndpoint) {
this._connectToServerLoading.loading = false; this._connectToServerLoading.loading = false;
this._connectToServerButton.enabled = true; this._connectToServerButton.enabled = true;
} }
@@ -426,12 +426,12 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
private refreshDashboardLinks(): void { private refreshDashboardLinks(): void {
if (this._miaaModel.config) { if (this._miaaModel.config) {
const kibanaUrl = this._miaaModel.config.status.logSearchDashboard ?? ''; const kibanaUrl = this._miaaModel.config.status.endpoints.logSearchDashboard ?? '';
this._kibanaLink.label = kibanaUrl; this._kibanaLink.label = kibanaUrl;
this._kibanaLink.url = kibanaUrl; this._kibanaLink.url = kibanaUrl;
this._kibanaLoading!.loading = false; this._kibanaLoading!.loading = false;
const grafanaUrl = this._miaaModel.config.status.metricsDashboard ?? ''; const grafanaUrl = this._miaaModel.config.status.endpoints.metricsDashboard ?? '';
this._grafanaLink.label = grafanaUrl; this._grafanaLink.label = grafanaUrl;
this._grafanaLink.url = grafanaUrl; this._grafanaLink.url = grafanaUrl;
this._grafanaLoading!.loading = false; this._grafanaLoading!.loading = false;

View File

@@ -171,12 +171,26 @@ declare module 'az-ext' {
} }
}, },
status: { status: {
readyReplicas: string, // "1/1" endpoints: {
state: string, // "Ready",
logSearchDashboard: string, // https://127.0.0.1:30777/kibana/app/kibana#/discover?_a=(query:(language:kuery,query:'custom_resource_name:miaa1')) logSearchDashboard: string, // https://127.0.0.1:30777/kibana/app/kibana#/discover?_a=(query:(language:kuery,query:'custom_resource_name:miaa1'))
metricsDashboard: string, // https://127.0.0.1:30777/grafana/d/40q72HnGk/sql-managed-instance-metrics?var-hostname=miaa1-0 metricsDashboard: string, // https://127.0.0.1:30777/grafana/d/40q72HnGk/sql-managed-instance-metrics?var-hostname=miaa1-0
mirroring: string, // 10.91.90.25:3448
primaryEndpoint?: string // "10.91.86.39:32718" primaryEndpoint?: string // "10.91.86.39:32718"
runningVersion: string // "v1.5.0_2022-04-05" },
highAvailability: {
lastUpdateTime: string, // "2022-02-07T06:08:20.500688Z"
mirroringCertificate: string // "-----BEGIN CERTIFICATE-----****-----END CERTIFICATE-----\n"
},
lastUpdateTime: string, // "2022-02-07T06:08:20.500688Z"
observedGeneration: string, // 1
roles: {
sql: {
lastUpdateTime: string, // "2022-02-07T06:08:20.500688Z"
readyReplicas: string // "1/1"
}
},
runningVersion: string, // "v1.5.0_2022-04-05"
state: string // "Ready",
} }
} }
@@ -219,12 +233,26 @@ declare module 'az-ext' {
} }
}, },
status: { status: {
readyReplicas: string, // "1/1" endpoints: {
state: string, // "Ready",
logSearchDashboard: string, // https://127.0.0.1:30777/kibana/app/kibana#/discover?_a=(query:(language:kuery,query:'custom_resource_name:miaa1')) logSearchDashboard: string, // https://127.0.0.1:30777/kibana/app/kibana#/discover?_a=(query:(language:kuery,query:'custom_resource_name:miaa1'))
metricsDashboard: string, // https://127.0.0.1:30777/grafana/d/40q72HnGk/sql-managed-instance-metrics?var-hostname=miaa1-0 metricsDashboard: string, // https://127.0.0.1:30777/grafana/d/40q72HnGk/sql-managed-instance-metrics?var-hostname=miaa1-0
mirroring: string, // 10.91.90.25:3448
primaryEndpoint?: string // "10.91.86.39:32718" primaryEndpoint?: string // "10.91.86.39:32718"
runningVersion: string // "v1.5.0_2022-04-05" },
highAvailability: {
lastUpdateTime: string, // "2022-02-07T06:08:20.500688Z"
mirroringCertificate: string // "-----BEGIN CERTIFICATE-----****-----END CERTIFICATE-----\n"
},
lastUpdateTime: string, // "2022-02-07T06:08:20.500688Z"
observedGeneration: string, // 1
roles: {
sql: {
lastUpdateTime: string, // "2022-02-07T06:08:20.500688Z"
readyReplicas: string // "1/1"
}
},
runningVersion: string, // "v1.5.0_2022-04-05"
state: string // "Ready",
} }
} }
@@ -344,30 +372,25 @@ declare module 'az-ext' {
}, },
status: { status: {
endpoints: { endpoints: {
logSearchDashboard: string, // https://localhost:12345/app/kibana#/discover?_a=(query:(language:kuery,query:'custom_resource_name:sql1')), logSearchDashboard: string, // https://127.0.0.1:30777/kibana/app/kibana#/discover?_a=(query:(language:kuery,query:'custom_resource_name:miaa1'))
metricsDashboard: string, // https://12.123.1.4:12345/d/sdfgwseg/sql-managed-instance-metrics?var-hostname=sql1-0, metricsDashboard: string, // https://127.0.0.1:30777/grafana/d/40q72HnGk/sql-managed-instance-metrics?var-hostname=miaa1-0
mirroring: string, // 10.224.0.4:32040, mirroring: string, // 10.91.90.25:3448
primary: string, // 10.224.0.4,32477 primaryEndpoint?: string // "10.91.86.39:32718"
}, },
highAvailability: { highAvailability: {
lastUpdateTime: string, // 2022-05-09T23:40:19.626856Z, lastUpdateTime: string, // "2022-02-07T06:08:20.500688Z"
mirroringCertificate: string, mirroringCertificate: string // "-----BEGIN CERTIFICATE-----****-----END CERTIFICATE-----\n"
}, },
lastUpdateTime: string, // 2022-05-09T23:41:00.137919Z, lastUpdateTime: string, // "2022-02-07T06:08:20.500688Z"
logSearchDashboard: string, observedGeneration: string, // 1
metricsDashboard: string,
observedGeneration: number, // 1,
primaryEndpoint: string, // 10.224.0.4,32477,
readyReplicas: string, // 1/1,
roles: { roles: {
sql: { sql: {
lastUpdateTime: string, // 2022-05-09T23:39:53.364002Z, lastUpdateTime: string, // "2022-02-07T06:08:20.500688Z"
readyReplicas: number, // 1, readyReplicas: string // "1/1"
replicas: number, // 1
} }
}, },
runningVersion: string, // v1.4.0_2022-02-25, runningVersion: string, // "v1.5.0_2022-04-05"
state: string, // Ready state: string // "Ready",
} }
}, },
lastUploadedDate: string, // null, lastUploadedDate: string, // null,