mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 09:35:38 -05:00
Remove typings and replace missing methods with vscodes (#8217)
* remove typings and replace missing methods with vscodes * fix strict-null-checks * fix tests
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ProfilerFilterClause, ProfilerFilter, ProfilerFilterClauseOperator } from 'sql/workbench/services/profiler/browser/interfaces';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
|
||||
|
||||
export function FilterData(filter: ProfilerFilter, data: any[]): any[] {
|
||||
@@ -67,16 +68,16 @@ function matches(item: any, clauses: ProfilerFilterClause[]): boolean {
|
||||
match = actualValue !== undefined && actualValue !== null && actualValue !== '';
|
||||
break;
|
||||
case ProfilerFilterClauseOperator.Contains:
|
||||
match = actualValueString && actualValueString.includes(expectedValueString);
|
||||
match = actualValueString && actualValueString.indexOf(expectedValueString) > -1;
|
||||
break;
|
||||
case ProfilerFilterClauseOperator.NotContains:
|
||||
match = !actualValueString || !actualValueString.includes(expectedValueString);
|
||||
match = !actualValueString || !(actualValueString.indexOf(expectedValueString) > -1);
|
||||
break;
|
||||
case ProfilerFilterClauseOperator.StartsWith:
|
||||
match = actualValueString.startsWith(expectedValueString);
|
||||
match = startsWith(actualValueString, expectedValueString);
|
||||
break;
|
||||
case ProfilerFilterClauseOperator.NotStartsWith:
|
||||
match = !actualValueString || !actualValueString.startsWith(expectedValueString);
|
||||
match = !actualValueString || !startsWith(actualValueString, expectedValueString);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Not a valid operator: ${clause.operator}`);
|
||||
|
||||
@@ -230,7 +230,7 @@ export class ProfilerService implements IProfilerService {
|
||||
// only use the templates that matches the following criteria:
|
||||
// 1. the template doesn't have any engine types specified - for backward compatibility (user with custom templates) or the templates applicable to both AzureSQLDB and standalone server
|
||||
// 2. the template supports the current engine type
|
||||
templates = templates.filter(template => !template.engineTypes || template.engineTypes.length === 0 || template.engineTypes.includes(engineType));
|
||||
templates = templates.filter(template => !template.engineTypes || template.engineTypes.length === 0 || template.engineTypes.some(x => x === engineType));
|
||||
}
|
||||
return this._commandService.executeCommand('profiler.openCreateSessionDialog', input.id, input.providerType, templates);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user