mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
* decentralizing page url-params management -- PoC / tsc 4.1 random fixes Signed-off-by: Roman <ixrock@gmail.com> * fixes, tweak example-extension for demo Signed-off-by: Roman <ixrock@gmail.com> * lint fixes, revert tests Signed-off-by: Roman <ixrock@gmail.com> * removed occasional changes related to typescript 4.1 Signed-off-by: Roman <ixrock@gmail.com> * updated example with 2 menu-items targeting same page with different params Signed-off-by: Roman <ixrock@gmail.com> * fix: merge page url chunks with native URL()-api, simplified default page-params registration Signed-off-by: Roman <ixrock@gmail.com> * fix: make lint happy Signed-off-by: Roman <ixrock@gmail.com> * fix: unit-tests Signed-off-by: Roman <ixrock@gmail.com> * renaming by jim's request: UrlParam => PageParam (type), createUrlParam => createPageParam (helper) Signed-off-by: Roman <ixrock@gmail.com> * fix: reverting NamespaceStore public-api breaking changes Signed-off-by: Roman <ixrock@gmail.com> * lint fix Signed-off-by: Roman <ixrock@gmail.com> * fine-tuning Signed-off-by: Roman <ixrock@gmail.com> * yes, lint always unhappy Signed-off-by: Roman <ixrock@gmail.com> * fix build Signed-off-by: Roman <ixrock@gmail.com> * small fixes Signed-off-by: Roman <ixrock@gmail.com> * fix merge-conflicts Signed-off-by: Roman <ixrock@gmail.com> * removed `isSystem` page-param's init field exposed to extensions-api Signed-off-by: Roman <ixrock@gmail.com>
104 lines
3.1 KiB
TypeScript
104 lines
3.1 KiB
TypeScript
import "./workloads.scss";
|
|
|
|
import React from "react";
|
|
import { observer } from "mobx-react";
|
|
import { Trans } from "@lingui/macro";
|
|
import { TabLayout, TabLayoutRoute } from "../layout/tab-layout";
|
|
import { WorkloadsOverview } from "../+workloads-overview/overview";
|
|
import { cronJobsRoute, cronJobsURL, daemonSetsRoute, daemonSetsURL, deploymentsRoute, deploymentsURL, jobsRoute, jobsURL, overviewRoute, overviewURL, podsRoute, podsURL, replicaSetsRoute, replicaSetsURL, statefulSetsRoute, statefulSetsURL } from "./workloads.route";
|
|
import { namespaceUrlParam } from "../+namespaces/namespace.store";
|
|
import { Pods } from "../+workloads-pods";
|
|
import { Deployments } from "../+workloads-deployments";
|
|
import { DaemonSets } from "../+workloads-daemonsets";
|
|
import { StatefulSets } from "../+workloads-statefulsets";
|
|
import { Jobs } from "../+workloads-jobs";
|
|
import { CronJobs } from "../+workloads-cronjobs";
|
|
import { isAllowedResource } from "../../../common/rbac";
|
|
import { ReplicaSets } from "../+workloads-replicasets";
|
|
|
|
@observer
|
|
export class Workloads extends React.Component {
|
|
static get tabRoutes(): TabLayoutRoute[] {
|
|
const query = namespaceUrlParam.toObjectParam();
|
|
const routes: TabLayoutRoute[] = [
|
|
{
|
|
title: <Trans>Overview</Trans>,
|
|
component: WorkloadsOverview,
|
|
url: overviewURL({ query }),
|
|
routePath: overviewRoute.path.toString()
|
|
}
|
|
];
|
|
|
|
if (isAllowedResource("pods")) {
|
|
routes.push({
|
|
title: <Trans>Pods</Trans>,
|
|
component: Pods,
|
|
url: podsURL({ query }),
|
|
routePath: podsRoute.path.toString()
|
|
});
|
|
}
|
|
|
|
if (isAllowedResource("deployments")) {
|
|
routes.push({
|
|
title: <Trans>Deployments</Trans>,
|
|
component: Deployments,
|
|
url: deploymentsURL({ query }),
|
|
routePath: deploymentsRoute.path.toString(),
|
|
});
|
|
}
|
|
|
|
if (isAllowedResource("daemonsets")) {
|
|
routes.push({
|
|
title: <Trans>DaemonSets</Trans>,
|
|
component: DaemonSets,
|
|
url: daemonSetsURL({ query }),
|
|
routePath: daemonSetsRoute.path.toString(),
|
|
});
|
|
}
|
|
|
|
if (isAllowedResource("statefulsets")) {
|
|
routes.push({
|
|
title: <Trans>StatefulSets</Trans>,
|
|
component: StatefulSets,
|
|
url: statefulSetsURL({ query }),
|
|
routePath: statefulSetsRoute.path.toString(),
|
|
});
|
|
}
|
|
|
|
if (isAllowedResource("replicasets")) {
|
|
routes.push({
|
|
title: <Trans>ReplicaSets</Trans>,
|
|
component: ReplicaSets,
|
|
url: replicaSetsURL({ query }),
|
|
routePath: replicaSetsRoute.path.toString(),
|
|
});
|
|
}
|
|
|
|
if (isAllowedResource("jobs")) {
|
|
routes.push({
|
|
title: <Trans>Jobs</Trans>,
|
|
component: Jobs,
|
|
url: jobsURL({ query }),
|
|
routePath: jobsRoute.path.toString(),
|
|
});
|
|
}
|
|
|
|
if (isAllowedResource("cronjobs")) {
|
|
routes.push({
|
|
title: <Trans>CronJobs</Trans>,
|
|
component: CronJobs,
|
|
url: cronJobsURL({ query }),
|
|
routePath: cronJobsRoute.path.toString(),
|
|
});
|
|
}
|
|
|
|
return routes;
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<TabLayout className="Workloads" tabs={Workloads.tabRoutes}/>
|
|
);
|
|
}
|
|
}
|