Merge pull request #421 from dbeaver/fix/filtered-values-quotes

fix(plugin-data-spreadsheet-new): CB-1018, CB-1019 remove single quot…
This commit is contained in:
Alexey
2021-07-15 15:42:32 +03:00
committed by GitHub
2 changed files with 6 additions and 8 deletions
@@ -96,13 +96,14 @@ export class DataGridContextMenuFilterService {
const val = typeof value === 'function' ? value() : value;
const stringifyValue = format.toDisplayString(val);
const wrappedValue = wrapOperationArgument(operation.id, stringifyValue);
const clippeddValue = replaceMiddle(wrappedValue, ' ... ', 8, 30);
return `${columnLabel} ${operation.expression} ${clippeddValue}`;
const clippedValue = replaceMiddle(wrappedValue, ' ... ', 8, 30);
return `${columnLabel} ${operation.expression} ${clippedValue}`;
},
icon,
onClick: async () => {
const val = typeof value === 'function' ? value() : value;
await this.applyFilter(model, resultIndex, column, operation.id, val);
const wrappedValue = wrapOperationArgument(operation.id, val);
await this.applyFilter(model, resultIndex, column, operation.id, wrappedValue);
},
}));
}
@@ -254,14 +254,11 @@ export function getNextOrder(order: Order): Order {
}
export function wrapOperationArgument(operationId: string, argument: any): string {
let result = argument;
if (operationId === 'LIKE') {
result = `%${result} %`;
return `%${argument}%`;
}
result = `'${result}'`;
return result;
return argument;
}
export function isFilterConstraint(constraint: SqlDataFilterConstraint): boolean {