Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Lens] Remove indexpattern id on column #42429

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const initialState: IndexPatternPrivateState = {
type: 'alphabetical',
},
},
indexPatternId: '1',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ describe('IndexPatternDimensionPanel', () => {
interval: '1d',
},
sourceField: 'timestamp',
indexPatternId: '1',
},
},
},
Expand Down Expand Up @@ -207,7 +206,6 @@ describe('IndexPatternDimensionPanel', () => {
// Private
operationType: 'max',
sourceField: 'bytes',
indexPatternId: '1',
},
},
},
Expand Down Expand Up @@ -249,7 +247,6 @@ describe('IndexPatternDimensionPanel', () => {
// Private
operationType: 'max',
sourceField: 'bytes',
indexPatternId: '1',
},
},
},
Expand Down Expand Up @@ -288,7 +285,6 @@ describe('IndexPatternDimensionPanel', () => {
// Private
operationType: 'max',
sourceField: 'bytes',
indexPatternId: '1',
},
},
},
Expand Down Expand Up @@ -373,7 +369,6 @@ describe('IndexPatternDimensionPanel', () => {
// Private
operationType: 'max',
sourceField: 'bytes',
indexPatternId: '1',
},
},
},
Expand Down Expand Up @@ -713,7 +708,6 @@ describe('IndexPatternDimensionPanel', () => {
// Private
operationType: 'max',
sourceField: 'bytes',
indexPatternId: '1',
},
},
},
Expand Down Expand Up @@ -819,7 +813,6 @@ describe('IndexPatternDimensionPanel', () => {
interval: '1d',
},
sourceField: 'timestamp',
indexPatternId: 'foo',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ describe('IndexPattern Data Source', () => {
orderBy: { type: 'alphabetical' },
orderDirection: 'asc',
},
indexPatternId: '1',
},
},
},
Expand Down Expand Up @@ -221,7 +220,6 @@ describe('IndexPattern Data Source', () => {

// Private
operationType: 'count',
indexPatternId: '1',
},
col2: {
label: 'Date',
Expand All @@ -234,7 +232,6 @@ describe('IndexPattern Data Source', () => {
params: {
interval: '1d',
},
indexPatternId: '1',
},
},
},
Expand Down Expand Up @@ -610,7 +607,6 @@ describe('IndexPattern Data Source', () => {
columns: {
col1: {
dataType: 'string',
indexPatternId: '1',
isBucketed: true,
sourceField: 'source',
label: 'values of source',
Expand All @@ -623,7 +619,6 @@ describe('IndexPattern Data Source', () => {
},
col2: {
dataType: 'number',
indexPatternId: '1',
isBucketed: false,
sourceField: 'bytes',
label: 'Min of bytes',
Expand All @@ -647,7 +642,6 @@ describe('IndexPattern Data Source', () => {
columns: {
col1: {
dataType: 'date',
indexPatternId: '1',
isBucketed: true,
sourceField: 'timestamp',
label: 'date histogram of timestamp',
Expand All @@ -658,7 +652,6 @@ describe('IndexPattern Data Source', () => {
},
col2: {
dataType: 'number',
indexPatternId: '1',
isBucketed: false,
sourceField: 'bytes',
label: 'Min of bytes',
Expand Down Expand Up @@ -1101,7 +1094,6 @@ describe('IndexPattern Data Source', () => {
operationType: 'max',
sourceField: 'baz',
suggestedPriority: 0,
indexPatternId: '1',
};
const columns: Record<string, IndexPatternColumn> = {
a: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export interface BaseIndexPatternColumn {
// Private
operationType: OperationType;
suggestedPriority?: DimensionPriority;
indexPatternId: string;
}

type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const countOperation: OperationDefinition<CountIndexPatternColumn> = {
},
];
},
buildColumn({ suggestedPriority, indexPatternId }) {
buildColumn({ suggestedPriority }) {
return {
label: i18n.translate('xpack.lens.indexPattern.countOf', {
defaultMessage: 'Count of documents',
Expand All @@ -31,7 +31,6 @@ export const countOperation: OperationDefinition<CountIndexPatternColumn> = {
operationType: 'count',
suggestedPriority,
isBucketed: false,
indexPatternId,
};
},
toEsAggsConfig: (column, columnId) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ describe('date_histogram', () => {
interval: 'w',
},
sourceField: 'timestamp',
indexPatternId: '1',
},
},
},
Expand All @@ -81,7 +80,6 @@ describe('date_histogram', () => {
interval: 'd',
},
sourceField: 'other_timestamp',
indexPatternId: '2',
},
},
},
Expand All @@ -95,7 +93,6 @@ describe('date_histogram', () => {
columns: {},
suggestedPriority: 0,
layerId: 'first',
indexPatternId: '1',
field: {
name: 'timestamp',
type: 'date',
Expand All @@ -112,7 +109,6 @@ describe('date_histogram', () => {
columns: {},
suggestedPriority: 0,
layerId: 'first',
indexPatternId: '1',
field: {
name: 'timestamp',
type: 'date',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,9 @@ export const dateHistogramOperation: OperationDefinition<DateHistogramIndexPatte
},
buildColumn({
suggestedPriority,
indexPatternId,
field,
}: {
suggestedPriority: DimensionPriority | undefined;
indexPatternId: string;
field?: IndexPatternField;
}): DateHistogramIndexPatternColumn {
if (!field) {
Expand All @@ -69,7 +67,6 @@ export const dateHistogramOperation: OperationDefinition<DateHistogramIndexPatte
timeZone = field.aggregationRestrictions.date_histogram.time_zone;
}
return {
indexPatternId,
label: ofName(field.name),
dataType: 'date',
operationType: 'date_histogram',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ describe('filter_ratio', () => {
numerator: { query: '', language: 'kuery' },
denominator: { query: '', language: 'kuery' },
},
indexPatternId: '1',
},
},
},
Expand All @@ -70,7 +69,6 @@ describe('filter_ratio', () => {
describe('buildColumn', () => {
it('should create column object with default params', () => {
const column = filterRatioOperation.buildColumn({
indexPatternId: '1',
layerId: 'first',
columns: {},
suggestedPriority: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const filterRatioOperation: OperationDefinition<FilterRatioIndexPatternCo
},
];
},
buildColumn({ suggestedPriority, indexPatternId }) {
buildColumn({ suggestedPriority }) {
return {
label: i18n.translate('xpack.lens.indexPattern.filterRatio', {
defaultMessage: 'Filter Ratio',
Expand All @@ -36,7 +36,6 @@ export const filterRatioOperation: OperationDefinition<FilterRatioIndexPatternCo
operationType: 'filter_ratio',
suggestedPriority,
isBucketed: false,
indexPatternId,
params: {
numerator: { language: 'kuery', query: '' },
denominator: { language: 'kuery', query: '' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function buildMetricOperation<T extends FieldBasedIndexPatternColumn>(
}
return [];
},
buildColumn({ suggestedPriority, field, indexPatternId }): T {
buildColumn({ suggestedPriority, field }): T {
if (!field) {
throw new Error(`Invariant: A ${type} operation can only be built with a field`);
}
Expand All @@ -45,7 +45,6 @@ function buildMetricOperation<T extends FieldBasedIndexPatternColumn>(
suggestedPriority,
sourceField: field ? field.name : '',
isBucketed: false,
indexPatternId,
} as T;
},
toEsAggsConfig: (column, columnId) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ describe('terms', () => {
orderDirection: 'asc',
},
sourceField: 'category',
indexPatternId: '1',
},
col2: {
label: 'Count',
Expand All @@ -46,7 +45,6 @@ describe('terms', () => {

// Private
operationType: 'count',
indexPatternId: '1',
},
},
},
Expand Down Expand Up @@ -76,7 +74,6 @@ describe('terms', () => {
it('should use existing metric column as order column', () => {
const termsColumn = termsOperation.buildColumn({
layerId: 'first',
indexPatternId: '1',
suggestedPriority: undefined,
columns: {
col1: {
Expand All @@ -86,7 +83,6 @@ describe('terms', () => {

// Private
operationType: 'count',
indexPatternId: '1',
},
},
});
Expand All @@ -113,7 +109,6 @@ describe('terms', () => {
orderDirection: 'asc',
},
sourceField: 'category',
indexPatternId: '1',
};
const updatedColumn = termsOperation.onOtherColumnChanged!(initialColumn, {
col1: {
Expand All @@ -123,7 +118,6 @@ describe('terms', () => {

// Private
operationType: 'count',
indexPatternId: '1',
},
});
expect(updatedColumn).toBe(initialColumn);
Expand All @@ -144,7 +138,6 @@ describe('terms', () => {
orderDirection: 'asc',
},
sourceField: 'category',
indexPatternId: '1',
},
{}
);
Expand All @@ -170,7 +163,6 @@ describe('terms', () => {
orderDirection: 'asc',
},
sourceField: 'category',
indexPatternId: '1',
},
{
col1: {
Expand All @@ -184,7 +176,6 @@ describe('terms', () => {
interval: 'w',
},
sourceField: 'timestamp',
indexPatternId: '1',
},
}
);
Expand Down Expand Up @@ -241,7 +232,6 @@ describe('terms', () => {
numerator: { query: '', language: 'kuery' },
denominator: { query: '', language: 'kuery' },
},
indexPatternId: '1',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const termsOperation: OperationDefinition<TermsIndexPatternColumn> = {
}
return [];
},
buildColumn({ suggestedPriority, columns, field, indexPatternId }) {
buildColumn({ suggestedPriority, columns, field }) {
const existingMetricColumn = Object.entries(columns)
.filter(([_columnId, column]) => column && isSortableByColumn(column))
.map(([id]) => id)[0];
Expand All @@ -65,7 +65,6 @@ export const termsOperation: OperationDefinition<TermsIndexPatternColumn> = {
suggestedPriority,
sourceField: field ? field.name : '',
isBucketed: true,
indexPatternId,
params: {
size: DEFAULT_SIZE,
orderBy: existingMetricColumn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ describe('getOperationTypesForField', () => {
interval: '1d',
},
sourceField: 'timestamp',
indexPatternId: '1',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export interface OperationDefinition<C extends BaseIndexPatternColumn> {
buildColumn: (arg: {
suggestedPriority: DimensionPriority | undefined;
layerId: string;
indexPatternId: string;
columns: Partial<Record<string, IndexPatternColumn>>;
field?: IndexPatternField;
}) => C;
Expand Down Expand Up @@ -189,6 +188,5 @@ export function buildColumn({
suggestedPriority,
field,
layerId,
indexPatternId: indexPattern.id,
});
}
Loading