Files
azuredatastudio/src/sql/workbench/services/dashboard/browser/newDashboardTabDialogService.ts
Anthony Dresser d4704e39ac Another code layering (#4037)
* working on formatting

* fixed basic lint errors; starting moving things to their appropriate location

* formatting

* update tslint to match the version of vscode we have

* remove unused code

* work in progress fixing layering

* formatting

* moved connection management service to platform

* formatting

* add missing file

* moving more servies

* formatting

* moving more services

* formatting

* wip

* moving more services

* formatting

* move css file

* add missing svgs

* moved the rest of services

* formatting

* changing around some references

* formatting

* revert tslint

* revert some changes that brake things

* formatting

* fix tests

* fix testzx

* fix tests

* fix tests

* fix compile issue
2019-02-19 12:11:54 -08:00

55 lines
2.4 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* 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 { INewDashboardTabDialogService } from 'sql/workbench/services/dashboard/common/newDashboardTabDialog';
import { NewDashboardTabDialog } from 'sql/workbench/services/dashboard/browser/newDashboardTabDialog';
import { IDashboardTab } from 'sql/platform/dashboard/common/dashboardRegistry';
import { IAngularEventingService, AngularEventType } from 'sql/platform/angularEventing/common/angularEventingService';
import { IDashboardUITab } from 'sql/workbench/services/dashboard/common/newDashboardTabViewModel';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
export class NewDashboardTabDialogService implements INewDashboardTabDialogService {
_serviceBrand: any;
// MEMBER VARIABLES ////////////////////////////////////////////////////
private _addNewTabDialog: NewDashboardTabDialog;
private _uri: string;
constructor(
@IAngularEventingService private _angularEventService: IAngularEventingService,
@IInstantiationService private _instantiationService: IInstantiationService
) { }
/**
* Open account dialog
*/
public showDialog(dashboardTabs: Array<IDashboardTab>, openedTabs: Array<IDashboardTab>, uri: string): void {
this._uri = uri;
let self = this;
// Create a new dialog if one doesn't exist
if (!this._addNewTabDialog) {
this._addNewTabDialog = this._instantiationService.createInstance(NewDashboardTabDialog);
this._addNewTabDialog.onCancel(() => { self.handleOnCancel(); });
this._addNewTabDialog.onAddTabs((selectedTabs) => { self.handleOnAddTabs(selectedTabs); });
this._addNewTabDialog.render();
}
// Open the dialog
this._addNewTabDialog.open(dashboardTabs, openedTabs);
}
// PRIVATE HELPERS /////////////////////////////////////////////////////
private handleOnAddTabs(selectedUiTabs: Array<IDashboardUITab>): void {
let selectedTabs = selectedUiTabs.map(tab => tab.tabConfig);
this._angularEventService.sendAngularEvent(this._uri, AngularEventType.NEW_TABS, { dashboardTabs: selectedTabs });
this._addNewTabDialog.close();
}
private handleOnCancel(): void { }
}