Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Apr 7, 2021
1 parent 1aab963 commit dbac397
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@ import type { SavedSearch, SortOrder } from '../../saved_searches/types';
import { AppState } from '../angular/discover_state';
import { getSortForSearchSource } from '../angular/doc_table';

interface SharingData {
columns: string[];
searchSource: SearchSourceFields;
}

/**
* Preparing data to share the current state as link or CSV/Report
*/
export async function getSharingData(
currentSearchSource: ISearchSource,
state: AppState | SavedSearch,
config: IUiSettingsClient
): Promise<{ columns: string[]; searchSource: SearchSourceFields }> {
): Promise<SharingData> {
const searchSource = currentSearchSource.createCopy();
const index = searchSource.getField('index')!;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
ISearchSource,
ISearchStartSearchSource,
SearchFieldValue,
SearchSourceFields,
tabifyDocs,
} from '../../../../../../../src/plugins/data/common';
import { KbnServerError } from '../../../../../../../src/plugins/kibana_utils/server';
Expand Down Expand Up @@ -60,8 +61,8 @@ function isPlainStringArray(
}

export class CsvGenerator {
private _columns: string[] | null = null;
private _formatters: Record<string, FieldFormat> | null = null;
private _columns?: string[];
private _formatters?: Record<string, FieldFormat>;
private csvContainsFormulas = false;
private maxSizeReached = false;
private csvRowCount = 0;
Expand Down Expand Up @@ -144,7 +145,7 @@ export class CsvGenerator {
// if columns is not provided in job params,
// default to use fields/fieldsFromSource from the searchSource to get the ordering of columns
const getFromSearchSource = (): string[] => {
const fieldValues: Record<string, string | boolean | SearchFieldValue[] | undefined> = {
const fieldValues: Pick<SearchSourceFields, 'fields' | 'fieldsFromSource'> = {
fields: searchSource.getField('fields'),
fieldsFromSource: searchSource.getField('fieldsFromSource'),
};
Expand Down

0 comments on commit dbac397

Please sign in to comment.