diff --git a/changelogs/fragments/10975.yml b/changelogs/fragments/10975.yml new file mode 100644 index 000000000000..82ea9d117f6e --- /dev/null +++ b/changelogs/fragments/10975.yml @@ -0,0 +1,2 @@ +fix: +- Fix hideTimeColumn and isShortDots ([#10975](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/10975)) \ No newline at end of file diff --git a/src/plugins/explore/public/helpers/data_table_helper.test.tsx b/src/plugins/explore/public/helpers/data_table_helper.test.tsx index 1c9244121e95..de54d341a561 100644 --- a/src/plugins/explore/public/helpers/data_table_helper.test.tsx +++ b/src/plugins/explore/public/helpers/data_table_helper.test.tsx @@ -99,7 +99,7 @@ describe('data_table_helper', () => { it('should return column properties without time field when hideTimeField is true', () => { const columns = ['field1', 'field2']; - const result = getLegacyDisplayedColumns(columns, mockIndexPattern, true, false); + const result = getLegacyDisplayedColumns(columns, mockIndexPattern, false, true); expect(result).toHaveLength(2); expect(result[0]).toEqual({ @@ -172,7 +172,7 @@ describe('data_table_helper', () => { sortable: false, }); - const result = getLegacyDisplayedColumns(columns, mockIndexPattern, true, false); + const result = getLegacyDisplayedColumns(columns, mockIndexPattern, false, true); expect(result[0].isSortable).toBe(false); // Should use field.sortable when osdFieldOverrides.sortable is undefined }); @@ -180,7 +180,7 @@ describe('data_table_helper', () => { it('should handle _source column removability correctly', () => { const columns = ['_source']; - const result = getLegacyDisplayedColumns(columns, mockIndexPattern, true, false); + const result = getLegacyDisplayedColumns(columns, mockIndexPattern, false, true); // hide time column expect(result[0].isRemoveable).toBe(false); // _source is not removeable when it's the only column }); @@ -188,7 +188,7 @@ describe('data_table_helper', () => { it('should make _source column removeable when there are multiple columns', () => { const columns = ['_source', 'field1']; - const result = getLegacyDisplayedColumns(columns, mockIndexPattern, true, false); + const result = getLegacyDisplayedColumns(columns, mockIndexPattern, false, true); expect(result[0].isRemoveable).toBe(true); // _source is removeable when there are other columns expect(result[1].isRemoveable).toBe(true); @@ -205,7 +205,7 @@ describe('data_table_helper', () => { 'spanId', ]; - const result = getLegacyDisplayedColumns(columns, mockIndexPattern, true, false); + const result = getLegacyDisplayedColumns(columns, mockIndexPattern, false, true); expect(result[0].displayName).toBe('Service Identifier'); expect(result[1].displayName).toBe('Duration'); diff --git a/src/plugins/explore/public/helpers/data_table_helper.tsx b/src/plugins/explore/public/helpers/data_table_helper.tsx index f49f22a9c5d8..97f35be0207b 100644 --- a/src/plugins/explore/public/helpers/data_table_helper.tsx +++ b/src/plugins/explore/public/helpers/data_table_helper.tsx @@ -110,8 +110,8 @@ function getColumnDisplayName(column: string): string { export function getLegacyDisplayedColumns( columns: string[], indexPattern: IndexPattern | Dataset, - hideTimeField: boolean, - isShortDots: boolean + isShortDots: boolean, + hideTimeField: boolean ): LegacyDisplayedColumn[] { if (!Array.isArray(columns) || !indexPattern || !indexPattern.getFieldByName) { return [];