mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Configurable columns in Jobs table
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
f1aa703dc6
commit
fcf54ca054
@ -12,9 +12,10 @@ import { IJobsRouteParams } from "../+workloads";
|
|||||||
import kebabCase from "lodash/kebabCase";
|
import kebabCase from "lodash/kebabCase";
|
||||||
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
import { KubeObjectStatusIcon } from "../kube-object-status-icon";
|
||||||
|
|
||||||
enum sortBy {
|
enum columnId {
|
||||||
name = "name",
|
name = "name",
|
||||||
namespace = "namespace",
|
namespace = "namespace",
|
||||||
|
completions = "completions",
|
||||||
conditions = "conditions",
|
conditions = "conditions",
|
||||||
age = "age",
|
age = "age",
|
||||||
}
|
}
|
||||||
@ -27,25 +28,27 @@ export class Jobs extends React.Component<Props> {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<KubeObjectListLayout
|
<KubeObjectListLayout
|
||||||
|
isConfigurable
|
||||||
|
tableId="workload_jobs"
|
||||||
className="Jobs" store={jobStore}
|
className="Jobs" store={jobStore}
|
||||||
dependentStores={[podsStore, eventStore]}
|
dependentStores={[podsStore, eventStore]}
|
||||||
sortingCallbacks={{
|
sortingCallbacks={{
|
||||||
[sortBy.name]: (job: Job) => job.getName(),
|
[columnId.name]: (job: Job) => job.getName(),
|
||||||
[sortBy.namespace]: (job: Job) => job.getNs(),
|
[columnId.namespace]: (job: Job) => job.getNs(),
|
||||||
[sortBy.conditions]: (job: Job) => job.getCondition() != null ? job.getCondition().type : "",
|
[columnId.conditions]: (job: Job) => job.getCondition() != null ? job.getCondition().type : "",
|
||||||
[sortBy.age]: (job: Job) => job.metadata.creationTimestamp,
|
[columnId.age]: (job: Job) => job.metadata.creationTimestamp,
|
||||||
}}
|
}}
|
||||||
searchFilters={[
|
searchFilters={[
|
||||||
(job: Job) => job.getSearchFields(),
|
(job: Job) => job.getSearchFields(),
|
||||||
]}
|
]}
|
||||||
renderHeaderTitle="Jobs"
|
renderHeaderTitle="Jobs"
|
||||||
renderTableHeader={[
|
renderTableHeader={[
|
||||||
{ title: "Name", className: "name", sortBy: sortBy.name },
|
{ title: "Name", className: "name", sortBy: columnId.name, id: columnId.name },
|
||||||
{ title: "Namespace", className: "namespace", sortBy: sortBy.namespace },
|
{ title: "Namespace", className: "namespace", sortBy: columnId.namespace, id: columnId.namespace },
|
||||||
{ title: "Completions", className: "completions" },
|
{ title: "Completions", className: "completions", id: columnId.completions },
|
||||||
{ className: "warning" },
|
{ className: "warning", showWithColumn: columnId.completions },
|
||||||
{ title: "Age", className: "age", sortBy: sortBy.age },
|
{ title: "Age", className: "age", sortBy: columnId.age, id: columnId.age },
|
||||||
{ title: "Conditions", className: "conditions", sortBy: sortBy.conditions },
|
{ title: "Conditions", className: "conditions", sortBy: columnId.conditions, id: columnId.conditions },
|
||||||
]}
|
]}
|
||||||
renderTableContents={(job: Job) => {
|
renderTableContents={(job: Job) => {
|
||||||
const condition = job.getCondition();
|
const condition = job.getCondition();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user