mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
# Backport This will backport the following commits from `main` to `8.12`: - [[Lens] Fix table alignment (#173908)](https://github.com/elastic/kibana/pull/173908) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Marco Liberati","email":"dej611@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-01-02T12:54:07Z","message":"[Lens] Fix table alignment (#173908)\n\n## Summary\r\n\r\nFixes https://github.com/elastic/kibana/issues/173902\r\n\r\nFix issue and introduces also a unit test.\r\n\r\n\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"2cddc6036879380723e3c3a6b382fb84217070aa","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Visualizations","Feature:Lens","backport:prev-minor","v8.12.0","v8.13.0"],"title":"[Lens] Fix table alignment","number":173908,"url":"https://github.com/elastic/kibana/pull/173908","mergeCommit":{"message":"[Lens] Fix table alignment (#173908)\n\n## Summary\r\n\r\nFixes https://github.com/elastic/kibana/issues/173902\r\n\r\nFix issue and introduces also a unit test.\r\n\r\n\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"2cddc6036879380723e3c3a6b382fb84217070aa"}},"sourceBranch":"main","suggestedTargetBranches":["8.12"],"targetPullRequestStates":[{"branch":"8.12","label":"v8.12.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/173908","number":173908,"mergeCommit":{"message":"[Lens] Fix table alignment (#173908)\n\n## Summary\r\n\r\nFixes https://github.com/elastic/kibana/issues/173902\r\n\r\nFix issue and introduces also a unit test.\r\n\r\n\r\n\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"2cddc6036879380723e3c3a6b382fb84217070aa"}}]}] BACKPORT--> Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
This commit is contained in:
parent
1fb896593f
commit
c8e877abc2
3 changed files with 43 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
Kibana source code with Kibana X-Pack source code
|
||||
Copyright 2012-2023 Elasticsearch B.V.
|
||||
Copyright 2012-2024 Elasticsearch B.V.
|
||||
|
||||
---
|
||||
Pretty handling of logarithmic axes.
|
||||
|
|
|
@ -759,6 +759,47 @@ describe('Datatable Visualization', () => {
|
|||
}).headerRowHeightLines
|
||||
).toEqual([2]);
|
||||
});
|
||||
|
||||
it('sets alignment correctly', () => {
|
||||
datasource.publicAPIMock.getOperationForColumnId.mockReturnValue({
|
||||
dataType: 'string',
|
||||
isBucketed: false, // <= make them metrics
|
||||
label: 'label',
|
||||
isStaticValue: false,
|
||||
hasTimeShift: false,
|
||||
hasReducedTimeRange: false,
|
||||
});
|
||||
const expression = datatableVisualization.toExpression(
|
||||
{
|
||||
...defaultExpressionTableState,
|
||||
columns: [
|
||||
{ columnId: 'b', alignment: 'center' },
|
||||
{ columnId: 'c', alignment: 'left' },
|
||||
{ columnId: 'a' },
|
||||
],
|
||||
},
|
||||
frame.datasourceLayers,
|
||||
{},
|
||||
{ '1': { type: 'expression', chain: [] } }
|
||||
) as Ast;
|
||||
|
||||
const columnArgs = buildExpression(expression).findFunction('lens_datatable_column');
|
||||
expect(columnArgs[0].arguments).toEqual(
|
||||
expect.objectContaining({
|
||||
alignment: ['left'],
|
||||
})
|
||||
);
|
||||
expect(columnArgs[1].arguments).toEqual(
|
||||
expect.objectContaining({
|
||||
alignment: ['center'],
|
||||
})
|
||||
);
|
||||
expect(columnArgs[2].arguments).toEqual(
|
||||
expect.not.objectContaining({
|
||||
alignment: [],
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#onEditAction', () => {
|
||||
|
|
|
@ -496,6 +496,7 @@ export const getDatatableVisualization = ({
|
|||
width: column.width,
|
||||
isTransposed: column.isTransposed,
|
||||
transposable: isTransposable,
|
||||
alignment: column.alignment,
|
||||
colorMode: canColor && column.colorMode ? column.colorMode : 'none',
|
||||
palette: paletteService.get(CUSTOM_PALETTE).toExpression(paletteParams),
|
||||
summaryRow: hasNoSummaryRow ? undefined : column.summaryRow!,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue