mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add age column to cluster overview (#1970)
Signed-off-by: Alex Culliere <alozhkin@mirantis.com>
This commit is contained in:
parent
1e8359851c
commit
55759fb3b8
@ -23,11 +23,13 @@ interface IWarning extends ItemObject {
|
|||||||
kind: string;
|
kind: string;
|
||||||
message: string;
|
message: string;
|
||||||
selfLink: string;
|
selfLink: string;
|
||||||
|
age: string | number;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum sortBy {
|
enum sortBy {
|
||||||
type = "type",
|
type = "type",
|
||||||
object = "object"
|
object = "object",
|
||||||
|
age = "age",
|
||||||
}
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
@ -35,6 +37,7 @@ export class ClusterIssues extends React.Component<Props> {
|
|||||||
private sortCallbacks = {
|
private sortCallbacks = {
|
||||||
[sortBy.type]: (warning: IWarning) => warning.kind,
|
[sortBy.type]: (warning: IWarning) => warning.kind,
|
||||||
[sortBy.object]: (warning: IWarning) => warning.getName(),
|
[sortBy.object]: (warning: IWarning) => warning.getName(),
|
||||||
|
[sortBy.age]: (warning: IWarning) => warning.age || "",
|
||||||
};
|
};
|
||||||
|
|
||||||
@computed get warnings() {
|
@computed get warnings() {
|
||||||
@ -42,15 +45,16 @@ export class ClusterIssues extends React.Component<Props> {
|
|||||||
|
|
||||||
// Node bad conditions
|
// Node bad conditions
|
||||||
nodesStore.items.forEach(node => {
|
nodesStore.items.forEach(node => {
|
||||||
const { kind, selfLink, getId, getName } = node;
|
const { kind, selfLink, getId, getName, getAge } = node;
|
||||||
|
|
||||||
node.getWarningConditions().forEach(({ message }) => {
|
node.getWarningConditions().forEach(({ message }) => {
|
||||||
warnings.push({
|
warnings.push({
|
||||||
kind,
|
age: getAge(),
|
||||||
getId,
|
getId,
|
||||||
getName,
|
getName,
|
||||||
selfLink,
|
kind,
|
||||||
message,
|
message,
|
||||||
|
selfLink,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -59,12 +63,13 @@ export class ClusterIssues extends React.Component<Props> {
|
|||||||
const events = eventStore.getWarnings();
|
const events = eventStore.getWarnings();
|
||||||
|
|
||||||
events.forEach(error => {
|
events.forEach(error => {
|
||||||
const { message, involvedObject } = error;
|
const { message, involvedObject, getAge } = error;
|
||||||
const { uid, name, kind } = involvedObject;
|
const { uid, name, kind } = involvedObject;
|
||||||
|
|
||||||
warnings.push({
|
warnings.push({
|
||||||
getId: () => uid,
|
getId: () => uid,
|
||||||
getName: () => name,
|
getName: () => name,
|
||||||
|
age: getAge(),
|
||||||
message,
|
message,
|
||||||
kind,
|
kind,
|
||||||
selfLink: lookupApiLink(involvedObject, error),
|
selfLink: lookupApiLink(involvedObject, error),
|
||||||
@ -78,7 +83,7 @@ export class ClusterIssues extends React.Component<Props> {
|
|||||||
getTableRow(uid: string) {
|
getTableRow(uid: string) {
|
||||||
const { warnings } = this;
|
const { warnings } = this;
|
||||||
const warning = warnings.find(warn => warn.getId() == uid);
|
const warning = warnings.find(warn => warn.getId() == uid);
|
||||||
const { getId, getName, message, kind, selfLink } = warning;
|
const { getId, getName, message, kind, selfLink, age } = warning;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TableRow
|
<TableRow
|
||||||
@ -96,6 +101,9 @@ export class ClusterIssues extends React.Component<Props> {
|
|||||||
<TableCell className="kind">
|
<TableCell className="kind">
|
||||||
{kind}
|
{kind}
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
<TableCell className="age">
|
||||||
|
{age}
|
||||||
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -139,6 +147,7 @@ export class ClusterIssues extends React.Component<Props> {
|
|||||||
<TableCell className="message">Message</TableCell>
|
<TableCell className="message">Message</TableCell>
|
||||||
<TableCell className="object" sortBy={sortBy.object}>Object</TableCell>
|
<TableCell className="object" sortBy={sortBy.object}>Object</TableCell>
|
||||||
<TableCell className="kind" sortBy={sortBy.type}>Type</TableCell>
|
<TableCell className="kind" sortBy={sortBy.type}>Type</TableCell>
|
||||||
|
<TableCell className="timestamp" sortBy={sortBy.age}>Age</TableCell>
|
||||||
</TableHead>
|
</TableHead>
|
||||||
</Table>
|
</Table>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user