diff --git a/plugins/circleci/README.md b/plugins/circleci/README.md
index 2dcc137a47..48e1bee6cc 100644
--- a/plugins/circleci/README.md
+++ b/plugins/circleci/README.md
@@ -4,8 +4,6 @@ Website: [https://circleci.com/](https://circleci.com/)
-
-
## Setup
@@ -35,8 +33,39 @@ export default builder.build() as ApiHolder;
export { plugin as Circleci } from '@backstage/plugin-circleci';
```
-3. Run app with `yarn start` and navigate to `/circleci/settings`
-4. Enter project settings and **project** token, acquired according to [https://circleci.com/docs/2.0/managing-api-tokens/](https://circleci.com/docs/2.0/managing-api-tokens/)
+3. Register the plugin router:
+
+```jsx
+// packages/app/src/components/catalog/EntityPage.tsx
+
+import { Router as CircleCIRouter } from '@backstage/plugin-circleci';
+
+// Then somewhere inside
+}
+/>;
+```
+
+4. Add proxy config:
+
+```
+// app-config.yaml
+proxy:
+ '/circleci/api':
+ target: https://circleci.com/api/v1.1
+ changeOrigin: true
+ pathRewrite:
+ '^/proxy/circleci/api/': '/'
+ headers:
+ Circle-Token:
+ $secret:
+ env: CIRCLECI_AUTH_TOKEN
+```
+
+5. Get and provide `CIRCLECI_AUTH_TOKEN` as env variable (https://circleci.com/docs/api/#add-an-api-token)
+6. Add `circleci.com/project-slug` annotation to your component-info.yaml file in format // (https://backstage.io/docs/architecture-decisions/adrs-adr002#format)
## Features
@@ -50,3 +79,4 @@ export { plugin as Circleci } from '@backstage/plugin-circleci';
## Limitations
- CircleCI has pretty strict rate limits per token, be careful with opened tabs
+- CircelCI doesn't provide a way to auth by 3rd party (e.g. GitHub) token, nor by calling their OAuth endpoints, which currently stands in the way of better auth integration with Backstage (https://discuss.circleci.com/t/circleci-api-authorization-with-github-token/5356)
diff --git a/plugins/circleci/src/assets/screenshot-1.png b/plugins/circleci/src/assets/screenshot-1.png
index 2e3f1f420b..db99230a65 100644
Binary files a/plugins/circleci/src/assets/screenshot-1.png and b/plugins/circleci/src/assets/screenshot-1.png differ
diff --git a/plugins/circleci/src/assets/screenshot-2.png b/plugins/circleci/src/assets/screenshot-2.png
index 4e97cbcf8e..4f9ddcaec6 100644
Binary files a/plugins/circleci/src/assets/screenshot-2.png and b/plugins/circleci/src/assets/screenshot-2.png differ
diff --git a/plugins/circleci/src/assets/screenshot-3.png b/plugins/circleci/src/assets/screenshot-3.png
deleted file mode 100644
index ac20d58246..0000000000
Binary files a/plugins/circleci/src/assets/screenshot-3.png and /dev/null differ
diff --git a/plugins/circleci/src/assets/screenshot-4.png b/plugins/circleci/src/assets/screenshot-4.png
deleted file mode 100644
index 2d4ab5fe77..0000000000
Binary files a/plugins/circleci/src/assets/screenshot-4.png and /dev/null differ
diff --git a/plugins/circleci/src/pages/BuildWithStepsPage/BuildWithStepsPage.tsx b/plugins/circleci/src/components/BuildWithStepsPage/BuildWithStepsPage.tsx
similarity index 80%
rename from plugins/circleci/src/pages/BuildWithStepsPage/BuildWithStepsPage.tsx
rename to plugins/circleci/src/components/BuildWithStepsPage/BuildWithStepsPage.tsx
index d0e0c655c3..30994f5ce3 100644
--- a/plugins/circleci/src/pages/BuildWithStepsPage/BuildWithStepsPage.tsx
+++ b/plugins/circleci/src/components/BuildWithStepsPage/BuildWithStepsPage.tsx
@@ -15,20 +15,22 @@
*/
import React, { FC, useEffect } from 'react';
import { useParams } from 'react-router-dom';
-import { Content, InfoCard, Progress } from '@backstage/core';
+import { InfoCard, Progress, Link } from '@backstage/core';
import { BuildWithSteps, BuildStepAction } from '../../api';
-import { Grid, Box, Link, IconButton } from '@material-ui/core';
+import {
+ Grid,
+ Box,
+ IconButton,
+ Breadcrumbs,
+ Typography,
+ Link as MaterialLink,
+} from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
-import { PluginHeader } from '../../components/PluginHeader';
import { ActionOutput } from './lib/ActionOutput/ActionOutput';
-import { Layout } from '../../components/Layout';
import LaunchIcon from '@material-ui/icons/Launch';
-import { useSettings } from '../../state/useSettings';
import { useBuildWithSteps } from '../../state/useBuildWithSteps';
-import { AppStateProvider } from '../../state';
-import { Settings } from '../../components/Settings';
-const IconLink = IconButton as typeof Link;
+const IconLink = (IconButton as any) as typeof MaterialLink;
const BuildName: FC<{ build?: BuildWithSteps }> = ({ build }) => (
#{build?.build_num} - {build?.subject}
@@ -94,56 +96,13 @@ const pickClassName = (
return classes.neutral;
};
-const Page = () => (
-
-
-
-
-
-
-
-
-);
-
-const BuildWithStepsView: FC<{}> = () => {
- const { buildId = '' } = useParams();
- const classes = useStyles();
- const [settings] = useSettings();
- const [{ loading, value }, { startPolling, stopPolling }] = useBuildWithSteps(
- parseInt(buildId, 10),
- );
-
- useEffect(() => {
- startPolling();
- return () => stopPolling();
- }, [buildId, settings, startPolling, stopPolling]);
-
- return (
- <>
-
-
-
-
- }
- cardClassName={classes.cardContent}
- >
- {loading ? : }
-
-
-
- >
- );
-};
-
const BuildsList: FC<{ build?: BuildWithSteps }> = ({ build }) => (
{build &&
build.steps &&
build.steps.map(
({ name, actions }: { name: string; actions: BuildStepAction[] }) => (
-
+
),
)}
@@ -167,5 +126,35 @@ const ActionsList: FC<{ actions: BuildStepAction[]; name: string }> = ({
);
};
-export default Page;
-export { BuildWithStepsView as BuildWithSteps };
+export const BuildWithStepsPage = () => {
+ const { buildId = '' } = useParams();
+ const classes = useStyles();
+ const [{ loading, value }, { startPolling, stopPolling }] = useBuildWithSteps(
+ parseInt(buildId, 10),
+ );
+
+ useEffect(() => {
+ startPolling();
+ return () => stopPolling();
+ }, [buildId, startPolling, stopPolling]);
+
+ return (
+ <>
+
+ All builds
+ Build details
+
+
+
+ }
+ cardClassName={classes.cardContent}
+ >
+ {loading ? : }
+
+
+
+ >
+ );
+};
diff --git a/plugins/circleci/src/components/PluginHeader/index.ts b/plugins/circleci/src/components/BuildWithStepsPage/index.ts
similarity index 90%
rename from plugins/circleci/src/components/PluginHeader/index.ts
rename to plugins/circleci/src/components/BuildWithStepsPage/index.ts
index 4de972f6f2..c5627bda1c 100644
--- a/plugins/circleci/src/components/PluginHeader/index.ts
+++ b/plugins/circleci/src/components/BuildWithStepsPage/index.ts
@@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-export * from './PluginHeader';
+export { BuildWithStepsPage } from './BuildWithStepsPage';
diff --git a/plugins/circleci/src/pages/BuildWithStepsPage/lib/ActionOutput/ActionOutput.tsx b/plugins/circleci/src/components/BuildWithStepsPage/lib/ActionOutput/ActionOutput.tsx
similarity index 100%
rename from plugins/circleci/src/pages/BuildWithStepsPage/lib/ActionOutput/ActionOutput.tsx
rename to plugins/circleci/src/components/BuildWithStepsPage/lib/ActionOutput/ActionOutput.tsx
diff --git a/plugins/circleci/src/pages/BuildWithStepsPage/lib/ActionOutput/index.ts b/plugins/circleci/src/components/BuildWithStepsPage/lib/ActionOutput/index.ts
similarity index 100%
rename from plugins/circleci/src/pages/BuildWithStepsPage/lib/ActionOutput/index.ts
rename to plugins/circleci/src/components/BuildWithStepsPage/lib/ActionOutput/index.ts
diff --git a/plugins/circleci/src/components/Settings/index.ts b/plugins/circleci/src/components/BuildsPage/BuildsPage.tsx
similarity index 70%
rename from plugins/circleci/src/components/Settings/index.ts
rename to plugins/circleci/src/components/BuildsPage/BuildsPage.tsx
index c04ded6dea..d8c38de481 100644
--- a/plugins/circleci/src/components/Settings/index.ts
+++ b/plugins/circleci/src/components/BuildsPage/BuildsPage.tsx
@@ -13,4 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-export { default as Settings } from './Settings';
+import React from 'react';
+import { Builds } from './lib/Builds';
+import { Grid } from '@material-ui/core';
+
+export const BuildsPage = () => (
+
+
+
+
+
+);
diff --git a/plugins/circleci/src/components/Layout/index.ts b/plugins/circleci/src/components/BuildsPage/index.ts
similarity index 93%
rename from plugins/circleci/src/components/Layout/index.ts
rename to plugins/circleci/src/components/BuildsPage/index.ts
index 236fc98851..f9543ed0a8 100644
--- a/plugins/circleci/src/components/Layout/index.ts
+++ b/plugins/circleci/src/components/BuildsPage/index.ts
@@ -13,4 +13,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-export * from './Layout';
+export { BuildsPage } from './BuildsPage';
diff --git a/plugins/circleci/src/pages/BuildsPage/lib/Builds/Builds.tsx b/plugins/circleci/src/components/BuildsPage/lib/Builds/Builds.tsx
similarity index 100%
rename from plugins/circleci/src/pages/BuildsPage/lib/Builds/Builds.tsx
rename to plugins/circleci/src/components/BuildsPage/lib/Builds/Builds.tsx
diff --git a/plugins/circleci/src/pages/BuildsPage/lib/Builds/index.ts b/plugins/circleci/src/components/BuildsPage/lib/Builds/index.ts
similarity index 100%
rename from plugins/circleci/src/pages/BuildsPage/lib/Builds/index.ts
rename to plugins/circleci/src/components/BuildsPage/lib/Builds/index.ts
diff --git a/plugins/circleci/src/pages/BuildsPage/lib/CITable/CITable.tsx b/plugins/circleci/src/components/BuildsPage/lib/CITable/CITable.tsx
similarity index 93%
rename from plugins/circleci/src/pages/BuildsPage/lib/CITable/CITable.tsx
rename to plugins/circleci/src/components/BuildsPage/lib/CITable/CITable.tsx
index b349dcfcbe..8e693429c2 100644
--- a/plugins/circleci/src/pages/BuildsPage/lib/CITable/CITable.tsx
+++ b/plugins/circleci/src/components/BuildsPage/lib/CITable/CITable.tsx
@@ -17,7 +17,7 @@ import React, { FC } from 'react';
import { Link, Typography, Box, IconButton } from '@material-ui/core';
import RetryIcon from '@material-ui/icons/Replay';
import GitHubIcon from '@material-ui/icons/GitHub';
-import { Link as RouterLink } from 'react-router-dom';
+import { Link as RouterLink, generatePath } from 'react-router-dom';
import {
StatusError,
StatusWarning,
@@ -27,6 +27,7 @@ import {
Table,
TableColumn,
} from '@backstage/core';
+import { circleCIBuildRouteRef } from '../../../../route-refs';
export type CITableBuildInfo = {
id: string;
@@ -80,7 +81,10 @@ const generatedColumns: TableColumn[] = [
field: 'buildName',
highlight: true,
render: (row: Partial) => (
-
+
{row.buildName}
),
diff --git a/plugins/circleci/src/pages/BuildsPage/lib/CITable/index.ts b/plugins/circleci/src/components/BuildsPage/lib/CITable/index.ts
similarity index 100%
rename from plugins/circleci/src/pages/BuildsPage/lib/CITable/index.ts
rename to plugins/circleci/src/components/BuildsPage/lib/CITable/index.ts
diff --git a/plugins/circleci/src/components/CircleCIWidget.tsx b/plugins/circleci/src/components/CircleCIWidget.tsx
deleted file mode 100644
index 767eb6d5c7..0000000000
--- a/plugins/circleci/src/components/CircleCIWidget.tsx
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2020 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-import { Route, MemoryRouter, Routes } from 'react-router';
-import { Builds } from '../pages/BuildsPage';
-import { BuildWithSteps } from '../pages/BuildWithStepsPage';
-import { AppStateProvider } from '../state';
-import { Settings } from './Settings';
-
-// TODO: allow pass in settings as props
-// When some shared settings workflow
-// will be established
-export const CircleCIWidget = () => (
-
-
- <>
-
- } />
- } />
-
-
- >
-
-
-);
diff --git a/plugins/circleci/src/components/Layout/Layout.tsx b/plugins/circleci/src/components/Layout/Layout.tsx
deleted file mode 100644
index 09479e6ef0..0000000000
--- a/plugins/circleci/src/components/Layout/Layout.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2020 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React from 'react';
-import { Header, Page, pageTheme, HeaderLabel } from '@backstage/core';
-
-export const Layout: React.FC = ({ children }) => {
- return (
-
-
-
-
-
- {children}
-
- );
-};
diff --git a/plugins/circleci/src/components/PluginHeader/PluginHeader.tsx b/plugins/circleci/src/components/PluginHeader/PluginHeader.tsx
deleted file mode 100644
index 9f94cff480..0000000000
--- a/plugins/circleci/src/components/PluginHeader/PluginHeader.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2020 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, { FC } from 'react';
-import { Link as RouterLink, useLocation } from 'react-router-dom';
-import { ContentHeader, SupportButton } from '@backstage/core';
-import { Button, IconButton, Box, Typography } from '@material-ui/core';
-import ArrowBack from '@material-ui/icons/ArrowBack';
-import SettingsIcon from '@material-ui/icons/Settings';
-import { useSettings } from '../../state';
-
-export type Props = { title?: string };
-export const PluginHeader: FC = ({ title = 'CircleCI' }) => {
- const [, { showSettings }] = useSettings();
- const location = useLocation();
- const notRoot = !location.pathname.match(/\/circleci\/?$/);
- const isSettingsPage = location.pathname.match(/\/circleci\/settings\/?/);
- return (
- (
-
- {notRoot && (
-
-
-
- )}
- {title}
-
- )}
- >
- {!isSettingsPage && (
- }>
- Settings
-
- )}
-
- This plugin allows you to view and interact with your builds within the
- Circle CI environment.
-
-
- );
-};
diff --git a/plugins/circleci/src/components/Settings/Settings.tsx b/plugins/circleci/src/components/Settings/Settings.tsx
deleted file mode 100644
index b3b62ce930..0000000000
--- a/plugins/circleci/src/components/Settings/Settings.tsx
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright 2020 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, { useState, useEffect } from 'react';
-import {
- Button,
- TextField,
- List,
- ListItem,
- Snackbar,
- Box,
- Dialog,
- DialogTitle,
-} from '@material-ui/core';
-import { Alert } from '@material-ui/lab';
-import { useSettings } from '../../state';
-
-const Settings = () => {
- const [
- {
- repo: repoFromStore,
- owner: ownerFromStore,
- token: tokenFromStore,
- showSettings,
- },
- { saveSettings, hideSettings },
- ] = useSettings();
-
- const [token, setToken] = useState(() => tokenFromStore);
- const [owner, setOwner] = useState(() => ownerFromStore);
- const [repo, setRepo] = useState(() => repoFromStore);
-
- useEffect(() => {
- if (tokenFromStore !== token) {
- setToken(token);
- }
- if (ownerFromStore !== owner) {
- setOwner(owner);
- }
- if (repoFromStore !== repo) {
- setRepo(repo);
- }
- }, [ownerFromStore, repoFromStore, tokenFromStore, token, owner, repo]);
-
- const [saved, setSaved] = useState(false);
-
- return (
- <>
- setSaved(false)}
- >
- Credentials saved.
-
-
- >
- );
-};
-
-export default Settings;
diff --git a/plugins/circleci/src/pages/BuildWithStepsPage/index.ts b/plugins/circleci/src/pages/BuildWithStepsPage/index.ts
deleted file mode 100644
index fddff7088c..0000000000
--- a/plugins/circleci/src/pages/BuildWithStepsPage/index.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2020 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-export {
- default as DetailedViewPage,
- BuildWithSteps,
-} from './BuildWithStepsPage';
diff --git a/plugins/circleci/src/pages/BuildsPage/BuildsPage.tsx b/plugins/circleci/src/pages/BuildsPage/BuildsPage.tsx
deleted file mode 100644
index 6e7fc44249..0000000000
--- a/plugins/circleci/src/pages/BuildsPage/BuildsPage.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2020 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, { FC } from 'react';
-import { Content } from '@backstage/core';
-import { Grid } from '@material-ui/core';
-import { Builds as BuildsComp } from './lib/Builds';
-import { Layout } from '../../components/Layout';
-import { PluginHeader } from '../../components/PluginHeader';
-import { AppStateProvider } from '../../state/AppState';
-import { Settings } from '../../components/Settings';
-
-const BuildsPage: FC<{}> = () => (
-
-
-
-
-
-
-
-
-);
-
-const Builds = () => (
- <>
-
-
-
-
-
-
- >
-);
-
-export default BuildsPage;
-export { Builds };
diff --git a/plugins/circleci/src/pages/BuildsPage/index.ts b/plugins/circleci/src/pages/BuildsPage/index.ts
deleted file mode 100644
index 72b46d6bc9..0000000000
--- a/plugins/circleci/src/pages/BuildsPage/index.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * Copyright 2020 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-export { default as BuildsPage, Builds } from './BuildsPage';
diff --git a/plugins/circleci/src/state/AppState.tsx b/plugins/circleci/src/state/AppState.tsx
deleted file mode 100644
index 2ee00362ee..0000000000
--- a/plugins/circleci/src/state/AppState.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2020 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import React, { FC, useReducer, Dispatch, Reducer } from 'react';
-import { circleCIApiRef } from '../api';
-import type { State, Action, SettingsState } from './types';
-
-export type { SettingsState };
-
-export const AppContext = React.createContext<[State, Dispatch]>(
- [] as any,
-);
-export const STORAGE_KEY = `${circleCIApiRef.id}.settings`;
-
-const initialState: State = {
- owner: '',
- repo: '',
- token: '',
- showSettings: false,
-};
-
-const reducer: Reducer = (state, action) => {
- switch (action.type) {
- case 'setCredentials':
- return {
- ...state,
- ...action.payload,
- };
- case 'showSettings':
- return { ...state, showSettings: true };
- case 'hideSettings':
- return { ...state, showSettings: false };
- default:
- return state;
- }
-};
-
-export const AppStateProvider: FC = ({ children }) => {
- const [state, dispatch] = useReducer(reducer, initialState);
- return (
-
- <>{children}>
-
- );
-};
diff --git a/plugins/circleci/src/state/index.ts b/plugins/circleci/src/state/index.ts
index 2321103eb4..d21a380c2a 100644
--- a/plugins/circleci/src/state/index.ts
+++ b/plugins/circleci/src/state/index.ts
@@ -13,7 +13,5 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-export * from './AppState';
-export * from './useSettings';
export * from './useBuilds';
export * from './useBuildWithSteps';
diff --git a/plugins/circleci/src/state/types.ts b/plugins/circleci/src/state/types.ts
deleted file mode 100644
index 41b3577082..0000000000
--- a/plugins/circleci/src/state/types.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2020 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-export type Settings = { owner: string; repo: string; token: string };
-export type SettingsState = Settings & {
- showSettings: boolean;
-};
-
-export type State = SettingsState;
-
-type SettingsAction =
- | {
- type: 'setCredentials';
- payload: {
- repo: string;
- owner: string;
- token: string;
- };
- }
- | { type: 'showSettings' }
- | { type: 'hideSettings' };
-
-export type Action = SettingsAction;
diff --git a/plugins/circleci/src/state/useSettings.ts b/plugins/circleci/src/state/useSettings.ts
deleted file mode 100644
index 3cc58a65bd..0000000000
--- a/plugins/circleci/src/state/useSettings.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2020 Spotify AB
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import { errorApiRef, useApi } from '@backstage/core';
-import { useContext, useEffect } from 'react';
-import { AppContext, STORAGE_KEY } from './AppState';
-import { Settings } from './types';
-
-export function useSettings() {
- const [settings, dispatch] = useContext(AppContext);
-
- const errorApi = useApi(errorApiRef);
-
- useEffect(() => {
- const rehydrate = () => {
- try {
- const stateFromStorage = JSON.parse(
- sessionStorage.getItem(STORAGE_KEY)!,
- );
- if (
- stateFromStorage &&
- Object.keys(stateFromStorage).some(
- k => (settings as any)[k] !== stateFromStorage[k],
- )
- )
- dispatch({
- type: 'setCredentials',
- payload: stateFromStorage,
- });
- } catch (error) {
- errorApi.post(error);
- }
- };
-
- rehydrate();
- }, [dispatch, errorApi, settings]);
-
- const persist = (state: Settings) => {
- sessionStorage.setItem(STORAGE_KEY, JSON.stringify(state));
- };
-
- return [
- settings,
- {
- saveSettings: (state: Settings) => {
- persist(state);
- dispatch({
- type: 'setCredentials',
- payload: state,
- });
- },
- showSettings: () => dispatch({ type: 'showSettings' }),
- hideSettings: () => dispatch({ type: 'hideSettings' }),
- },
- ] as const;
-}