chore: refactor
This commit is contained in:
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
import React, { FC, useState } from 'react';
|
||||
import {
|
||||
Content,
|
||||
@@ -29,13 +28,12 @@ import {
|
||||
} from '@backstage/core';
|
||||
|
||||
import ClusterTable from '../ClusterTable/ClusterTable';
|
||||
import { Button, useTheme } from '@material-ui/core';
|
||||
import { Button } from '@material-ui/core';
|
||||
import { useAsync } from 'react-use';
|
||||
import { gitOpsApiRef } from '../../api';
|
||||
import { Alert } from '@material-ui/lab';
|
||||
|
||||
const ClusterList: FC<{}> = () => {
|
||||
const backstageTheme = useTheme<BackstageTheme>();
|
||||
const api = useApi(gitOpsApiRef);
|
||||
const githubAuth = useApi(githubAuthApiRef);
|
||||
const [githubUsername, setGithubUsername] = useState(String);
|
||||
@@ -92,11 +90,7 @@ const ClusterList: FC<{}> = () => {
|
||||
}
|
||||
|
||||
return (
|
||||
<Page
|
||||
theme={backstageTheme.getPageTheme({
|
||||
themeId: 'home',
|
||||
})}
|
||||
>
|
||||
<Page themeId="home">
|
||||
<Header title="GitOps-managed Clusters">
|
||||
<HeaderLabel label="Welcome" value={githubUsername} />
|
||||
</Header>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
import React, { FC, useEffect, useState } from 'react';
|
||||
import {
|
||||
Content,
|
||||
@@ -26,13 +25,12 @@ import {
|
||||
githubAuthApiRef,
|
||||
} from '@backstage/core';
|
||||
|
||||
import { Link, useTheme } from '@material-ui/core';
|
||||
import { Link } from '@material-ui/core';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { gitOpsApiRef, Status } from '../../api';
|
||||
import { transformRunStatus } from '../ProfileCatalog';
|
||||
|
||||
const ClusterPage: FC<{}> = () => {
|
||||
const backstageTheme = useTheme<BackstageTheme>();
|
||||
const params = useParams() as { owner: string; repo: string };
|
||||
|
||||
const [pollingLog, setPollingLog] = useState(true);
|
||||
@@ -85,11 +83,7 @@ const ClusterPage: FC<{}> = () => {
|
||||
}, [pollingLog, api, params, githubAuth, githubAccessToken, githubUsername]);
|
||||
|
||||
return (
|
||||
<Page
|
||||
theme={backstageTheme.getPageTheme({
|
||||
themeId: 'home',
|
||||
})}
|
||||
>
|
||||
<Page themeId="home">
|
||||
<Header title={`Cluster ${params.owner}/${params.repo}`}>
|
||||
<HeaderLabel label="Welcome" value={githubUsername} />
|
||||
</Header>
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
import React, { FC, useEffect, useState } from 'react';
|
||||
import {
|
||||
Header,
|
||||
@@ -37,7 +36,7 @@ import {
|
||||
useApi,
|
||||
githubAuthApiRef,
|
||||
} from '@backstage/core';
|
||||
import { TextField, List, ListItem, Link, useTheme } from '@material-ui/core';
|
||||
import { TextField, List, ListItem, Link } from '@material-ui/core';
|
||||
|
||||
import ClusterTemplateCardList from '../ClusterTemplateCardList';
|
||||
import ProfileCardList from '../ProfileCardList';
|
||||
@@ -81,8 +80,6 @@ export const transformRunStatus = (x: Status[]) => {
|
||||
};
|
||||
|
||||
const ProfileCatalog: FC<{}> = () => {
|
||||
const backstageTheme = useTheme<BackstageTheme>();
|
||||
|
||||
// TODO: get data from REST API
|
||||
const [clusterTemplates] = React.useState([
|
||||
{
|
||||
@@ -261,11 +258,7 @@ const ProfileCatalog: FC<{}> = () => {
|
||||
];
|
||||
|
||||
return (
|
||||
<Page
|
||||
theme={backstageTheme.getPageTheme({
|
||||
themeId: 'tool',
|
||||
})}
|
||||
>
|
||||
<Page themeId="tool">
|
||||
<Header
|
||||
title="Create GitOps-managed Cluster"
|
||||
subtitle="Kubernetes cluster with ready-to-use profiles"
|
||||
|
||||
Reference in New Issue
Block a user