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
[Cases] Added Updated on column in Cases table #149116
[Cases] Added Updated on column in Cases table #149116
Conversation
…URL and local storage on all cases list
Pinging @elastic/response-ops-cases (Feature:Cases) |
Pinging @elastic/response-ops (Team:ResponseOps) |
render: (updatedAt: Case['updatedAt']) => { | ||
if (updatedAt != null) { | ||
return ( | ||
<span data-test-subj={`case-table-column-updatedAt`}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for {
}
can just be a string.
@@ -519,6 +520,9 @@ export const convertSortField = (sortField: string | undefined): SortFieldCase = | |||
return SortFieldCase.title; | |||
case 'severity': | |||
return SortFieldCase.severity; | |||
case 'updatedAt': | |||
case 'updated_at': | |||
return SortFieldCase.updatedAt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw createdAt/_at
and closedAt/_at
do the same but why do we need both conversions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know to be honest, but first I added updated_at
only and sorting didn't work.
Then I added updatedAt
and it worked 😄 And it makes sense because I added updatedAt
sorting filed.
So I assumed updated_at
might be used somewhere. Couldn't find it assigned to sortField
anywhere though 🤷♀️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I added updatedAt and it worked 😄 And it makes sense because I added updatedAt sorting filed.
This is so weird. Most places I found use SortFieldCase.updatedAt
which is updated_at
so dunno where updatedAt might be passed 🤔 . Anyway, this is fine, no need to change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I found it. The rows are populated with instances of
export type Case = Omit<SnakeToCamelCase<CaseResponse>, 'comments'> & { comments: Comment[] };
so when adding the columns we do:
columns.push({
field: 'updatedAt',
render: (updatedAt: Case['updatedAt']) => {
Clicking a header of this table calls tableOnChangeCallback
defined in all_cases_list.tsx
row 120.
This is triggered when the sorting changes in the EuiTable(see onChange props).
So that field: 'updatedAt'
is passed to this callback and then we need to say sortField: getSortField(sort.field),
Dunno, it looks unnecessarily complicated.
But don't change it, I am just digging around 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!! However I have another issue in which we will redesign this modal to show only necessary information. |
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
## Summary Fixes elastic#148871 Adds new column `Updated on ` in `Cases` table. This column can be sorted and can persist sorting options. ![image](https://user-images.githubusercontent.com/117571355/213171804-9fa1bc42-8b8b-4b7b-baf3-03ce649b1dc6.png) ### Checklist - [x] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) ### Release notes - Adds new column `Updated on ` in `all cases list ` table. This column can be sorted and can persist sorting options.
Summary
Fixes #148871
Adds new column
Updated on
inCases
table. This column can be sorted and can persist sorting options.Checklist
Release notes
Updated on
inall cases list
table. This column can be sorted and can persist sorting options.