mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 01:25:38 -05:00
No console linting (#9156)
* add no-console linting and change to just using overrides for sql files * whitespace * fix tests
This commit is contained in:
@@ -78,7 +78,7 @@ export class QueryModelViewTabView implements IPanelView {
|
||||
* Load the angular components and record for this input that we have done so
|
||||
*/
|
||||
private bootstrapAngular(container: HTMLElement): string {
|
||||
let uniqueSelector = bootstrapAngular(this._instantiationService,
|
||||
let uniqueSelector = this._instantiationService.invokeFunction(bootstrapAngular,
|
||||
QueryModelViewTabModule,
|
||||
container,
|
||||
'querytab-modelview-container',
|
||||
|
||||
@@ -42,6 +42,7 @@ import { TreeViewItemHandleArg } from 'sql/workbench/common/views';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { IQueryManagementService } from 'sql/workbench/services/query/common/queryManagement';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
/**
|
||||
* Action class that query-based Actions will extend. This base class automatically handles activating and
|
||||
@@ -268,7 +269,8 @@ export class CancelQueryAction extends QueryTaskbarAction {
|
||||
constructor(
|
||||
editor: QueryEditor,
|
||||
@IQueryModelService private readonly queryModelService: IQueryModelService,
|
||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService
|
||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||
@ILogService private readonly logService: ILogService
|
||||
) {
|
||||
super(connectionManagementService, editor, CancelQueryAction.ID, CancelQueryAction.EnabledClass);
|
||||
this.enabled = false;
|
||||
@@ -278,7 +280,7 @@ export class CancelQueryAction extends QueryTaskbarAction {
|
||||
public async run(): Promise<void> {
|
||||
if (this.isConnected(this.editor)) {
|
||||
if (!this.editor.input) {
|
||||
console.error('editor input was null');
|
||||
this.logService.error('editor input was null');
|
||||
return;
|
||||
}
|
||||
this.queryModelService.cancelQuery(this.editor.input.uri);
|
||||
@@ -526,7 +528,8 @@ export class ToggleSqlCmdModeAction extends QueryTaskbarAction {
|
||||
private _isSqlCmdMode: boolean,
|
||||
@IQueryManagementService protected readonly queryManagementService: IQueryManagementService,
|
||||
@IConfigurationService protected readonly configurationService: IConfigurationService,
|
||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService
|
||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||
@ILogService private readonly logService: ILogService
|
||||
) {
|
||||
super(connectionManagementService, editor, ToggleSqlCmdModeAction.ID, undefined);
|
||||
}
|
||||
@@ -554,7 +557,7 @@ export class ToggleSqlCmdModeAction extends QueryTaskbarAction {
|
||||
let queryoptions: QueryExecutionOptions = { options: {} };
|
||||
queryoptions.options['isSqlCmdMode'] = toSqlCmdState;
|
||||
if (!this.editor.input) {
|
||||
console.error('editor input was null');
|
||||
this.logService.error('editor input was null');
|
||||
return;
|
||||
}
|
||||
this.queryManagementService.setQueryExecutionOptions(this.editor.input.uri, queryoptions);
|
||||
@@ -586,7 +589,8 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
||||
@IContextViewService contextViewProvider: IContextViewService,
|
||||
@IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService,
|
||||
@INotificationService private readonly notificationService: INotificationService,
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService
|
||||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@ILogService private readonly logService: ILogService
|
||||
) {
|
||||
super();
|
||||
this._databaseListDropdown = $('.databaseListDropdown');
|
||||
@@ -680,7 +684,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
||||
// PRIVATE HELPERS /////////////////////////////////////////////////////
|
||||
private databaseSelected(dbName: string): void {
|
||||
if (!this._editor.input) {
|
||||
console.error('editor input was null');
|
||||
this.logService.error('editor input was null');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -716,7 +720,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
||||
|
||||
private getCurrentDatabaseName(): string | undefined {
|
||||
if (!this._editor.input) {
|
||||
console.error('editor input was null');
|
||||
this.logService.error('editor input was null');
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -744,7 +748,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
||||
}
|
||||
|
||||
if (!this._editor.input) {
|
||||
console.error('editor input was null');
|
||||
this.logService.error('editor input was null');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -758,7 +762,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
||||
|
||||
private onDropdownFocus(): void {
|
||||
if (!this._editor.input) {
|
||||
console.error('editor input was null');
|
||||
this.logService.error('editor input was null');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -782,7 +786,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
||||
if (this._isInAccessibilityMode) {
|
||||
this._databaseSelectBox.enable();
|
||||
if (!this._editor.input) {
|
||||
console.error('editor input was null');
|
||||
this.logService.error('editor input was null');
|
||||
return;
|
||||
}
|
||||
let uri = this._editor.input.uri;
|
||||
|
||||
@@ -333,7 +333,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
});
|
||||
|
||||
// If I call run on CancelQueryAction when I am not connected
|
||||
let queryAction: CancelQueryAction = new CancelQueryAction(editor.object, queryModelService.object, connectionManagementService.object);
|
||||
let queryAction: CancelQueryAction = new CancelQueryAction(editor.object, queryModelService.object, connectionManagementService.object, undefined);
|
||||
isConnected = false;
|
||||
await queryAction.run();
|
||||
|
||||
@@ -467,7 +467,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
});
|
||||
|
||||
// If I query without having initialized anything, state should be clear
|
||||
listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object);
|
||||
listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
|
||||
|
||||
assert.equal(listItem.isEnabled(), false, 'do not expect dropdown enabled unless connected');
|
||||
assert.equal(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries unless connected');
|
||||
@@ -498,7 +498,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
connectionManagementService.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName });
|
||||
|
||||
// ... Create a database dropdown that has been connected
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object);
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
|
||||
listItem.onConnected();
|
||||
|
||||
// If: I raise a connection changed event
|
||||
@@ -520,7 +520,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
connectionManagementService.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName });
|
||||
|
||||
// ... Create a database dropdown that has been connected
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object);
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
|
||||
listItem.onConnected();
|
||||
|
||||
// If: I raise a connection changed event for the 'wrong' URI
|
||||
@@ -545,7 +545,7 @@ suite('SQL QueryAction Tests', () => {
|
||||
connectionManagementService.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event);
|
||||
|
||||
// ... Create a database dropdown
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object);
|
||||
let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
|
||||
|
||||
// If: I raise a connection changed event
|
||||
let eventParams = <IConnectionParams>{
|
||||
|
||||
@@ -63,7 +63,7 @@ suite('SQL QueryEditor Tests', () => {
|
||||
instantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((classDef, editor, action) => {
|
||||
if (classDef.ID) {
|
||||
if (classDef.ID === 'listDatabaseQueryActionItem') {
|
||||
return new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object);
|
||||
return new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
|
||||
}
|
||||
}
|
||||
// Default
|
||||
@@ -295,7 +295,7 @@ suite('SQL QueryEditor Tests', () => {
|
||||
queryActionInstantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
||||
.returns((definition, editor, action, selectBox) => {
|
||||
if (definition.ID === 'listDatabaseQueryActionItem') {
|
||||
let item = new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object);
|
||||
let item = new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object, undefined);
|
||||
return item;
|
||||
}
|
||||
// Default
|
||||
|
||||
Reference in New Issue
Block a user