respect include header option (#17134)

* respect include header option

* use correct option for copying

* check for setting when copying

* add dependency injection

* use instantiation service

Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
Aditya Bist
2021-11-01 12:36:19 -07:00
committed by GitHub
parent 9bbe39e9e2
commit 6dda9392e0
4 changed files with 28 additions and 26 deletions

View File

@@ -105,6 +105,7 @@ export class CopyResultAction extends Action {
constructor(
id: string,
label: string,
private configurationService: IConfigurationService,
private copyHeader: boolean,
private accountForNumberColumn = true
) {
@@ -113,7 +114,8 @@ export class CopyResultAction extends Action {
public override async run(context: IGridActionContext): Promise<void> {
const selection = this.accountForNumberColumn ? mapForNumberColumn(context.selection) : context.selection;
await context.gridDataProvider.copyResults(selection, this.copyHeader, context.table.getData());
const includeHeader = this.configurationService.getValue<boolean>('queryEditor.results.copyIncludeHeaders') || this.copyHeader;
await context.gridDataProvider.copyResults(selection, includeHeader, context.table.getData());
}
}