mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 17:23:29 -05:00
Stricter tslint rules (#9352)
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises */
|
||||
|
||||
import { IMainContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { deepClone, assign } from 'vs/base/common/objects';
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import * as vscode from 'vscode';
|
||||
import { SqlMainContext, ExtHostModelViewTreeViewsShape, MainThreadModelViewShape } from 'sql/workbench/api/common/sqlExtHost.protocol';
|
||||
import { ITreeComponentItem } from 'sql/workbench/common/views';
|
||||
@@ -132,7 +133,7 @@ export class ExtHostTreeView<T> extends vsTreeExt.ExtHostTreeView<T> {
|
||||
} else {
|
||||
const handlesToRefresh = this.getHandlesToRefresh(elements);
|
||||
if (handlesToRefresh.length) {
|
||||
this.refreshHandles(handlesToRefresh);
|
||||
this.refreshHandles(handlesToRefresh).catch(errors.onUnexpectedError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ export class ExtHostObjectExplorerNode implements azdata.objectexplorer.ObjectEx
|
||||
let parentPathEndIndex: number = this.nodePath.lastIndexOf(nodePathName) - 1;
|
||||
if (parentPathEndIndex < 0) {
|
||||
// At root node
|
||||
Promise.resolve(undefined);
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
return this._proxy.$getNode(this.connectionId, this.nodePath.slice(0, parentPathEndIndex)).then(
|
||||
nodeInfo => nodeInfo ? new ExtHostObjectExplorerNode(nodeInfo, this.connectionId, this._proxy) : undefined);
|
||||
|
||||
@@ -235,7 +235,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
this._register(this.themeService.onThemeChange(() => this.doRefresh([this.root]) /** soft refresh **/));
|
||||
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
||||
if (e.affectsConfiguration('explorer.decorations')) {
|
||||
this.doRefresh([this.root]); /** soft refresh **/
|
||||
this.doRefresh([this.root]).catch(onUnexpectedError); /** soft refresh **/
|
||||
}
|
||||
}));
|
||||
this.markdownRenderer = instantiationService.createInstance(MarkdownRenderer);
|
||||
@@ -272,7 +272,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
}
|
||||
};
|
||||
this.updateMessage();
|
||||
this.refresh();
|
||||
this.refresh().catch(onUnexpectedError);
|
||||
} else {
|
||||
this._dataProvider = null;
|
||||
this.updateMessage();
|
||||
@@ -361,7 +361,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
|
||||
}
|
||||
|
||||
if (this.isVisible && this.elementsToRefresh.length) {
|
||||
this.doRefresh(this.elementsToRefresh);
|
||||
this.doRefresh(this.elementsToRefresh).catch(onUnexpectedError);
|
||||
this.elementsToRefresh = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import { IColorTheme, IWorkbenchThemeService } from 'vs/workbench/services/theme
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as themeColors from 'vs/workbench/common/theme';
|
||||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
export const DASHBOARD_SELECTOR: string = 'dashboard-component';
|
||||
|
||||
@@ -59,7 +60,7 @@ export class DashboardComponent extends AngularDisposable implements OnInit {
|
||||
});
|
||||
if (profile && (!profile.databaseName || Utils.isMaster(profile))) {
|
||||
// Route to the server page as this is the default database
|
||||
this._router.navigate(['server-dashboard']);
|
||||
this._router.navigate(['server-dashboard']).catch(onUnexpectedError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
export class ServerDashboardPage extends DashboardPage implements OnInit {
|
||||
protected propertiesWidget: WidgetConfig = {
|
||||
@@ -68,6 +69,6 @@ export class ServerDashboardPage extends DashboardPage implements OnInit {
|
||||
this.dashboardService.connectionManagementService.connectionInfo.connectionProfile.databaseName = null;
|
||||
this.init();
|
||||
this._cd.detectChanges();
|
||||
});
|
||||
}).catch(onUnexpectedError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import * as nls from 'vs/nls';
|
||||
import { deepClone } from 'vs/base/common/objects';
|
||||
import { RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
const DASHBOARD_SETTINGS = 'dashboard';
|
||||
|
||||
@@ -116,7 +117,7 @@ export class DashboardServiceInterface extends CommonServiceInterface {
|
||||
if (this._router.url === '/database-dashboard') {
|
||||
this._updatePage.fire();
|
||||
} else {
|
||||
this._router.navigate(['database-dashboard']);
|
||||
this._router.navigate(['database-dashboard']).catch(onUnexpectedError);
|
||||
}
|
||||
} else {
|
||||
this._notificationService.notify({
|
||||
@@ -134,7 +135,7 @@ export class DashboardServiceInterface extends CommonServiceInterface {
|
||||
);
|
||||
break;
|
||||
case AngularEventType.NAV_SERVER:
|
||||
this._router.navigate(['server-dashboard']);
|
||||
this._router.navigate(['server-dashboard']).catch(onUnexpectedError);
|
||||
break;
|
||||
case AngularEventType.DELETE_WIDGET:
|
||||
this._onDeleteWidget.fire(event.payload.id);
|
||||
|
||||
@@ -24,6 +24,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { ItemContextKey } from 'sql/workbench/contrib/dashboard/browser/widgets/explorer/explorerTreeContext';
|
||||
import { ObjectMetadataWrapper } from 'sql/workbench/contrib/dashboard/browser/widgets/explorer/objectMetadataWrapper';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
export declare type TreeResource = IConnectionProfile | ObjectMetadataWrapper;
|
||||
|
||||
@@ -113,7 +114,7 @@ export class ExplorerController extends TreeDefaults.DefaultController {
|
||||
|
||||
private handleItemDoubleClick(element: IConnectionProfile): void {
|
||||
this.progressService.showWhile(this._connectionService.changeDatabase(element.databaseName).then(result => {
|
||||
this._router.navigate(['database-dashboard']);
|
||||
this._router.navigate(['database-dashboard']).catch(onUnexpectedError);
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -123,7 +124,7 @@ export class ExplorerController extends TreeDefaults.DefaultController {
|
||||
const focus = tree.getFocus();
|
||||
if (focus && !(focus instanceof ObjectMetadataWrapper)) {
|
||||
this._connectionService.changeDatabase(focus.databaseName).then(result => {
|
||||
this._router.navigate(['database-dashboard']);
|
||||
this._router.navigate(['database-dashboard']).catch(onUnexpectedError);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import { EditDataResultsInput } from 'sql/workbench/browser/editData/editDataRes
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
/**
|
||||
* Editor that hosts an action bar and a resultSetInput for an edit data session
|
||||
@@ -581,12 +582,12 @@ export class EditDataEditor extends BaseEditor {
|
||||
this._createResultsEditorContainer();
|
||||
|
||||
this._createEditor(<EditDataResultsInput>input.results, this._resultsEditorContainer)
|
||||
.then(result => {
|
||||
this._onResultsEditorCreated(<EditDataResultsEditor>result, input.results, this.options);
|
||||
.then(async result => {
|
||||
await this._onResultsEditorCreated(<EditDataResultsEditor>result, input.results, this.options);
|
||||
this.resultsEditorVisibility = true;
|
||||
this.hideQueryResultsView = false;
|
||||
this._doLayout(true);
|
||||
});
|
||||
}).catch(onUnexpectedError);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,6 +34,7 @@ import { deepClone, assign } from 'vs/base/common/objects';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { equals } from 'vs/base/common/arrays';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
export class EditDataGridPanel extends GridParentComponent {
|
||||
// The time(in milliseconds) we wait before refreshing the grid.
|
||||
@@ -251,7 +252,7 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
return (index: number): void => {
|
||||
// If the user is deleting a new row that hasn't been committed yet then use the revert code
|
||||
if (self.newRowVisible && index === self.dataSet.dataRows.getLength() - 2) {
|
||||
self.revertCurrentRow();
|
||||
self.revertCurrentRow().catch(onUnexpectedError);
|
||||
}
|
||||
else if (self.isNullRow(index)) {
|
||||
// Don't try to delete NULL (new) row since it doesn't actually exist and will throw an error
|
||||
@@ -270,7 +271,7 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
onRevertRow(): () => void {
|
||||
const self = this;
|
||||
return (): void => {
|
||||
self.revertCurrentRow();
|
||||
self.revertCurrentRow().catch(onUnexpectedError);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -478,7 +479,7 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
let handled: boolean = false;
|
||||
|
||||
if (e.keyCode === KeyCode.Escape) {
|
||||
this.revertCurrentRow();
|
||||
this.revertCurrentRow().catch(onUnexpectedError);
|
||||
handled = true;
|
||||
}
|
||||
return handled;
|
||||
@@ -714,7 +715,7 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
self.setCellDirtyState(self.currentCell.row, self.currentCell.column, result.cell.isDirty);
|
||||
}, (error: any) => {
|
||||
self.notificationService.error(error);
|
||||
});
|
||||
}).catch(onUnexpectedError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import { attachButtonStyler } from 'sql/platform/theme/common/styler';
|
||||
import { find, fill } from 'vs/base/common/arrays';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
export const JOBSVIEW_SELECTOR: string = 'jobsview-component';
|
||||
export const ROW_HEIGHT: number = 45;
|
||||
@@ -389,7 +390,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
||||
// cache the dataview for future use
|
||||
this._jobCacheObject.dataView = this.dataView;
|
||||
this.filterValueMap['start'] = [[], this.dataView.getItems()];
|
||||
this.loadJobHistories();
|
||||
this.loadJobHistories().catch(onUnexpectedError);
|
||||
}
|
||||
|
||||
private highlightErrorRows(e) {
|
||||
@@ -541,7 +542,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
||||
// so they can be expanded quicker
|
||||
let failing = separatedJobs[0];
|
||||
let passing = separatedJobs[1];
|
||||
Promise.all([this.curateJobHistory(failing, ownerUri), this.curateJobHistory(passing, ownerUri)]);
|
||||
await Promise.all([this.curateJobHistory(failing, ownerUri), this.curateJobHistory(passing, ownerUri)]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import { generateUuid } from 'vs/base/common/uuid';
|
||||
|
||||
import { ComponentBase } from 'sql/workbench/browser/modelComponents/componentBase';
|
||||
import { ComponentEventType, IModelStore, IComponentDescriptor, IComponent } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
function reviveWebviewOptions(options: vscode.WebviewOptions): vscode.WebviewOptions {
|
||||
return {
|
||||
@@ -95,7 +96,7 @@ export default class WebViewComponent extends ComponentBase implements IComponen
|
||||
}));
|
||||
|
||||
this.setHtml();
|
||||
});
|
||||
}).catch(onUnexpectedError);
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
@@ -141,7 +142,7 @@ export default class WebViewComponent extends ComponentBase implements IComponen
|
||||
this._ready.then(() => {
|
||||
let element = <HTMLElement>this._el.nativeElement;
|
||||
element.style.position = this.position;
|
||||
});
|
||||
}).catch(onUnexpectedError);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +165,7 @@ export default class WebViewComponent extends ComponentBase implements IComponen
|
||||
this._extensionLocationUri = URI.revive(this.extensionLocation);
|
||||
}
|
||||
this.sendMessage();
|
||||
});
|
||||
}).catch(onUnexpectedError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,9 +69,9 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
|
||||
this._treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
|
||||
this._onSelectionOrFocusChange = new Emitter();
|
||||
this._actionProvider = this._instantiationService.createInstance(ServerTreeActionProvider);
|
||||
capabilitiesService.onCapabilitiesRegistered(() => {
|
||||
capabilitiesService.onCapabilitiesRegistered(async () => {
|
||||
if (this._connectionManagementService.hasRegisteredServers()) {
|
||||
this.refreshTree();
|
||||
await this.refreshTree();
|
||||
this._treeSelectionHandler.onTreeActionStateChange(false);
|
||||
}
|
||||
});
|
||||
@@ -114,7 +114,7 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
|
||||
CommandsRegistry.registerCommand({
|
||||
id: 'registeredServers.clearSearchServerResult',
|
||||
handler: (accessor: ServicesAccessor, ...args: any[]) => {
|
||||
this.refreshTree();
|
||||
this.refreshTree().catch(errors.onUnexpectedError);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -151,14 +151,14 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
|
||||
|
||||
// Refresh Tree when these events are emitted
|
||||
this._register(this._connectionManagementService.onAddConnectionProfile((newProfile: IConnectionProfile) => {
|
||||
this.handleAddConnectionProfile(newProfile);
|
||||
this.handleAddConnectionProfile(newProfile).catch(errors.onUnexpectedError);
|
||||
}));
|
||||
this._register(this._connectionManagementService.onDeleteConnectionProfile(() => {
|
||||
this.refreshTree();
|
||||
this.refreshTree().catch(errors.onUnexpectedError);
|
||||
}));
|
||||
this._register(this._connectionManagementService.onDisconnect((connectionParams) => {
|
||||
if (this.isObjectExplorerConnectionUri(connectionParams.connectionUri)) {
|
||||
this.deleteObjectExplorerNodeAndRefreshTree(connectionParams.connectionProfile);
|
||||
this.deleteObjectExplorerNodeAndRefreshTree(connectionParams.connectionProfile).catch(errors.onUnexpectedError);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
this._connectionManagementService.disconnect(connection).then(() => {
|
||||
connection.isDisconnecting = false;
|
||||
}).catch((e) => this.logService.error(e));
|
||||
});
|
||||
}).catch((e) => this.logService.error(e));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user