PageRegistration & BaseRegistry refactoring (#1334)

Signed-off-by: Roman <ixrock@gmail.com>
Co-authored-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
RomanandJari Kolehmainen authored and GitHub committed 2020-11-12 16:29:02 +02:00
1 parent 6432b3bb9e
commit faa1cef307
43 files changed
+432 -369

No files matched your search

+5 -12
View File
@@ -1,41 +1,34 @@
import React from "react";
import { observer } from "mobx-react";
import { Redirect, Route, Switch } from "react-router";
import { Trans } from "@lingui/macro";
import { TabLayout, TabRoute } from "../layout/tab-layout";
import { TabLayout, TabLayoutRoute } from "../layout/tab-layout";
import { HelmCharts, helmChartsRoute, helmChartsURL } from "../+apps-helm-charts";
import { HelmReleases, releaseRoute, releaseURL } from "../+apps-releases";
import { namespaceStore } from "../+namespaces/namespace.store";
@observer
export class Apps extends React.Component {
static get tabRoutes(): TabRoute[] {
static get tabRoutes(): TabLayoutRoute[] {
const query = namespaceStore.getContextParams();
return [
{
title: <Trans>Charts</Trans>,
component: HelmCharts,
url: helmChartsURL(),
path: helmChartsRoute.path,
routePath: helmChartsRoute.path.toString(),
},
{
title: <Trans>Releases</Trans>,
component: HelmReleases,
url: releaseURL({ query }),
path: releaseRoute.path,
routePath: releaseRoute.path.toString(),
},
]
}
render() {
const tabRoutes = Apps.tabRoutes;
return (
<TabLayout className="Apps" tabs={tabRoutes}>
<Switch>
{tabRoutes.map((route, index) => <Route key={index} {...route}/>)}
<Redirect to={tabRoutes[0].url}/>
</Switch>
</TabLayout>
<TabLayout className="Apps" tabs={Apps.tabRoutes}/>
)
}
}