diff --git a/app-config.yaml b/app-config.yaml index 1fbd1896a6..9a4a14b923 100644 --- a/app-config.yaml +++ b/app-config.yaml @@ -11,14 +11,17 @@ backend: credentials: true proxy: - '/circleci/api': - target: 'https://circleci.com/api/v1.1' + "/circleci/api": + target: "https://circleci.com/api/v1.1" changeOrigin: true pathRewrite: - '^/proxy/circleci/api/': '/' + "^/proxy/circleci/api/": "/" organization: name: Spotify techdocs: storageUrl: https://techdocs-mock-sites.storage.googleapis.com + +sentry: + organization: spotify diff --git a/plugins/sentry/src/components/SentryPluginPage/SentryPluginPage.test.tsx b/plugins/sentry/src/components/SentryPluginPage/SentryPluginPage.test.tsx index b0437ff4f7..d508ddf7c2 100644 --- a/plugins/sentry/src/components/SentryPluginPage/SentryPluginPage.test.tsx +++ b/plugins/sentry/src/components/SentryPluginPage/SentryPluginPage.test.tsx @@ -20,15 +20,26 @@ import mockFetch from 'jest-fetch-mock'; import SentryPluginPage from './SentryPluginPage'; import { ThemeProvider } from '@material-ui/core'; import { lightTheme } from '@backstage/theme'; -import { ApiProvider, ApiRegistry, errorApiRef } from '@backstage/core'; +import { + ApiProvider, + ApiRegistry, + errorApiRef, + configApiRef, +} from '@backstage/core'; const errorApi = { post: () => {} }; +const ConfigApi = { getString: () => 'test' }; describe('SentryPluginPage', () => { it('should render header and time switched', () => { mockFetch.mockResponse('{}'); const rendered = render( - + diff --git a/plugins/sentry/src/components/SentryPluginPage/SentryPluginPage.tsx b/plugins/sentry/src/components/SentryPluginPage/SentryPluginPage.tsx index ae5f8bd35c..0473cb805c 100644 --- a/plugins/sentry/src/components/SentryPluginPage/SentryPluginPage.tsx +++ b/plugins/sentry/src/components/SentryPluginPage/SentryPluginPage.tsx @@ -30,6 +30,7 @@ import { ToggleButton, ToggleButtonGroup } from '@material-ui/lab'; const SentryPluginPage: FC<{}> = () => { const [statsFor, setStatsFor] = useState<'12h' | '24h'>('12h'); const toggleStatsFor = () => setStatsFor(statsFor === '12h' ? '12h' : '24h'); + const sentryProjectId = 'sample-sentry-project-id'; return ( @@ -56,7 +57,7 @@ const SentryPluginPage: FC<{}> = () => { diff --git a/plugins/sentry/src/components/SentryPluginWidget/SentryPluginWidget.tsx b/plugins/sentry/src/components/SentryPluginWidget/SentryPluginWidget.tsx index b101a9092a..0ee32f1bab 100644 --- a/plugins/sentry/src/components/SentryPluginWidget/SentryPluginWidget.tsx +++ b/plugins/sentry/src/components/SentryPluginWidget/SentryPluginWidget.tsx @@ -21,18 +21,20 @@ import { InfoCard, Progress, useApi, + configApiRef, } from '@backstage/core'; import SentryIssuesTable from '../SentryIssuesTable/SentryIssuesTable'; import { useAsync } from 'react-use'; import { sentryApiFactory } from '../../data/api-factory'; -const api = sentryApiFactory('spotify'); - export const SentryPluginWidget: FC<{ sentryProjectId: string; statsFor: '24h' | '12h'; }> = ({ sentryProjectId, statsFor }) => { const errorApi = useApi(errorApiRef); + const configApi = useApi(configApiRef); + const org = configApi.getString('sentry.organization'); + const api = sentryApiFactory(org); const { loading, value, error } = useAsync( () => api.fetchIssues(sentryProjectId, statsFor),