mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 17:22:45 -05:00
Remove logging and clone utlities (#5309)
* remove log utility functions; remove custom mixin * fix tests * add log service as required by telemetry utils * remove unused code * replace some console.logs with logservice
This commit is contained in:
@@ -19,7 +19,6 @@ import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { warn } from 'sql/base/common/log';
|
||||
import { ipcRenderer as ipc } from 'electron';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
@@ -27,6 +26,7 @@ import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
|
||||
import { localize } from 'vs/nls';
|
||||
import { QueryInput } from 'sql/workbench/parts/query/common/queryInput';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export class CommandLineService implements ICommandLineProcessing {
|
||||
public _serviceBrand: any;
|
||||
@@ -40,7 +40,8 @@ export class CommandLineService implements ICommandLineProcessing {
|
||||
@IEditorService private _editorService: IEditorService,
|
||||
@ICommandService private _commandService: ICommandService,
|
||||
@IConfigurationService private _configurationService: IConfigurationService,
|
||||
@IStatusbarService private _statusBarService: IStatusbarService
|
||||
@IStatusbarService private _statusBarService: IStatusbarService,
|
||||
@ILogService private logService: ILogService
|
||||
) {
|
||||
if (ipc) {
|
||||
ipc.on('ads:processCommandLine', (event: any, args: ParsedArgs) => this.onLaunched(args));
|
||||
@@ -56,11 +57,11 @@ export class CommandLineService implements ICommandLineProcessing {
|
||||
let sqlProvider = registry.getProperties(Constants.mssqlProviderName);
|
||||
// We can't connect to object explorer until the MSSQL connection provider is registered
|
||||
if (sqlProvider) {
|
||||
this.processCommandLine(args).catch(reason => { warn('processCommandLine failed: ' + reason); });
|
||||
this.processCommandLine(args).catch(reason => { this.logService.warn('processCommandLine failed: ' + reason); });
|
||||
} else {
|
||||
registry.onNewProvider(e => {
|
||||
if (e.id === Constants.mssqlProviderName) {
|
||||
this.processCommandLine(args).catch(reason => { warn('processCommandLine failed: ' + reason); });
|
||||
this.processCommandLine(args).catch(reason => { this.logService.warn('processCommandLine failed: ' + reason); });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -101,7 +102,7 @@ export class CommandLineService implements ICommandLineProcessing {
|
||||
let updatedProfile = this._connectionManagementService.getConnectionProfileById(profile.id);
|
||||
connectedContext = { connectionProfile: new ConnectionProfile(this._capabilitiesService, updatedProfile).toIConnectionProfile() };
|
||||
} catch (err) {
|
||||
warn('Failed to connect due to error' + err.message);
|
||||
this.logService.warn('Failed to connect due to error' + err.message);
|
||||
}
|
||||
}
|
||||
if (commandName) {
|
||||
@@ -128,7 +129,7 @@ export class CommandLineService implements ICommandLineProcessing {
|
||||
this._objectExplorerService,
|
||||
this._editorService);
|
||||
} catch (error) {
|
||||
warn('unable to open query editor ' + error);
|
||||
this.logService.warn('unable to open query editor ' + error);
|
||||
// Note: we are intentionally swallowing this error.
|
||||
// In part this is to accommodate unit testing where we don't want to set up the query stack
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
|
||||
import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export interface OnShowUIResponse {
|
||||
selectedProviderType: string;
|
||||
@@ -95,9 +96,10 @@ export class ConnectionDialogWidget extends Modal {
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IContextMenuService private _contextMenuService: IContextMenuService,
|
||||
@IContextViewService private _contextViewService: IContextViewService,
|
||||
@IClipboardService clipboardService: IClipboardService
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@ILayoutService logService: ILogService
|
||||
) {
|
||||
super(localize('connection', "Connection"), TelemetryKeys.Connection, telemetryService, layoutService, clipboardService, themeService, contextKeyService, { hasSpinner: true, hasErrors: true });
|
||||
super(localize('connection', "Connection"), TelemetryKeys.Connection, telemetryService, layoutService, clipboardService, themeService, logService, contextKeyService, { hasSpinner: true, hasErrors: true });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,8 @@ import * as TelemetryKeys from 'sql/platform/telemetry/telemetryKeys';
|
||||
import { NewDashboardTabViewModel, IDashboardUITab } from 'sql/workbench/services/dashboard/common/newDashboardTabViewModel';
|
||||
import { IDashboardTab } from 'sql/platform/dashboard/common/dashboardRegistry';
|
||||
import { IClipboardService } from 'sql/platform/clipboard/common/clipboardService';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
class ExtensionListDelegate implements IListVirtualDelegate<IDashboardUITab> {
|
||||
|
||||
@@ -110,11 +111,12 @@ export class NewDashboardTabDialog extends Modal {
|
||||
public get onCancel(): Event<void> { return this._onCancel.event; }
|
||||
|
||||
constructor(
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@ILayoutService layoutService: ILayoutService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IClipboardService clipboardService: IClipboardService
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@ILogService logService: ILogService
|
||||
) {
|
||||
super(
|
||||
localize('newDashboardTab.openDashboardExtensions', 'Open dashboard extensions'),
|
||||
@@ -123,6 +125,7 @@ export class NewDashboardTabDialog extends Modal {
|
||||
layoutService,
|
||||
clipboardService,
|
||||
themeService,
|
||||
logService,
|
||||
contextKeyService,
|
||||
{ hasSpinner: true }
|
||||
);
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* 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 { IDashboardTab } from 'sql/platform/dashboard/common/dashboardRegistry';
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
import 'vs/css!sql/media/icons/common-icons';
|
||||
import 'vs/css!./media/errorMessageDialog';
|
||||
import { Button } from 'sql/base/browser/ui/button/button';
|
||||
@@ -20,8 +19,9 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
const maxActions = 1;
|
||||
|
||||
@@ -44,11 +44,12 @@ export class ErrorMessageDialog extends Modal {
|
||||
constructor(
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@ILayoutService layoutService: ILayoutService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@ILogService logService: ILogService
|
||||
) {
|
||||
super('', TelemetryKeys.ErrorMessage, telemetryService, layoutService, clipboardService, themeService, contextKeyService, { isFlyout: false, hasTitleIcon: true });
|
||||
super('', TelemetryKeys.ErrorMessage, telemetryService, layoutService, clipboardService, themeService, logService, contextKeyService, { isFlyout: false, hasTitleIcon: true });
|
||||
this._okLabel = localize('errorMessageDialog.ok', 'OK');
|
||||
this._closeLabel = localize('errorMessageDialog.close', 'Close');
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import 'vs/css!sql/media/icons/common-icons';
|
||||
import 'vs/css!./media/fileBrowserDialog';
|
||||
import { Button } from 'sql/base/browser/ui/button/button';
|
||||
@@ -31,7 +29,9 @@ import { SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { IClipboardService } from 'sql/platform/clipboard/common/clipboardService';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export class FileBrowserDialog extends Modal {
|
||||
private _viewModel: FileBrowserViewModel;
|
||||
@@ -49,15 +49,16 @@ export class FileBrowserDialog extends Modal {
|
||||
private _isFolderSelected: boolean;
|
||||
|
||||
constructor(title: string,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@IWorkbenchThemeService private _workbenchthemeService: IWorkbenchThemeService,
|
||||
@ILayoutService layoutService: ILayoutService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IContextViewService private _contextViewService: IContextViewService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IClipboardService clipboardService: IClipboardService
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@ILogService logService: ILogService
|
||||
) {
|
||||
super(title, TelemetryKeys.Backup, telemetryService, layoutService, clipboardService, _workbenchthemeService, contextKeyService, { isFlyout: true, hasTitleIcon: false, hasBackButton: true, hasSpinner: true });
|
||||
super(title, TelemetryKeys.Backup, telemetryService, layoutService, clipboardService, themeService, logService, contextKeyService, { isFlyout: true, hasTitleIcon: false, hasBackButton: true, hasSpinner: true });
|
||||
this._viewModel = this._instantiationService.createInstance(FileBrowserViewModel);
|
||||
this._viewModel.onAddFileTree(args => this.handleOnAddFileTree(args.rootNode, args.selectedNode, args.expandedNodes));
|
||||
this._viewModel.onPathValidate(args => this.handleOnValidate(args.succeeded, args.message));
|
||||
@@ -228,7 +229,7 @@ export class FileBrowserDialog extends Modal {
|
||||
this._register(attachButtonStyler(this._okButton, this._themeService));
|
||||
this._register(attachButtonStyler(this._cancelButton, this._themeService));
|
||||
|
||||
this._register(this._workbenchthemeService.onDidColorThemeChange(e => this.updateTheme()));
|
||||
this._register(this._themeService.onThemeChange(e => this.updateTheme()));
|
||||
}
|
||||
|
||||
// Update theming that is specific to file browser
|
||||
|
||||
@@ -15,7 +15,6 @@ import * as TelemetryKeys from 'sql/platform/telemetry/telemetryKeys';
|
||||
import { IInsightsDialogModel, ListResource, IInsightDialogActionContext, insertValueRegex } from 'sql/workbench/services/insights/common/insightsDialogService';
|
||||
import { TableDataView } from 'sql/base/browser/ui/table/tableDataView';
|
||||
import { RowSelectionModel } from 'sql/base/browser/ui/table/plugins/rowSelectionModel.plugin';
|
||||
import { error } from 'sql/base/common/log';
|
||||
import { Table } from 'sql/base/browser/ui/table/table';
|
||||
import { CopyInsightDialogSelectionAction } from 'sql/workbench/services/insights/common/insightDialogActions';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
@@ -40,7 +39,8 @@ import { SplitView, Orientation, Sizing } from 'vs/base/browser/ui/splitview/spl
|
||||
import { ViewletPanel, IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
|
||||
const labelDisplay = nls.localize("insights.item", "Item");
|
||||
const valueDisplay = nls.localize("insights.value", "Value");
|
||||
@@ -156,17 +156,18 @@ export class InsightsDialogView extends Modal {
|
||||
|
||||
constructor(
|
||||
private _model: IInsightsDialogModel,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@IContextMenuService private _contextMenuService: IContextMenuService,
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@ILayoutService layoutService: ILayoutService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@ICommandService private _commandService: ICommandService,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
|
||||
@IClipboardService clipboardService: IClipboardService
|
||||
@ILogService logService: ILogService,
|
||||
@IInstantiationService private readonly _instantiationService: IInstantiationService,
|
||||
@IContextMenuService private readonly _contextMenuService: IContextMenuService,
|
||||
@ICommandService private readonly _commandService: ICommandService,
|
||||
@ICapabilitiesService private readonly _capabilitiesService: ICapabilitiesService
|
||||
) {
|
||||
super(nls.localize("InsightsDialogTitle", "Insights"), TelemetryKeys.Insights, telemetryService, layoutService, clipboardService, themeService, contextKeyService);
|
||||
super(nls.localize("InsightsDialogTitle", "Insights"), TelemetryKeys.Insights, telemetryService, layoutService, clipboardService, themeService, logService, contextKeyService);
|
||||
this._model.onDataChange(e => this.build());
|
||||
}
|
||||
|
||||
@@ -411,7 +412,7 @@ export class InsightsDialogView extends Modal {
|
||||
if (match && match.length > 0) {
|
||||
let index = this._model.columns.indexOf(match[1]);
|
||||
if (index === -1) {
|
||||
error('Could not find column', match[1]);
|
||||
this.logService.error('Could not find column', match[1]);
|
||||
} else {
|
||||
database = database.replace(match[0], element.data[index]);
|
||||
}
|
||||
@@ -421,7 +422,7 @@ export class InsightsDialogView extends Modal {
|
||||
if (match && match.length > 0) {
|
||||
let index = this._model.columns.indexOf(match[1]);
|
||||
if (index === -1) {
|
||||
error('Could not find column', match[1]);
|
||||
this.logService.error('Could not find column', match[1]);
|
||||
} else {
|
||||
server = server.replace(match[0], element.data[index]);
|
||||
}
|
||||
@@ -431,7 +432,7 @@ export class InsightsDialogView extends Modal {
|
||||
if (match && match.length > 0) {
|
||||
let index = this._model.columns.indexOf(match[1]);
|
||||
if (index === -1) {
|
||||
error('Could not find column', match[1]);
|
||||
this.logService.error('Could not find column', match[1]);
|
||||
} else {
|
||||
user = user.replace(match[0], element.data[index]);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import { IInsightsConfigDetails } from 'sql/workbench/parts/dashboard/widgets/in
|
||||
import QueryRunner, { EventType as QREvents } from 'sql/platform/query/common/queryRunner';
|
||||
import * as Utils from 'sql/platform/connection/common/utils';
|
||||
import { IInsightsDialogModel } from 'sql/workbench/services/insights/common/insightsDialogService';
|
||||
import { error } from 'sql/base/common/log';
|
||||
import { IErrorMessageService } from 'sql/platform/errorMessage/common/errorMessageService';
|
||||
import { resolveQueryFilePath } from '../common/insightsUtils';
|
||||
|
||||
@@ -23,6 +22,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export class InsightsDialogController {
|
||||
private _queryRunner: QueryRunner;
|
||||
@@ -38,7 +38,8 @@ export class InsightsDialogController {
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@IWorkspaceContextService private _workspaceContextService: IWorkspaceContextService,
|
||||
@IConfigurationResolverService private _configurationResolverService: IConfigurationResolverService
|
||||
@IConfigurationResolverService private _configurationResolverService: IConfigurationResolverService,
|
||||
@ILogService private logService: ILogService
|
||||
) { }
|
||||
|
||||
public async update(input: IInsightsConfigDetails, connectionProfile: IConnectionProfile): Promise<void> {
|
||||
@@ -87,7 +88,7 @@ export class InsightsDialogController {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
error('Error reading details Query: ', input);
|
||||
this.logService.error('Error reading details Query: ', input);
|
||||
this._notificationService.notify({
|
||||
severity: Severity.Error,
|
||||
message: nls.localize("insightsConfigError", "There was an error parsing the insight config; could not find query array/string or queryfile")
|
||||
|
||||
@@ -22,6 +22,7 @@ import { elapsedTimeLabel } from 'sql/workbench/parts/query/common/localizedCons
|
||||
import * as notebookUtils from 'sql/workbench/parts/notebook/notebookUtils';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export const sqlKernelError: string = localize("sqlKernelError", "SQL kernel error");
|
||||
export const MAX_ROWS = 5000;
|
||||
@@ -166,7 +167,8 @@ class SqlKernel extends Disposable implements nb.IKernel {
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@IErrorMessageService private _errorMessageService: IErrorMessageService,
|
||||
@IConfigurationService private _configurationService: IConfigurationService
|
||||
@IConfigurationService private _configurationService: IConfigurationService,
|
||||
@ILogService private readonly logService: ILogService
|
||||
) {
|
||||
super();
|
||||
this.initMagics();
|
||||
@@ -261,7 +263,7 @@ class SqlKernel extends Disposable implements nb.IKernel {
|
||||
// TODO verify this is "canonical" behavior
|
||||
let count = canRun ? ++this._executionCount : undefined;
|
||||
|
||||
this._future = new SQLFuture(this._queryRunner, count, this._configurationService);
|
||||
this._future = new SQLFuture(this._queryRunner, count, this._configurationService, this.logService);
|
||||
if (!canRun) {
|
||||
// Complete early
|
||||
this._future.handleDone(new Error(localize('connectionRequired', "A connection must be chosen to run notebook cells")));
|
||||
@@ -333,7 +335,7 @@ class SqlKernel extends Disposable implements nb.IKernel {
|
||||
try {
|
||||
await this._connectionManagementService.disconnect(this._path);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
this.logService.error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -348,7 +350,12 @@ export class SQLFuture extends Disposable implements FutureInternal {
|
||||
private doneDeferred = new Deferred<nb.IShellMessage>();
|
||||
private configuredMaxRows: number = MAX_ROWS;
|
||||
private _outputAddedPromises: Promise<void>[] = [];
|
||||
constructor(private _queryRunner: QueryRunner, private _executionCount: number | undefined, private configurationService: IConfigurationService) {
|
||||
constructor(
|
||||
private _queryRunner: QueryRunner,
|
||||
private _executionCount: number | undefined,
|
||||
configurationService: IConfigurationService,
|
||||
private readonly logService: ILogService
|
||||
) {
|
||||
super();
|
||||
let config = configurationService.getValue(NotebookConfigSectionName);
|
||||
if (config) {
|
||||
@@ -450,7 +457,7 @@ export class SQLFuture extends Disposable implements FutureInternal {
|
||||
}
|
||||
} catch (err) {
|
||||
// TODO should we output this somewhere else?
|
||||
console.log(`Error outputting result sets from Notebook query: ${err}`);
|
||||
this.logService.error(`Error outputting result sets from Notebook query: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,11 +16,11 @@ import * as nls from 'vs/nls';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/telemetryKeys';
|
||||
import * as TelemetryUtils from 'sql/platform/telemetry/telemetryUtilities';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { warn, error } from 'sql/base/common/log';
|
||||
import { ServerTreeView } from 'sql/workbench/parts/objectExplorer/browser/serverTreeView';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import * as Utils from 'sql/platform/connection/common/utils';
|
||||
import { entries } from 'sql/base/common/objects';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export const SERVICE_ID = 'ObjectExplorerService';
|
||||
|
||||
@@ -146,7 +146,8 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
constructor(
|
||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||
@ITelemetryService private _telemetryService: ITelemetryService,
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService
|
||||
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
|
||||
@ILogService private logService: ILogService
|
||||
) {
|
||||
this._onUpdateObjectExplorerNodes = new Emitter<ObjectExplorerNodeEventArgs>();
|
||||
this._activeObjectExplorerNodes = {};
|
||||
@@ -206,7 +207,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
public onNodeExpanded(expandResponse: NodeExpandInfoWithProviderId) {
|
||||
|
||||
if (expandResponse.errorMessage) {
|
||||
error(expandResponse.errorMessage);
|
||||
this.logService.error(expandResponse.errorMessage);
|
||||
}
|
||||
|
||||
let sessionStatus = this._sessions[expandResponse.sessionId];
|
||||
@@ -219,7 +220,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
}
|
||||
}
|
||||
if (!foundSession) {
|
||||
warn(`Cannot find node status for session: ${expandResponse.sessionId} and node path: ${expandResponse.nodePath}`);
|
||||
this.logService.warn(`Cannot find node status for session: ${expandResponse.sessionId} and node path: ${expandResponse.nodePath}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +233,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
} else {
|
||||
let errorMessage = session && session.errorMessage ? session.errorMessage :
|
||||
nls.localize('OeSessionFailedError', 'Failed to create Object Explorer session');
|
||||
error(errorMessage);
|
||||
this.logService.error(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +253,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
else {
|
||||
errorMessage = session && session.errorMessage ? session.errorMessage :
|
||||
nls.localize('OeSessionFailedError', 'Failed to create Object Explorer session');
|
||||
error(errorMessage);
|
||||
this.logService.error(errorMessage);
|
||||
}
|
||||
// Send on session created about the session to all node providers so they can prepare for node expansion
|
||||
let nodeProviders = this._nodeProviders[connection.providerName];
|
||||
@@ -262,12 +263,12 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
}
|
||||
}
|
||||
else {
|
||||
warn(`cannot find session ${session.sessionId}`);
|
||||
this.logService.warn(`cannot find session ${session.sessionId}`);
|
||||
}
|
||||
|
||||
this.sendUpdateNodeEvent(connection, errorMessage);
|
||||
} catch (error) {
|
||||
warn(`cannot handle the session ${session.sessionId} in all nodeProviders`);
|
||||
this.logService.warn(`cannot handle the session ${session.sessionId} in all nodeProviders`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +291,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
warn(`Cannot find session ${session.sessionId}`);
|
||||
this.logService.warn(`Cannot find session ${session.sessionId}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,7 +349,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
return new Promise<azdata.ObjectExplorerExpandInfo>((resolve, reject) => {
|
||||
let provider = this._providers[providerId];
|
||||
if (provider) {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.ObjectExplorerExpand, { refresh: 0, provider: providerId });
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.ObjectExplorerExpand, { refresh: 0, provider: providerId });
|
||||
this.expandOrRefreshNode(providerId, session, nodePath).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
@@ -398,7 +399,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
if (expandResult && expandResult.providerId) {
|
||||
resultMap.set(expandResult.providerId, expandResult);
|
||||
} else {
|
||||
error('OE provider returns empty result or providerId');
|
||||
this.logService.error('OE provider returns empty result or providerId');
|
||||
}
|
||||
|
||||
// When get all responses from all providers, merge results
|
||||
@@ -486,7 +487,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
public refreshNode(providerId: string, session: azdata.ObjectExplorerSession, nodePath: string): Thenable<azdata.ObjectExplorerExpandInfo> {
|
||||
let provider = this._providers[providerId];
|
||||
if (provider) {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.ObjectExplorerExpand, { refresh: 1, provider: providerId });
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.ObjectExplorerExpand, { refresh: 1, provider: providerId });
|
||||
return this.expandOrRefreshNode(providerId, session, nodePath, true);
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
|
||||
@@ -14,6 +14,7 @@ import { FirewallRuleDialogController } from 'sql/platform/accounts/browser/fire
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { invalidProvider } from 'sql/base/common/errors';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export class ResourceProviderService implements IResourceProviderService {
|
||||
|
||||
@@ -24,6 +25,7 @@ export class ResourceProviderService implements IResourceProviderService {
|
||||
constructor(
|
||||
@ITelemetryService private _telemetryService: ITelemetryService,
|
||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||
@ILogService private readonly logService: ILogService
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -47,7 +49,7 @@ export class ResourceProviderService implements IResourceProviderService {
|
||||
return new Promise<azdata.CreateFirewallRuleResponse>((resolve, reject) => {
|
||||
const provider = this._providers[resourceProviderId];
|
||||
if (provider) {
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, TelemetryKeys.FirewallRuleRequested, { provider: resourceProviderId });
|
||||
TelemetryUtils.addTelemetry(this._telemetryService, this.logService, TelemetryKeys.FirewallRuleRequested, { provider: resourceProviderId });
|
||||
provider.createFirewallRule(selectedAccount, firewallruleInfo).then(result => {
|
||||
resolve(result);
|
||||
}, error => {
|
||||
|
||||
Reference in New Issue
Block a user