refactor model components to not reference any dashboard services (#1168)

* refactor model components to not reference any dashboard services
This commit is contained in:
Leila Lali
2018-04-18 11:48:20 -07:00
committed by GitHub
parent 134f76c17f
commit d3f0ac7954
36 changed files with 422 additions and 224 deletions

View File

@@ -9,6 +9,7 @@ import 'sql/parts/dashboard/common/dashboardPanelStyles';
import { Component, Inject, forwardRef, ViewChild, ElementRef, ViewChildren, QueryList, OnDestroy, ChangeDetectorRef } from '@angular/core'; import { Component, Inject, forwardRef, ViewChild, ElementRef, ViewChildren, QueryList, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { WidgetConfig, TabConfig, TabSettingConfig } from 'sql/parts/dashboard/common/dashboardWidget'; import { WidgetConfig, TabConfig, TabSettingConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { Extensions, IInsightRegistry } from 'sql/platform/dashboard/common/insightRegistry'; import { Extensions, IInsightRegistry } from 'sql/platform/dashboard/common/insightRegistry';
import { DashboardWidgetWrapper } from 'sql/parts/dashboard/contents/dashboardWidgetWrapper.component'; import { DashboardWidgetWrapper } from 'sql/parts/dashboard/contents/dashboardWidgetWrapper.component';
@@ -85,13 +86,15 @@ export abstract class DashboardPage extends AngularDisposable {
protected abstract propertiesWidget: WidgetConfig; protected abstract propertiesWidget: WidgetConfig;
protected abstract get context(): string; protected abstract get context(): string;
protected dashboardService: DashboardServiceInterface;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) protected dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) protected commonService: CommonServiceInterface,
@Inject(forwardRef(() => ElementRef)) protected _el: ElementRef, @Inject(forwardRef(() => ElementRef)) protected _el: ElementRef,
@Inject(forwardRef(() => ChangeDetectorRef)) protected _cd: ChangeDetectorRef @Inject(forwardRef(() => ChangeDetectorRef)) protected _cd: ChangeDetectorRef
) { ) {
super(); super();
this.dashboardService = commonService as DashboardServiceInterface;
} }
protected init() { protected init() {

View File

@@ -9,6 +9,7 @@ import { Component, Inject, Input, forwardRef, ViewChild, ElementRef, ViewChildr
import { NgGridConfig, NgGrid, NgGridItem } from 'angular2-grid'; import { NgGridConfig, NgGrid, NgGridItem } from 'angular2-grid';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { TabConfig, WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget'; import { TabConfig, WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardWidgetWrapper } from 'sql/parts/dashboard/contents/dashboardWidgetWrapper.component'; import { DashboardWidgetWrapper } from 'sql/parts/dashboard/contents/dashboardWidgetWrapper.component';
import { subscriptionToDisposable } from 'sql/base/common/lifecycle'; import { subscriptionToDisposable } from 'sql/base/common/lifecycle';
@@ -153,7 +154,7 @@ export class DashboardGridContainer extends DashboardTab implements OnDestroy {
@ViewChildren(DashboardWidgetWrapper) private _widgets: QueryList<DashboardWidgetWrapper>; @ViewChildren(DashboardWidgetWrapper) private _widgets: QueryList<DashboardWidgetWrapper>;
@ViewChildren(WebviewContent) private _webViews: QueryList<WebviewContent>; @ViewChildren(WebviewContent) private _webViews: QueryList<WebviewContent>;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) protected dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) protected dashboardService: CommonServiceInterface,
@Inject(forwardRef(() => ElementRef)) protected _el: ElementRef, @Inject(forwardRef(() => ElementRef)) protected _el: ElementRef,
@Inject(forwardRef(() => ChangeDetectorRef)) protected _cd: ChangeDetectorRef @Inject(forwardRef(() => ChangeDetectorRef)) protected _cd: ChangeDetectorRef
) { ) {

View File

@@ -11,6 +11,7 @@ import { DashboardWidgetContainer } from 'sql/parts/dashboard/containers/dashboa
import { DashboardTab } from 'sql/parts/dashboard/common/interfaces'; import { DashboardTab } from 'sql/parts/dashboard/common/interfaces';
import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget'; import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { AngularEventType } from '../../../services/angularEventing/angularEventingService'; import { AngularEventType } from '../../../services/angularEventing/angularEventingService';
import { DashboardWidgetWrapper } from 'sql/parts/dashboard/contents/dashboardWidgetWrapper.component'; import { DashboardWidgetWrapper } from 'sql/parts/dashboard/contents/dashboardWidgetWrapper.component';
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
@@ -30,12 +31,15 @@ export class DashboardHomeContainer extends DashboardWidgetContainer {
@Input() private properties: WidgetConfig; @Input() private properties: WidgetConfig;
@ViewChild('propertiesClass') private _propertiesClass: DashboardWidgetWrapper; @ViewChild('propertiesClass') private _propertiesClass: DashboardWidgetWrapper;
private dashboardService: DashboardServiceInterface;
constructor( constructor(
@Inject(forwardRef(() => ChangeDetectorRef)) _cd: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) _cd: ChangeDetectorRef,
@Inject(forwardRef(() => DashboardServiceInterface)) protected dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) protected commonService: CommonServiceInterface,
) { ) {
super(_cd); super(_cd);
this.dashboardService = commonService as DashboardServiceInterface;
} }
ngAfterContentInit() { ngAfterContentInit() {

View File

@@ -8,6 +8,7 @@ import 'vs/css!./dashboardNavSection';
import { Component, Inject, Input, forwardRef, ViewChild, ElementRef, ViewChildren, QueryList, OnDestroy, ChangeDetectorRef, EventEmitter, OnChanges, AfterContentInit } from '@angular/core'; import { Component, Inject, Input, forwardRef, ViewChild, ElementRef, ViewChildren, QueryList, OnDestroy, ChangeDetectorRef, EventEmitter, OnChanges, AfterContentInit } from '@angular/core';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { WidgetConfig, TabConfig, NavSectionConfig } from 'sql/parts/dashboard/common/dashboardWidget'; import { WidgetConfig, TabConfig, NavSectionConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { PanelComponent, IPanelOptions, NavigationBarLayout } from 'sql/base/browser/ui/panel/panel.component'; import { PanelComponent, IPanelOptions, NavigationBarLayout } from 'sql/base/browser/ui/panel/panel.component';
import { TabComponent } from 'sql/base/browser/ui/panel/tab.component'; import { TabComponent } from 'sql/base/browser/ui/panel/tab.component';
@@ -53,7 +54,7 @@ export class DashboardNavSection extends DashboardTab implements OnDestroy, OnCh
@ViewChildren(DashboardTab) private _tabs: QueryList<DashboardTab>; @ViewChildren(DashboardTab) private _tabs: QueryList<DashboardTab>;
@ViewChild(PanelComponent) private _panel: PanelComponent; @ViewChild(PanelComponent) private _panel: PanelComponent;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) protected dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) protected dashboardService: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) protected _cd: ChangeDetectorRef @Inject(forwardRef(() => ChangeDetectorRef)) protected _cd: ChangeDetectorRef
) { ) {
super(); super();

View File

@@ -13,6 +13,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
import { DashboardTab } from 'sql/parts/dashboard/common/interfaces'; import { DashboardTab } from 'sql/parts/dashboard/common/interfaces';
import { TabConfig } from 'sql/parts/dashboard/common/dashboardWidget'; import { TabConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import { memoize } from 'vs/base/common/decorators'; import { memoize } from 'vs/base/common/decorators';
@@ -37,7 +38,7 @@ export class ControlHostContent {
@ViewChild('agent') private _agentViewComponent: AgentViewComponent; @ViewChild('agent') private _agentViewComponent: AgentViewComponent;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) private _dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private _dashboardService: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef @Inject(forwardRef(() => ElementRef)) private _el: ElementRef
) { ) {

View File

@@ -25,6 +25,7 @@ import { InsightsWidget } from 'sql/parts/dashboard/widgets/insights/insightsWid
import { WebviewWidget } from 'sql/parts/dashboard/widgets/webview/webviewWidget.component'; import { WebviewWidget } from 'sql/parts/dashboard/widgets/webview/webviewWidget.component';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { IDisposable } from 'vs/base/common/lifecycle'; import { IDisposable } from 'vs/base/common/lifecycle';
import { IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { IColorTheme } from 'vs/workbench/services/themes/common/workbenchThemeService';
@@ -88,7 +89,7 @@ export class DashboardWidgetWrapper extends AngularDisposable implements OnInit
constructor( constructor(
@Inject(forwardRef(() => ComponentFactoryResolver)) private _componentFactoryResolver: ComponentFactoryResolver, @Inject(forwardRef(() => ComponentFactoryResolver)) private _componentFactoryResolver: ComponentFactoryResolver,
@Inject(forwardRef(() => ElementRef)) private _ref: ElementRef, @Inject(forwardRef(() => ElementRef)) private _ref: ElementRef,
@Inject(forwardRef(() => DashboardServiceInterface)) private _bootstrap: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private _bootstrap: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeref: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _changeref: ChangeDetectorRef,
@Inject(forwardRef(() => Injector)) private _injector: Injector @Inject(forwardRef(() => Injector)) private _injector: Injector
) { ) {

View File

@@ -16,6 +16,7 @@ import { memoize } from 'vs/base/common/decorators';
import { DashboardTab } from 'sql/parts/dashboard/common/interfaces'; import { DashboardTab } from 'sql/parts/dashboard/common/interfaces';
import { TabConfig } from 'sql/parts/dashboard/common/dashboardWidget'; import { TabConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { IDashboardWebview } from 'sql/services/dashboard/common/dashboardViewService'; import { IDashboardWebview } from 'sql/services/dashboard/common/dashboardViewService';
import { AngularDisposable } from 'sql/base/common/lifecycle'; import { AngularDisposable } from 'sql/base/common/lifecycle';
@@ -36,13 +37,15 @@ export class WebviewContent extends AngularDisposable implements OnInit, IDashbo
private _onMessageDisposable: IDisposable; private _onMessageDisposable: IDisposable;
private _webview: Webview; private _webview: Webview;
private _html: string; private _html: string;
private _dashboardService: DashboardServiceInterface;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) private _dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private commonService: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef @Inject(forwardRef(() => ElementRef)) private _el: ElementRef
) { ) {
super(); super();
this._dashboardService = commonService as DashboardServiceInterface;
} }
ngOnInit() { ngOnInit() {

View File

@@ -9,6 +9,7 @@ import { Component, Inject, Input, forwardRef, ViewChild, ViewChildren, QueryLis
import { NgGridConfig, NgGrid, NgGridItem } from 'angular2-grid'; import { NgGridConfig, NgGrid, NgGridItem } from 'angular2-grid';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget'; import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardWidgetWrapper } from 'sql/parts/dashboard/contents/dashboardWidgetWrapper.component'; import { DashboardWidgetWrapper } from 'sql/parts/dashboard/contents/dashboardWidgetWrapper.component';
import { subscriptionToDisposable, AngularDisposable } from 'sql/base/common/lifecycle'; import { subscriptionToDisposable, AngularDisposable } from 'sql/base/common/lifecycle';
@@ -111,11 +112,14 @@ export class WidgetContent extends AngularDisposable implements AfterViewInit {
@ViewChildren(NgGridItem) private _items: QueryList<NgGridItem>; @ViewChildren(NgGridItem) private _items: QueryList<NgGridItem>;
@ViewChild('scrollable', { read: ElementRef }) private _scrollable: ElementRef; @ViewChild('scrollable', { read: ElementRef }) private _scrollable: ElementRef;
@ViewChild('scrollContainer', { read: ElementRef }) private _scrollContainer: ElementRef; @ViewChild('scrollContainer', { read: ElementRef }) private _scrollContainer: ElementRef;
protected dashboardService: DashboardServiceInterface;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) protected dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) protected commonService: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) protected _cd: ChangeDetectorRef @Inject(forwardRef(() => ChangeDetectorRef)) protected _cd: ChangeDetectorRef
) { ) {
super(); super();
this.dashboardService = commonService as DashboardServiceInterface;
} }
ngAfterViewInit() { ngAfterViewInit() {

View File

@@ -9,6 +9,7 @@ import { OnInit, Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, O
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { DashboardServiceInterface } from './services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from './services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces'; import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import * as Utils from 'sql/parts/connection/common/utils'; import * as Utils from 'sql/parts/connection/common/utils';
import { RefreshWidgetAction, EditDashboardAction } from 'sql/parts/dashboard/common/actions'; import { RefreshWidgetAction, EditDashboardAction } from 'sql/parts/dashboard/common/actions';
@@ -36,7 +37,7 @@ export class DashboardComponent extends AngularDisposable implements OnInit {
private editDisposable: IDisposable; private editDisposable: IDisposable;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) private _bootstrapService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private _bootstrapService: CommonServiceInterface,
@Inject(forwardRef(() => Router)) private _router: Router, @Inject(forwardRef(() => Router)) private _router: Router,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef @Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef
) { ) {

View File

@@ -26,6 +26,7 @@ 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';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
/* Directives */ /* Directives */
import { ComponentHostDirective } from 'sql/parts/dashboard/common/componentHost.directive'; import { ComponentHostDirective } from 'sql/parts/dashboard/common/componentHost.directive';
@@ -128,18 +129,19 @@ const appRoutes: Routes = [
providers: [ providers: [
{ provide: APP_BASE_HREF, useValue: '/' }, { provide: APP_BASE_HREF, useValue: '/' },
{ provide: IBreadcrumbService, useClass: BreadcrumbService }, { provide: IBreadcrumbService, useClass: BreadcrumbService },
DashboardServiceInterface, { provide: CommonServiceInterface, useClass: DashboardServiceInterface },
{ provide: UrlSerializer, useClass: CustomUrlSerializer } { provide: UrlSerializer, useClass: CustomUrlSerializer }
] ]
}) })
export class DashboardModule { export class DashboardModule {
private _bootstrap: DashboardServiceInterface;
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(() => CommonServiceInterface)) bootstrap: CommonServiceInterface,
@Inject(forwardRef(() => Router)) private _router: Router @Inject(forwardRef(() => Router)) private _router: Router
) { ) {
this._bootstrap = bootstrap as DashboardServiceInterface;
} }
ngDoBootstrap(appRef: ApplicationRef) { ngDoBootstrap(appRef: ApplicationRef) {

View File

@@ -14,6 +14,7 @@ import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/
import * as colors from 'vs/platform/theme/common/colorRegistry'; import * as colors from 'vs/platform/theme/common/colorRegistry';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
export class DatabaseDashboardPage extends DashboardPage implements OnInit { export class DatabaseDashboardPage extends DashboardPage implements OnInit {
protected propertiesWidget: WidgetConfig = { protected propertiesWidget: WidgetConfig = {
@@ -35,7 +36,7 @@ export class DatabaseDashboardPage extends DashboardPage implements OnInit {
constructor( constructor(
@Inject(forwardRef(() => IBreadcrumbService)) private _breadcrumbService: IBreadcrumbService, @Inject(forwardRef(() => IBreadcrumbService)) private _breadcrumbService: IBreadcrumbService,
@Inject(forwardRef(() => DashboardServiceInterface)) dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) dashboardService: DashboardServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) _cd: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) _cd: ChangeDetectorRef,
@Inject(forwardRef(() => ElementRef)) el: ElementRef @Inject(forwardRef(() => ElementRef)) el: ElementRef
) { ) {

View File

@@ -10,6 +10,7 @@ import { BreadcrumbClass } from 'sql/parts/dashboard/services/breadcrumb.service
import { IBreadcrumbService } from 'sql/base/browser/ui/breadcrumb/interfaces'; import { IBreadcrumbService } from 'sql/base/browser/ui/breadcrumb/interfaces';
import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget'; import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService'; import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
import * as colors from 'vs/platform/theme/common/colorRegistry'; import * as colors from 'vs/platform/theme/common/colorRegistry';
@@ -36,7 +37,7 @@ export class ServerDashboardPage extends DashboardPage implements OnInit {
constructor( constructor(
@Inject(forwardRef(() => IBreadcrumbService)) private breadcrumbService: IBreadcrumbService, @Inject(forwardRef(() => IBreadcrumbService)) private breadcrumbService: IBreadcrumbService,
@Inject(forwardRef(() => DashboardServiceInterface)) dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) dashboardService: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) _cd: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) _cd: ChangeDetectorRef,
@Inject(forwardRef(() => ElementRef)) el: ElementRef @Inject(forwardRef(() => ElementRef)) el: ElementRef
) { ) {

View File

@@ -7,6 +7,7 @@ import { Injectable, forwardRef, Inject, OnDestroy } from '@angular/core';
import { Subject } from 'rxjs/Subject'; import { Subject } from 'rxjs/Subject';
import { DashboardServiceInterface } from './dashboardServiceInterface.service'; import { DashboardServiceInterface } from './dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { MenuItem, IBreadcrumbService } from 'sql/base/browser/ui/breadcrumb/interfaces'; import { MenuItem, IBreadcrumbService } from 'sql/base/browser/ui/breadcrumb/interfaces';
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile'; import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
@@ -23,9 +24,11 @@ export class BreadcrumbService implements IBreadcrumbService {
public breadcrumbItem: Subject<MenuItem[]>; public breadcrumbItem: Subject<MenuItem[]>;
private itemBreadcrums: MenuItem[]; private itemBreadcrums: MenuItem[];
private _currentPage: BreadcrumbClass; private _currentPage: BreadcrumbClass;
private _bootstrap: DashboardServiceInterface;
constructor( @Inject(forwardRef(() => DashboardServiceInterface)) private _bootstrap: DashboardServiceInterface) { constructor( @Inject(forwardRef(() => CommonServiceInterface)) private commonService: CommonServiceInterface) {
_bootstrap.onUpdatePage(() => { this._bootstrap = commonService as DashboardServiceInterface;
this._bootstrap.onUpdatePage(() => {
this.setBreadcrumbs(this._currentPage); this.setBreadcrumbs(this._currentPage);
}); });
this.breadcrumbItem = new Subject<MenuItem[]>(); this.breadcrumbItem = new Subject<MenuItem[]>();

View File

@@ -26,6 +26,8 @@ import { TabSettingConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { IDashboardViewService } from 'sql/services/dashboard/common/dashboardViewService'; import { IDashboardViewService } from 'sql/services/dashboard/common/dashboardViewService';
import { AngularDisposable } from 'sql/base/common/lifecycle'; import { AngularDisposable } from 'sql/base/common/lifecycle';
import { ConnectionContextkey } from 'sql/parts/connection/common/connectionContextKey'; import { ConnectionContextkey } from 'sql/parts/connection/common/connectionContextKey';
import { SingleConnectionMetadataService, SingleConnectionManagementService, SingleAdminService, SingleQueryManagementService, CommonServiceInterface }
from 'sql/services/common/commonServiceInterface.service';
import { ProviderMetadata, DatabaseInfo, SimpleExecuteResult } from 'sqlops'; import { ProviderMetadata, DatabaseInfo, SimpleExecuteResult } from 'sqlops';
@@ -50,68 +52,6 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
const DASHBOARD_SETTINGS = 'dashboard'; const DASHBOARD_SETTINGS = 'dashboard';
/* Wrapper for a metadata service that contains the uri string to use on each request */
export class SingleConnectionMetadataService {
constructor(
private _metadataService: IMetadataService,
private _uri: string
) { }
get metadata(): Observable<ProviderMetadata> {
return Observable.fromPromise(this._metadataService.getMetadata(this._uri));
}
get databaseNames(): Observable<string[]> {
return Observable.fromPromise(this._metadataService.getDatabaseNames(this._uri));
}
}
/* Wrapper for a connection service that contains the uri string to use on each request */
export class SingleConnectionManagementService {
constructor(
private _connectionService: IConnectionManagementService,
private _uri: string,
private _contextKey: ConnectionContextkey
) { }
public changeDatabase(name: string): Thenable<boolean> {
return this._connectionService.changeDatabase(this._uri, name).then(e => {
// we need to update our context
this._contextKey.set(this.connectionInfo.connectionProfile);
return e;
});
}
public get connectionInfo(): ConnectionManagementInfo {
return this._connectionService.getConnectionInfo(this._uri);
}
}
export class SingleAdminService {
constructor(
private _adminService: IAdminService,
private _uri: string
) { }
public get databaseInfo(): Observable<DatabaseInfo> {
return Observable.fromPromise(this._adminService.getDatabaseInfo(this._uri));
}
}
export class SingleQueryManagementService {
constructor(
private _queryManagementService: IQueryManagementService,
private _uri: string
) { }
public runQueryAndReturn(queryString: string): Thenable<SimpleExecuteResult> {
return this._queryManagementService.runQueryAndReturn(this._uri, queryString);
}
}
/* /*
Providers a interface between a dashboard interface and the rest of carbon. Providers a interface between a dashboard interface and the rest of carbon.
Stores the uri and unique selector of a dashboard instance and uses that Stores the uri and unique selector of a dashboard instance and uses that
@@ -120,35 +60,12 @@ export class SingleQueryManagementService {
usage of a widget. usage of a widget.
*/ */
@Injectable() @Injectable()
export class DashboardServiceInterface extends AngularDisposable { export class DashboardServiceInterface extends CommonServiceInterface {
private _uniqueSelector: string;
private _uri: string;
private _bootstrapParams: DashboardComponentParams;
/* Static Services */ /* Static Services */
private _themeService = this._bootstrapService.themeService;
private _contextMenuService = this._bootstrapService.contextMenuService;
private _instantiationService = this._bootstrapService.instantiationService;
private _configService = this._bootstrapService.configurationService;
private _insightsDialogService = this._bootstrapService.insightsDialogService;
private _contextViewService = this._bootstrapService.contextViewService;
private _notificationService = this._bootstrapService.notificationService;
private _workspaceContextService = this._bootstrapService.workspaceContextService;
private _storageService = this._bootstrapService.storageService;
private _capabilitiesService = this._bootstrapService.capabilitiesService;
private _configurationEditingService = this._bootstrapService.configurationEditorService;
private _commandService = this._bootstrapService.commandService;
private _dashboardViewService = this._bootstrapService.dashboardViewService;
private _partService = this._bootstrapService.partService;
private _angularEventingService = this._bootstrapService.angularEventingService;
private _environmentService = this._bootstrapService.environmentService;
/* Special Services */ private _dashboardViewService = this._bootstrapService.dashboardViewService;
private _metadataService: SingleConnectionMetadataService;
private _connectionManagementService: SingleConnectionManagementService;
private _adminService: SingleAdminService;
private _queryManagementService: SingleQueryManagementService;
private _contextKeyService: IContextKeyService;
private _updatePage = new Emitter<void>(); private _updatePage = new Emitter<void>();
public readonly onUpdatePage: Event<void> = this._updatePage.event; public readonly onUpdatePage: Event<void> = this._updatePage.event;
@@ -168,93 +85,19 @@ export class DashboardServiceInterface extends AngularDisposable {
private _dashboardContextKey = new RawContextKey<string>('dashboardContext', undefined); private _dashboardContextKey = new RawContextKey<string>('dashboardContext', undefined);
public dashboardContextKey: IContextKey<string>; public dashboardContextKey: IContextKey<string>;
private _connectionContextKey: ConnectionContextkey;
private _numberOfPageNavigations = 0; private _numberOfPageNavigations = 0;
constructor( constructor(
@Inject(BOOTSTRAP_SERVICE_ID) private _bootstrapService: IBootstrapService, @Inject(BOOTSTRAP_SERVICE_ID) bootstrapService: IBootstrapService,
@Inject(forwardRef(() => Router)) private _router: Router, @Inject(forwardRef(() => Router)) private _router: Router,
) { ) {
super(); super(bootstrapService);
}
public get notificationService(): INotificationService {
return this._notificationService;
}
public get configurationEditingService(): ConfigurationEditingService {
return this._configurationEditingService;
}
public get metadataService(): SingleConnectionMetadataService {
return this._metadataService;
}
public get connectionManagementService(): SingleConnectionManagementService {
return this._connectionManagementService;
}
public get commandService(): ICommandService {
return this._commandService;
}
public get themeService(): IWorkbenchThemeService {
return this._themeService;
}
public get contextMenuService(): IContextMenuService {
return this._contextMenuService;
}
public get instantiationService(): IInstantiationService {
return this._instantiationService;
} }
public get dashboardViewService(): IDashboardViewService { public get dashboardViewService(): IDashboardViewService {
return this._dashboardViewService; return this._dashboardViewService;
} }
public get partService(): IPartService {
return this._partService;
}
public get contextKeyService(): IContextKeyService {
return this._contextKeyService;
}
public get adminService(): SingleAdminService {
return this._adminService;
}
public get queryManagementService(): SingleQueryManagementService {
return this._queryManagementService;
}
public get environmentService(): IEnvironmentService {
return this._environmentService;
}
public get contextViewService(): IContextViewService {
return this._contextViewService;
}
public get workspaceContextService(): IWorkspaceContextService {
return this._workspaceContextService;
}
public get storageService(): IStorageService {
return this._storageService;
}
public get capabilitiesService(): ICapabilitiesService {
return this._capabilitiesService;
}
public get angularEventingService(): IAngularEventingService {
return this._angularEventingService;
}
/** /**
* Set the selector for this dashboard instance, should only be set once * Set the selector for this dashboard instance, should only be set once
*/ */
@@ -263,7 +106,7 @@ export class DashboardServiceInterface extends AngularDisposable {
this._getbootstrapParams(); this._getbootstrapParams();
} }
private _getbootstrapParams(): void { protected _getbootstrapParams(): void {
this._bootstrapParams = this._bootstrapService.getBootstrapParams<DashboardComponentParams>(this._uniqueSelector); this._bootstrapParams = this._bootstrapService.getBootstrapParams<DashboardComponentParams>(this._uniqueSelector);
this._contextKeyService = this._bootstrapParams.scopedContextService; this._contextKeyService = this._bootstrapParams.scopedContextService;
this._connectionContextKey = this._bootstrapParams.connectionContextKey; this._connectionContextKey = this._bootstrapParams.connectionContextKey;
@@ -275,27 +118,11 @@ export class DashboardServiceInterface extends AngularDisposable {
* Set the uri for this dashboard instance, should only be set once * Set the uri for this dashboard instance, should only be set once
* Inits all the services that depend on knowing a uri * Inits all the services that depend on knowing a uri
*/ */
private set uri(uri: string) { protected set uri(uri: string) {
this._uri = uri; super.setUri(uri);
this._metadataService = new SingleConnectionMetadataService(this._bootstrapService.metadataService, this._uri);
this._connectionManagementService = new SingleConnectionManagementService(this._bootstrapService.connectionManagementService, this._uri, this._connectionContextKey);
this._adminService = new SingleAdminService(this._bootstrapService.adminService, this._uri);
this._queryManagementService = new SingleQueryManagementService(this._bootstrapService.queryManagementService, this._uri);
this._register(toDisposableSubscription(this._bootstrapService.angularEventingService.onAngularEvent(this._uri, (event) => this.handleDashboardEvent(event)))); this._register(toDisposableSubscription(this._bootstrapService.angularEventingService.onAngularEvent(this._uri, (event) => this.handleDashboardEvent(event))));
} }
/**
* Gets the underlying Uri for dashboard
* In general don't use this, use specific services instances exposed publically
*/
public getUnderlyingUri(): string {
return this._uri;
}
public getOriginalConnectionProfile(): IConnectionProfile {
return this._bootstrapParams.connection;
}
/** /**
* Gets the number of page navigation * Gets the number of page navigation
*/ */

View File

@@ -7,7 +7,7 @@ import { Router } from '@angular/router';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces'; import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { MetadataType } from 'sql/parts/connection/common/connectionManagement'; import { MetadataType } from 'sql/parts/connection/common/connectionManagement';
import { SingleConnectionManagementService } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { SingleConnectionManagementService } from 'sql/services/common/commonServiceInterface.service';
import { import {
NewQueryAction, ScriptSelectAction, EditDataAction, ScriptCreateAction, ScriptExecuteAction, ScriptAlterAction, NewQueryAction, ScriptSelectAction, EditDataAction, ScriptCreateAction, ScriptExecuteAction, ScriptAlterAction,
BackupAction, ManageActionContext, BaseActionContext, ManageAction, RestoreAction BackupAction, ManageActionContext, BaseActionContext, ManageAction, RestoreAction

View File

@@ -12,6 +12,7 @@ import { Router } from '@angular/router';
import { DashboardWidget, IDashboardWidget, WidgetConfig, WIDGET_CONFIG } from 'sql/parts/dashboard/common/dashboardWidget'; import { DashboardWidget, IDashboardWidget, WidgetConfig, WIDGET_CONFIG } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { toDisposableSubscription } from 'sql/parts/common/rxjsUtils'; import { toDisposableSubscription } from 'sql/parts/common/rxjsUtils';
import { ExplorerFilter, ExplorerRenderer, ExplorerDataSource, ExplorerController, ObjectMetadataWrapper, ExplorerModel } from './explorerTree'; import { ExplorerFilter, ExplorerRenderer, ExplorerDataSource, ExplorerController, ObjectMetadataWrapper, ExplorerModel } from './explorerTree';
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile'; import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
@@ -49,7 +50,7 @@ export class ExplorerWidget extends DashboardWidget implements IDashboardWidget,
@ViewChild('table') private _tableContainer: ElementRef; @ViewChild('table') private _tableContainer: ElementRef;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) private _bootstrap: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private _bootstrap: CommonServiceInterface,
@Inject(forwardRef(() => Router)) private _router: Router, @Inject(forwardRef(() => Router)) private _router: Router,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
@Inject(WIDGET_CONFIG) protected _config: WidgetConfig, @Inject(WIDGET_CONFIG) protected _config: WidgetConfig,

View File

@@ -10,6 +10,7 @@ import { Observable } from 'rxjs/Observable';
import { DashboardWidget, IDashboardWidget, WIDGET_CONFIG, WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget'; import { DashboardWidget, IDashboardWidget, WIDGET_CONFIG, WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { ComponentHostDirective } from 'sql/parts/dashboard/common/componentHost.directive'; import { ComponentHostDirective } from 'sql/parts/dashboard/common/componentHost.directive';
import { InsightAction, InsightActionContext } from 'sql/workbench/common/actions'; import { InsightAction, InsightActionContext } from 'sql/workbench/common/actions';
import { toDisposableSubscription } from 'sql/parts/common/rxjsUtils'; import { toDisposableSubscription } from 'sql/parts/common/rxjsUtils';
@@ -57,7 +58,7 @@ export class InsightsWidget extends DashboardWidget implements IDashboardWidget,
constructor( constructor(
@Inject(forwardRef(() => ComponentFactoryResolver)) private _componentFactoryResolver: ComponentFactoryResolver, @Inject(forwardRef(() => ComponentFactoryResolver)) private _componentFactoryResolver: ComponentFactoryResolver,
@Inject(forwardRef(() => DashboardServiceInterface)) private dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private dashboardService: CommonServiceInterface,
@Inject(WIDGET_CONFIG) protected _config: WidgetConfig, @Inject(WIDGET_CONFIG) protected _config: WidgetConfig,
@Inject(forwardRef(() => ViewContainerRef)) private viewContainerRef: ViewContainerRef, @Inject(forwardRef(() => ViewContainerRef)) private viewContainerRef: ViewContainerRef,
@Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef @Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef

View File

@@ -7,6 +7,7 @@ import { Component, Inject, forwardRef, ChangeDetectorRef, OnInit, ElementRef, V
import { DashboardWidget, IDashboardWidget, WidgetConfig, WIDGET_CONFIG } from 'sql/parts/dashboard/common/dashboardWidget'; import { DashboardWidget, IDashboardWidget, WidgetConfig, WIDGET_CONFIG } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo'; import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';
import { toDisposableSubscription } from 'sql/parts/common/rxjsUtils'; import { toDisposableSubscription } from 'sql/parts/common/rxjsUtils';
import { error } from 'sql/base/common/log'; import { error } from 'sql/base/common/log';
@@ -68,7 +69,7 @@ export class PropertiesWidgetComponent extends DashboardWidget implements IDashb
@ViewChild('parent', { read: ElementRef }) private _parent: ElementRef; @ViewChild('parent', { read: ElementRef }) private _parent: ElementRef;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) private _bootstrap: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private _bootstrap: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef, @Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
@Inject(WIDGET_CONFIG) protected _config: WidgetConfig, @Inject(WIDGET_CONFIG) protected _config: WidgetConfig,

View File

@@ -12,6 +12,7 @@ import { DomSanitizer } from '@angular/platform-browser';
/* SQL imports */ /* SQL imports */
import { DashboardWidget, IDashboardWidget, WidgetConfig, WIDGET_CONFIG } from 'sql/parts/dashboard/common/dashboardWidget'; import { DashboardWidget, IDashboardWidget, WidgetConfig, WIDGET_CONFIG } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { TaskRegistry } from 'sql/platform/tasks/common/tasks'; import { TaskRegistry } from 'sql/platform/tasks/common/tasks';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces'; import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { BaseActionContext } from 'sql/workbench/common/actions'; import { BaseActionContext } from 'sql/workbench/common/actions';
@@ -57,7 +58,7 @@ export class TasksWidget extends DashboardWidget implements IDashboardWidget, On
@ViewChild('container', { read: ElementRef }) private _container: ElementRef; @ViewChild('container', { read: ElementRef }) private _container: ElementRef;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) private _bootstrap: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private _bootstrap: CommonServiceInterface,
@Inject(forwardRef(() => DomSanitizer)) private _sanitizer: DomSanitizer, @Inject(forwardRef(() => DomSanitizer)) private _sanitizer: DomSanitizer,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeref: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _changeref: ChangeDetectorRef,
@Inject(WIDGET_CONFIG) protected _config: WidgetConfig @Inject(WIDGET_CONFIG) protected _config: WidgetConfig

View File

@@ -13,6 +13,7 @@ import { memoize } from 'vs/base/common/decorators';
import { DashboardWidget, IDashboardWidget, WidgetConfig, WIDGET_CONFIG } from 'sql/parts/dashboard/common/dashboardWidget'; import { DashboardWidget, IDashboardWidget, WidgetConfig, WIDGET_CONFIG } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { IDashboardWebview } from 'sql/services/dashboard/common/dashboardViewService'; import { IDashboardWebview } from 'sql/services/dashboard/common/dashboardViewService';
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
@@ -35,15 +36,17 @@ export class WebviewWidget extends DashboardWidget implements IDashboardWidget,
private _onMessage = new Emitter<string>(); private _onMessage = new Emitter<string>();
public readonly onMessage: Event<string> = this._onMessage.event; public readonly onMessage: Event<string> = this._onMessage.event;
private _onMessageDisposable: IDisposable; private _onMessageDisposable: IDisposable;
private _dashboardService: DashboardServiceInterface;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) private _dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private commonService: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
@Inject(WIDGET_CONFIG) protected _config: WidgetConfig, @Inject(WIDGET_CONFIG) protected _config: WidgetConfig,
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef @Inject(forwardRef(() => ElementRef)) private _el: ElementRef
) { ) {
super(); super();
this._id = (_config.widget[selector] as IWebviewWidgetConfig).id; this._id = (_config.widget[selector] as IWebviewWidgetConfig).id;
this._dashboardService = commonService as DashboardServiceInterface;
} }
ngOnInit() { ngOnInit() {

View File

@@ -19,6 +19,7 @@ import { PanelComponent } from 'sql/base/browser/ui/panel/panel.component';
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService'; import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
import { IJobManagementService } from '../common/interfaces'; import { IJobManagementService } from '../common/interfaces';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component'; import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
import { JobHistoryController, JobHistoryDataSource, import { JobHistoryController, JobHistoryDataSource,
JobHistoryRenderer, JobHistoryFilter, JobHistoryModel, JobHistoryRow } from 'sql/parts/jobManagement/views/jobHistoryTree'; JobHistoryRenderer, JobHistoryFilter, JobHistoryModel, JobHistoryRow } from 'sql/parts/jobManagement/views/jobHistoryTree';
@@ -63,7 +64,7 @@ export class JobHistoryComponent extends Disposable implements OnInit {
@Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService, @Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService,
@Inject(forwardRef(() => ElementRef)) el: ElementRef, @Inject(forwardRef(() => ElementRef)) el: ElementRef,
@Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef,
@Inject(forwardRef(() => DashboardServiceInterface)) private _dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private _dashboardService: CommonServiceInterface,
@Inject(forwardRef(() => AgentViewComponent)) private _agentViewComponent: AgentViewComponent @Inject(forwardRef(() => AgentViewComponent)) private _agentViewComponent: AgentViewComponent
) { ) {
super(); super();

View File

@@ -7,7 +7,7 @@ import { Router } from '@angular/router';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces'; import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { MetadataType } from 'sql/parts/connection/common/connectionManagement'; import { MetadataType } from 'sql/parts/connection/common/connectionManagement';
import { SingleConnectionManagementService } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { SingleConnectionManagementService } from 'sql/services/common/commonServiceInterface.service';
import { import {
NewQueryAction, ScriptSelectAction, EditDataAction, ScriptCreateAction, ScriptExecuteAction, ScriptAlterAction, NewQueryAction, ScriptSelectAction, EditDataAction, ScriptCreateAction, ScriptExecuteAction, ScriptAlterAction,
BackupAction, ManageActionContext, BaseActionContext, ManageAction, RestoreAction BackupAction, ManageActionContext, BaseActionContext, ManageAction, RestoreAction

View File

@@ -14,6 +14,7 @@ import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService'; import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
import { IJobManagementService } from '../common/interfaces'; import { IJobManagementService } from '../common/interfaces';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { AgentJobHistoryInfo } from 'sqlops'; import { AgentJobHistoryInfo } from 'sqlops';
import { JobStepsViewController, JobStepsViewDataSource, JobStepsViewFilter, import { JobStepsViewController, JobStepsViewDataSource, JobStepsViewFilter,
JobStepsViewRenderer, JobStepsViewRow, JobStepsViewModel} from 'sql/parts/jobManagement/views/jobStepsViewTree'; JobStepsViewRenderer, JobStepsViewRow, JobStepsViewModel} from 'sql/parts/jobManagement/views/jobStepsViewTree';
@@ -42,7 +43,7 @@ export class JobStepsViewComponent extends Disposable implements OnInit, AfterCo
@Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService, @Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService,
@Inject(forwardRef(() => ElementRef)) el: ElementRef, @Inject(forwardRef(() => ElementRef)) el: ElementRef,
@Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef,
@Inject(forwardRef(() => DashboardServiceInterface)) private _dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private _dashboardService: CommonServiceInterface,
@Inject(forwardRef(() => JobHistoryComponent)) private _jobHistoryComponent: JobHistoryComponent @Inject(forwardRef(() => JobHistoryComponent)) private _jobHistoryComponent: JobHistoryComponent
) { ) {
super(); super();

View File

@@ -7,7 +7,7 @@ import { Router } from '@angular/router';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces'; import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { MetadataType } from 'sql/parts/connection/common/connectionManagement'; import { MetadataType } from 'sql/parts/connection/common/connectionManagement';
import { SingleConnectionManagementService } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { SingleConnectionManagementService } from 'sql/services/common/commonServiceInterface.service';
import { import {
NewQueryAction, ScriptSelectAction, EditDataAction, ScriptCreateAction, ScriptExecuteAction, ScriptAlterAction, NewQueryAction, ScriptSelectAction, EditDataAction, ScriptCreateAction, ScriptExecuteAction, ScriptAlterAction,
BackupAction, ManageActionContext, BaseActionContext, ManageAction, RestoreAction BackupAction, ManageActionContext, BaseActionContext, ManageAction, RestoreAction

View File

@@ -21,6 +21,7 @@ import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService'; import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
import { IJobManagementService } from '../common/interfaces'; import { IJobManagementService } from '../common/interfaces';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
@@ -74,7 +75,7 @@ export class JobsViewComponent implements AfterContentChecked {
constructor( constructor(
@Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService, @Inject(BOOTSTRAP_SERVICE_ID) private bootstrapService: IBootstrapService,
@Inject(forwardRef(() => DashboardServiceInterface)) private _dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private _dashboardService: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef,
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef, @Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
@Inject(forwardRef(() => AgentViewComponent)) private _agentViewComponent: AgentViewComponent @Inject(forwardRef(() => AgentViewComponent)) private _agentViewComponent: AgentViewComponent

View File

@@ -13,6 +13,7 @@ import { ComponentHostDirective } from 'sql/parts/dashboard/common/componentHost
import { error } from 'sql/base/common/log'; import { error } from 'sql/base/common/log';
import { AngularDisposable } from 'sql/base/common/lifecycle'; import { AngularDisposable } from 'sql/base/common/lifecycle';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { IComponent, IComponentConfig, IComponentDescriptor, IModelStore, COMPONENT_CONFIG } from './interfaces'; import { IComponent, IComponentConfig, IComponentDescriptor, IModelStore, COMPONENT_CONFIG } from './interfaces';
import { Extensions, IComponentRegistry } from 'sql/platform/dashboard/common/modelComponentRegistry'; import { Extensions, IComponentRegistry } from 'sql/platform/dashboard/common/modelComponentRegistry';
@@ -52,7 +53,7 @@ export class ModelComponentWrapper extends AngularDisposable implements OnInit {
constructor( constructor(
@Inject(forwardRef(() => ComponentFactoryResolver)) private _componentFactoryResolver: ComponentFactoryResolver, @Inject(forwardRef(() => ComponentFactoryResolver)) private _componentFactoryResolver: ComponentFactoryResolver,
@Inject(forwardRef(() => ElementRef)) private _ref: ElementRef, @Inject(forwardRef(() => ElementRef)) private _ref: ElementRef,
@Inject(forwardRef(() => DashboardServiceInterface)) private _bootstrap: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private _bootstrap: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeref: ChangeDetectorRef, @Inject(forwardRef(() => ChangeDetectorRef)) private _changeref: ChangeDetectorRef,
@Inject(forwardRef(() => Injector)) private _injector: Injector @Inject(forwardRef(() => Injector)) private _injector: Injector
) { ) {

View File

@@ -15,7 +15,7 @@ import nls = require('vs/nls');
import { DashboardTab } from 'sql/parts/dashboard/common/interfaces'; import { DashboardTab } from 'sql/parts/dashboard/common/interfaces';
import { TabConfig } from 'sql/parts/dashboard/common/dashboardWidget'; import { TabConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
import { IModelView } from 'sql/services/model/modelViewService'; import { IModelView } from 'sql/services/model/modelViewService';
import { AngularDisposable } from 'sql/base/common/lifecycle'; import { AngularDisposable } from 'sql/base/common/lifecycle';
@@ -42,14 +42,14 @@ export class ModelViewContent extends ViewBase implements OnInit, IModelView {
private _onMessageDisposable: IDisposable; private _onMessageDisposable: IDisposable;
constructor( constructor(
@Inject(forwardRef(() => DashboardServiceInterface)) private _dashboardService: DashboardServiceInterface, @Inject(forwardRef(() => CommonServiceInterface)) private _commonService: CommonServiceInterface,
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef @Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef
) { ) {
super(changeRef); super(changeRef);
} }
ngOnInit() { ngOnInit() {
this._dashboardService.dashboardViewService.registerModelView(this); this._commonService.modelViewService.registerModelView(this);
this._register(addDisposableListener(window, EventType.RESIZE, e => { this._register(addDisposableListener(window, EventType.RESIZE, e => {
this.layout(); this.layout();
})); }));
@@ -64,7 +64,7 @@ export class ModelViewContent extends ViewBase implements OnInit, IModelView {
@memoize @memoize
public get connection(): sqlops.connection.Connection { public get connection(): sqlops.connection.Connection {
let currentConnection = this._dashboardService.connectionManagementService.connectionInfo.connectionProfile; let currentConnection = this._commonService.connectionManagementService.connectionInfo.connectionProfile;
let connection: sqlops.connection.Connection = { let connection: sqlops.connection.Connection = {
providerName: currentConnection.providerName, providerName: currentConnection.providerName,
connectionId: currentConnection.id, connectionId: currentConnection.id,
@@ -75,6 +75,6 @@ export class ModelViewContent extends ViewBase implements OnInit, IModelView {
@memoize @memoize
public get serverInfo(): sqlops.ServerInfo { public get serverInfo(): sqlops.ServerInfo {
return this._dashboardService.connectionManagementService.connectionInfo.serverInfo; return this._commonService.connectionManagementService.connectionInfo.serverInfo;
} }
} }

View File

@@ -19,13 +19,16 @@ export interface EditDataComponentParams extends BootstrapParams {
dataService: DataService; dataService: DataService;
} }
export interface DashboardComponentParams extends BootstrapParams { export interface DefaultComponentParams extends BootstrapParams {
connection: IConnectionProfile; connection: IConnectionProfile;
ownerUri: string; ownerUri: string;
scopedContextService: IContextKeyService; scopedContextService: IContextKeyService;
connectionContextKey: ConnectionContextkey; connectionContextKey: ConnectionContextkey;
} }
export interface DashboardComponentParams extends DefaultComponentParams {
}
export interface TaskDialogComponentParams extends BootstrapParams { export interface TaskDialogComponentParams extends BootstrapParams {
ownerUri: string; ownerUri: string;
} }

View File

@@ -43,6 +43,7 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces'; import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification'; import { INotificationService } from 'vs/platform/notification/common/notification';
import { IModelViewService } from 'sql/services/modelComponents/modelViewService';
export const BOOTSTRAP_SERVICE_ID = 'bootstrapService'; export const BOOTSTRAP_SERVICE_ID = 'bootstrapService';
export const IBootstrapService = createDecorator<IBootstrapService>(BOOTSTRAP_SERVICE_ID); export const IBootstrapService = createDecorator<IBootstrapService>(BOOTSTRAP_SERVICE_ID);
@@ -94,6 +95,7 @@ export interface IBootstrapService {
configurationEditorService: ConfigurationEditingService; configurationEditorService: ConfigurationEditingService;
commandService: ICommandService; commandService: ICommandService;
dashboardViewService: IDashboardViewService; dashboardViewService: IDashboardViewService;
modelViewService: IModelViewService;
jobManagementService: IJobManagementService; jobManagementService: IJobManagementService;
environmentService: IEnvironmentService; environmentService: IEnvironmentService;

View File

@@ -25,6 +25,7 @@ import { IFileBrowserService, IFileBrowserDialogController } from 'sql/parts/fil
import { IClipboardService } from 'sql/platform/clipboard/common/clipboardService'; import { IClipboardService } from 'sql/platform/clipboard/common/clipboardService';
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService'; import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
import { IDashboardViewService } from 'sql/services/dashboard/common/dashboardViewService'; import { IDashboardViewService } from 'sql/services/dashboard/common/dashboardViewService';
import { IModelViewService } from 'sql/services/modelComponents/modelViewService';
import { $ } from 'vs/base/browser/dom'; import { $ } from 'vs/base/browser/dom';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
@@ -103,6 +104,7 @@ export class BootstrapService implements IBootstrapService {
@ICapabilitiesService public capabilitiesService: ICapabilitiesService, @ICapabilitiesService public capabilitiesService: ICapabilitiesService,
@ICommandService public commandService: ICommandService, @ICommandService public commandService: ICommandService,
@IDashboardViewService public dashboardViewService: IDashboardViewService, @IDashboardViewService public dashboardViewService: IDashboardViewService,
@IModelViewService public modelViewService: IModelViewService,
@IJobManagementService public jobManagementService: IJobManagementService, @IJobManagementService public jobManagementService: IJobManagementService,
@IEnvironmentService public environmentService: IEnvironmentService @IEnvironmentService public environmentService: IEnvironmentService
) { ) {

View File

@@ -0,0 +1,279 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* Node Modules */
import { Injectable, Inject, forwardRef, OnDestroy } from '@angular/core';
import { Router } from '@angular/router';
import { Observable } from 'rxjs/Observable';
/* SQL imports */
import { DefaultComponentParams } from 'sql/services/bootstrap/bootstrapParams';
import { IBootstrapService, BOOTSTRAP_SERVICE_ID } from 'sql/services/bootstrap/bootstrapService';
import { IMetadataService } from 'sql/services/metadata/metadataService';
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';
import { IAdminService } from 'sql/parts/admin/common/adminService';
import { IQueryManagementService } from 'sql/parts/query/common/queryManagement';
import { toDisposableSubscription } from 'sql/parts/common/rxjsUtils';
import { IInsightsDialogService } from 'sql/parts/insights/common/interfaces';
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
import { AngularEventType, IAngularEvent, IAngularEventingService } from 'sql/services/angularEventing/angularEventingService';
import { IModelViewService } from 'sql/services/modelComponents/modelViewService';
import { AngularDisposable } from 'sql/base/common/lifecycle';
import { ConnectionContextkey } from 'sql/parts/connection/common/connectionContextKey';
import { ProviderMetadata, DatabaseInfo, SimpleExecuteResult } from 'sqlops';
/* VS imports */
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IDisposable } from 'vs/base/common/lifecycle';
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
import { ConfigurationEditingService, IConfigurationValue } from 'vs/workbench/services/configuration/node/configurationEditingService';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IStorageService } from 'vs/platform/storage/common/storage';
import Event, { Emitter } from 'vs/base/common/event';
import Severity from 'vs/base/common/severity';
import * as nls from 'vs/nls';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { deepClone } from 'vs/base/common/objects';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
/* Wrapper for a metadata service that contains the uri string to use on each request */
export class SingleConnectionMetadataService {
constructor(
private _metadataService: IMetadataService,
private _uri: string
) { }
get metadata(): Observable<ProviderMetadata> {
return Observable.fromPromise(this._metadataService.getMetadata(this._uri));
}
get databaseNames(): Observable<string[]> {
return Observable.fromPromise(this._metadataService.getDatabaseNames(this._uri));
}
}
/* Wrapper for a connection service that contains the uri string to use on each request */
export class SingleConnectionManagementService {
constructor(
private _connectionService: IConnectionManagementService,
private _uri: string,
private _contextKey: ConnectionContextkey
) { }
public changeDatabase(name: string): Thenable<boolean> {
return this._connectionService.changeDatabase(this._uri, name).then(e => {
// we need to update our context
this._contextKey.set(this.connectionInfo.connectionProfile);
return e;
});
}
public get connectionInfo(): ConnectionManagementInfo {
return this._connectionService.getConnectionInfo(this._uri);
}
}
export class SingleAdminService {
constructor(
private _adminService: IAdminService,
private _uri: string
) { }
public get databaseInfo(): Observable<DatabaseInfo> {
return Observable.fromPromise(this._adminService.getDatabaseInfo(this._uri));
}
}
export class SingleQueryManagementService {
constructor(
private _queryManagementService: IQueryManagementService,
private _uri: string
) { }
public runQueryAndReturn(queryString: string): Thenable<SimpleExecuteResult> {
return this._queryManagementService.runQueryAndReturn(this._uri, queryString);
}
}
/*
Providers a interface between a UI interface and the rest of carbon.
Stores the uri and unique selector of a UI instance and uses that
whenever a call to a carbon service needs this information, so that the widgets
don't need to be aware of the uri or selector. Simplifies the initialization and
usage of a widget.
*/
@Injectable()
export class CommonServiceInterface extends AngularDisposable {
protected _uniqueSelector: string;
protected _uri: string;
protected _bootstrapParams: DefaultComponentParams;
/* Static Services */
protected _themeService = this._bootstrapService.themeService;
protected _contextMenuService = this._bootstrapService.contextMenuService;
protected _instantiationService = this._bootstrapService.instantiationService;
protected _configService = this._bootstrapService.configurationService;
protected _insightsDialogService = this._bootstrapService.insightsDialogService;
protected _contextViewService = this._bootstrapService.contextViewService;
protected _notificationService = this._bootstrapService.notificationService;
protected _workspaceContextService = this._bootstrapService.workspaceContextService;
protected _storageService = this._bootstrapService.storageService;
protected _capabilitiesService = this._bootstrapService.capabilitiesService;
protected _configurationEditingService = this._bootstrapService.configurationEditorService;
protected _commandService = this._bootstrapService.commandService;
protected _modelViewService = this._bootstrapService.modelViewService;
protected _partService = this._bootstrapService.partService;
protected _angularEventingService = this._bootstrapService.angularEventingService;
protected _environmentService = this._bootstrapService.environmentService;
/* Special Services */
protected _metadataService: SingleConnectionMetadataService;
protected _connectionManagementService: SingleConnectionManagementService;
protected _adminService: SingleAdminService;
protected _queryManagementService: SingleQueryManagementService;
protected _contextKeyService: IContextKeyService;
protected _connectionContextKey: ConnectionContextkey;
constructor(
@Inject(BOOTSTRAP_SERVICE_ID) protected _bootstrapService: IBootstrapService
) {
super();
}
public get notificationService(): INotificationService {
return this._notificationService;
}
public get configurationEditingService(): ConfigurationEditingService {
return this._configurationEditingService;
}
public get metadataService(): SingleConnectionMetadataService {
return this._metadataService;
}
public get connectionManagementService(): SingleConnectionManagementService {
return this._connectionManagementService;
}
public get commandService(): ICommandService {
return this._commandService;
}
public get themeService(): IWorkbenchThemeService {
return this._themeService;
}
public get contextMenuService(): IContextMenuService {
return this._contextMenuService;
}
public get instantiationService(): IInstantiationService {
return this._instantiationService;
}
public get modelViewService(): IModelViewService {
return this._modelViewService;
}
public get partService(): IPartService {
return this._partService;
}
public get contextKeyService(): IContextKeyService {
return this._contextKeyService;
}
public get adminService(): SingleAdminService {
return this._adminService;
}
public get queryManagementService(): SingleQueryManagementService {
return this._queryManagementService;
}
public get environmentService(): IEnvironmentService {
return this._environmentService;
}
public get contextViewService(): IContextViewService {
return this._contextViewService;
}
public get workspaceContextService(): IWorkspaceContextService {
return this._workspaceContextService;
}
public get storageService(): IStorageService {
return this._storageService;
}
public get capabilitiesService(): ICapabilitiesService {
return this._capabilitiesService;
}
public get angularEventingService(): IAngularEventingService {
return this._angularEventingService;
}
/**
* Set the selector for this instance, should only be set once
*/
public set selector(selector: string) {
this._uniqueSelector = selector;
this._getbootstrapParams();
}
protected _getbootstrapParams(): void {
this._bootstrapParams = this._bootstrapService.getBootstrapParams<DefaultComponentParams>(this._uniqueSelector);
this._contextKeyService = this._bootstrapParams.scopedContextService;
this._connectionContextKey = this._bootstrapParams.connectionContextKey;
this.uri = this._bootstrapParams.ownerUri;
}
protected setUri(uri: string) {
this._uri = uri;
this._metadataService = new SingleConnectionMetadataService(this._bootstrapService.metadataService, this._uri);
this._connectionManagementService = new SingleConnectionManagementService(this._bootstrapService.connectionManagementService, this._uri, this._connectionContextKey);
this._adminService = new SingleAdminService(this._bootstrapService.adminService, this._uri);
this._queryManagementService = new SingleQueryManagementService(this._bootstrapService.queryManagementService, this._uri);
}
/**
* Set the uri for this instance, should only be set once
* Inits all the services that depend on knowing a uri
*/
protected set uri(uri: string) {
this.setUri(uri);
}
protected get uri(): string {
return this._uri;
}
/**
* Gets the underlying Uri
* In general don't use this, use specific services instances exposed publicly
*/
public getUnderlyingUri(): string {
return this._uri;
}
public getOriginalConnectionProfile(): IConnectionProfile {
return this._bootstrapParams.connection;
}
}

View File

@@ -0,0 +1,23 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import Event from 'vs/base/common/event';
import * as sqlops from 'sqlops';
import { IItemConfig, IComponentShape } from 'sql/workbench/api/common/sqlExtHostTypes';
import { IView, IModelView } from 'sql/services/model/modelViewService';
export const SERVICE_ID = 'modelViewService';
export interface IModelViewService {
_serviceBrand: any;
onRegisteredModelView: Event<IModelView>;
registerModelView(widget: IModelView);
}
export const IModelViewService = createDecorator<IModelViewService>(SERVICE_ID);

View File

@@ -0,0 +1,21 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { IModelViewService } from 'sql/services/modelComponents/modelViewService';
import Event, { Emitter } from 'vs/base/common/event';
import { IModelView } from 'sql/services/model/modelViewService';
export class ModelViewService implements IModelViewService {
_serviceBrand: any;
private _onRegisteredModelView = new Emitter<IModelView>();
public readonly onRegisteredModelView: Event<IModelView> = this._onRegisteredModelView.event;
public registerModelView(view: IModelView) {
this._onRegisteredModelView.fire(view);
}
}

View File

@@ -10,7 +10,7 @@ import { IExtHostContext } from 'vs/workbench/api/node/extHost.protocol';
import * as sqlops from 'sqlops'; import * as sqlops from 'sqlops';
import { IDashboardViewService } from 'sql/services/dashboard/common/dashboardViewService'; import { IModelViewService } from 'sql/services/modelComponents/modelViewService';
import { IItemConfig, ModelComponentTypes, IComponentShape } from 'sql/workbench/api/common/sqlExtHostTypes'; import { IItemConfig, ModelComponentTypes, IComponentShape } from 'sql/workbench/api/common/sqlExtHostTypes';
import { IModelView } from 'sql/services/model/modelViewService'; import { IModelView } from 'sql/services/model/modelViewService';
@@ -26,7 +26,7 @@ export class MainThreadModelView implements MainThreadModelViewShape {
constructor( constructor(
context: IExtHostContext, context: IExtHostContext,
@IDashboardViewService viewService: IDashboardViewService @IModelViewService viewService: IModelViewService
) { ) {
this._proxy = context.getProxy(SqlExtHostContext.ExtHostModelView); this._proxy = context.getProxy(SqlExtHostContext.ExtHostModelView);
viewService.onRegisteredModelView(view => { viewService.onRegisteredModelView(view => {

View File

@@ -8,7 +8,8 @@ import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/of'; import 'rxjs/add/observable/of';
import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget'; import { WidgetConfig } from 'sql/parts/dashboard/common/dashboardWidget';
import { DashboardServiceInterface, SingleAdminService, SingleConnectionManagementService } from 'sql/parts/dashboard/services/dashboardServiceInterface.service'; import { DashboardServiceInterface } from 'sql/parts/dashboard/services/dashboardServiceInterface.service';
import { SingleAdminService, SingleConnectionManagementService } from 'sql/services/common/commonServiceInterface.service';
import { PropertiesWidgetComponent } from 'sql/parts/dashboard/widgets/properties/propertiesWidget.component'; import { PropertiesWidgetComponent } from 'sql/parts/dashboard/widgets/properties/propertiesWidget.component';
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo'; import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';

View File

@@ -155,7 +155,9 @@ import { IResourceProviderService, IAccountPickerService } from 'sql/parts/accou
import { ResourceProviderService } from 'sql/parts/accountManagement/common/resourceProviderService'; import { ResourceProviderService } from 'sql/parts/accountManagement/common/resourceProviderService';
import { AccountPickerService } from 'sql/parts/accountManagement/accountPicker/accountPickerService'; import { AccountPickerService } from 'sql/parts/accountManagement/accountPicker/accountPickerService';
import { IDashboardViewService } from 'sql/services/dashboard/common/dashboardViewService'; import { IDashboardViewService } from 'sql/services/dashboard/common/dashboardViewService';
import { IModelViewService } from 'sql/services/modelComponents/modelViewService';
import { DashboardViewService } from 'sql/services/dashboard/common/dashboardViewServiceImpl'; import { DashboardViewService } from 'sql/services/dashboard/common/dashboardViewServiceImpl';
import { ModelViewService } from 'sql/services/modelComponents/modelViewServiceImpl';
import { IDashboardService } from 'sql/services/dashboard/common/dashboardService'; import { IDashboardService } from 'sql/services/dashboard/common/dashboardService';
import { DashboardService } from 'sql/services/dashboard/common/dashboardServiceImpl'; import { DashboardService } from 'sql/services/dashboard/common/dashboardServiceImpl';
@@ -678,6 +680,7 @@ export class Workbench implements IPartService {
// SQL Tools services // SQL Tools services
serviceCollection.set(IDashboardService, this.instantiationService.createInstance(DashboardService)); serviceCollection.set(IDashboardService, this.instantiationService.createInstance(DashboardService));
serviceCollection.set(IDashboardViewService, this.instantiationService.createInstance(DashboardViewService)); serviceCollection.set(IDashboardViewService, this.instantiationService.createInstance(DashboardViewService));
serviceCollection.set(IModelViewService, this.instantiationService.createInstance(ModelViewService));
serviceCollection.set(IAngularEventingService, this.instantiationService.createInstance(AngularEventingService)); serviceCollection.set(IAngularEventingService, this.instantiationService.createInstance(AngularEventingService));
serviceCollection.set(INewDashboardTabDialogService, this.instantiationService.createInstance(NewDashboardTabDialogService)); serviceCollection.set(INewDashboardTabDialogService, this.instantiationService.createInstance(NewDashboardTabDialogService));
serviceCollection.set(ISqlOAuthService, this.instantiationService.createInstance(SqlOAuthService)); serviceCollection.set(ISqlOAuthService, this.instantiationService.createInstance(SqlOAuthService));