mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 09:35:38 -05:00
Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 (#12295)
* Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 * Fix test build break * Update distro * Fix build errors * Update distro * Update REH build file * Update build task names for REL * Fix product build yaml * Fix product REH task name * Fix type in task name * Update linux build step * Update windows build tasks * Turn off server publish * Disable REH * Fix typo * Bump distro * Update vscode tests * Bump distro * Fix type in disto * Bump distro * Turn off docker build * Remove docker step from release Co-authored-by: ADS Merger <andresse@microsoft.com> Co-authored-by: Karl Burtram <karlb@microsoft.com>
This commit is contained in:
@@ -16,7 +16,6 @@ import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
import { UpdateAccountListEventParams } from 'sql/platform/accounts/common/eventTypes';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadAccountManagement)
|
||||
export class MainThreadAccountManagement extends Disposable implements MainThreadAccountManagementShape {
|
||||
@@ -38,7 +37,7 @@ export class MainThreadAccountManagement extends Disposable implements MainThrea
|
||||
return;
|
||||
}
|
||||
|
||||
const providerMetadataIndex = firstIndex(values(this._providerMetadata), (providerMetadata: azdata.AccountProviderMetadata) => providerMetadata.id === e.providerId);
|
||||
const providerMetadataIndex = values(this._providerMetadata).findIndex((providerMetadata: azdata.AccountProviderMetadata) => providerMetadata.id === e.providerId);
|
||||
if (providerMetadataIndex === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import { MainThreadDashboardWebviewShape, SqlMainContext, ExtHostDashboardWebvie
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { IDashboardViewService, IDashboardWebview } from 'sql/platform/dashboard/browser/dashboardViewService';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadDashboardWebview)
|
||||
export class MainThreadDashboardWebview implements MainThreadDashboardWebviewShape {
|
||||
@@ -24,7 +23,7 @@ export class MainThreadDashboardWebview implements MainThreadDashboardWebviewSha
|
||||
) {
|
||||
this._proxy = context.getProxy(SqlExtHostContext.ExtHostDashboardWebviews);
|
||||
viewService.onRegisteredWebview(e => {
|
||||
if (find(this.knownWidgets, x => x === e.id)) {
|
||||
if (this.knownWidgets.find(x => x === e.id)) {
|
||||
let handle = MainThreadDashboardWebview._handlePool++;
|
||||
this._dialogs.set(handle, e);
|
||||
this._proxy.$registerWidget(handle, e.id, e.connection, e.serverInfo);
|
||||
|
||||
@@ -11,7 +11,6 @@ import { Disposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
import { IModelViewService } from 'sql/platform/modelComponents/browser/modelViewService';
|
||||
import { IItemConfig, IComponentShape, IModelView } from 'sql/platform/model/browser/modelViewService';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
|
||||
@extHostNamedCustomer(SqlMainContext.MainThreadModelView)
|
||||
@@ -29,7 +28,7 @@ export class MainThreadModelView extends Disposable implements MainThreadModelVi
|
||||
super();
|
||||
this._proxy = _context.getProxy(SqlExtHostContext.ExtHostModelView);
|
||||
viewService.onRegisteredModelView(view => {
|
||||
if (find(this.knownWidgets, x => x === view.id)) {
|
||||
if (this.knownWidgets.find(x => x === view.id)) {
|
||||
let handle = MainThreadModelView._handlePool++;
|
||||
this._dialogs.set(handle, view);
|
||||
this._proxy.$registerWidget(handle, view.id, view.connection, view.serverInfo);
|
||||
|
||||
@@ -33,7 +33,6 @@ import { localize } from 'vs/nls';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { UntitledNotebookInput } from 'sql/workbench/contrib/notebook/browser/models/untitledNotebookInput';
|
||||
import { FileNotebookInput } from 'sql/workbench/contrib/notebook/browser/models/fileNotebookInput';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
@@ -384,7 +383,7 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
|
||||
let cell: ICellModel;
|
||||
if (cellUri) {
|
||||
let uriString = URI.revive(cellUri).toString();
|
||||
cell = find(editor.cells, c => c.cellUri.toString() === uriString);
|
||||
cell = editor.cells.find(c => c.cellUri.toString() === uriString);
|
||||
// If it's markdown what should we do? Show notification??
|
||||
} else {
|
||||
// Use the active cell in this case, or 1st cell if there's none active
|
||||
@@ -406,11 +405,11 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
|
||||
let endCell: ICellModel;
|
||||
if (startCellUri) {
|
||||
let uriString = URI.revive(startCellUri).toString();
|
||||
startCell = find(editor.cells, c => c.cellUri.toString() === uriString);
|
||||
startCell = editor.cells.find(c => c.cellUri.toString() === uriString);
|
||||
}
|
||||
if (endCellUri) {
|
||||
let uriString = URI.revive(endCellUri).toString();
|
||||
endCell = find(editor.cells, c => c.cellUri.toString() === uriString);
|
||||
endCell = editor.cells.find(c => c.cellUri.toString() === uriString);
|
||||
}
|
||||
return editor.runAllCells(startCell, endCell);
|
||||
}
|
||||
@@ -424,7 +423,7 @@ export class MainThreadNotebookDocumentsAndEditors extends Disposable implements
|
||||
let cell: ICellModel;
|
||||
if (cellUri) {
|
||||
let uriString = URI.revive(cellUri).toString();
|
||||
cell = find(editor.cells, c => c.cellUri.toString() === uriString);
|
||||
cell = editor.cells.find(c => c.cellUri.toString() === uriString);
|
||||
// If it's markdown what should we do? Show notification??
|
||||
} else {
|
||||
// Use the active cell in this case, or 1st cell if there's none active
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
import { AzureResource } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { IMainContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
|
||||
export class ExtHostAccountManagement extends ExtHostAccountManagementShape {
|
||||
@@ -93,7 +92,7 @@ export class ExtHostAccountManagement extends ExtHostAccountManagementShape {
|
||||
return this.$getAllAccounts().then(() => {
|
||||
for (const handle in this._accounts) {
|
||||
const providerHandle = parseInt(handle);
|
||||
if (firstIndex(this._accounts[handle], (acct) => acct.key.accountId === account.key.accountId) !== -1) {
|
||||
if (this._accounts[handle].findIndex((acct) => acct.key.accountId === account.key.accountId) !== -1) {
|
||||
return this._withProvider(providerHandle, (provider: azdata.AccountProvider) => provider.getSecurityToken(account, resource));
|
||||
}
|
||||
}
|
||||
@@ -106,7 +105,7 @@ export class ExtHostAccountManagement extends ExtHostAccountManagementShape {
|
||||
return this.$getAllAccounts().then(() => {
|
||||
for (const handle in this._accounts) {
|
||||
const providerHandle = parseInt(handle);
|
||||
if (firstIndex(this._accounts[handle], (acct) => acct.key.accountId === account.key.accountId) !== -1) {
|
||||
if (this._accounts[handle].findIndex((acct) => acct.key.accountId === account.key.accountId) !== -1) {
|
||||
return this._withProvider(providerHandle, (provider: azdata.AccountProvider) => provider.getAccountSecurityToken(account, tenant, resource));
|
||||
}
|
||||
}
|
||||
@@ -128,7 +127,7 @@ export class ExtHostAccountManagement extends ExtHostAccountManagementShape {
|
||||
let self = this;
|
||||
|
||||
// Look for any account providers that have the same provider ID
|
||||
let matchingProviderIndex = firstIndex(values(this._providers), (provider: AccountProviderWithMetadata) => {
|
||||
let matchingProviderIndex = values(this._providers).findIndex((provider: AccountProviderWithMetadata) => {
|
||||
return provider.metadata.id === providerMetadata.id;
|
||||
});
|
||||
if (matchingProviderIndex >= 0) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import { SqlMainContext, MainThreadDataProtocolShape, ExtHostDataProtocolShape }
|
||||
import { DataProviderType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { IURITransformer } from 'vs/base/common/uriIpc';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { RunOnceScheduler } from 'vs/base/common/async';
|
||||
import { mapToSerializable } from 'sql/base/common/map';
|
||||
|
||||
@@ -77,7 +76,7 @@ export class ExtHostDataProtocol extends ExtHostDataProtocolShape {
|
||||
if (!providersForType) {
|
||||
return undefined;
|
||||
}
|
||||
return find(providersForType, provider => provider.providerId === providerId) as T;
|
||||
return providersForType.find(provider => provider.providerId === providerId) as T;
|
||||
}
|
||||
|
||||
public getProvidersByType<T extends azdata.DataProvider>(providerType: azdata.DataProviderType): T[] {
|
||||
|
||||
@@ -17,7 +17,6 @@ import * as azdata from 'azdata';
|
||||
import { SqlMainContext, ExtHostModelViewShape, MainThreadModelViewShape, ExtHostModelViewTreeViewsShape } from 'sql/workbench/api/common/sqlExtHost.protocol';
|
||||
import { IItemConfig, ModelComponentTypes, IComponentShape, IComponentEventArgs, ComponentEventType, ColumnSizingMode, ModelViewAction } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
@@ -457,7 +456,7 @@ class FormContainerBuilder extends GenericContainerBuilder<azdata.FormContainer,
|
||||
let result: boolean = false;
|
||||
if (componentGroup && componentGroup.components !== undefined) {
|
||||
let firstComponent = componentGroup.components[0];
|
||||
let index = firstIndex(this._component.itemConfigs, x => x.component.id === firstComponent.component.id);
|
||||
let index = this._component.itemConfigs.findIndex(x => x.component.id === firstComponent.component.id);
|
||||
if (index !== -1) {
|
||||
result = this._component.removeItemAt(index - 1);
|
||||
}
|
||||
@@ -709,7 +708,7 @@ class ComponentWrapper implements azdata.Component {
|
||||
}
|
||||
|
||||
public removeItem(item: azdata.Component): boolean {
|
||||
let index = firstIndex(this.itemConfigs, c => c.component.id === item.id);
|
||||
let index = this.itemConfigs.findIndex(c => c.component.id === item.id);
|
||||
if (index >= 0 && index < this.itemConfigs.length) {
|
||||
return this.removeItemAt(index);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { readonly } from 'vs/base/common/errors';
|
||||
import { MainThreadNotebookDocumentsAndEditorsShape } from 'sql/workbench/api/common/sqlExtHost.protocol';
|
||||
import { ExtHostNotebookDocumentData } from 'sql/workbench/api/common/extHostNotebookDocumentData';
|
||||
import { CellRange, ISingleNotebookEditOperation, ICellRange } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { HideInputTag } from 'sql/platform/notebooks/common/outputRegistry';
|
||||
|
||||
export interface INotebookEditOperation {
|
||||
@@ -96,7 +95,7 @@ export class NotebookEditorEdit {
|
||||
value.metadata = { tags: [HideInputTag] };
|
||||
} else if (!value.metadata.tags) {
|
||||
value.metadata.tags = [HideInputTag];
|
||||
} else if (!find(value.metadata.tags, x => x === HideInputTag)) {
|
||||
} else if (!value.metadata.tags.find(x => x === HideInputTag)) {
|
||||
value.metadata.tags.push(HideInputTag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
SqlMainContext,
|
||||
} from 'sql/workbench/api/common/sqlExtHost.protocol';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
|
||||
export class ExtHostResourceProvider extends ExtHostResourceProviderShape {
|
||||
private _handlePool: number = 0;
|
||||
@@ -38,7 +37,7 @@ export class ExtHostResourceProvider extends ExtHostResourceProviderShape {
|
||||
let self = this;
|
||||
|
||||
// Look for any account providers that have the same provider ID
|
||||
let matchingProviderIndex = firstIndex(values(this._providers), (provider: ResourceProviderWithMetadata) => {
|
||||
let matchingProviderIndex = values(this._providers).findIndex((provider: ResourceProviderWithMetadata) => {
|
||||
return provider.metadata.id === providerMetadata.id;
|
||||
});
|
||||
if (matchingProviderIndex >= 0) {
|
||||
|
||||
@@ -19,7 +19,6 @@ import * as types from 'vs/base/common/types';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { FilterData } from 'sql/workbench/services/profiler/browser/profilerFilter';
|
||||
import { uriPrefixes } from 'sql/platform/connection/common/utils';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
export interface ColumnDefinition extends Slick.Column<Slick.SlickData> {
|
||||
name: string;
|
||||
@@ -208,11 +207,11 @@ export class ProfilerInput extends EditorInput implements IProfilerSession {
|
||||
this._notificationService.error(nls.localize("profiler.sessionCreationError", "Error while starting new session"));
|
||||
} else {
|
||||
this._sessionName = params.sessionName;
|
||||
let sessionTemplate = find(this._profilerService.getSessionTemplates(), (template) => {
|
||||
let sessionTemplate = this._profilerService.getSessionTemplates().find((template) => {
|
||||
return template.name === params.templateName;
|
||||
});
|
||||
if (!types.isUndefinedOrNull(sessionTemplate)) {
|
||||
let newView = find(this._profilerService.getViewTemplates(), (view) => {
|
||||
let newView = this._profilerService.getViewTemplates().find((view) => {
|
||||
return view.name === sessionTemplate!.defaultView;
|
||||
});
|
||||
if (!types.isUndefinedOrNull(newView)) {
|
||||
|
||||
@@ -23,7 +23,6 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { find, firstIndex } from 'vs/base/common/arrays';
|
||||
import { IThemable } from 'vs/base/common/styler';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
@@ -436,7 +435,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
* @param onSelect The callback to call when the button is selected
|
||||
*/
|
||||
protected findFooterButton(label: string): Button | undefined {
|
||||
return find(this._footerButtons, e => {
|
||||
return this._footerButtons.find(e => {
|
||||
try {
|
||||
return e && e.element.innerText === label;
|
||||
} catch {
|
||||
@@ -450,7 +449,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
* @param label Label on the button
|
||||
*/
|
||||
protected removeFooterButton(label: string): void {
|
||||
let buttonIndex = firstIndex(this._footerButtons, e => {
|
||||
let buttonIndex = this._footerButtons.findIndex(e => {
|
||||
return e && e.element && e.element.innerText === label;
|
||||
});
|
||||
if (buttonIndex > -1 && buttonIndex < this._footerButtons.length) {
|
||||
|
||||
@@ -18,7 +18,6 @@ import { URI } from 'vs/base/common/uri';
|
||||
import * as nls from 'vs/nls';
|
||||
import { EventType, addDisposableListener } from 'vs/base/browser/dom';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { IComponentDescriptor, IComponent, IModelStore, IComponentEventArgs, ComponentEventType } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import { convertSize } from 'sql/base/browser/dom';
|
||||
|
||||
@@ -319,7 +318,7 @@ export abstract class ContainerBase<T, TPropertyBag extends azdata.ComponentProp
|
||||
if (!componentDescriptor) {
|
||||
return false;
|
||||
}
|
||||
let index = firstIndex(this.items, item => item.descriptor.id === componentDescriptor.id && item.descriptor.type === componentDescriptor.type);
|
||||
let index = this.items.findIndex(item => item.descriptor.id === componentDescriptor.id && item.descriptor.type === componentDescriptor.type);
|
||||
if (index >= 0) {
|
||||
this.items.splice(index, 1);
|
||||
this._changeRef.detectChanges();
|
||||
|
||||
@@ -13,7 +13,7 @@ import * as azdata from 'azdata';
|
||||
|
||||
import { ContainerBase } from 'sql/workbench/browser/modelComponents/componentBase';
|
||||
import { ISelectData } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||
import { find, equals as arrayEquals } from 'vs/base/common/arrays';
|
||||
import { equals as arrayEquals } from 'vs/base/common/arrays';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import { convertSize } from 'sql/base/browser/dom';
|
||||
@@ -125,7 +125,7 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
|
||||
|
||||
if (column.categoryValues) {
|
||||
if (typeof e === 'string') {
|
||||
let category = find(column.categoryValues, c => c.displayName === e);
|
||||
let category = column.categoryValues.find(c => c.displayName === e);
|
||||
if (category) {
|
||||
this.onCellDataChanged(category.name, rowIdx, colIdx);
|
||||
} else {
|
||||
@@ -184,7 +184,7 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
|
||||
let column: azdata.DeclarativeTableColumn = this.columns[colIdx];
|
||||
let cellData = this.data[rowIdx][colIdx];
|
||||
if (cellData && column.categoryValues) {
|
||||
let category = find(column.categoryValues, v => v.name === cellData.value);
|
||||
let category = column.categoryValues.find(v => v.name === cellData.value);
|
||||
if (category) {
|
||||
return category.displayName;
|
||||
} else if (this.isEditableSelectBox(colIdx)) {
|
||||
|
||||
@@ -19,7 +19,6 @@ import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
@@ -186,7 +185,7 @@ export default class DropDownComponent extends ComponentBase<azdata.DropDownProp
|
||||
private getSelectedValue(): string {
|
||||
if (this.values && this.values.length > 0 && this.valuesHaveDisplayName()) {
|
||||
let selectedValue = <azdata.CategoryValue>this.value || <azdata.CategoryValue>this.values[0];
|
||||
let valueCategory = find(<azdata.CategoryValue[]>this.values, v => v.name === selectedValue.name);
|
||||
let valueCategory = (<azdata.CategoryValue[]>this.values).find(v => v.name === selectedValue.name);
|
||||
return valueCategory && valueCategory.displayName;
|
||||
} else {
|
||||
if (!this.value && this.values && this.values.length > 0) {
|
||||
@@ -198,7 +197,7 @@ export default class DropDownComponent extends ComponentBase<azdata.DropDownProp
|
||||
|
||||
private setSelectedValue(newValue: string): void {
|
||||
if (this.values && this.valuesHaveDisplayName()) {
|
||||
let valueCategory = find((<azdata.CategoryValue[]>this.values), v => v.displayName === newValue);
|
||||
let valueCategory = (<azdata.CategoryValue[]>this.values).find(v => v.displayName === newValue);
|
||||
this.value = valueCategory;
|
||||
} else {
|
||||
this.value = newValue;
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
import { FormLayout, FormItemLayout } from 'azdata';
|
||||
|
||||
import { ContainerBase } from 'sql/workbench/browser/modelComponents/componentBase';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { IComponentDescriptor, IComponent, IModelStore } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import { convertSize } from 'sql/base/browser/dom';
|
||||
|
||||
@@ -186,7 +185,7 @@ export default class FormContainer extends ContainerBase<FormItemLayout> impleme
|
||||
let itemConfig = item.config;
|
||||
if (itemConfig && itemConfig.actions) {
|
||||
let resultItems = itemConfig.actions.map(x => {
|
||||
let actionComponent = find(items, i => i.descriptor.id === x);
|
||||
let actionComponent = items.find(i => i.descriptor.id === x);
|
||||
return <FormItem>actionComponent;
|
||||
});
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import { Deferred } from 'sql/base/common/promise';
|
||||
import { entries } from 'sql/base/common/collections';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { IComponentDescriptor, IModelStore, IComponent } from 'sql/platform/dashboard/browser/interfaces';
|
||||
|
||||
class ComponentDescriptor implements IComponentDescriptor {
|
||||
@@ -65,7 +64,7 @@ export class ModelStore implements IModelStore {
|
||||
}
|
||||
|
||||
validate(component: IComponent): Thenable<boolean> {
|
||||
let componentId = find(entries(this._componentMappings), ([id, mappedComponent]) => component === mappedComponent)[0];
|
||||
let componentId = entries(this._componentMappings).find(([id, mappedComponent]) => component === mappedComponent)[0];
|
||||
return Promise.all(this._validationCallbacks.map(callback => callback(componentId))).then(validations => validations.every(validation => validation === true));
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { ITree, IRenderer } from 'vs/base/parts/tree/browser/tree';
|
||||
import { LIGHT, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { ITreeComponentItem } from 'sql/workbench/common/views';
|
||||
import { TreeViewDataProvider } from './treeViewDataProvider';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ColorScheme } from 'vs/platform/theme/common/theme';
|
||||
|
||||
export enum TreeCheckboxState {
|
||||
Intermediate = 0,
|
||||
@@ -138,7 +139,7 @@ export class TreeComponentRenderer extends Disposable implements IRenderer {
|
||||
* Render a element, given an object bag returned by the template
|
||||
*/
|
||||
public renderElement(tree: ITree, element: ITreeComponentItem, templateId: string, templateData: TreeDataTemplate): void {
|
||||
const icon = this.themeService.getColorTheme().type === LIGHT ? element.icon : element.iconDark;
|
||||
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? element.icon : element.iconDark;
|
||||
const iconUri = icon ? URI.revive(icon) : null;
|
||||
templateData.icon.style.backgroundImage = iconUri ? `url('${iconUri.toString(true)}')` : '';
|
||||
templateData.icon.style.backgroundRepeat = 'no-repeat';
|
||||
|
||||
@@ -20,7 +20,6 @@ import { IDashboardService } from 'sql/platform/dashboard/browser/dashboardServi
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IColorTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { attachButtonStyler } from 'sql/platform/theme/common/styler';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { RowDetailView, ExtendedItem } from 'sql/base/browser/ui/table/plugins/rowDetailView';
|
||||
import {
|
||||
IAssessmentComponent,
|
||||
@@ -478,13 +477,13 @@ export class AsmtResultsViewComponent extends TabChild implements IAssessmentCom
|
||||
let filterValues = col.filterValues;
|
||||
if (filterValues && filterValues.length > 0) {
|
||||
if (item._parent) {
|
||||
value = value && find(filterValues, x => x === item._parent[col.field]);
|
||||
value = value && filterValues.find(x => x === item._parent[col.field]);
|
||||
} else {
|
||||
let colValue = item[col.field];
|
||||
if (colValue instanceof Array) {
|
||||
value = value && find(filterValues, x => colValue.indexOf(x) >= 0);
|
||||
value = value && filterValues.find(x => colValue.indexOf(x) >= 0);
|
||||
} else {
|
||||
value = value && find(filterValues, x => x === colValue);
|
||||
value = value && filterValues.find(x => x === colValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectio
|
||||
import { equalsIgnoreCase } from 'vs/base/common/strings';
|
||||
import { IConnectionManagementService, IConnectionCompletionOptions, ConnectionType, RunQueryOnConnectionMode } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { ParsedArgs } from 'vs/platform/environment/node/argv';
|
||||
import * as Constants from 'sql/platform/connection/common/constants';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
@@ -28,9 +27,8 @@ import { openNewQuery } from 'sql/workbench/contrib/query/browser/queryActions';
|
||||
import { IURLService, IURLHandler } from 'vs/platform/url/common/url';
|
||||
import { getErrorMessage } from 'vs/base/common/errors';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
|
||||
export interface SqlArgs {
|
||||
_?: string[];
|
||||
@@ -79,7 +77,7 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
|
||||
@IDialogService private readonly dialogService: IDialogService
|
||||
) {
|
||||
if (ipc) {
|
||||
ipc.on('ads:processCommandLine', (event: any, args: ParsedArgs) => this.onLaunched(args));
|
||||
ipc.on('ads:processCommandLine', (event: any, args: NativeParsedArgs) => this.onLaunched(args));
|
||||
}
|
||||
// we only get the ipc from main during window reuse
|
||||
if (environmentService) {
|
||||
@@ -90,7 +88,7 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
|
||||
}
|
||||
}
|
||||
|
||||
private onLaunched(args: ParsedArgs) {
|
||||
private onLaunched(args: NativeParsedArgs) {
|
||||
let sqlProvider = this._capabilitiesService.getCapabilities(Constants.mssqlProviderName);
|
||||
// We can't connect to object explorer until the MSSQL connection provider is registered
|
||||
if (sqlProvider) {
|
||||
@@ -310,7 +308,7 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
|
||||
if (groups && groups.length > 0) {
|
||||
let rootGroup = groups[0];
|
||||
let connections = ConnectionProfileGroup.getConnectionsInGroup(rootGroup);
|
||||
match = find(connections, (c) => this.matchProfile(profile, c));
|
||||
match = connections.find((c) => this.matchProfile(profile, c));
|
||||
}
|
||||
return match ? match : profile;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
|
||||
import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
|
||||
import { CommandLineWorkbenchContribution, SqlArgs } from 'sql/workbench/contrib/commandLine/electron-browser/commandLine';
|
||||
import * as Constants from 'sql/platform/connection/common/constants';
|
||||
import { ParsedArgs } from 'vs/platform/environment/node/argv';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -34,8 +33,9 @@ import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/common/fileQueryEditorInput';
|
||||
import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService';
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
|
||||
class TestParsedArgs implements ParsedArgs, SqlArgs {
|
||||
class TestParsedArgs implements NativeParsedArgs, SqlArgs {
|
||||
[arg: string]: any;
|
||||
_: string[];
|
||||
database?: string;
|
||||
|
||||
@@ -13,7 +13,6 @@ import { WIDGETS_CONTAINER, validateWidgetContainerContribution } from 'sql/work
|
||||
import { GRID_CONTAINER, validateGridContainerContribution } from 'sql/workbench/contrib/dashboard/browser/containers/dashboardGridContainer.contribution';
|
||||
import { WEBVIEW_CONTAINER } from 'sql/workbench/contrib/dashboard/browser/containers/dashboardWebviewContainer.contribution';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { NavSectionConfig } from 'sql/workbench/contrib/dashboard/browser/core/dashboardWidget';
|
||||
|
||||
const containerTypes = [
|
||||
@@ -78,7 +77,7 @@ ExtensionsRegistry.registerExtensionPoint<IDashboardContainerContrib | IDashboar
|
||||
const containerkey = Object.keys(container)[0];
|
||||
const containerValue = values(container)[0];
|
||||
|
||||
const containerTypeFound = find(containerTypes, c => c === containerkey);
|
||||
const containerTypeFound = containerTypes.find(c => c === containerkey);
|
||||
if (!containerTypeFound) {
|
||||
extension.collector.error(localize('dashboardTab.contribution.unKnownContainerType', "Unknown container type defines in dashboard container for extension."));
|
||||
return;
|
||||
|
||||
@@ -9,7 +9,6 @@ import * as nls from 'vs/nls';
|
||||
|
||||
import { generateDashboardGridLayoutSchema } from 'sql/workbench/contrib/dashboard/browser/pages/dashboardPageContribution';
|
||||
import { registerContainerType, registerNavSectionContainerType } from 'sql/platform/dashboard/common/dashboardContainerRegistry';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
export const GRID_CONTAINER = 'grid-container';
|
||||
|
||||
@@ -26,7 +25,7 @@ export function validateGridContainerContribution(extension: IExtensionPointUser
|
||||
let result = true;
|
||||
gridConfigs.forEach(widgetConfig => {
|
||||
const allKeys = Object.keys(widgetConfig);
|
||||
const widgetOrWebviewKey = find(allKeys, key => key === 'widget' || key === 'webview');
|
||||
const widgetOrWebviewKey = allKeys.find(key => key === 'widget' || key === 'webview');
|
||||
if (!widgetOrWebviewKey) {
|
||||
result = false;
|
||||
extension.collector.error(nls.localize('gridContainer.invalidInputs', "widgets or webviews are expected inside widgets-container for extension."));
|
||||
|
||||
@@ -19,7 +19,6 @@ import * as dashboardHelper from 'sql/workbench/contrib/dashboard/browser/core/d
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
|
||||
@Component({
|
||||
@@ -129,7 +128,7 @@ export class DashboardNavSection extends DashboardTab implements OnDestroy, OnCh
|
||||
}
|
||||
|
||||
private addNewTab(tab: TabConfig): void {
|
||||
const existedTab = find(this.tabs, i => i.id === tab.id);
|
||||
const existedTab = this.tabs.find(i => i.id === tab.id);
|
||||
if (!existedTab) {
|
||||
this.tabs.push(tab);
|
||||
this._cd.detectChanges();
|
||||
|
||||
@@ -9,7 +9,6 @@ import * as nls from 'vs/nls';
|
||||
|
||||
import { generateDashboardWidgetSchema } from 'sql/workbench/contrib/dashboard/browser/pages/dashboardPageContribution';
|
||||
import { registerContainerType, registerNavSectionContainerType } from 'sql/platform/dashboard/common/dashboardContainerRegistry';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
export const WIDGETS_CONTAINER = 'widgets-container';
|
||||
|
||||
@@ -26,7 +25,7 @@ export function validateWidgetContainerContribution(extension: IExtensionPointUs
|
||||
let result = true;
|
||||
WidgetConfigs.forEach(widgetConfig => {
|
||||
const allKeys = Object.keys(widgetConfig);
|
||||
const widgetKey = find(allKeys, key => key === 'widget');
|
||||
const widgetKey = allKeys.find(key => key === 'widget');
|
||||
if (!widgetKey) {
|
||||
result = false;
|
||||
extension.collector.error(nls.localize('widgetContainer.invalidInputs', "The list of widgets is expected inside widgets-container for extension."));
|
||||
|
||||
@@ -21,7 +21,6 @@ import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { ScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
|
||||
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
|
||||
import { getContentHeight, addDisposableListener, EventType } from 'vs/base/browser/dom';
|
||||
import { find, firstIndex } from 'vs/base/common/arrays';
|
||||
|
||||
/**
|
||||
* Sorting function for dashboard widgets
|
||||
@@ -209,10 +208,10 @@ export class WidgetContent extends AngularDisposable implements AfterViewInit {
|
||||
this._grid.enableResize();
|
||||
this._grid.enableDrag();
|
||||
this._editDispose.push(this.dashboardService.onDeleteWidget(e => {
|
||||
let index = firstIndex(this.widgets, i => i.id === e);
|
||||
let index = this.widgets.findIndex(i => i.id === e);
|
||||
this.widgets.splice(index, 1);
|
||||
|
||||
index = firstIndex(this.originalConfig, i => i.id === e);
|
||||
index = this.originalConfig.findIndex(i => i.id === e);
|
||||
this.originalConfig.splice(index, 1);
|
||||
|
||||
this._rewriteConfig();
|
||||
@@ -221,7 +220,7 @@ export class WidgetContent extends AngularDisposable implements AfterViewInit {
|
||||
this._editDispose.push(subscriptionToDisposable(this._grid.onResizeStop.subscribe((e: NgGridItem) => {
|
||||
this._onResize.fire();
|
||||
const event = e.getEventOutput();
|
||||
const config = find(this.originalConfig, i => i.id === event.payload.id);
|
||||
const config = this.originalConfig.find(i => i.id === event.payload.id);
|
||||
|
||||
if (!config.gridItemConfig) {
|
||||
config.gridItemConfig = {};
|
||||
@@ -239,7 +238,7 @@ export class WidgetContent extends AngularDisposable implements AfterViewInit {
|
||||
this._onResize.fire();
|
||||
const event = e.getEventOutput();
|
||||
this._items.forEach(i => {
|
||||
const config = find(this.originalConfig, j => j.id === i.getEventOutput().payload.id);
|
||||
const config = this.originalConfig.find(j => j.id === i.getEventOutput().payload.id);
|
||||
if ((config.gridItemConfig && config.gridItemConfig.col) || config.id === event.payload.id) {
|
||||
if (!config.gridItemConfig) {
|
||||
config.gridItemConfig = {};
|
||||
|
||||
@@ -11,7 +11,6 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { IAngularEventingService, AngularEventType, IAngularEvent } from 'sql/platform/angularEventing/browser/angularEventingService';
|
||||
import { INewDashboardTabDialogService } from 'sql/workbench/services/dashboard/browser/newDashboardTabDialog';
|
||||
import { IDashboardTab } from 'sql/workbench/services/dashboard/browser/common/interfaces';
|
||||
import { find, firstIndex } from 'vs/base/common/arrays';
|
||||
import { CellContext } from 'sql/workbench/contrib/notebook/browser/cellViews/codeActions';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
@@ -202,14 +201,14 @@ export class AddFeatureTabAction extends Action {
|
||||
case AngularEventType.NEW_TABS:
|
||||
const openedTabs = <IDashboardTab[]>event.payload.dashboardTabs;
|
||||
openedTabs.forEach(tab => {
|
||||
const existedTab = find(this._openedTabs, i => i === tab);
|
||||
const existedTab = this._openedTabs.find(i => i === tab);
|
||||
if (!existedTab) {
|
||||
this._openedTabs.push(tab);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case AngularEventType.CLOSE_TAB:
|
||||
const index = firstIndex(this._openedTabs, i => i.id === event.payload.id);
|
||||
const index = this._openedTabs.findIndex(i => i.id === event.payload.id);
|
||||
this._openedTabs.splice(index, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import { IDashboardContainerRegistry, Extensions as DashboardContainerExtensions
|
||||
import { SingleConnectionManagementService } from 'sql/workbench/services/bootstrap/browser/commonServiceInterface.service';
|
||||
import * as Constants from 'sql/platform/connection/common/constants';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
const dashboardcontainerRegistry = Registry.as<IDashboardContainerRegistry>(DashboardContainerExtensions.dashboardContainerContributions);
|
||||
const containerTypes = [
|
||||
@@ -163,7 +162,7 @@ function hasCompatibleProvider(provider: string | string[], contextKeyService: I
|
||||
const connectionProvider = contextKeyService.getContextKeyValue<string>(Constants.connectionProviderContextKey);
|
||||
if (connectionProvider) {
|
||||
const providers = (provider instanceof Array) ? provider : [provider];
|
||||
const matchingProvider = find(providers, (p) => p === connectionProvider || p === Constants.anyProviderName);
|
||||
const matchingProvider = providers.find((p) => p === connectionProvider || p === Constants.anyProviderName);
|
||||
isCompatible = (matchingProvider !== undefined);
|
||||
} // Else there's no connection context so skip the check
|
||||
return isCompatible;
|
||||
@@ -175,7 +174,7 @@ function hasCompatibleProvider(provider: string | string[], contextKeyService: I
|
||||
*/
|
||||
export function getDashboardContainer(container: object, logService: ILogService): { result: boolean, message: string, container: { [key: string]: any } } {
|
||||
const key = Object.keys(container)[0];
|
||||
const containerTypeFound = find(containerTypes, c => (c === key));
|
||||
const containerTypeFound = containerTypes.find(c => (c === key));
|
||||
if (!containerTypeFound) {
|
||||
const dashboardContainer = dashboardcontainerRegistry.getRegisteredContainer(key);
|
||||
if (!dashboardContainer) {
|
||||
|
||||
@@ -36,7 +36,6 @@ import Severity from 'vs/base/common/severity';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IContextKeyService, ContextKeyExpr, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { firstIndex, find } from 'vs/base/common/arrays';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { RefreshWidgetAction, ToolbarAction } from 'sql/workbench/contrib/dashboard/browser/core/actions';
|
||||
import { Taskbar, ITaskbarContent } from 'sql/base/browser/ui/taskbar/taskbar';
|
||||
@@ -187,7 +186,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
primary.forEach(a => {
|
||||
if (a instanceof MenuItemAction) {
|
||||
// Need to ensure that we don't add the same action multiple times
|
||||
let foundIndex = firstIndex(tasks, act => act.action && act.action.id === a.id);
|
||||
let foundIndex = tasks.findIndex(act => act.action && act.action.id === a.id);
|
||||
if (foundIndex < 0) {
|
||||
tasks.push({ action: a });
|
||||
}
|
||||
@@ -318,7 +317,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
this._cd.detectChanges();
|
||||
|
||||
this._tabsDispose.push(this.dashboardService.onPinUnpinTab(e => {
|
||||
const tabConfig = find(this._tabSettingConfigs, i => i.tabId === e.tabId);
|
||||
const tabConfig = this._tabSettingConfigs.find(i => i.tabId === e.tabId);
|
||||
if (tabConfig) {
|
||||
tabConfig.isPinned = e.isPinned;
|
||||
} else {
|
||||
@@ -395,7 +394,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
iconClass: 'home-tab-icon'
|
||||
};
|
||||
|
||||
const homeTabIndex = firstIndex(allTabs, (tab) => tab.isHomeTab === true);
|
||||
const homeTabIndex = allTabs.findIndex(tab => tab.isHomeTab === true);
|
||||
if (homeTabIndex !== undefined && homeTabIndex > -1) {
|
||||
// Have a tab: get its information and copy over to the home tab definition
|
||||
const homeTab = allTabs.splice(homeTabIndex, 1)[0];
|
||||
@@ -491,7 +490,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
}
|
||||
|
||||
private addNewTab(tab: TabConfig): void {
|
||||
const existedTab = find(this.tabs, i => i.id === tab.id);
|
||||
const existedTab = this.tabs.find(i => i.id === tab.id);
|
||||
if (!existedTab) {
|
||||
if (!tab.iconClass && tab.type !== 'group-header') {
|
||||
tab.iconClass = 'default-tab-icon';
|
||||
@@ -553,7 +552,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
}
|
||||
|
||||
public handleTabClose(tab: TabComponent): void {
|
||||
const index = firstIndex(this.tabs, i => i.id === tab.identifier);
|
||||
const index = this.tabs.findIndex(i => i.id === tab.identifier);
|
||||
this.tabs.splice(index, 1);
|
||||
this.angularEventingService.sendAngularEvent(this.dashboardService.getUnderlyingUri(), AngularEventType.CLOSE_TAB, { id: tab.identifier });
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/e
|
||||
import { DATABASE_DASHBOARD_TABS } from 'sql/workbench/contrib/dashboard/browser/pages/databaseDashboardPage.contribution';
|
||||
import { SERVER_DASHBOARD_TABS } from 'sql/workbench/contrib/dashboard/browser/pages/serverDashboardPage.contribution';
|
||||
import { DASHBOARD_CONFIG_ID, DASHBOARD_TABS_KEY_PROPERTY } from 'sql/workbench/contrib/dashboard/browser/pages/dashboardPageContribution';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { IDashboardTab, IDashboardTabGroup } from 'sql/workbench/services/dashboard/browser/common/interfaces';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
@@ -169,7 +168,7 @@ class DashboardRegistry implements IDashboardRegistry {
|
||||
|
||||
public registerTab(tab: IDashboardTab): void {
|
||||
this._tabs.push(tab);
|
||||
let dashboardConfig = find(this._configurationRegistry.getConfigurations(), c => c.id === DASHBOARD_CONFIG_ID);
|
||||
let dashboardConfig = this._configurationRegistry.getConfigurations().find(c => c.id === DASHBOARD_CONFIG_ID);
|
||||
|
||||
if (dashboardConfig) {
|
||||
let dashboardDatabaseTabProperty = (<IJSONSchema>dashboardConfig.properties[DATABASE_DASHBOARD_TABS].items).properties[DASHBOARD_TABS_KEY_PROPERTY];
|
||||
|
||||
@@ -16,7 +16,6 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
const $ = dom.$;
|
||||
|
||||
/**
|
||||
@@ -196,7 +195,7 @@ export class ChangeMaxRowsActionItem extends Disposable implements IActionViewIt
|
||||
}
|
||||
|
||||
public set setCurrentOptionIndex(selection: number) {
|
||||
this._currentOptionsIndex = firstIndex(this._options, x => x === selection.toString());
|
||||
this._currentOptionsIndex = this._options.findIndex(x => x === selection.toString());
|
||||
this._refreshOptions();
|
||||
}
|
||||
|
||||
@@ -214,7 +213,7 @@ export class ChangeMaxRowsActionItem extends Disposable implements IActionViewIt
|
||||
|
||||
private _registerListeners(): void {
|
||||
this._register(this.selectBox.onDidSelect(selection => {
|
||||
this._currentOptionsIndex = firstIndex(this._options, x => x === selection.selected);
|
||||
this._currentOptionsIndex = this._options.findIndex(x => x === selection.selected);
|
||||
this._editor.editDataInput.onRowDropDownSet(Number(selection.selected));
|
||||
}));
|
||||
this._register(attachSelectBoxStyler(this.selectBox, this._themeService));
|
||||
|
||||
@@ -33,7 +33,6 @@ import { IDashboardService } from 'sql/platform/dashboard/browser/dashboardServi
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
export const DASHBOARD_SELECTOR: string = 'jobhistory-component';
|
||||
|
||||
@@ -199,10 +198,10 @@ export class JobHistoryComponent extends JobManagementView implements OnInit {
|
||||
const self = this;
|
||||
let cachedHistory = self._jobCacheObject.getJobHistory(element.jobID);
|
||||
if (cachedHistory) {
|
||||
self.agentJobHistoryInfo = find(cachedHistory,
|
||||
self.agentJobHistoryInfo = cachedHistory.find(
|
||||
history => self.formatTime(history.runDate) === self.formatTime(element.runDate));
|
||||
} else {
|
||||
self.agentJobHistoryInfo = find(self._treeController.jobHistories,
|
||||
self.agentJobHistoryInfo = self._treeController.jobHistories.find(
|
||||
history => self.formatTime(history.runDate) === self.formatTime(element.runDate));
|
||||
}
|
||||
if (self.agentJobHistoryInfo) {
|
||||
|
||||
@@ -32,7 +32,6 @@ import { tableBackground, cellBackground, cellBorderColor } from 'sql/platform/t
|
||||
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 } from 'vs/base/common/arrays';
|
||||
import { IColorTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
@@ -311,7 +310,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
||||
this._table.grid.removeCellCssStyles('error-row' + i.toString());
|
||||
let item = this.dataView.getItemByIdx(i);
|
||||
// current filter
|
||||
if (find(filterValues, x => x === item[args.column.field])) {
|
||||
if (filterValues.find(x => x === item[args.column.field])) {
|
||||
// check all previous filters
|
||||
if (this.checkPreviousFilters(item)) {
|
||||
if (item.lastRunOutcome === 'Failed') {
|
||||
@@ -563,7 +562,9 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
||||
private checkPreviousFilters(item): boolean {
|
||||
for (let column in this.filterValueMap) {
|
||||
if (column !== 'start' && this.filterValueMap[column][0].length > 0) {
|
||||
if (!find(this.filterValueMap[column][0], x => x === item[JobManagementUtilities.convertColNameToField(column)])) {
|
||||
let temp = this.filterValueMap[column][0] as unknown;
|
||||
let arr = temp as [];
|
||||
if (!arr.find(x => x === item[JobManagementUtilities.convertColNameToField(column)])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -705,9 +706,9 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
||||
let filterValues = col.filterValues;
|
||||
if (filterValues && filterValues.length > 0) {
|
||||
if (item._parent) {
|
||||
value = value && find(filterValues, x => x === item._parent[col.field]);
|
||||
value = value && filterValues.find(x => x === item._parent[col.field]);
|
||||
} else {
|
||||
value = value && find(filterValues, x => x === item[col.field]);
|
||||
value = value && filterValues.find(x => x === item[col.field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ 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 { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IColorTheme } from 'vs/platform/theme/common/themeService';
|
||||
|
||||
@@ -319,7 +318,7 @@ export class NotebooksViewComponent extends JobManagementView implements OnInit,
|
||||
this._table.grid.removeCellCssStyles('notebook-error-row' + i.toString());
|
||||
let item = this.dataView.getItemByIdx(i);
|
||||
// current filter
|
||||
if (!!find(filterValues, x => x === item[args.column.field])) {
|
||||
if (!!filterValues.find(x => x === item[args.column.field])) {
|
||||
// check all previous filters
|
||||
if (this.checkPreviousFilters(item)) {
|
||||
if (item.lastRunOutcome === 'Failed') {
|
||||
@@ -612,7 +611,9 @@ export class NotebooksViewComponent extends JobManagementView implements OnInit,
|
||||
private checkPreviousFilters(item): boolean {
|
||||
for (let column in this.filterValueMap) {
|
||||
if (column !== 'start' && this.filterValueMap[column][0].length > 0) {
|
||||
if (!find(this.filterValueMap[column][0], x => x === item[JobManagementUtilities.convertColNameToField(column)])) {
|
||||
let temp = this.filterValueMap[column][0] as unknown;
|
||||
let arr = temp as [];
|
||||
if (!arr.find(x => x === item[JobManagementUtilities.convertColNameToField(column)])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -771,9 +772,9 @@ export class NotebooksViewComponent extends JobManagementView implements OnInit,
|
||||
let filterValues = col.filterValues;
|
||||
if (filterValues && filterValues.length > 0) {
|
||||
if (item._parent) {
|
||||
value = value && find(filterValues, x => x === item._parent[col.field]);
|
||||
value = value && filterValues.find(x => x === item._parent[col.field]);
|
||||
} else {
|
||||
value = value && find(filterValues, x => x === item[col.field]);
|
||||
value = value && filterValues.find(x => x === item[col.field]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import { CellActionBase, CellContext } from 'sql/workbench/contrib/notebook/brow
|
||||
import { CellModel } from 'sql/workbench/services/notebook/browser/models/cell';
|
||||
import { CellTypes, CellType } from 'sql/workbench/services/notebook/common/contracts';
|
||||
import { ToggleableAction } from 'sql/workbench/contrib/notebook/browser/notebookActions';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { getErrorMessage } from 'vs/base/common/errors';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
@@ -218,7 +217,7 @@ export class AddCellFromContextAction extends CellActionBase {
|
||||
doRun(context: CellContext): Promise<void> {
|
||||
try {
|
||||
let model = context.model;
|
||||
let index = firstIndex(model.cells, (cell) => cell.id === context.cell.id);
|
||||
let index = model.cells.findIndex((cell) => cell.id === context.cell.id);
|
||||
if (index !== undefined && this.isAfter) {
|
||||
index += 1;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
import { ICellMagicMapper } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
import { ILanguageMagic } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
const defaultKernel = '*';
|
||||
export class CellMagicMapper implements ICellMagicMapper {
|
||||
@@ -40,7 +39,7 @@ export class CellMagicMapper implements ICellMagicMapper {
|
||||
searchText = searchText.toLowerCase();
|
||||
let kernelMagics = this.kernelToMagicMap.get(kernelId) || [];
|
||||
if (kernelMagics) {
|
||||
return find(kernelMagics, m => m.magic.toLowerCase() === searchText);
|
||||
return kernelMagics.find(m => m.magic.toLowerCase() === searchText);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ import { Button } from 'sql/base/browser/ui/button/button';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { IBootstrapParams } from 'sql/workbench/services/bootstrap/common/bootstrapParams';
|
||||
import { getErrorMessage, onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { find, firstIndex } from 'vs/base/common/arrays';
|
||||
import { CodeCellComponent } from 'sql/workbench/contrib/notebook/browser/cellViews/codeCell.component';
|
||||
import { TextCellComponent } from 'sql/workbench/contrib/notebook/browser/cellViews/textCell.component';
|
||||
import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/notebookInput';
|
||||
@@ -364,7 +363,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
|
||||
if (DEFAULT_NOTEBOOK_PROVIDER === providerInfo.providerId) {
|
||||
let providers = notebookUtils.getProvidersForFileName(this._notebookParams.notebookUri.fsPath, this.notebookService);
|
||||
let tsqlProvider = find(providers, provider => provider === SQL_NOTEBOOK_PROVIDER);
|
||||
let tsqlProvider = providers.find(provider => provider === SQL_NOTEBOOK_PROVIDER);
|
||||
providerInfo.providerId = tsqlProvider ? SQL_NOTEBOOK_PROVIDER : providers[0];
|
||||
}
|
||||
}
|
||||
@@ -411,7 +410,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
}
|
||||
|
||||
findCellIndex(cellModel: ICellModel): number {
|
||||
return firstIndex(this._model.cells, (cell) => cell.id === cellModel.id);
|
||||
return this._model.cells.findIndex((cell) => cell.id === cellModel.id);
|
||||
}
|
||||
|
||||
private setViewInErrorState(error: any): any {
|
||||
@@ -607,7 +606,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
private addPrimaryContributedActions(primary: IAction[]) {
|
||||
for (let action of primary) {
|
||||
// Need to ensure that we don't add the same action multiple times
|
||||
let foundIndex = firstIndex(this._providerRelatedActions, act => act.id === action.id);
|
||||
let foundIndex = this._providerRelatedActions.findIndex(act => act.id === action.id);
|
||||
if (foundIndex < 0) {
|
||||
this._actionBar.addAction(action);
|
||||
this._providerRelatedActions.push(action);
|
||||
@@ -658,7 +657,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
public async runCell(cell: ICellModel): Promise<boolean> {
|
||||
await this.modelReady;
|
||||
let uriString = cell.cellUri.toString();
|
||||
if (firstIndex(this._model.cells, c => c.cellUri.toString() === uriString) > -1) {
|
||||
if (this._model.cells.findIndex(c => c.cellUri.toString() === uriString) > -1) {
|
||||
this.selectCell(cell);
|
||||
return cell.runCell(this.notificationService, this.connectionManagementService);
|
||||
} else {
|
||||
@@ -674,10 +673,10 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
let startIndex = 0;
|
||||
let endIndex = codeCells.length;
|
||||
if (!isUndefinedOrNull(startCell)) {
|
||||
startIndex = firstIndex(codeCells, c => c.id === startCell.id);
|
||||
startIndex = codeCells.findIndex(c => c.id === startCell.id);
|
||||
}
|
||||
if (!isUndefinedOrNull(endCell)) {
|
||||
endIndex = firstIndex(codeCells, c => c.id === endCell.id);
|
||||
endIndex = codeCells.findIndex(c => c.id === endCell.id);
|
||||
}
|
||||
for (let i = startIndex; i < endIndex; i++) {
|
||||
let cellStatus = await this.runCell(codeCells[i]);
|
||||
@@ -693,7 +692,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
try {
|
||||
await this.modelReady;
|
||||
let uriString = cell.cellUri.toString();
|
||||
if (firstIndex(this._model.cells, c => c.cellUri.toString() === uriString) > -1) {
|
||||
if (this._model.cells.findIndex(c => c.cellUri.toString() === uriString) > -1) {
|
||||
this.selectCell(cell);
|
||||
// Clear outputs of the requested cell if cell type is code cell.
|
||||
// If cell is markdown cell, clearOutputs() is a no-op
|
||||
@@ -767,7 +766,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
let elBody: HTMLElement = document.body;
|
||||
let tabBar = elBody.querySelector('.title.tabs') as HTMLElement;
|
||||
let actionBar = elBody.querySelector('.editor-toolbar.actionbar-container') as HTMLElement;
|
||||
let section = find(this.getSectionElements(), s => s.relativeUri && s.relativeUri.toLowerCase() === id);
|
||||
let section = this.getSectionElements().find(s => s.relativeUri && s.relativeUri.toLowerCase() === id);
|
||||
if (section) {
|
||||
// Scroll this section to the top of the header instead of just bringing header into view.
|
||||
if (tabBar && actionBar) {
|
||||
|
||||
@@ -24,7 +24,6 @@ import { IFindNotebookController } from 'sql/workbench/contrib/notebook/browser/
|
||||
import { INotebookModel } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
|
||||
import { TreeUpdateUtils } from 'sql/workbench/services/objectExplorer/browser/treeUpdateUtils';
|
||||
import { find, firstIndex } from 'vs/base/common/arrays';
|
||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { CellContext } from 'sql/workbench/contrib/notebook/browser/cellViews/codeActions';
|
||||
@@ -323,10 +322,10 @@ export class KernelsDropdown extends SelectBox {
|
||||
if (kernels) {
|
||||
let index;
|
||||
if (standardKernel) {
|
||||
index = firstIndex(kernels, kernel => kernel === standardKernel.displayName);
|
||||
index = kernels.findIndex(kernel => kernel === standardKernel.displayName);
|
||||
} else {
|
||||
let kernelSpec = this.model.specs.kernels.find(k => k.name === kernel.name);
|
||||
index = firstIndex(kernels, k => k === kernelSpec?.display_name);
|
||||
index = kernels.findIndex(k => k === kernelSpec?.display_name);
|
||||
}
|
||||
if (nbKernelAlias) {
|
||||
index = kernels.indexOf(nbKernelAlias);
|
||||
@@ -407,7 +406,7 @@ export class AttachToDropdown extends SelectBox {
|
||||
let kernelDisplayName: string;
|
||||
if (this.model.clientSession && this.model.clientSession.kernel && this.model.clientSession.kernel.name) {
|
||||
let currentKernelName = this.model.clientSession.kernel.name.toLowerCase();
|
||||
let currentKernelSpec = find(this.model.specs.kernels, kernel => kernel.name && kernel.name.toLowerCase() === currentKernelName);
|
||||
let currentKernelSpec = this.model.specs.kernels.find(kernel => kernel.name && kernel.name.toLowerCase() === currentKernelName);
|
||||
if (currentKernelSpec) {
|
||||
//KernelDisplayName should be Kusto when connecting to Kusto connection
|
||||
if ((this.model.context?.serverCapabilities.notebookKernelAlias && this.model.currentKernelAlias === this.model.context?.serverCapabilities.notebookKernelAlias) || (this.model.kernelAliases.includes(this.model.selectedKernelDisplayName) && this.model.selectedKernelDisplayName)) {
|
||||
@@ -427,7 +426,7 @@ export class AttachToDropdown extends SelectBox {
|
||||
this.setOptions([msgLocalHost]);
|
||||
} else {
|
||||
let connections: string[] = model.context && model.context.title && (connProviderIds.includes(this.model.context.providerName)) ? [model.context.title] : [msgSelectConnection];
|
||||
if (!find(connections, x => x === msgChangeConnection)) {
|
||||
if (!connections.find(x => x === msgChangeConnection)) {
|
||||
connections.push(msgChangeConnection);
|
||||
}
|
||||
this.setOptions(connections, 0);
|
||||
@@ -497,7 +496,7 @@ export class AttachToDropdown extends SelectBox {
|
||||
//To ignore n/a after we have at least one valid connection
|
||||
attachToConnections = attachToConnections.filter(val => val !== msgSelectConnection);
|
||||
|
||||
let index = firstIndex(attachToConnections, connection => connection === connectedServer);
|
||||
let index = attachToConnections.findIndex(connection => connection === connectedServer);
|
||||
this.setOptions([]);
|
||||
this.setOptions(attachToConnections);
|
||||
if (!index || index < 0 || index >= attachToConnections.length) {
|
||||
|
||||
@@ -33,7 +33,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
|
||||
import { CommonFindController, FindStartFocusAction } from 'vs/editor/contrib/find/findController';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { attachSelectBoxStyler } from 'vs/platform/theme/common/styler';
|
||||
import { DARK, HIGH_CONTRAST } from 'vs/platform/theme/common/themeService';
|
||||
import { ColorScheme } from 'vs/platform/theme/common/theme';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IView, SplitView, Sizing } from 'vs/base/browser/ui/splitview/splitview';
|
||||
@@ -50,7 +50,6 @@ import { IClipboardService } from 'sql/platform/clipboard/common/clipboardServic
|
||||
import { CellSelectionModel } from 'sql/base/browser/ui/table/plugins/cellSelectionModel.plugin';
|
||||
import { handleCopyRequest } from 'sql/workbench/contrib/profiler/browser/profilerCopyHandler';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { attachTabbedPanelStyler } from 'sql/workbench/common/styler';
|
||||
import { UntitledTextEditorModel } from 'vs/workbench/services/untitled/common/untitledTextEditorModel';
|
||||
@@ -239,7 +238,7 @@ export class ProfilerEditor extends EditorPane {
|
||||
this._viewTemplateSelector.setAriaLabel(nls.localize('profiler.viewSelectAccessibleName', "Select View"));
|
||||
this._register(this._viewTemplateSelector.onDidSelect(e => {
|
||||
if (this.input) {
|
||||
this.input.setViewTemplate(find(this._viewTemplates, i => i.name === e.selected));
|
||||
this.input.setViewTemplate(this._viewTemplates.find(i => i.name === e.selected));
|
||||
}
|
||||
}));
|
||||
let viewTemplateContainer = document.createElement('div');
|
||||
@@ -301,16 +300,16 @@ export class ProfilerEditor extends EditorPane {
|
||||
profilerTableContainer.style.overflow = 'hidden';
|
||||
profilerTableContainer.style.position = 'relative';
|
||||
let theme = this.themeService.getColorTheme();
|
||||
if (theme.type === DARK) {
|
||||
if (theme.type === ColorScheme.DARK) {
|
||||
DOM.addClass(profilerTableContainer, VS_DARK_THEME);
|
||||
} else if (theme.type === HIGH_CONTRAST) {
|
||||
} else if (theme.type === ColorScheme.HIGH_CONTRAST) {
|
||||
DOM.addClass(profilerTableContainer, VS_HC_THEME);
|
||||
}
|
||||
this.themeService.onDidColorThemeChange(e => {
|
||||
DOM.removeClasses(profilerTableContainer, VS_DARK_THEME, VS_HC_THEME);
|
||||
if (e.type === DARK) {
|
||||
if (e.type === ColorScheme.DARK) {
|
||||
DOM.addClass(profilerTableContainer, VS_DARK_THEME);
|
||||
} else if (e.type === HIGH_CONTRAST) {
|
||||
} else if (e.type === ColorScheme.HIGH_CONTRAST) {
|
||||
DOM.addClass(profilerTableContainer, VS_HC_THEME);
|
||||
}
|
||||
});
|
||||
@@ -466,7 +465,7 @@ export class ProfilerEditor extends EditorPane {
|
||||
if (input.viewTemplate) {
|
||||
this._viewTemplateSelector.selectWithOptionName(input.viewTemplate.name);
|
||||
} else {
|
||||
input.setViewTemplate(find(this._viewTemplates, i => i.name === 'Standard View'));
|
||||
input.setViewTemplate(this._viewTemplates.find(i => i.name === 'Standard View'));
|
||||
}
|
||||
|
||||
this._actionBar.context = input;
|
||||
|
||||
@@ -29,7 +29,7 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { Disposable, dispose, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { range, find } from 'vs/base/common/arrays';
|
||||
import { range } from 'vs/base/common/arrays';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { ActionBar, ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { isInDOM, Dimension } from 'vs/base/browser/dom';
|
||||
@@ -182,7 +182,7 @@ export class GridPanel extends Disposable {
|
||||
|
||||
if (this.configurationService.getValue<IQueryEditorConfiguration>('queryEditor').results.streaming) {
|
||||
for (let set of resultsToUpdate) {
|
||||
let table = find(this.tables, t => t.resultSet.batchId === set.batchId && t.resultSet.id === set.id);
|
||||
let table = this.tables.find(t => t.resultSet.batchId === set.batchId && t.resultSet.id === set.id);
|
||||
if (table) {
|
||||
table.updateResult(set);
|
||||
} else {
|
||||
@@ -204,12 +204,12 @@ export class GridPanel extends Disposable {
|
||||
|
||||
for (const set of resultSet) {
|
||||
// ensure we aren't adding a resultSet that is already visible
|
||||
if (find(this.tables, t => t.resultSet.batchId === set.batchId && t.resultSet.id === set.id)) {
|
||||
if (this.tables.find(t => t.resultSet.batchId === set.batchId && t.resultSet.id === set.id)) {
|
||||
continue;
|
||||
}
|
||||
let tableState: GridTableState;
|
||||
if (this.state) {
|
||||
tableState = find(this.state.tableStates, e => e.batchId === set.batchId && e.resultId === set.id);
|
||||
tableState = this.state.tableStates.find(e => e.batchId === set.batchId && e.resultId === set.id);
|
||||
}
|
||||
if (!tableState) {
|
||||
tableState = new GridTableState(set.id, set.batchId);
|
||||
@@ -263,7 +263,7 @@ export class GridPanel extends Disposable {
|
||||
}
|
||||
|
||||
private maximizeTable(tableid: string): void {
|
||||
if (!find(this.tables, t => t.id === tableid)) {
|
||||
if (!this.tables.find(t => t.id === tableid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ export class GridPanel extends Disposable {
|
||||
this._state = val;
|
||||
if (this.state) {
|
||||
this.tables.map(t => {
|
||||
let state = find(this.state.tableStates, s => s.batchId === t.resultSet.batchId && s.resultId === t.resultSet.id);
|
||||
let state = this.state.tableStates.find(s => s.batchId === t.resultSet.batchId && s.resultId === t.resultSet.id);
|
||||
if (!state) {
|
||||
this.state.tableStates.push(t.state);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import { EditDataEditor } from 'sql/workbench/contrib/editData/browser/editDataE
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { QueryEditorInput } from 'sql/workbench/common/editor/query/queryEditorInput';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
|
||||
const singleQuote = '\'';
|
||||
|
||||
@@ -369,7 +368,7 @@ export class RunQueryShortcutAction extends Action {
|
||||
}
|
||||
|
||||
private getColumnIndex(columnInfo: azdata.IDbColumn[], columnName: string): number {
|
||||
return columnInfo ? firstIndex(columnInfo, c => c.columnName === columnName) : undefined;
|
||||
return columnInfo ? columnInfo.findIndex(c => c.columnName === columnName) : undefined;
|
||||
}
|
||||
|
||||
private canQueryProcMetadata(editor: QueryEditor): boolean {
|
||||
|
||||
@@ -23,7 +23,7 @@ import { ResourceLabels, IResourceLabel } from 'vs/workbench/browser/labels';
|
||||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { dirname, basename } from 'vs/base/common/resources';
|
||||
import { LIGHT, FileThemeIcon, FolderThemeIcon, registerThemingParticipant, ThemeIcon, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { FileThemeIcon, FolderThemeIcon, registerThemingParticipant, ThemeIcon, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { FileKind } from 'vs/platform/files/common/files';
|
||||
import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService';
|
||||
import { localize } from 'vs/nls';
|
||||
@@ -37,12 +37,12 @@ import { FuzzyScore, createMatches } from 'vs/base/common/filters';
|
||||
import { CollapseAllAction } from 'vs/base/browser/ui/tree/treeDefaults';
|
||||
import { isFalsyOrWhitespace } from 'vs/base/common/strings';
|
||||
import { SIDE_BAR_BACKGROUND, PANEL_BACKGROUND } from 'vs/workbench/common/theme';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { ITreeItem, ITreeView } from 'sql/workbench/common/views';
|
||||
import { UserCancelledConnectionError } from 'sql/base/common/errors';
|
||||
import { IOEShimService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerViewTreeShim';
|
||||
import { NodeContextKey } from 'sql/workbench/contrib/views/browser/nodeContext';
|
||||
import { ActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
|
||||
import { ColorScheme } from 'vs/platform/theme/common/theme';
|
||||
|
||||
class Root implements ITreeItem {
|
||||
label = { label: 'root' };
|
||||
@@ -793,7 +793,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
|
||||
}
|
||||
return ({ start, end });
|
||||
}) : undefined;
|
||||
const icon = this.themeService.getColorTheme().type === LIGHT ? node.icon : node.iconDark;
|
||||
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? node.icon : node.iconDark;
|
||||
const iconUrl = icon ? URI.revive(icon) : null;
|
||||
const title = node.tooltip ? isString(node.tooltip) ? node.tooltip : undefined : resource ? undefined : label;
|
||||
const sqlIcon = node.sqlIcon;
|
||||
@@ -901,7 +901,7 @@ class Aligner extends Disposable {
|
||||
}
|
||||
|
||||
private hasIcon(node: ITreeItem): boolean {
|
||||
const icon = this.themeService.getColorTheme().type === LIGHT ? node.icon : node.iconDark;
|
||||
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? node.icon : node.iconDark;
|
||||
if (icon) {
|
||||
return true;
|
||||
}
|
||||
@@ -975,7 +975,7 @@ class TreeMenus extends Disposable implements IDisposable {
|
||||
}
|
||||
|
||||
private mergeActions(actions: IAction[][]): IAction[] {
|
||||
return actions.reduce((p, c) => p.concat(...c.filter(a => firstIndex(p, x => x.id === a.id) === -1)), [] as IAction[]);
|
||||
return actions.reduce((p, c) => p.concat(...c.filter(a => p.findIndex(x => x.id === a.id) === -1)), [] as IAction[]);
|
||||
}
|
||||
|
||||
private getActions(menuId: MenuId, context: { key: string, value?: string }): { primary: IAction[]; secondary: IAction[]; } {
|
||||
|
||||
@@ -85,7 +85,7 @@ export class WelcomePageContribution implements IWorkbenchContribution {
|
||||
try {
|
||||
const folder = await this.fileService.resolve(folderUri);
|
||||
const files = folder.children ? folder.children.map(child => child.name) : [];
|
||||
const file = arrays.find(files.sort(), file => strings.startsWith(file.toLowerCase(), 'readme'));
|
||||
const file = files.sort().find(file => strings.startsWith(file.toLowerCase(), 'readme'));
|
||||
if (file) {
|
||||
return joinPath(folderUri, file);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import { Deferred } from 'sql/base/common/promise';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
@@ -185,7 +184,7 @@ export class AccountManagementService implements IAccountManagementService {
|
||||
}
|
||||
if (result.accountModified) {
|
||||
// Find the updated account and splice the updated on in
|
||||
let indexToRemove: number = firstIndex(provider.accounts, account => {
|
||||
let indexToRemove: number = provider.accounts.findIndex(account => {
|
||||
return account.key.accountId === result.changedAccount!.key.accountId;
|
||||
});
|
||||
if (indexToRemove >= 0) {
|
||||
@@ -275,7 +274,7 @@ export class AccountManagementService implements IAccountManagementService {
|
||||
return result;
|
||||
}
|
||||
|
||||
let indexToRemove: number = firstIndex(provider.accounts, account => {
|
||||
let indexToRemove: number = provider.accounts.findIndex(account => {
|
||||
return account.key.accountId === accountKey.accountId;
|
||||
});
|
||||
|
||||
@@ -473,7 +472,7 @@ export class AccountManagementService implements IAccountManagementService {
|
||||
|
||||
private spliceModifiedAccount(provider: AccountProviderWithMetadata, modifiedAccount: azdata.Account) {
|
||||
// Find the updated account and splice the updated one in
|
||||
let indexToRemove: number = firstIndex(provider.accounts, account => {
|
||||
let indexToRemove: number = provider.accounts.findIndex(account => {
|
||||
return account.key.accountId === modifiedAccount.key.accountId;
|
||||
});
|
||||
if (indexToRemove >= 0) {
|
||||
|
||||
@@ -24,7 +24,6 @@ import { attachDropdownStyler } from 'sql/platform/theme/common/styler';
|
||||
import { AddAccountAction, RefreshAccountAction } from 'sql/platform/accounts/common/accountActions';
|
||||
import { AccountPickerListRenderer, AccountListDelegate } from 'sql/workbench/services/accountManagement/browser/accountListRenderer';
|
||||
import { AccountPickerViewModel } from 'sql/platform/accounts/common/accountPickerViewModel';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { Tenant, TenantListDelegate, TenantPickerListRenderer } from 'sql/workbench/services/accountManagement/browser/tenantListRenderer';
|
||||
|
||||
export class AccountPicker extends Disposable {
|
||||
@@ -304,7 +303,7 @@ export class AccountPicker extends Disposable {
|
||||
// find selected index
|
||||
let selectedIndex: number | undefined;
|
||||
if (selectedElements.length > 0 && accounts.length > 0) {
|
||||
selectedIndex = firstIndex(accounts, (account) => {
|
||||
selectedIndex = accounts.findIndex(account => {
|
||||
return (account.key.accountId === selectedElements[0].key.accountId);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ import { EditDataInput } from 'sql/workbench/browser/editData/editDataInput';
|
||||
import { DashboardInput } from 'sql/workbench/browser/editor/profiler/dashboardInput';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
/**
|
||||
* Workbench action to clear the recent connnections list
|
||||
@@ -83,7 +82,7 @@ export class ClearRecentConnectionsAction extends Action {
|
||||
];
|
||||
|
||||
self._quickInputService.pick(choices.map(x => x.key), { placeHolder: nls.localize('ClearRecentlyUsedLabel', "Clear List"), ignoreFocusLost: true }).then((choice) => {
|
||||
let confirm = find(choices, x => x.key === choice);
|
||||
let confirm = choices.find(x => x.key === choice);
|
||||
resolve(confirm && confirm.value);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,7 +18,6 @@ import { IServerGroupController } from 'sql/platform/serverGroup/common/serverGr
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ConnectionProviderProperties } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
export class ConnectionController implements IConnectionComponentController {
|
||||
private _advancedController: AdvancedPropertiesController;
|
||||
@@ -166,7 +165,7 @@ export class ConnectionController implements IConnectionComponentController {
|
||||
this._connectionWidget.updateServerGroup(this.getAllServerGroups(providers));
|
||||
this._model = connectionInfo;
|
||||
this._model.providerName = this._providerName;
|
||||
let appNameOption = find(this._providerOptions, option => option.specialValueType === ConnectionOptionSpecialType.appName);
|
||||
let appNameOption = this._providerOptions.find(option => option.specialValueType === ConnectionOptionSpecialType.appName);
|
||||
if (appNameOption) {
|
||||
let appNameKey = appNameOption.name;
|
||||
this._model.options[appNameKey] = Constants.applicationName;
|
||||
|
||||
@@ -29,7 +29,6 @@ import { localize } from 'vs/nls';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { CmsConnectionController } from 'sql/workbench/services/connection/browser/cmsConnectionController';
|
||||
import { entries } from 'sql/base/common/collections';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
@@ -316,7 +315,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
}
|
||||
if (!isProviderInParams) {
|
||||
let uniqueProvidersMap = this._connectionManagementService.getUniqueConnectionProvidersByNameMap(this._providerNameToDisplayNameMap);
|
||||
this._currentProviderType = find(Object.keys(uniqueProvidersMap), (key) => uniqueProvidersMap[key] === input.selectedProviderDisplayName);
|
||||
this._currentProviderType = Object.keys(uniqueProvidersMap).find((key) => uniqueProvidersMap[key] === input.selectedProviderDisplayName);
|
||||
}
|
||||
}
|
||||
this._model.providerName = this._currentProviderType;
|
||||
|
||||
@@ -45,7 +45,6 @@ import { Memento } from 'vs/workbench/common/memento';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { entries } from 'sql/base/common/collections';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
@@ -795,7 +794,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
return AzureResource.Sql;
|
||||
}
|
||||
|
||||
let result = find(ConnectionManagementService._azureResources, r => AzureResource[r] === provider.properties.azureResource);
|
||||
let result = ConnectionManagementService._azureResources.find(r => AzureResource[r] === provider.properties.azureResource);
|
||||
return result ? result : AzureResource.Sql;
|
||||
}
|
||||
|
||||
@@ -814,7 +813,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
const azureAccounts = accounts.filter(a => a.key.providerId.startsWith('azure'));
|
||||
if (azureAccounts && azureAccounts.length > 0) {
|
||||
let accountId = (connection.authenticationType === Constants.azureMFA || connection.authenticationType === Constants.azureMFAAndUser) ? connection.azureAccount : connection.userName;
|
||||
let account = find(azureAccounts, account => account.key.accountId === accountId);
|
||||
let account = azureAccounts.find(account => account.key.accountId === accountId);
|
||||
if (account) {
|
||||
this._logService.debug(`Getting security token for Azure account ${account.key.accountId}`);
|
||||
if (account.isStale) {
|
||||
@@ -1094,7 +1093,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
];
|
||||
|
||||
return this._quickInputService.pick(choices.map(x => x.key), { placeHolder: nls.localize('cancelConnectionConfirmation', "Are you sure you want to cancel this connection?"), ignoreFocusLost: true }).then((choice) => {
|
||||
let confirm = find(choices, x => x.key === choice);
|
||||
let confirm = choices.find(x => x.key === choice);
|
||||
return confirm && confirm.value;
|
||||
});
|
||||
}
|
||||
@@ -1350,10 +1349,10 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
}
|
||||
|
||||
public async getConnectionCredentials(profileId: string): Promise<{ [name: string]: string }> {
|
||||
let profile = find(this.getActiveConnections(), connectionProfile => connectionProfile.id === profileId);
|
||||
let profile = this.getActiveConnections().find(connectionProfile => connectionProfile.id === profileId);
|
||||
if (!profile) {
|
||||
// Couldn't find an active profile so try all profiles now - fetching the password if we found one
|
||||
profile = find(this.getConnections(), connectionProfile => connectionProfile.id === profileId);
|
||||
profile = this.getConnections().find(connectionProfile => connectionProfile.id === profileId);
|
||||
if (!profile) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -1361,7 +1360,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
}
|
||||
|
||||
// Find the password option for the connection provider
|
||||
let passwordOption = find(this._capabilitiesService.getCapabilities(profile.providerName).connection.connectionOptions,
|
||||
let passwordOption = this._capabilitiesService.getCapabilities(profile.providerName).connection.connectionOptions.find(
|
||||
option => option.specialValueType === ConnectionOptionSpecialType.password);
|
||||
if (!passwordOption) {
|
||||
return undefined;
|
||||
@@ -1449,7 +1448,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
const connections = this.getActiveConnections();
|
||||
|
||||
const connectionExists: (conn: ConnectionProfile) => boolean = (conn) => {
|
||||
return find(connections, existingConnection => existingConnection.id === conn.id) !== undefined;
|
||||
return connections.find(existingConnection => existingConnection.id === conn.id) !== undefined;
|
||||
};
|
||||
|
||||
if (!activeConnectionsOnly) {
|
||||
|
||||
@@ -35,7 +35,6 @@ import { endsWith, startsWith } from 'vs/base/common/strings';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
export enum AuthenticationType {
|
||||
SqlLogin = 'SqlLogin',
|
||||
@@ -136,7 +135,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
protected getAuthTypeDefault(option: azdata.ConnectionOption, os: OperatingSystem): string {
|
||||
// Check for OS-specific default value
|
||||
if (option.defaultValueOsOverrides) {
|
||||
let result = find(option.defaultValueOsOverrides, d => ConnectionWidget._osByName[d.os] === os);
|
||||
let result = option.defaultValueOsOverrides.find(d => ConnectionWidget._osByName[d.os] === os);
|
||||
if (result) {
|
||||
return result.defaultValueOverride;
|
||||
}
|
||||
@@ -413,7 +412,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
|
||||
if (this._refreshCredentialsLink) {
|
||||
this._register(DOM.addDisposableListener(this._refreshCredentialsLink, DOM.EventType.CLICK, async () => {
|
||||
let account = find(this._azureAccountList, account => account.key.accountId === this._azureAccountDropdown.value);
|
||||
let account = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
|
||||
if (account) {
|
||||
await this._accountManagementService.refreshAccount(account);
|
||||
await this.fillInAzureAccountOptions();
|
||||
@@ -537,7 +536,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
}
|
||||
|
||||
private updateRefreshCredentialsLink(): void {
|
||||
let chosenAccount = find(this._azureAccountList, account => account.key.accountId === this._azureAccountDropdown.value);
|
||||
let chosenAccount = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
|
||||
if (chosenAccount && chosenAccount.isStale) {
|
||||
DOM.removeClass(this._tableContainer, 'hide-refresh-link');
|
||||
} else {
|
||||
@@ -558,7 +557,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
await this.fillInAzureAccountOptions();
|
||||
|
||||
// If a new account was added find it and select it, otherwise select the first account
|
||||
let newAccount = find(this._azureAccountList, option => !oldAccountIds.some(oldId => oldId === option.key.accountId));
|
||||
let newAccount = this._azureAccountList.find(option => !oldAccountIds.some(oldId => oldId === option.key.accountId));
|
||||
if (newAccount) {
|
||||
this._azureAccountDropdown.selectWithOptionName(newAccount.key.accountId);
|
||||
} else {
|
||||
@@ -570,7 +569,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
|
||||
// Display the tenant select box if needed
|
||||
const hideTenantsClassName = 'hide-azure-tenants';
|
||||
let selectedAccount = find(this._azureAccountList, account => account.key.accountId === this._azureAccountDropdown.value);
|
||||
let selectedAccount = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
|
||||
if (selectedAccount && selectedAccount.properties.tenants && selectedAccount.properties.tenants.length > 1) {
|
||||
// There are multiple tenants available so let the user select one
|
||||
let options = selectedAccount.properties.tenants.map(tenant => tenant.displayName);
|
||||
@@ -589,7 +588,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
|
||||
private onAzureTenantSelected(tenantIndex: number): void {
|
||||
this._azureTenantId = undefined;
|
||||
let account = find(this._azureAccountList, account => account.key.accountId === this._azureAccountDropdown.value);
|
||||
let account = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
|
||||
if (account && account.properties.tenants) {
|
||||
let tenant = account.properties.tenants[tenantIndex];
|
||||
if (tenant) {
|
||||
@@ -708,7 +707,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
this._azureAccountDropdown.selectWithOptionName(this.getModelValue(accountName));
|
||||
await this.onAzureAccountSelected();
|
||||
let tenantId = connectionInfo.azureTenantId;
|
||||
let account = find(this._azureAccountList, account => account.key.accountId === this._azureAccountDropdown.value);
|
||||
let account = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
|
||||
if (account && account.properties.tenants.length > 1) {
|
||||
let tenant = account.properties.tenants.find(tenant => tenant.id === tenantId);
|
||||
if (tenant) {
|
||||
@@ -912,12 +911,12 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
private findGroupId(groupFullName: string): string {
|
||||
let group: IConnectionProfileGroup;
|
||||
if (ConnectionProfileGroup.isRoot(groupFullName)) {
|
||||
group = find(this._serverGroupOptions, g => ConnectionProfileGroup.isRoot(g.name));
|
||||
group = this._serverGroupOptions.find(g => ConnectionProfileGroup.isRoot(g.name));
|
||||
if (group === undefined) {
|
||||
group = find(this._serverGroupOptions, g => g.name === this.DefaultServerGroup.name);
|
||||
group = this._serverGroupOptions.find(g => g.name === this.DefaultServerGroup.name);
|
||||
}
|
||||
} else {
|
||||
group = find(this._serverGroupOptions, g => g.name === groupFullName);
|
||||
group = this._serverGroupOptions.find(g => g.name === groupFullName);
|
||||
}
|
||||
return group ? group.id : undefined;
|
||||
}
|
||||
@@ -926,7 +925,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
if (!displayName) {
|
||||
return undefined;
|
||||
}
|
||||
return find(ConnectionWidget._authTypes, authType => this.getAuthTypeDisplayName(authType) === displayName);
|
||||
return ConnectionWidget._authTypes.find(authType => this.getAuthTypeDisplayName(authType) === displayName);
|
||||
}
|
||||
|
||||
public closeDatabaseDropdown(): void {
|
||||
|
||||
@@ -24,7 +24,8 @@ import { ResourceLabels, IResourceLabel } from 'vs/workbench/browser/labels';
|
||||
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { dirname, basename } from 'vs/base/common/resources';
|
||||
import { LIGHT, FileThemeIcon, FolderThemeIcon, registerThemingParticipant, ThemeIcon, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { FileThemeIcon, FolderThemeIcon, registerThemingParticipant, ThemeIcon, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { ColorScheme } from 'vs/platform/theme/common/theme';
|
||||
import { FileKind } from 'vs/platform/files/common/files';
|
||||
import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService';
|
||||
import { localize } from 'vs/nls';
|
||||
@@ -754,7 +755,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
|
||||
}
|
||||
return ({ start, end });
|
||||
}) : undefined;
|
||||
const icon = this.themeService.getColorTheme().type === LIGHT ? node.icon : node.iconDark;
|
||||
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? node.icon : node.iconDark;
|
||||
const iconUrl = icon ? URI.revive(icon) : null;
|
||||
|
||||
// reset
|
||||
@@ -922,7 +923,7 @@ class Aligner extends Disposable {
|
||||
}
|
||||
|
||||
private hasIcon(node: ITreeItem): boolean {
|
||||
const icon = this.themeService.getColorTheme().type === LIGHT ? node.icon : node.iconDark;
|
||||
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? node.icon : node.iconDark;
|
||||
if (icon) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
|
||||
import { IDashboardTab } from 'sql/workbench/services/dashboard/browser/common/interfaces';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
|
||||
export interface IDashboardUITab {
|
||||
@@ -35,7 +34,7 @@ export class NewDashboardTabViewModel {
|
||||
tabList.push({ tabConfig: tab });
|
||||
});
|
||||
openedTabs.forEach(tab => {
|
||||
let uiTab = find(tabList, i => i.tabConfig === tab);
|
||||
let uiTab = tabList.find(i => i.tabConfig === tab);
|
||||
if (uiTab) {
|
||||
uiTab.isOpened = true;
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ import * as pfs from 'vs/base/node/pfs';
|
||||
import { getRandomTestPath } from 'vs/base/test/node/testUtils';
|
||||
import { IProcessEnvironment } from 'vs/base/common/platform';
|
||||
import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
|
||||
import { TestWindowConfiguration } from 'vs/workbench/test/electron-browser/workbenchTestServices';
|
||||
import { isEqual } from 'vs/base/common/resources';
|
||||
import { TestWorkbenchConfiguration } from 'vs/workbench/test/electron-browser/workbenchTestServices';
|
||||
|
||||
class MockWorkbenchEnvironmentService extends NativeWorkbenchEnvironmentService {
|
||||
|
||||
constructor(public userEnv: IProcessEnvironment) {
|
||||
super({ ...TestWindowConfiguration, userEnv }, TestWindowConfiguration.execPath);
|
||||
super({ ...TestWorkbenchConfiguration, userEnv });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
export class JobManagementUtilities {
|
||||
|
||||
@@ -42,7 +41,9 @@ export class JobManagementUtilities {
|
||||
}
|
||||
|
||||
public static convertToNextRun(date: string) {
|
||||
if (find(date, x => x === '1/1/0001')) {
|
||||
let newDate = date as unknown;
|
||||
let dateArr = newDate as [];
|
||||
if (dateArr.find(x => x === '1/1/0001')) {
|
||||
return nls.localize('agentUtilities.notScheduled', "Not Scheduled");
|
||||
} else {
|
||||
return date;
|
||||
@@ -50,7 +51,9 @@ export class JobManagementUtilities {
|
||||
}
|
||||
|
||||
public static convertToLastRun(date: string) {
|
||||
if (find(date, x => x === '1/1/0001')) {
|
||||
let newDate = date as unknown;
|
||||
let dateArr = newDate as [];
|
||||
if (dateArr.find(x => x === '1/1/0001')) {
|
||||
return nls.localize('agentUtilities.neverRun', "Never Run");
|
||||
} else {
|
||||
return date;
|
||||
@@ -58,7 +61,9 @@ export class JobManagementUtilities {
|
||||
}
|
||||
|
||||
public static setRunnable(icon: HTMLElement, index: number) {
|
||||
if (find(icon.className, x => x === 'non-runnable')) {
|
||||
let temp = icon.className as unknown;
|
||||
let classNameArr = temp as [];
|
||||
if (classNameArr.find(x => x === 'non-runnable')) {
|
||||
icon.className = icon.className.slice(0, index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import { optional } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { getErrorMessage, onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { IModelContentChangedEvent } from 'vs/editor/common/model/textModelEvents';
|
||||
import { firstIndex, find } from 'vs/base/common/arrays';
|
||||
import { HideInputTag } from 'sql/platform/notebooks/common/outputRegistry';
|
||||
import { FutureInternal, notebookConstants } from 'sql/workbench/services/notebook/browser/interfaces';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
@@ -136,7 +135,7 @@ export class CellModel extends Disposable implements ICellModel {
|
||||
|
||||
let tagIndex = -1;
|
||||
if (this._metadata.tags) {
|
||||
tagIndex = firstIndex(this._metadata.tags, tag => tag === HideInputTag);
|
||||
tagIndex = this._metadata.tags.findIndex(tag => tag === HideInputTag);
|
||||
}
|
||||
|
||||
if (this._isCollapsed) {
|
||||
@@ -786,7 +785,7 @@ export class CellModel extends Disposable implements ICellModel {
|
||||
if (serverInfo) {
|
||||
let endpoints: notebookUtils.IEndpoint[] = notebookUtils.getClusterEndpoints(serverInfo);
|
||||
if (endpoints && endpoints.length > 0) {
|
||||
endpoint = find(endpoints, ep => ep.serviceName.toLowerCase() === notebookUtils.hadoopEndpointNameGateway);
|
||||
endpoint = endpoints.find(ep => ep.serviceName.toLowerCase() === notebookUtils.hadoopEndpointNameGateway);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
|
||||
import { uriPrefixes } from 'sql/platform/connection/common/utils';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { getErrorMessage } from 'vs/base/common/errors';
|
||||
import { find, firstIndex } from 'vs/base/common/arrays';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { notebookConstants } from 'sql/workbench/services/notebook/browser/interfaces';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
@@ -119,18 +118,18 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
}
|
||||
|
||||
public get notebookManager(): INotebookManager {
|
||||
let manager = find(this.notebookManagers, manager => manager.providerId === this._providerId);
|
||||
let manager = this.notebookManagers.find(manager => manager.providerId === this._providerId);
|
||||
if (!manager) {
|
||||
// Note: this seems like a less than ideal scenario. We should ideally pass in the "correct" provider ID and allow there to be a default,
|
||||
// instead of assuming in the NotebookModel constructor that the option is either SQL or Jupyter
|
||||
manager = find(this.notebookManagers, manager => manager.providerId === DEFAULT_NOTEBOOK_PROVIDER);
|
||||
manager = this.notebookManagers.find(manager => manager.providerId === DEFAULT_NOTEBOOK_PROVIDER);
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
public getNotebookManager(providerId: string): INotebookManager {
|
||||
if (providerId) {
|
||||
return find(this.notebookManagers, manager => manager.providerId === providerId);
|
||||
return this.notebookManagers.find(manager => manager.providerId === providerId);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -397,7 +396,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
}
|
||||
|
||||
public findCellIndex(cellModel: ICellModel): number {
|
||||
return firstIndex(this._cells, (cell) => cell.equals(cellModel));
|
||||
return this._cells.findIndex(cell => cell.equals(cellModel));
|
||||
}
|
||||
|
||||
public addCell(cellType: CellType, index?: number): ICellModel {
|
||||
@@ -498,7 +497,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
if (this.inErrorState || !this._cells) {
|
||||
return;
|
||||
}
|
||||
let index = firstIndex(this._cells, (cell) => cell.equals(cellModel));
|
||||
let index = this._cells.findIndex(cell => cell.equals(cellModel));
|
||||
if (index > -1) {
|
||||
this._cells.splice(index, 1);
|
||||
if (this._activeCell === cellModel) {
|
||||
@@ -548,7 +547,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
|
||||
public async startSession(manager: INotebookManager, displayName?: string, setErrorStateOnFail?: boolean, kernelAlias?: string): Promise<void> {
|
||||
if (displayName && this._standardKernels) {
|
||||
let standardKernel = find(this._standardKernels, kernel => kernel.displayName === displayName);
|
||||
let standardKernel = this._standardKernels.find(kernel => kernel.displayName === displayName);
|
||||
if (standardKernel) {
|
||||
this._defaultKernel = { name: standardKernel.name, display_name: standardKernel.displayName };
|
||||
}
|
||||
@@ -653,7 +652,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
|
||||
private isValidConnection(profile: IConnectionProfile | connection.Connection) {
|
||||
if (this._standardKernels) {
|
||||
let standardKernels = find(this._standardKernels, kernel => this._defaultKernel && kernel.displayName === this._defaultKernel.display_name);
|
||||
let standardKernels = this._standardKernels.find(kernel => this._defaultKernel && kernel.displayName === this._defaultKernel.display_name);
|
||||
let connectionProviderIds = standardKernels ? standardKernels.connectionProviderIds : undefined;
|
||||
let providerFeatures = this._capabilitiesService.getCapabilities(profile.providerName);
|
||||
if (connectionProviderIds?.length) {
|
||||
@@ -666,14 +665,14 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
this._kernelDisplayNameToConnectionProviderIds.set(this._currentKernelAlias, [profile.providerName]);
|
||||
}
|
||||
}
|
||||
return this._currentKernelAlias || profile && connectionProviderIds && find(connectionProviderIds, provider => provider === profile.providerName) !== undefined;
|
||||
return this._currentKernelAlias || profile && connectionProviderIds && connectionProviderIds.find(provider => provider === profile.providerName) !== undefined;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public getStandardKernelFromName(name: string): notebookUtils.IStandardKernelWithProvider {
|
||||
if (name && this._standardKernels) {
|
||||
let kernel = find(this._standardKernels, kernel => kernel.name.toLowerCase() === name.toLowerCase());
|
||||
let kernel = this._standardKernels.find(kernel => kernel.name.toLowerCase() === name.toLowerCase());
|
||||
return kernel;
|
||||
}
|
||||
return undefined;
|
||||
@@ -681,7 +680,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
|
||||
public getStandardKernelFromDisplayName(displayName: string): notebookUtils.IStandardKernelWithProvider {
|
||||
if (displayName && this._standardKernels) {
|
||||
let kernel = find(this._standardKernels, kernel => kernel.displayName.toLowerCase() === displayName.toLowerCase());
|
||||
let kernel = this._standardKernels.find(kernel => kernel.displayName.toLowerCase() === displayName.toLowerCase());
|
||||
return kernel;
|
||||
}
|
||||
return undefined;
|
||||
@@ -827,8 +826,8 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
if (spec) {
|
||||
// Ensure that the kernel we try to switch to is a valid kernel; if not, use the default
|
||||
let kernelSpecs = this.getKernelSpecs();
|
||||
if (kernelSpecs && kernelSpecs.length > 0 && firstIndex(kernelSpecs, k => k.display_name === spec.display_name) < 0) {
|
||||
spec = find(kernelSpecs, spec => spec.name === this.notebookManager.sessionManager.specs.defaultKernel);
|
||||
if (kernelSpecs && kernelSpecs.length > 0 && kernelSpecs.findIndex(k => k.display_name === spec.display_name) < 0) {
|
||||
spec = kernelSpecs.find(spec => spec.name === this.notebookManager.sessionManager.specs.defaultKernel);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -889,7 +888,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
}
|
||||
|
||||
private getKernelSpecFromDisplayName(displayName: string): nb.IKernelSpec {
|
||||
let kernel: nb.IKernelSpec = find(this.specs.kernels, k => k.display_name.toLowerCase() === displayName.toLowerCase());
|
||||
let kernel: nb.IKernelSpec = this.specs.kernels.find(k => k.display_name.toLowerCase() === displayName.toLowerCase());
|
||||
if (!kernel) {
|
||||
return undefined; // undefined is handled gracefully in the session to default to the default kernel
|
||||
} else if (!kernel.name) {
|
||||
@@ -906,7 +905,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
this._savedKernelInfo.display_name = displayName;
|
||||
}
|
||||
if (this._standardKernels) {
|
||||
let standardKernel = find(this._standardKernels, kernel => kernel.displayName === displayName || startsWith(displayName, kernel.displayName));
|
||||
let standardKernel = this._standardKernels.find(kernel => kernel.displayName === displayName || startsWith(displayName, kernel.displayName));
|
||||
if (standardKernel && this._savedKernelInfo.name && this._savedKernelInfo.name !== standardKernel.name) {
|
||||
this._savedKernelInfo.name = standardKernel.name;
|
||||
this._savedKernelInfo.display_name = standardKernel.displayName;
|
||||
@@ -920,7 +919,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
if (!specs || !specs.kernels) {
|
||||
return kernel.name;
|
||||
}
|
||||
let newKernel = find(this.notebookManager.sessionManager.specs.kernels, k => k.name === kernel.name);
|
||||
let newKernel = this.notebookManager.sessionManager.specs.kernels.find(k => k.name === kernel.name);
|
||||
let newKernelDisplayName;
|
||||
if (newKernel) {
|
||||
newKernelDisplayName = newKernel.display_name;
|
||||
|
||||
@@ -24,7 +24,6 @@ import { ILanguageMagic } from 'sql/workbench/services/notebook/browser/notebook
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { getUriPrefix, uriPrefixes } from 'sql/platform/connection/common/utils';
|
||||
import { firstIndex } from 'vs/base/common/arrays';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { FutureInternal, notebookConstants } from 'sql/workbench/services/notebook/browser/interfaces';
|
||||
@@ -75,7 +74,7 @@ export class SqlSessionManager implements nb.SessionManager {
|
||||
|
||||
startNew(options: nb.ISessionOptions): Thenable<nb.ISession> {
|
||||
let sqlSession = new SqlSession(options, this._instantiationService);
|
||||
let index = firstIndex(SqlSessionManager._sessions, session => session.path === options.path);
|
||||
let index = SqlSessionManager._sessions.findIndex(session => session.path === options.path);
|
||||
if (index > -1) {
|
||||
SqlSessionManager._sessions.splice(index);
|
||||
}
|
||||
@@ -84,7 +83,7 @@ export class SqlSessionManager implements nb.SessionManager {
|
||||
}
|
||||
|
||||
shutdown(id: string): Thenable<void> {
|
||||
let index = firstIndex(SqlSessionManager._sessions, session => session.id === id);
|
||||
let index = SqlSessionManager._sessions.findIndex(session => session.id === id);
|
||||
if (index > -1) {
|
||||
let sessionManager = SqlSessionManager._sessions[index];
|
||||
SqlSessionManager._sessions.splice(index);
|
||||
|
||||
@@ -24,7 +24,6 @@ import { TreeNodeContextKey } from 'sql/workbench/services/objectExplorer/common
|
||||
import { IQueryManagementService } from 'sql/workbench/services/query/common/queryManagement';
|
||||
import { ServerInfoContextKey } from 'sql/workbench/services/connection/common/serverInfoContextKey';
|
||||
import { fillInActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
|
||||
import { firstIndex, find } from 'vs/base/common/arrays';
|
||||
import { AsyncServerTree, ServerTreeElement } from 'sql/workbench/services/objectExplorer/browser/asyncServerTree';
|
||||
|
||||
/**
|
||||
@@ -87,7 +86,7 @@ export class ServerTreeActionProvider {
|
||||
const options = { arg: undefined, shouldForwardArgs: true };
|
||||
const groups = menu.getActions(options);
|
||||
let insertIndex: number | undefined = 0;
|
||||
const queryIndex = firstIndex(groups, v => {
|
||||
const queryIndex = groups.findIndex(v => {
|
||||
if (v[0] === '0_query') {
|
||||
return true;
|
||||
} else {
|
||||
@@ -193,7 +192,7 @@ export class ServerTreeActionProvider {
|
||||
|
||||
private isScriptableObject(context: ObjectExplorerContext): boolean {
|
||||
if (context.treeNode) {
|
||||
if (find(NodeType.SCRIPTABLE_OBJECTS, x => x === context?.treeNode?.nodeTypeId)) {
|
||||
if (NodeType.SCRIPTABLE_OBJECTS.find(x => x === context?.treeNode?.nodeTypeId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { TestObjectExplorerProvider } from 'sql/workbench/services/objectExplorer/test/common/testObjectExplorerProvider';
|
||||
import { TestConnectionManagementService } from 'sql/platform/connection/test/common/testConnectionManagementService';
|
||||
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { NullAdsTelemetryService } from 'sql/platform/telemetry/common/adsTelemetryService';
|
||||
import { ConnectionOptionSpecialType, ServiceOptionType } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
@@ -495,7 +494,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
sqlOEProvider.setup(x => x.expandNode(TypeMoq.It.isAny())).callback(() => {
|
||||
objectExplorerService.onNodeExpanded(tableExpandInfo);
|
||||
}).returns(() => Promise.resolve(true));
|
||||
const tableNode = find(childNodes, node => node.nodePath === table1NodePath);
|
||||
const tableNode = childNodes.find(node => node.nodePath === table1NodePath);
|
||||
await objectExplorerService.resolveTreeNodeChildren(objectExplorerSession, tableNode);
|
||||
const isExpanded = await tableNode.isExpanded();
|
||||
assert.equal(isExpanded, true, 'Table node was not expanded');
|
||||
@@ -511,7 +510,7 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
objectExplorerService.onSessionCreated(1, objectExplorerSession);
|
||||
const childNodes = await objectExplorerService.resolveTreeNodeChildren(objectExplorerSession, objectExplorerService.getObjectExplorerNode(connection));
|
||||
// If I check whether the table is expanded, the answer should be no because only its parent node is expanded
|
||||
const tableNode = find(childNodes, node => node.nodePath === table1NodePath);
|
||||
const tableNode = childNodes.find(node => node.nodePath === table1NodePath);
|
||||
const isExpanded = await tableNode.isExpanded();
|
||||
assert.equal(isExpanded, false);
|
||||
});
|
||||
@@ -535,9 +534,9 @@ suite('SQL Object Explorer Service tests', () => {
|
||||
sqlOEProvider.setup(x => x.expandNode(TypeMoq.It.isAny())).callback(() => {
|
||||
objectExplorerService.onNodeExpanded(tableExpandInfo);
|
||||
}).returns(() => Promise.resolve(true));
|
||||
await objectExplorerService.resolveTreeNodeChildren(objectExplorerSession, find(childNodes, node => node.nodePath === table1NodePath));
|
||||
await objectExplorerService.resolveTreeNodeChildren(objectExplorerSession, childNodes.find(node => node.nodePath === table1NodePath));
|
||||
// If I check whether the table is expanded, the answer should be yes
|
||||
const tableNode = find(childNodes, node => node.nodePath === table1NodePath);
|
||||
const tableNode = childNodes.find(node => node.nodePath === table1NodePath);
|
||||
const isExpanded = await tableNode.isExpanded();
|
||||
assert.equal(isExpanded, false);
|
||||
});
|
||||
|
||||
@@ -24,7 +24,6 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { ProfilerFilter, ProfilerFilterClause, ProfilerFilterClauseOperator, IProfilerService } from 'sql/workbench/services/profiler/browser/interfaces';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { find, firstIndex } from 'vs/base/common/arrays';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { attachModalDialogStyler } from 'sql/workbench/common/styler';
|
||||
@@ -223,7 +222,7 @@ export class ProfilerFilterDialog extends Modal {
|
||||
|
||||
private addClauseRow(setInitialValue: boolean, field?: string, operator?: string, value?: string): void {
|
||||
const columns = this._input!.columns.map(column => column.name);
|
||||
if (field && !find(columns, x => x === field)) {
|
||||
if (field && !columns.find(x => x === field)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -272,7 +271,7 @@ export class ProfilerFilterDialog extends Modal {
|
||||
}
|
||||
|
||||
private removeRow(clauseId: string) {
|
||||
const idx = firstIndex(this._clauseRows, (entry) => { return entry.id === clauseId; });
|
||||
const idx = this._clauseRows.findIndex(entry => { return entry.id === clauseId; });
|
||||
if (idx !== -1) {
|
||||
this._clauseRows[idx].row.remove();
|
||||
this._clauseRows.splice(idx, 1);
|
||||
|
||||
@@ -23,7 +23,6 @@ import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
import { IGridDataProvider, getResultsString } from 'sql/workbench/services/query/common/gridDataProvider';
|
||||
import { getErrorMessage } from 'vs/base/common/errors';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { IRange, Range } from 'vs/editor/common/core/range';
|
||||
import { BatchSummary, IQueryMessage, ResultSetSummary, QueryExecuteSubsetParams, CompleteBatchSummary, IResultMessage, ResultSetSubset, BatchStartSummary } from './query';
|
||||
import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
|
||||
@@ -323,7 +322,7 @@ export default class QueryRunner extends Disposable {
|
||||
}
|
||||
// handle getting queryPlanxml if we need too
|
||||
// check if this result has show plan, this needs work, it won't work for any other provider
|
||||
let hasShowPlan = !!find(resultSet.columnInfo, e => e.columnName === 'Microsoft SQL Server 2005 XML Showplan');
|
||||
let hasShowPlan = !!resultSet.columnInfo.find(e => e.columnName === 'Microsoft SQL Server 2005 XML Showplan');
|
||||
if (hasShowPlan && resultSet.rowCount > 0) {
|
||||
this._isQueryPlan = true;
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import { IConnectionManagementService } from 'sql/platform/connection/common/con
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
/**
|
||||
* Service that collects the results of executed queries
|
||||
@@ -42,7 +41,7 @@ export class QueryHistoryService extends Disposable implements IQueryHistoryServ
|
||||
this._captureEnabled = !!this._configurationService.getValue<boolean>('queryHistory.captureEnabled');
|
||||
|
||||
this._register(this._configurationService.onDidChangeConfiguration((e: IConfigurationChangeEvent) => {
|
||||
if (find(e.affectedKeys, x => x === 'queryHistory.captureEnabled')) {
|
||||
if (e.affectedKeys.find(x => x === 'queryHistory.captureEnabled')) {
|
||||
this.updateCaptureEnabled();
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -13,7 +13,6 @@ import { localize } from 'vs/nls';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
export const SERVICE_ID = 'taskHistoryService';
|
||||
export const ITaskService = createDecorator<ITaskService>(SERVICE_ID);
|
||||
@@ -227,7 +226,7 @@ export class TaskService implements ITaskService {
|
||||
|
||||
private getTaskInQueue(taskId: string): TaskNode | undefined {
|
||||
if (this._taskQueue.hasChildren) {
|
||||
return find(this._taskQueue.children!, x => x.id === taskId);
|
||||
return this._taskQueue.children!.find(x => x.id === taskId);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import * as TypeMoq from 'typemoq';
|
||||
|
||||
import { MainThreadObjectExplorerShape } from 'sql/workbench/api/common/sqlExtHost.protocol';
|
||||
import { ExtHostObjectExplorerNode } from 'sql/workbench/api/common/extHostObjectExplorer';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
|
||||
const nodes: { [nodeName: string]: azdata.NodeInfo } =
|
||||
{
|
||||
@@ -75,7 +74,7 @@ suite('ExtHostObjectExplorer Tests', () => {
|
||||
mockProxy.setup(p =>
|
||||
p.$getNode(TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
||||
.returns((connectionId, nodePath) => {
|
||||
return Promise.resolve<azdata.NodeInfo>(nodes[find(Object.keys(nodes), key =>
|
||||
return Promise.resolve<azdata.NodeInfo>(nodes[Object.keys(nodes).find(key =>
|
||||
nodes[key].nodePath === nodePath)]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user