1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Show event last-seen column in addition to age (#2820)

This commit is contained in:
Sebastian Malton 2021-05-25 10:34:28 -04:00 committed by GitHub
parent 45d74b8c3a
commit 73b5d30692
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,6 +46,7 @@ enum columnId {
count = "count",
source = "source",
age = "age",
lastSeen = "last-seen",
}
interface Props extends Partial<KubeObjectListLayoutProps> {
@ -61,6 +62,7 @@ const defaultProps: Partial<Props> = {
@observer
export class Events extends React.Component<Props> {
static defaultProps = defaultProps as object;
now = Date.now();
@observable sorting: TableSortParams = {
sortBy: columnId.age,
@ -73,6 +75,7 @@ export class Events extends React.Component<Props> {
[columnId.object]: (event: KubeEvent) => event.involvedObject.name,
[columnId.count]: (event: KubeEvent) => event.count,
[columnId.age]: (event: KubeEvent) => event.getTimeDiffFromNow(),
[columnId.lastSeen]: (event: KubeEvent) => this.now - new Date(event.lastTimestamp).getTime(),
};
private tableConfiguration: TableProps = {
@ -168,7 +171,8 @@ export class Events extends React.Component<Props> {
{ title: "Involved Object", className: "object", sortBy: columnId.object, id: columnId.object },
{ title: "Source", className: "source", id: columnId.source },
{ title: "Count", className: "count", sortBy: columnId.count, id: columnId.count },
{ title: "Last Seen", className: "age", sortBy: columnId.age, id: columnId.age },
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
{ title: "Last Seen", className: "last-seen", sortBy: columnId.lastSeen, id: columnId.lastSeen },
]}
renderTableContents={(event: KubeEvent) => {
const { involvedObject, type, message } = event;
@ -195,6 +199,7 @@ export class Events extends React.Component<Props> {
event.getSource(),
event.count,
event.getAge(),
event.getLastSeenTime(),
];
}}
/>