* Arc dashboard fixes

* Bump versions
This commit is contained in:
Charles Gagnon 2020-08-31 12:32:26 -07:00 коммит произвёл GitHub
Родитель 3d0dd0de98
Коммит 404260b8a0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 36 добавлений и 30 удалений

Просмотреть файл

@ -2,7 +2,7 @@
"name": "arc",
"displayName": "%arc.displayName%",
"description": "%arc.description%",
"version": "0.3.0",
"version": "0.3.1",
"publisher": "Microsoft",
"preview": true,
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",

Просмотреть файл

@ -8,9 +8,9 @@ import { getErrorMessage } from './common/utils';
const localize = nls.loadMessageBundle();
export const arcDeploymentDeprecation = localize('arc.arcDeploymentDeprecation', "The Arc Deployment extension has been replaced by the Arc extension and has been uninstalled.");
export const arcControllerDashboard = localize('arc.controllerDashboard', "Azure Arc Controller Dashboard (Preview)");
export const miaaDashboard = localize('arc.miaaDashboard', "Managed Instance Dashboard (Preview)");
export const postgresDashboard = localize('arc.postgresDashboard', "Postgres Dashboard (Preview)");
export function arcControllerDashboard(name: string): string { return localize('arc.controllerDashboard', "Azure Arc Controller Dashboard (Preview) - {0}", name); }
export function miaaDashboard(name: string): string { return localize('arc.miaaDashboard', "Managed Instance Dashboard (Preview) - {0}", name); }
export function postgresDashboard(name: string): string { return localize('arc.postgresDashboard', "Postgres Dashboard (Preview) - {0}", name); }
export const dataControllersType = localize('arc.dataControllersType', "Azure Arc Data Controller");
export const pgSqlType = localize('arc.pgSqlType', "PostgreSQL Server group - Azure Arc");

Просмотреть файл

