-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SecuritySolution] Fix bucket names in legend (#156764)
## Summary issue: #156636 This PR is to fix the bucket name in the legend. When Stack by `@timestamp`, the bucket names in the legend were not formatted. In this PR, it parses it with users' `local` timezone and formate: <img width="2549" alt="Screenshot 2023-05-05 at 00 01 16" src="https://user-images.githubusercontent.com/6295984/236348010-6ebfae4f-6f0e-4e33-9f06-ebc887adb108.png"> https://user-images.githubusercontent.com/6295984/236355789-3438ad32-fb4f-4270-8b4e-11c56b1b5d02.mov --------- Co-authored-by: kibanamachine <[email protected]> Co-authored-by: PhilippeOberti <[email protected]>
- Loading branch information
1 parent
14f5b9e
commit f2a268c
Showing
18 changed files
with
193 additions
and
51 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
...ligence/public/modules/indicators/components/barchart/__snapshots__/wrapper.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
.../indicators/components/barchart/field_selector/__snapshots__/field_selector.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...igence/public/modules/indicators/components/barchart/legend_action/legend_action.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { render } from '@testing-library/react'; | ||
import moment from 'moment'; | ||
import React from 'react'; | ||
import { IndicatorBarchartLegendAction } from './legend_action'; | ||
|
||
jest.mock('moment'); | ||
|
||
describe('IndicatorBarchartLegendAction', () => { | ||
const mockDate = '14182940000'; | ||
|
||
const mockToIsoString = jest.fn(); | ||
beforeAll(() => { | ||
(moment as unknown as jest.Mock).mockReturnValue({ | ||
toISOString: mockToIsoString, | ||
}); | ||
}); | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
it('should formate group name if it is a date type', () => { | ||
const mockField = { | ||
label: '@timestamp', | ||
value: 'date', | ||
}; | ||
render(<IndicatorBarchartLegendAction data={mockDate} field={mockField} />); | ||
expect(mockToIsoString).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should render group name without formation', () => { | ||
const mockField = { | ||
label: 'host.name', | ||
value: 'string', | ||
}; | ||
render(<IndicatorBarchartLegendAction data={mockDate} field={mockField} />); | ||
expect(mockToIsoString).not.toHaveBeenCalled(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.