Skip to content

Commit 2b8f78d

Browse files
committed
feat: add created & updated at columns to sessions/events list
1 parent 29979ec commit 2b8f78d

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

ami/main/api/serializers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ class Meta:
323323
"taxa_count",
324324
"captures",
325325
"example_captures",
326+
"created_at",
327+
"updated_at",
326328
]
327329

328330
def get_captures(self, obj):
@@ -1317,6 +1319,8 @@ class Meta:
13171319
"first_capture",
13181320
"summary_data",
13191321
"capture_page_offset",
1322+
"created_at",
1323+
"updated_at",
13201324
]
13211325

13221326
def get_captures(self, obj):

ui/src/data-services/models/session.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { getCompactDatespanString } from 'utils/date/getCompactDatespanString/getCompactDatespanString'
22
import { getCompactTimespanString } from 'utils/date/getCompactTimespanString/getCompactTimespanString'
33
import { getFormatedDateString } from 'utils/date/getFormatedDateString/getFormatedDateString'
4+
import { getFormatedDateTimeString } from 'utils/date/getFormatedDateTimeString/getFormatedDateTimeString'
45
import { getFormatedTimeString } from 'utils/date/getFormatedTimeString/getFormatedTimeString'
56

67
export type ServerEvent = any // TODO: Update this type
@@ -99,4 +100,16 @@ export class Session {
99100
date2: new Date(this._event.end),
100101
})
101102
}
103+
104+
get createdAt(): string {
105+
return getFormatedDateTimeString({
106+
date: new Date(this._event.created_at),
107+
})
108+
}
109+
110+
get updatedAt(): string {
111+
return getFormatedDateTimeString({
112+
date: new Date(this._event.updated_at),
113+
})
114+
}
102115
}

ui/src/pages/sessions/session-columns.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,16 @@ export const columns: (projectId: string) => TableColumn<Session>[] = (
134134
</Link>
135135
),
136136
},
137+
{
138+
id: 'created-at',
139+
name: translate(STRING.FIELD_LABEL_CREATED_AT),
140+
sortField: 'created_at',
141+
renderCell: (item: Session) => <BasicTableCell value={item.createdAt} />,
142+
},
143+
{
144+
id: 'updated-at',
145+
name: translate(STRING.FIELD_LABEL_UPDATED_AT),
146+
sortField: 'updated_at',
147+
renderCell: (item: Session) => <BasicTableCell value={item.updatedAt} />,
148+
},
137149
]

0 commit comments

Comments
 (0)