@ -12,7 +12,7 @@ import * as loc from '../../../localizedConstants';
export class ControllerDashboard extends Dashboard {
constructor(private _controllerModel: ControllerModel) {
super(loc.arcControllerDashboard);
super(loc.arcControllerDashboard(_controllerModel.info.name));
}
public async showDashboard(): Promise<void> {

Просмотреть файл

@ -14,7 +14,7 @@ import { MiaaModel } from '../../../models/miaaModel';
export class MiaaDashboard extends Dashboard {
constructor(private _controllerModel: ControllerModel, private _miaaModel: MiaaModel) {
super(loc.miaaDashboard);
super(loc.miaaDashboard(_miaaModel.info.name));
}
public async showDashboard(): Promise<void> {

Просмотреть файл

@ -50,7 +50,7 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
this._instanceProperties.miaaAdmin = this._miaaModel.username || this._instanceProperties.miaaAdmin;
this.disposables.push(
this._controllerModel.onRegistrationsUpdated(() => this.handleRegistrationsUpdated()),
this._controllerModel.onEndpointsUpdated(() => this.eventuallyRunOnInitialized(() => this.handleEndpointsUpdated())),
this._controllerModel.onEndpointsUpdated(() => this.eventuallyRunOnInitialized(() => this.refreshDashboardLinks())),
this._miaaModel.onConfigUpdated(() => this.eventuallyRunOnInitialized(() => this.handleMiaaConfigUpdated())),
this._miaaModel.onDatabasesUpdated(() => this.eventuallyRunOnInitialized(() => this.handleDatabasesUpdated()))
);
@ -114,7 +114,7 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
// Update loaded components with data
this.handleRegistrationsUpdated();
this.handleMiaaConfigUpdated();
this.handleEndpointsUpdated();
this.refreshDashboardLinks();
this.handleDatabasesUpdated();
// Assign the loading component after it has data
@ -277,23 +277,7 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
}
this.refreshDisplayedProperties();
}
private handleEndpointsUpdated(): void {
const kibanaEndpoint = this._controllerModel.getEndpoint(Endpoints.logsui);
const kibanaQuery = `kubernetes_namespace:"${this._miaaModel.config?.metadata.namespace}" and instance_name :"${this._miaaModel.config?.metadata.name}"`;
const kibanaUrl = kibanaEndpoint ? `${kibanaEndpoint.endpoint}/app/kibana#/discover?_a=(query:(language:kuery,query:'${kibanaQuery}'))` : '';
this._kibanaLink.label = kibanaUrl;
this._kibanaLink.url = kibanaUrl;
const grafanaEndpoint = this._controllerModel.getEndpoint(Endpoints.metricsui);
const grafanaQuery = `var-hostname=${this._miaaModel.info.name}-0`;
const grafanaUrl = grafanaEndpoint ? `${grafanaEndpoint.endpoint}/d/wZx3OUdmz/azure-sql-db-managed-instance-metrics?${grafanaQuery}` : '';
this._grafanaLink.label = grafanaUrl;
this._grafanaLink.url = grafanaUrl;
this._kibanaLoading!.loading = !this._controllerModel.endpointsLastUpdated;
this._grafanaLoading!.loading = !this._controllerModel.endpointsLastUpdated;
this.refreshDashboardLinks();
}
private handleDatabasesUpdated(): void {
@ -345,4 +329,24 @@ export class MiaaDashboardOverviewPage extends DashboardPage {
!this._miaaModel.configLastUpdated &&
!this._miaaModel.databasesLastUpdated;
}
private refreshDashboardLinks(): void {
const kibanaEndpoint = this._controllerModel.getEndpoint(Endpoints.logsui);
if (kibanaEndpoint && this._miaaModel.config) {
const kibanaQuery = `kubernetes_namespace:"${this._miaaModel.config.metadata.namespace}" and custom_resource_name :"${this._miaaModel.config.metadata.name}"`;
const kibanaUrl = `${kibanaEndpoint.endpoint}/app/kibana#/discover?_a=(query:(language:kuery,query:'${kibanaQuery}'))`;
this._kibanaLink.label = kibanaUrl;
this._kibanaLink.url = kibanaUrl;
this._kibanaLoading!.loading = false;
}
const grafanaEndpoint = this._controllerModel.getEndpoint(Endpoints.metricsui);
if (grafanaEndpoint && this._miaaModel.config) {
const grafanaQuery = `var-hostname=${this._miaaModel.info.name}-0`;
const grafanaUrl = grafanaEndpoint ? `${grafanaEndpoint.endpoint}/d/40q72HnGk/sql-managed-instance-metrics?${grafanaQuery}` : '';
this._grafanaLink.label = grafanaUrl;
this._grafanaLink.url = grafanaUrl;
this._grafanaLoading!.loading = false;
}
}
}

Просмотреть файл

@ -18,7 +18,7 @@ import { PostgresResourceHealthPage } from './postgresResourceHealthPage';
export class PostgresDashboard extends Dashboard {
constructor(private _context: vscode.ExtensionContext, private _controllerModel: ControllerModel, private _postgresModel: PostgresModel) {
super(loc.postgresDashboard);
super(loc.postgresDashboard(_postgresModel.name));
}
public async showDashboard(): Promise<void> {

Просмотреть файл

@ -317,7 +317,7 @@ export class PostgresOverviewPage extends DashboardPage {
}
private getKibanaLink(): string {
const kibanaQuery = `kubernetes_namespace:"${this._postgresModel.namespace}" and cluster_name:"${this._postgresModel.name}"`;
const kibanaQuery = `kubernetes_namespace:"${this._postgresModel.namespace}" and custom_resource_name:"${this._postgresModel.name}"`;
return `${this._controllerModel.getEndpoint(Endpoints.logsui)?.endpoint}/app/kibana#/discover?_a=(query:(language:kuery,query:'${kibanaQuery}'))`;
}

Просмотреть файл

@ -132,11 +132,10 @@ export class AzureArcTreeDataProvider implements vscode.TreeDataProvider<TreeNod
if (controllerNode) {
const resourceNode = controllerNode.getResourceNode(resourceType, name);
if (resourceNode) {
await resourceNode.openDashboard();
} else {
console.log(`Couldn't find resource node for ${name} (${resourceType})`);
}
await resourceNode?.openDashboard();
} else {
console.log('Couldn\'t find controller node for opening dashboard');
}

Просмотреть файл

@ -30,6 +30,9 @@ export class ControllerTreeNode extends TreeNode {
model.onInfoUpdated(_ => {
this.label = model.label;
});
model.onRegistrationsUpdated(registrations => {
this.updateChildren(registrations);
});
}
public async getChildren(): Promise<TreeNode[]> {

Просмотреть файл

@ -2,7 +2,7 @@
"name": "azdata",
"displayName": "%azdata.displayName%",
"description": "%azdata.description%",
"version": "0.1.0",
"version": "0.1.1",
"publisher": "Microsoft",
"preview": true,
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",