mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
follow-up fix for #2113: incorrectly filtered events with compact=true
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
b873ba76bd
commit
e348cd4ace
@ -1,9 +1,11 @@
|
|||||||
import "./events.scss";
|
import "./events.scss";
|
||||||
|
|
||||||
import React, { Fragment } from "react";
|
import React, { Fragment } from "react";
|
||||||
|
import { computed } from "mobx";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
|
import { orderBy } from "lodash";
|
||||||
import { TabLayout } from "../layout/tab-layout";
|
import { TabLayout } from "../layout/tab-layout";
|
||||||
import { eventStore } from "./event.store";
|
import { EventStore, eventStore } from "./event.store";
|
||||||
import { getDetailsUrl, KubeObjectListLayout, KubeObjectListLayoutProps } from "../kube-object";
|
import { getDetailsUrl, KubeObjectListLayout, KubeObjectListLayoutProps } from "../kube-object";
|
||||||
import { KubeEvent } from "../../api/endpoints/events.api";
|
import { KubeEvent } from "../../api/endpoints/events.api";
|
||||||
import { Tooltip } from "../tooltip";
|
import { Tooltip } from "../tooltip";
|
||||||
@ -12,6 +14,7 @@ import { cssNames, IClassName, stopPropagation } from "../../utils";
|
|||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { lookupApiLink } from "../../api/kube-api";
|
import { lookupApiLink } from "../../api/kube-api";
|
||||||
import { eventsURL } from "./events.route";
|
import { eventsURL } from "./events.route";
|
||||||
|
import { TableSortParams } from "../table";
|
||||||
|
|
||||||
enum columnId {
|
enum columnId {
|
||||||
message = "message",
|
message = "message",
|
||||||
@ -37,12 +40,20 @@ const defaultProps: Partial<Props> = {
|
|||||||
export class Events extends React.Component<Props> {
|
export class Events extends React.Component<Props> {
|
||||||
static defaultProps = defaultProps as object;
|
static defaultProps = defaultProps as object;
|
||||||
|
|
||||||
get store() {
|
private defaultSorting: TableSortParams = {
|
||||||
|
sortBy: columnId.type,
|
||||||
|
orderBy: "desc", // show "Warning" events at the top
|
||||||
|
};
|
||||||
|
|
||||||
|
get store(): EventStore {
|
||||||
return eventStore;
|
return eventStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
get items() {
|
@computed get items(): KubeEvent[] {
|
||||||
return eventStore.contextItems;
|
const { sortBy, orderBy: order } = this.defaultSorting;
|
||||||
|
|
||||||
|
// we must sort items before passing to KubeObjectListLayout for proper handling "compact" mode
|
||||||
|
return orderBy(this.store.contextItems, sortBy, order as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -68,10 +79,7 @@ export class Events extends React.Component<Props> {
|
|||||||
renderHeaderTitle={compact && !allEventsAreShown ? compactModeHeader : "Events"}
|
renderHeaderTitle={compact && !allEventsAreShown ? compactModeHeader : "Events"}
|
||||||
tableProps={{
|
tableProps={{
|
||||||
sortSyncWithUrl: false,
|
sortSyncWithUrl: false,
|
||||||
sortByDefault: {
|
sortByDefault: this.defaultSorting,
|
||||||
sortBy: columnId.type,
|
|
||||||
orderBy: "desc", // show "Warning" events at the top
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[columnId.namespace]: (event: KubeEvent) => event.getNs(),
|
[columnId.namespace]: (event: KubeEvent) => event.getNs(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user