mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 17:22:45 -05:00
Inital platform relayering (#6385)
* moving test files and inital refactoring * relayer extension host code * fix imports * make insights work * relayer dashboard * relayer notebooks * moveing more code around * formatting * accept angular as browser * fix serializer * add missing files * remove declarations from extensions * fix build errors * more relayering * change urls to relative to help code relayering * remove layering to prep for merge * fix hygiene errors * fix hygiene errors * fix tests
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Component, forwardRef, Input, OnInit, Inject, ChangeDetectorRef } from '@angular/core';
|
||||
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { addDisposableListener, EventType } from 'vs/base/browser/dom';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
|
||||
import { CommonServiceInterface } from 'sql/platform/bootstrap/browser/commonServiceInterface.service';
|
||||
import { IModelView } from 'sql/platform/model/common/modelViewService';
|
||||
import { ViewBase } from 'sql/workbench/browser/modelComponents/viewBase';
|
||||
import { IModelViewService } from 'sql/platform/modelComponents/common/modelViewService';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
@Component({
|
||||
selector: 'modelview-content',
|
||||
template: `
|
||||
<div *ngIf="rootDescriptor" style="width: 100%; height: 100%;">
|
||||
<model-component-wrapper style="display: block; height: 100%" [descriptor]="rootDescriptor" [modelStore]="modelStore">
|
||||
</model-component-wrapper>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class ModelViewContent extends ViewBase implements OnInit, IModelView {
|
||||
@Input() private modelViewId: string;
|
||||
|
||||
private _onResize = new Emitter<void>();
|
||||
public readonly onResize: Event<void> = this._onResize.event;
|
||||
private _onMessage = new Emitter<string>();
|
||||
public readonly onMessage: Event<string> = this._onMessage.event;
|
||||
|
||||
private _onMessageDisposable: IDisposable;
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => CommonServiceInterface)) private _commonService: CommonServiceInterface,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
||||
@Inject(IModelViewService) private modelViewService: IModelViewService
|
||||
) {
|
||||
super(changeRef);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.modelViewService.registerModelView(this);
|
||||
this._register(addDisposableListener(window, EventType.RESIZE, e => {
|
||||
this.layout();
|
||||
}));
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this._onDestroy.fire();
|
||||
super.ngOnDestroy();
|
||||
}
|
||||
|
||||
public layout(): void {
|
||||
this.changeRef.detectChanges();
|
||||
}
|
||||
|
||||
public get id(): string {
|
||||
return this.modelViewId;
|
||||
}
|
||||
|
||||
@memoize
|
||||
public get connection(): azdata.connection.Connection {
|
||||
if (!this._commonService.connectionManagementService || !this._commonService.connectionManagementService.connectionInfo) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let currentConnection = this._commonService.connectionManagementService.connectionInfo.connectionProfile;
|
||||
let connection: azdata.connection.Connection = {
|
||||
providerName: currentConnection.providerName,
|
||||
connectionId: currentConnection.id,
|
||||
options: currentConnection.options
|
||||
};
|
||||
return connection;
|
||||
}
|
||||
|
||||
@memoize
|
||||
public get serverInfo(): azdata.ServerInfo {
|
||||
if (!this._commonService.connectionManagementService || !this._commonService.connectionManagementService.connectionInfo) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return this._commonService.connectionManagementService.connectionInfo.serverInfo;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user