mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix several dashboard issues and add telemetry (#889)
* fix several dashboard issues * formatting * address comments * keep track of number of page navigation inside the dashboard service
This commit is contained in:
@@ -23,6 +23,7 @@ export const RunQueryStatement = 'RunQueryStatement';
|
|||||||
export const CancelQuery = 'CancelQuery';
|
export const CancelQuery = 'CancelQuery';
|
||||||
export const NewQuery = 'NewQuery';
|
export const NewQuery = 'NewQuery';
|
||||||
export const FirewallRuleRequested = 'FirewallRuleCreated';
|
export const FirewallRuleRequested = 'FirewallRuleCreated';
|
||||||
|
export const DashboardNavigated = 'DashboardNavigated';
|
||||||
|
|
||||||
|
|
||||||
// Telemetry Properties
|
// Telemetry Properties
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
|
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/platform/extensions/common/extensionsRegistry';
|
||||||
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
|
import * as types from 'vs/base/common/types';
|
||||||
|
|
||||||
import { registerTab } from 'sql/platform/dashboard/common/dashboardRegistry';
|
import { registerTab } from 'sql/platform/dashboard/common/dashboardRegistry';
|
||||||
import { generateContainerTypeSchemaProperties } from 'sql/platform/dashboard/common/dashboardContainerRegistry';
|
import { generateContainerTypeSchemaProperties } from 'sql/platform/dashboard/common/dashboardContainerRegistry';
|
||||||
@@ -92,7 +93,11 @@ ExtensionsRegistry.registerExtensionPoint<IDashboardTabContrib | IDashboardTabCo
|
|||||||
|
|
||||||
function handleCommand(tab: IDashboardTabContrib, extension: IExtensionPointUser<any>) {
|
function handleCommand(tab: IDashboardTabContrib, extension: IExtensionPointUser<any>) {
|
||||||
let { description, container, title, edition, provider, id, alwaysShow } = tab;
|
let { description, container, title, edition, provider, id, alwaysShow } = tab;
|
||||||
alwaysShow = alwaysShow || false;
|
|
||||||
|
// If always show is not specified, set it to true by default.
|
||||||
|
if (!types.isBoolean(alwaysShow)) {
|
||||||
|
alwaysShow = true;
|
||||||
|
}
|
||||||
let publisher = extension.description.publisher;
|
let publisher = extension.description.publisher;
|
||||||
if (!title) {
|
if (!title) {
|
||||||
extension.collector.error(localize('dashboardTab.contribution.noTitleError', 'No title specified for extension.'));
|
extension.collector.error(localize('dashboardTab.contribution.noTitleError', 'No title specified for extension.'));
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import { Inject, NgModule, forwardRef, ApplicationRef, ComponentFactoryResolver } from '@angular/core';
|
import { Inject, NgModule, forwardRef, ApplicationRef, ComponentFactoryResolver } from '@angular/core';
|
||||||
import { CommonModule, APP_BASE_HREF } from '@angular/common';
|
import { CommonModule, APP_BASE_HREF } from '@angular/common';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { RouterModule, Routes, UrlSerializer } from '@angular/router';
|
import { RouterModule, Routes, UrlSerializer, Router, NavigationEnd } from '@angular/router';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { NgGridModule } from 'angular2-grid';
|
import { NgGridModule } from 'angular2-grid';
|
||||||
import { ChartsModule } from 'ng2-charts/ng2-charts';
|
import { ChartsModule } from 'ng2-charts/ng2-charts';
|
||||||
@@ -17,6 +17,11 @@ import { Extensions, IInsightRegistry } from 'sql/platform/dashboard/common/insi
|
|||||||
|
|
||||||
import { Registry } from 'vs/platform/registry/common/platform';
|
import { Registry } from 'vs/platform/registry/common/platform';
|
||||||
|
|
||||||
|
/* Telemetry */
|
||||||
|
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||||
|
import * as TelemetryUtils from 'sql/common/telemetryUtilities';
|
||||||
|
import * as TelemetryKeys from 'sql/common/telemetryKeys';
|
||||||
|
|
||||||
/* Services */
|
/* Services */
|
||||||
import { BreadcrumbService } from 'sql/parts/dashboard/services/breadcrumb.service';
|
import { BreadcrumbService } from 'sql/parts/dashboard/services/breadcrumb.service';
|
||||||
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
|
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
|
||||||
@@ -114,7 +119,8 @@ export class DashboardModule {
|
|||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ComponentFactoryResolver)) private _resolver: ComponentFactoryResolver,
|
@Inject(forwardRef(() => ComponentFactoryResolver)) private _resolver: ComponentFactoryResolver,
|
||||||
@Inject(BOOTSTRAP_SERVICE_ID) private _bootstrapService: IBootstrapService,
|
@Inject(BOOTSTRAP_SERVICE_ID) private _bootstrapService: IBootstrapService,
|
||||||
@Inject(forwardRef(() => DashboardServiceInterface)) private _bootstrap: DashboardServiceInterface
|
@Inject(forwardRef(() => DashboardServiceInterface)) private _bootstrap: DashboardServiceInterface,
|
||||||
|
@Inject(forwardRef(() => Router)) private _router: Router
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,5 +130,15 @@ export class DashboardModule {
|
|||||||
this._bootstrap.selector = uniqueSelector;
|
this._bootstrap.selector = uniqueSelector;
|
||||||
(<any>factory).factory.selector = uniqueSelector;
|
(<any>factory).factory.selector = uniqueSelector;
|
||||||
appRef.bootstrap(factory);
|
appRef.bootstrap(factory);
|
||||||
|
|
||||||
|
this._router.events.subscribe(e => {
|
||||||
|
if (e instanceof NavigationEnd) {
|
||||||
|
this._bootstrap.handlePageNavigation();
|
||||||
|
TelemetryUtils.addTelemetry(this._bootstrapService.telemetryService, TelemetryKeys.DashboardNavigated, {
|
||||||
|
numberOfNavigations: this._bootstrap.getNumberOfPageNavigations(),
|
||||||
|
routeUrl: e.url
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,3 +63,8 @@
|
|||||||
opacity: .6;
|
opacity: .6;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-extensionTab-label {
|
||||||
|
font-size: 12px;
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
@@ -101,6 +101,8 @@ export class NewDashboardTabDialog extends Modal {
|
|||||||
private _extensionList: List<IDashboardUITab>;
|
private _extensionList: List<IDashboardUITab>;
|
||||||
private _extensionTabView: FixedListView<IDashboardUITab>;
|
private _extensionTabView: FixedListView<IDashboardUITab>;
|
||||||
private _container: HTMLElement;
|
private _container: HTMLElement;
|
||||||
|
private _extensionViewContainer: HTMLElement;
|
||||||
|
private _noExtensionViewContainer: HTMLElement;
|
||||||
|
|
||||||
private _viewModel: NewDashboardTabViewModel;
|
private _viewModel: NewDashboardTabViewModel;
|
||||||
|
|
||||||
@@ -154,10 +156,20 @@ export class NewDashboardTabDialog extends Modal {
|
|||||||
|
|
||||||
protected renderBody(container: HTMLElement) {
|
protected renderBody(container: HTMLElement) {
|
||||||
this._container = container;
|
this._container = container;
|
||||||
let viewBody = DOM.$('div.extension-view');
|
this._extensionViewContainer = DOM.$('div.extension-view');
|
||||||
DOM.append(container, viewBody);
|
DOM.append(container, this._extensionViewContainer);
|
||||||
|
|
||||||
// Create a fixed list view for the account provider
|
this.createExtensionList(this._extensionViewContainer);
|
||||||
|
this._noExtensionViewContainer = DOM.$('.no-extension-view');
|
||||||
|
let noExtensionTitle = DOM.append(this._noExtensionViewContainer, DOM.$('.no-extensionTab-label'));
|
||||||
|
let noExtensionLabel = localize('newdashboardTabDialog.noExtensionLabel', 'No available feature tabs. Install extensions from the Extension Manager to get additional features.');
|
||||||
|
noExtensionTitle.innerHTML = noExtensionLabel;
|
||||||
|
|
||||||
|
DOM.append(container, this._noExtensionViewContainer);
|
||||||
|
}
|
||||||
|
|
||||||
|
private createExtensionList(container: HTMLElement) {
|
||||||
|
// Create a fixed list view for the extensions
|
||||||
let extensionTabViewContainer = DOM.$('.extensionTab-view');
|
let extensionTabViewContainer = DOM.$('.extensionTab-view');
|
||||||
let delegate = new ExtensionListDelegate(NewDashboardTabDialog.EXTENSIONLIST_HEIGHT);
|
let delegate = new ExtensionListDelegate(NewDashboardTabDialog.EXTENSIONLIST_HEIGHT);
|
||||||
let extensionTabRenderer = new ExtensionListRenderer();
|
let extensionTabRenderer = new ExtensionListRenderer();
|
||||||
@@ -186,7 +198,7 @@ export class NewDashboardTabDialog extends Modal {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this._extensionTabView.render(viewBody, Orientation.VERTICAL);
|
this._extensionTabView.render(container, Orientation.VERTICAL);
|
||||||
|
|
||||||
this._register(attachListStyler(this._extensionList, this._themeService));
|
this._register(attachListStyler(this._extensionList, this._themeService));
|
||||||
|
|
||||||
@@ -234,10 +246,14 @@ export class NewDashboardTabDialog extends Modal {
|
|||||||
this._extensionTabView.updateList(tabs);
|
this._extensionTabView.updateList(tabs);
|
||||||
this.layout();
|
this.layout();
|
||||||
if (this._extensionList.length > 0) {
|
if (this._extensionList.length > 0) {
|
||||||
|
this._extensionViewContainer.hidden = false;
|
||||||
|
this._noExtensionViewContainer.hidden = true;
|
||||||
this._extensionList.setSelection([0]);
|
this._extensionList.setSelection([0]);
|
||||||
this._extensionList.domFocus();
|
this._extensionList.domFocus();
|
||||||
this._addNewTabButton.enabled = true;
|
this._addNewTabButton.enabled = true;
|
||||||
} else {
|
} else {
|
||||||
|
this._extensionViewContainer.hidden = true;
|
||||||
|
this._noExtensionViewContainer.hidden = false;
|
||||||
this._addNewTabButton.enabled = false;
|
this._addNewTabButton.enabled = false;
|
||||||
this._cancelButton.focus();
|
this._cancelButton.focus();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,6 +155,8 @@ export class DashboardServiceInterface implements OnDestroy {
|
|||||||
private _onCloseTab = new Emitter<string>();
|
private _onCloseTab = new Emitter<string>();
|
||||||
public readonly onCloseTab: Event<string> = this._onCloseTab.event;
|
public readonly onCloseTab: Event<string> = this._onCloseTab.event;
|
||||||
|
|
||||||
|
private _numberOfPageNavigations: number;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(BOOTSTRAP_SERVICE_ID) private _bootstrapService: IBootstrapService,
|
@Inject(BOOTSTRAP_SERVICE_ID) private _bootstrapService: IBootstrapService,
|
||||||
@Inject(forwardRef(() => Router)) private _router: Router,
|
@Inject(forwardRef(() => Router)) private _router: Router,
|
||||||
@@ -174,6 +176,7 @@ export class DashboardServiceInterface implements OnDestroy {
|
|||||||
this._dashboardWebviewService = this._bootstrapService.dashboardWebviewService;
|
this._dashboardWebviewService = this._bootstrapService.dashboardWebviewService;
|
||||||
this._partService = this._bootstrapService.partService;
|
this._partService = this._bootstrapService.partService;
|
||||||
this._angularEventingService = this._bootstrapService.angularEventingService;
|
this._angularEventingService = this._bootstrapService.angularEventingService;
|
||||||
|
this._numberOfPageNavigations = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
@@ -291,6 +294,20 @@ export class DashboardServiceInterface implements OnDestroy {
|
|||||||
return this._bootstrapParams.connection;
|
return this._bootstrapParams.connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the number of page navigation
|
||||||
|
*/
|
||||||
|
public getNumberOfPageNavigations(): number {
|
||||||
|
return this._numberOfPageNavigations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle on page navigation
|
||||||
|
*/
|
||||||
|
public handlePageNavigation(): void {
|
||||||
|
this._numberOfPageNavigations++;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get settings for given string
|
* Get settings for given string
|
||||||
* @param type string of setting to get from dashboard settings; i.e dashboard.{type}
|
* @param type string of setting to get from dashboard settings; i.e dashboard.{type}
|
||||||
|
|||||||
Reference in New Issue
Block a user