Createa @backstage/plugin-catalog-common-react package

This commit is contained in:
Oliver Sand
2021-01-26 18:53:29 +01:00
parent aca1ada8dc
commit 019fe39a08
100 changed files with 488 additions and 228 deletions
+19
View File
@@ -0,0 +1,19 @@
---
'@backstage/plugin-api-docs': patch
'@backstage/plugin-catalog-import': patch
'@backstage/plugin-circleci': patch
'@backstage/plugin-cloudbuild': patch
'@backstage/plugin-github-actions': patch
'@backstage/plugin-jenkins': patch
'@backstage/plugin-kafka': patch
'@backstage/plugin-lighthouse': patch
'@backstage/plugin-org': patch
'@backstage/plugin-register-component': patch
'@backstage/plugin-rollbar': patch
'@backstage/plugin-scaffolder': patch
'@backstage/plugin-search': patch
'@backstage/plugin-sentry': patch
'@backstage/plugin-techdocs': patch
---
Switch dependency from `@backstage/plugin-catalog` to `@backstage/plugin-catalog-common-react`.
+8
View File
@@ -0,0 +1,8 @@
---
'@backstage/plugin-catalog': minor
'@backstage/create-app': minor
---
`@backstage/plugin-catalog` stopped exporting hooks and helpers for other
plugins. They are migrated to `@backstage/plugin-catalog-common-react`.
Change both your dependencies and imports to the new package.
+1
View File
@@ -9,6 +9,7 @@
"@backstage/core": "^0.5.0",
"@backstage/plugin-api-docs": "^0.4.3",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/plugin-catalog-import": "^0.3.6",
"@backstage/plugin-circleci": "^0.2.6",
"@backstage/plugin-cloudbuild": "^0.2.7",
@@ -27,11 +27,8 @@ import {
ProvidedApisCard,
ProvidingComponentsCard,
} from '@backstage/plugin-api-docs';
import {
AboutCard,
EntityPageLayout,
useEntity,
} from '@backstage/plugin-catalog';
import { AboutCard, EntityPageLayout } from '@backstage/plugin-catalog';
import { useEntity } from '@backstage/plugin-catalog-common-react';
import {
isPluginApplicableToEntity as isCircleCIAvailable,
Router as CircleCIRouter,
@@ -50,6 +47,7 @@ import {
LatestRunCard as JenkinsLatestRunCard,
Router as JenkinsRouter,
} from '@backstage/plugin-jenkins';
import { Router as KafkaRouter } from '@backstage/plugin-kafka';
import { Router as KubernetesRouter } from '@backstage/plugin-kubernetes';
import {
EmbeddedRouter as LighthouseRouter,
@@ -57,13 +55,16 @@ import {
LastLighthouseAuditCard,
} from '@backstage/plugin-lighthouse';
import {
OwnershipCard,
MembersListCard,
GroupProfileCard,
MembersListCard,
OwnershipCard,
UserProfileCard,
} from '@backstage/plugin-org';
import {
isPluginApplicableToEntity as isPagerDutyAvailable,
PagerDutyCard,
} from '@backstage/plugin-pagerduty';
import { Router as SentryRouter } from '@backstage/plugin-sentry';
import { Router as KafkaRouter } from '@backstage/plugin-kafka';
import { EmbeddedDocsRouter as DocsRouter } from '@backstage/plugin-techdocs';
import { Button, Grid } from '@material-ui/core';
import {
@@ -82,10 +83,6 @@ import {
PullRequestsStatsCard,
Router as PullRequestsRouter,
} from '@roadiehq/backstage-plugin-github-pull-requests';
import {
isPluginApplicableToEntity as isPagerDutyAvailable,
PagerDutyCard,
} from '@backstage/plugin-pagerduty';
import {
isPluginApplicableToEntity as isTravisCIAvailable,
RecentTravisCIBuildsWidget,
+2
View File
@@ -42,6 +42,7 @@ import { version as pluginApiDocs } from '../../../../plugins/api-docs/package.j
import { version as pluginAppBackend } from '../../../../plugins/app-backend/package.json';
import { version as pluginAuthBackend } from '../../../../plugins/auth-backend/package.json';
import { version as pluginCatalog } from '../../../../plugins/catalog/package.json';
import { version as pluginCatalogCommonReact } from '../../../../plugins/catalog-common-react/package.json';
import { version as pluginCatalogBackend } from '../../../../plugins/catalog-backend/package.json';
import { version as pluginCatalogImport } from '../../../../plugins/catalog-import/package.json';
import { version as pluginCircleci } from '../../../../plugins/circleci/package.json';
@@ -68,6 +69,7 @@ export const packageVersions = {
'@backstage/plugin-app-backend': pluginAppBackend,
'@backstage/plugin-auth-backend': pluginAuthBackend,
'@backstage/plugin-catalog': pluginCatalog,
'@backstage/plugin-catalog-common-react': pluginCatalogCommonReact,
'@backstage/plugin-catalog-backend': pluginCatalogBackend,
'@backstage/plugin-catalog-import': pluginCatalogImport,
'@backstage/plugin-circleci': pluginCircleci,
@@ -10,6 +10,7 @@
"@backstage/core": "^{{version '@backstage/core'}}",
"@backstage/plugin-api-docs": "^{{version '@backstage/plugin-api-docs'}}",
"@backstage/plugin-catalog": "^{{version '@backstage/plugin-catalog'}}",
"@backstage/plugin-catalog-common-react": "^{{version '@backstage/plugin-catalog-common-react'}}",
"@backstage/plugin-catalog-import": "^{{version '@backstage/plugin-catalog-import'}}",
"@backstage/plugin-scaffolder": "^{{version '@backstage/plugin-scaffolder'}}",
"@backstage/plugin-techdocs": "^{{version '@backstage/plugin-techdocs'}}",
@@ -24,8 +24,10 @@ import {
} from '@backstage/plugin-api-docs';
import {
AboutCard, EntityPageLayout,
useEntity
} from '@backstage/plugin-catalog';
import {
useEntity
} from '@backstage/plugin-catalog-common-react';
import {
isPluginApplicableToEntity as isCircleCIAvailable, Router as CircleCIRouter
} from '@backstage/plugin-circleci';
+1 -1
View File
@@ -32,7 +32,7 @@
"@asyncapi/react-component": "^0.18.2",
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-icons/font": "^1.0.2",
"@material-ui/core": "^4.11.0",
@@ -16,7 +16,10 @@
import { Entity } from '@backstage/catalog-model';
import { ApiProvider, ApiRegistry, storageApiRef } from '@backstage/core';
import { CatalogApi, catalogApiRef } from '@backstage/plugin-catalog';
import {
CatalogApi,
catalogApiRef,
} from '@backstage/plugin-catalog-common-react';
import { MockStorageApi, wrapInTestApp } from '@backstage/test-utils';
import { render } from '@testing-library/react';
import React from 'react';
@@ -15,7 +15,7 @@
*/
import { Content, ContentHeader, SupportButton, useApi } from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { Button } from '@material-ui/core';
import React from 'react';
import { Link as RouterLink } from 'react-router-dom';
@@ -16,7 +16,10 @@
import { Entity, RELATION_CONSUMES_API } from '@backstage/catalog-model';
import { ApiProvider, ApiRegistry } from '@backstage/core';
import { CatalogApi, catalogApiRef } from '@backstage/plugin-catalog';
import {
CatalogApi,
catalogApiRef,
} from '@backstage/plugin-catalog-common-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
import React from 'react';
@@ -16,7 +16,10 @@
import { Entity, RELATION_PROVIDES_API } from '@backstage/catalog-model';
import { ApiProvider, ApiRegistry } from '@backstage/core';
import { CatalogApi, catalogApiRef } from '@backstage/plugin-catalog';
import {
CatalogApi,
catalogApiRef,
} from '@backstage/plugin-catalog-common-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
import React from 'react';
@@ -16,7 +16,10 @@
import { Entity, RELATION_API_CONSUMED_BY } from '@backstage/catalog-model';
import { ApiProvider, ApiRegistry } from '@backstage/core';
import { CatalogApi, catalogApiRef } from '@backstage/plugin-catalog';
import {
CatalogApi,
catalogApiRef,
} from '@backstage/plugin-catalog-common-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
import React from 'react';
@@ -16,7 +16,10 @@
import { Entity, RELATION_API_PROVIDED_BY } from '@backstage/catalog-model';
import { ApiProvider, ApiRegistry } from '@backstage/core';
import { CatalogApi, catalogApiRef } from '@backstage/plugin-catalog';
import {
CatalogApi,
catalogApiRef,
} from '@backstage/plugin-catalog-common-react';
import { renderInTestApp } from '@backstage/test-utils';
import { waitFor } from '@testing-library/react';
import React from 'react';
@@ -15,7 +15,10 @@
*/
import { Entity } from '@backstage/catalog-model';
import { entityRoute, entityRouteParams } from '@backstage/plugin-catalog';
import {
entityRoute,
entityRouteParams,
} from '@backstage/plugin-catalog-common-react';
import { Link } from '@material-ui/core';
import React, { PropsWithChildren } from 'react';
import { generatePath, Link as RouterLink } from 'react-router-dom';
@@ -15,7 +15,7 @@
*/
import { Entity } from '@backstage/catalog-model';
import { useApi } from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { useAsyncRetry } from 'react-use';
// TODO: Maybe this hook is interesting for others too?
@@ -0,0 +1,3 @@
module.exports = {
extends: [require.resolve('@backstage/cli/config/eslint')],
};
+17
View File
@@ -0,0 +1,17 @@
# Catalog Client
Contains a frontend and backend compatible client for communicating with the
Backstage Catalog.
Backend code may import and use this package directly.
However, frontend code will not want to import this package directly - use the
`@backstage/plugin-catalog` package instead, which re-exports all of the types
and classes from this package. Thereby, you will also gain access to its
`catalogApiRef`.
## Links
- [Default frontend part of the catalog](https://github.com/spotify/backstage/tree/master/plugins/catalog)
- [Default backend part of the catalog](https://github.com/spotify/backstage/tree/master/plugins/catalog-backend)
- [The Backstage homepage](https://backstage.io)
+60
View File
@@ -0,0 +1,60 @@
{
"name": "@backstage/plugin-catalog-common-react",
"version": "0.0.1",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"private": false,
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts"
},
"homepage": "https://backstage.io",
"repository": {
"type": "git",
"url": "https://github.com/backstage/backstage",
"directory": "plugins/plugin-catalog-common-react"
},
"keywords": [
"backstage"
],
"scripts": {
"build": "backstage-cli build",
"lint": "backstage-cli lint",
"test": "backstage-cli test",
"prepack": "backstage-cli prepack",
"postpack": "backstage-cli postpack",
"clean": "backstage-cli clean"
},
"dependencies": {
"@backstage/catalog-client": "^0.3.5",
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@material-ui/core": "^4.11.0",
"@types/react": "^16.9",
"react": "^16.13.1",
"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",
"react-use": "^15.3.3"
},
"devDependencies": {
"@backstage/cli": "^0.4.7",
"@backstage/dev-utils": "^0.1.8",
"@backstage/test-utils": "^0.1.6",
"@microsoft/microsoft-graph-types": "^1.25.0",
"@testing-library/jest-dom": "^5.10.1",
"@testing-library/react": "^10.4.1",
"@testing-library/react-hooks": "^3.3.0",
"@testing-library/user-event": "^12.0.7",
"@types/jest": "^26.0.7",
"@types/node": "^12.0.0",
"cross-fetch": "^3.0.6",
"msw": "^0.21.2",
"react-test-renderer": "^16.13.1"
},
"files": [
"dist"
]
}
+24
View File
@@ -0,0 +1,24 @@
/*
* 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 { CatalogApi } from '@backstage/catalog-client';
import { createApiRef } from '@backstage/core';
export const catalogApiRef = createApiRef<CatalogApi>({
id: 'plugin.catalog.service',
description:
'Used by the Catalog plugin to make requests to accompanying backend',
});
@@ -31,9 +31,6 @@ type EntityRefLinkProps = {
children?: React.ReactNode;
};
// TODO: This component is private for now, as it should probably belong into
// some kind of helper module for the catalog plugin to avoid a dependency on
// the catalog plugin itself.
export const EntityRefLink = ({
entityRef,
defaultKind,
@@ -22,7 +22,6 @@ type EntityRefLinksProps = {
defaultKind?: string;
};
// TODO: Move into a shared helper package
export const EntityRefLinks = ({
entityRefs,
defaultKind,
@@ -0,0 +1,16 @@
/*
* 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 * from './EntityRefLink';
@@ -0,0 +1,17 @@
/*
* 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 { EntityContext, useEntity, useEntityFromUrl } from './useEntity';
export { useEntityCompoundName } from './useEntityCompoundName';
@@ -18,8 +18,8 @@ import { errorApiRef, useApi } from '@backstage/core';
import { createContext, useContext, useEffect } from 'react';
import { useNavigate } from 'react-router';
import { useAsync } from 'react-use';
import { useEntityCompoundName } from '../components/useEntityCompoundName';
import { catalogApiRef } from '../plugin';
import { useEntityCompoundName } from './useEntityCompoundName';
import { catalogApiRef } from '../api';
type EntityLoadingStatus = {
entity?: Entity;
+26
View File
@@ -0,0 +1,26 @@
/*
* 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 * from '@backstage/catalog-client';
export { catalogApiRef } from './api';
export * from './components';
export * from './hooks';
export {
catalogRouteRef,
entityRoute,
entityRouteParams,
entityRouteRef,
rootRoute,
} from './routes';
@@ -0,0 +1,18 @@
/*
* 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 '@testing-library/jest-dom';
import 'cross-fetch/polyfill';
+1 -1
View File
@@ -33,7 +33,7 @@
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/integration": "^0.3.1",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
@@ -14,32 +14,35 @@
* limitations under the License.
*/
import React, { useCallback, useState } from 'react';
import {
Button,
CircularProgress,
Grid,
Link,
List,
ListItem,
Typography,
Divider,
} from '@material-ui/core';
import { useGithubRepos } from '../util/useGithubRepos';
import { ConfigSpec } from './ImportComponentPage';
import { Entity } from '@backstage/catalog-model';
import {
errorApiRef,
RouteRef,
StructuredMetadataTable,
useApi,
} from '@backstage/core';
import { PartialEntity } from '../util/types';
import {
entityRoute,
entityRouteParams,
} from '@backstage/plugin-catalog-common-react';
import {
Button,
CircularProgress,
Divider,
Grid,
Link,
List,
ListItem,
Typography,
} from '@material-ui/core';
import React, { useCallback, useState } from 'react';
import { generatePath, resolvePath } from 'react-router';
import { entityRoute, entityRouteParams } from '@backstage/plugin-catalog';
import { Entity } from '@backstage/catalog-model';
import { Link as RouterLink } from 'react-router-dom';
import * as YAML from 'yaml';
import { PartialEntity } from '../util/types';
import { urlType } from '../util/urls';
import { useGithubRepos } from '../util/useGithubRepos';
import { ConfigSpec } from './ImportComponentPage';
const getEntityCatalogPath = ({
entity,
@@ -13,18 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { renderInTestApp } from '@backstage/test-utils';
import { RegisterComponentForm } from './ImportComponentForm';
import {
ApiProvider,
ApiRegistry,
DiscoveryApi,
errorApiRef,
} from '@backstage/core';
import { catalogApiRef, CatalogClient } from '@backstage/plugin-catalog';
import {
catalogApiRef,
CatalogClient,
} from '@backstage/plugin-catalog-common-react';
import { renderInTestApp } from '@backstage/test-utils';
import { fireEvent, screen, waitFor } from '@testing-library/react';
import React from 'react';
import { catalogImportApiRef, CatalogImportClient } from '../api';
import { fireEvent, waitFor, screen } from '@testing-library/react';
import { RegisterComponentForm } from './ImportComponentForm';
describe('<RegisterComponentForm />', () => {
let apis: ApiRegistry;
@@ -15,6 +15,7 @@
*/
import { errorApiRef, useApi } from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { BackstageTheme } from '@backstage/theme';
import {
Button,
@@ -26,11 +27,10 @@ import { makeStyles } from '@material-ui/core/styles';
import React from 'react';
import { useForm } from 'react-hook-form';
import { useMountedState } from 'react-use';
import { ComponentIdValidators } from '../util/validate';
import { useGithubRepos } from '../util/useGithubRepos';
import { ConfigSpec } from './ImportComponentPage';
import { catalogApiRef } from '@backstage/plugin-catalog';
import { urlType } from '../util/urls';
import { useGithubRepos } from '../util/useGithubRepos';
import { ComponentIdValidators } from '../util/validate';
import { ConfigSpec } from './ImportComponentPage';
const useStyles = makeStyles<BackstageTheme>(theme => ({
form: {
@@ -13,22 +13,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { msw, renderInTestApp } from '@backstage/test-utils';
import { ImportComponentPage } from './ImportComponentPage';
import {
ApiProvider,
ApiRegistry,
configApiRef,
errorApiRef,
} from '@backstage/core';
import { catalogApiRef, CatalogClient } from '@backstage/plugin-catalog';
import { catalogImportApiRef, CatalogImportClient } from '../api';
import {
catalogApiRef,
CatalogClient,
} from '@backstage/plugin-catalog-common-react';
import { msw, renderInTestApp } from '@backstage/test-utils';
import { fireEvent, screen, waitFor } from '@testing-library/react';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import React from 'react';
import { catalogImportApiRef, CatalogImportClient } from '../api';
import { ImportComponentPage } from './ImportComponentPage';
let codeSearchMockResponse: () => Promise<{
data: {
+2 -1
View File
@@ -33,6 +33,7 @@
"@backstage/catalog-client": "^0.3.5",
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/plugin-scaffolder": "^0.4.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
@@ -68,4 +69,4 @@
"files": [
"dist"
]
}
}
@@ -19,9 +19,9 @@ import {
RELATION_OWNED_BY,
RELATION_PART_OF,
} from '@backstage/catalog-model';
import { EntityRefLinks } from '@backstage/plugin-catalog-common-react';
import { Chip, Grid, makeStyles, Typography } from '@material-ui/core';
import React from 'react';
import { EntityRefLinks } from '../EntityRefLink';
import { getEntityRelations } from '../getEntityRelations';
import { AboutField } from './AboutField';
@@ -22,6 +22,7 @@ import {
SupportButton,
useApi,
} from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { rootRoute as scaffolderRootRoute } from '@backstage/plugin-scaffolder';
import { Button, makeStyles } from '@material-ui/core';
import SettingsIcon from '@material-ui/icons/Settings';
@@ -30,14 +31,13 @@ import React, { useCallback, useMemo, useState } from 'react';
import { Link as RouterLink } from 'react-router-dom';
import { EntityFilterGroupsProvider, useFilteredEntities } from '../../filter';
import { useStarredEntities } from '../../hooks/useStarredEntities';
import { catalogApiRef } from '../../plugin';
import { ButtonGroup, CatalogFilter } from '../CatalogFilter/CatalogFilter';
import { CatalogTable } from '../CatalogTable/CatalogTable';
import { isOwnerOf } from '../isOwnerOf';
import { ResultsFilter } from '../ResultsFilter/ResultsFilter';
import { useOwnUser } from '../useOwnUser';
import CatalogLayout from './CatalogLayout';
import { CatalogTabs, LabeledComponentType } from './CatalogTabs';
import { useOwnUser } from '../useOwnUser';
import { isOwnerOf } from '../isOwnerOf';
const useStyles = makeStyles(theme => ({
contentWrapper: {
@@ -20,6 +20,11 @@ import {
RELATION_PART_OF,
} from '@backstage/catalog-model';
import { Table, TableColumn, TableProps } from '@backstage/core';
import {
EntityRefLink,
EntityRefLinks,
formatEntityRefTitle,
} from '@backstage/plugin-catalog-common-react';
import { Chip } from '@material-ui/core';
import Edit from '@material-ui/icons/Edit';
import OpenInNew from '@material-ui/icons/OpenInNew';
@@ -28,11 +33,6 @@ import React from 'react';
import { findLocationForEntityMeta } from '../../data/utils';
import { useStarredEntities } from '../../hooks/useStarredEntities';
import { createEditLink } from '../createEditLink';
import {
EntityRefLink,
EntityRefLinks,
formatEntityRefTitle,
} from '../EntityRefLink';
import {
favouriteEntityIcon,
favouriteEntityTooltip,
@@ -13,22 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { EntityLayout } from './EntityLayout';
import { CatalogApi } from '@backstage/catalog-client';
import { Entity } from '@backstage/catalog-model';
import {
AlertApi,
alertApiRef,
ApiProvider,
ApiRegistry,
} from '@backstage/core';
import {
catalogApiRef,
EntityContext,
} from '@backstage/plugin-catalog-common-react';
import { renderInTestApp, withLogCollector } from '@backstage/test-utils';
import { fireEvent } from '@testing-library/react';
import React from 'react';
import { act } from 'react-dom/test-utils';
import { Routes, Route } from 'react-router';
import { Entity } from '@backstage/catalog-model';
import { EntityContext } from '../../hooks/useEntity';
import { catalogApiRef } from '../../plugin';
import { CatalogApi } from '@backstage/catalog-client';
import { Route, Routes } from 'react-router';
import { EntityLayout } from './EntityLayout';
const mockEntityData = {
loading: false,
@@ -14,15 +14,6 @@
* limitations under the License.
*/
import React, {
Children,
Fragment,
PropsWithChildren,
ReactNode,
isValidElement,
useContext,
useState,
} from 'react';
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
import {
attachComponentData,
@@ -32,14 +23,25 @@ import {
Page,
Progress,
} from '@backstage/core';
import {
EntityContext,
useEntityCompoundName,
} from '@backstage/plugin-catalog-common-react';
import { Box } from '@material-ui/core';
import { Alert } from '@material-ui/lab';
import React, {
Children,
Fragment,
isValidElement,
PropsWithChildren,
ReactNode,
useContext,
useState,
} from 'react';
import { useNavigate } from 'react-router';
import { EntityContext } from '../../hooks/useEntity';
import { EntityContextMenu } from '../EntityContextMenu/EntityContextMenu';
import { FavouriteEntity } from '../FavouriteEntity/FavouriteEntity';
import { UnregisterEntityDialog } from '../UnregisterEntityDialog/UnregisterEntityDialog';
import { useEntityCompoundName } from '../useEntityCompoundName';
import { TabbedLayout } from './TabbedLayout';
type SubRoute = {
@@ -13,8 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
EntityContext,
useEntityFromUrl,
} from '@backstage/plugin-catalog-common-react';
import React, { ReactNode } from 'react';
import { useEntityFromUrl, EntityContext } from '../../hooks/useEntity';
export const EntityLoaderProvider = ({ children }: { children: ReactNode }) => {
const { entity, loading, error } = useEntityFromUrl();
@@ -19,11 +19,14 @@ import { Box } from '@material-ui/core';
import { Alert } from '@material-ui/lab';
import React, { PropsWithChildren, useContext, useState } from 'react';
import { useNavigate } from 'react-router';
import { EntityContext } from '../../hooks/useEntity';
import {
EntityContext,
useEntityCompoundName,
} from '@backstage/plugin-catalog-common-react';
import { EntityContextMenu } from '../EntityContextMenu/EntityContextMenu';
import { FavouriteEntity } from '../FavouriteEntity/FavouriteEntity';
import { UnregisterEntityDialog } from '../UnregisterEntityDialog/UnregisterEntityDialog';
import { useEntityCompoundName } from '../useEntityCompoundName';
import { Tabbed } from './Tabbed';
const EntityPageTitle = ({
@@ -15,7 +15,7 @@
*/
import { Entity } from '@backstage/catalog-model';
import React, { ReactNode } from 'react';
import { EntityContext } from '../../hooks/useEntity';
import { EntityContext } from '@backstage/plugin-catalog-common-react';
type EntityProviderProps = {
entity: Entity;
@@ -14,12 +14,12 @@
* limitations under the License.
*/
import React from 'react';
import { render } from '@testing-library/react';
import { EntityContext } from '../../hooks/useEntity';
import { Entity } from '@backstage/catalog-model';
import { EntitySwitch } from './EntitySwitch';
import { EntityContext } from '@backstage/plugin-catalog-common-react';
import { render } from '@testing-library/react';
import React from 'react';
import { isKind } from './conditions';
import { EntitySwitch } from './EntitySwitch';
describe('EntitySwitch', () => {
it('should switch child when entity switches', () => {
@@ -14,16 +14,16 @@
* limitations under the License.
*/
import { Entity } from '@backstage/catalog-model';
import { useEntity } from '@backstage/plugin-catalog-common-react';
import {
ReactNode,
PropsWithChildren,
Children,
Fragment,
useMemo,
isValidElement,
PropsWithChildren,
ReactNode,
useMemo,
} from 'react';
import { useEntity } from '../../hooks/useEntity';
import { Entity } from '@backstage/catalog-model';
const EntitySwitchCase = (_: {
if?: (entity: Entity) => boolean;
+6 -3
View File
@@ -15,15 +15,18 @@
*/
import { ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
import { Content } from '@backstage/core';
import {
entityRoute,
rootRoute,
useEntity,
} from '@backstage/plugin-catalog-common-react';
import { Link, Typography } from '@material-ui/core';
import React, { ComponentType } from 'react';
import { Navigate, Route, Routes, useParams } from 'react-router';
import { useEntity } from '../hooks/useEntity';
import { entityRoute, rootRoute } from '../routes';
import { CatalogPage } from './CatalogPage';
import { EntityLoaderProvider } from './EntityLoaderProvider';
import { EntityNotFound } from './EntityNotFound';
import { EntityPageLayout } from './EntityPageLayout';
import { EntityLoaderProvider } from './EntityLoaderProvider';
const DefaultEntityPage = () => (
<EntityPageLayout>
@@ -16,6 +16,10 @@
import { Entity, ORIGIN_LOCATION_ANNOTATION } from '@backstage/catalog-model';
import { alertApiRef, configApiRef, Progress, useApi } from '@backstage/core';
import {
catalogApiRef,
formatEntityRefTitle,
} from '@backstage/plugin-catalog-common-react';
import {
Button,
Dialog,
@@ -31,8 +35,6 @@ import Alert from '@material-ui/lab/Alert';
import React from 'react';
import { useAsync } from 'react-use';
import { AsyncState } from 'react-use/lib/useAsync';
import { catalogApiRef } from '../../plugin';
import { formatEntityRefTitle } from '../EntityRefLink';
type Props = {
open: boolean;
+2 -2
View File
@@ -15,10 +15,10 @@
*/
import { UserEntity } from '@backstage/catalog-model';
import { identityApiRef, useApi } from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { useAsync } from 'react-use';
import { AsyncState } from 'react-use/lib/useAsync';
import { identityApiRef, useApi } from '@backstage/core';
import { catalogApiRef } from '../plugin';
/**
* Get the catalog User entity (if any) that matches the logged-in user.
+4 -1
View File
@@ -15,7 +15,10 @@
*/
import { createRoutableExtension } from '@backstage/core';
import { catalogRouteRef, entityRouteRef } from './routes';
import {
catalogRouteRef,
entityRouteRef,
} from '@backstage/plugin-catalog-common-react';
import { plugin } from './plugin';
export const CatalogIndexPage = plugin.provide(
@@ -16,9 +16,9 @@
import { Entity } from '@backstage/catalog-model';
import { useApi } from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useAsyncFn } from 'react-use';
import { catalogApiRef } from '../plugin';
import { filterGroupsContext, FilterGroupsContext } from './context';
import {
EntityFilterFn,
+2 -6
View File
@@ -14,15 +14,11 @@
* limitations under the License.
*/
export * from '@backstage/catalog-client';
export { AboutCard } from './components/AboutCard';
export { EntityPageLayout } from './components/EntityPageLayout';
export { EntityLayout } from './components/EntityLayout';
export { EntityPageLayout } from './components/EntityPageLayout';
export { EntityProvider } from './components/EntityProvider';
export * from './components/EntitySwitch';
export { Router } from './components/Router';
export { useEntityCompoundName } from './components/useEntityCompoundName';
export { EntityContext, useEntity } from './hooks/useEntity';
export { catalogApiRef, plugin } from './plugin';
export * from './routes';
export * from './extensions';
export { plugin } from './plugin';
+6 -9
View File
@@ -14,20 +14,17 @@
* limitations under the License.
*/
import { CatalogApi, CatalogClient } from '@backstage/catalog-client';
import { CatalogClient } from '@backstage/catalog-client';
import {
createApiFactory,
createApiRef,
createPlugin,
discoveryApiRef,
} from '@backstage/core';
import { catalogRouteRef, entityRouteRef } from './routes';
export const catalogApiRef = createApiRef<CatalogApi>({
id: 'plugin.catalog.service',
description:
'Used by the Catalog plugin to make requests to accompanying backend',
});
import {
catalogApiRef,
catalogRouteRef,
entityRouteRef,
} from '@backstage/plugin-catalog-common-react';
export const plugin = createPlugin({
id: 'catalog',
+1 -1
View File
@@ -33,7 +33,7 @@
"dependencies": {
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
+2 -2
View File
@@ -15,14 +15,14 @@
*/
import { errorApiRef, useApi } from '@backstage/core';
import { useEntity } from '@backstage/plugin-catalog-common-react';
import { BuildSummary, GitType } from 'circleci-api';
import { getOr } from 'lodash/fp';
import { useCallback, useEffect, useState } from 'react';
import { useAsyncRetry } from 'react-use';
import { circleCIApiRef } from '../api';
import type { CITableBuildInfo } from '../components/BuildsPage/lib/CITable';
import { useEntity } from '@backstage/plugin-catalog';
import { CIRCLECI_ANNOTATION } from '../constants';
import { getOr } from 'lodash/fp';
const makeReadableStatus = (status: string | undefined) => {
if (!status) return '';
-1
View File
@@ -32,7 +32,6 @@
"dependencies": {
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
-1
View File
@@ -35,7 +35,6 @@
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/integration": "^0.3.1",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
+1 -1
View File
@@ -33,7 +33,7 @@
"dependencies": {
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useEntity } from '@backstage/plugin-catalog';
import { useEntity } from '@backstage/plugin-catalog-common-react';
import { JENKINS_ANNOTATION } from '../constants';
export const useProjectSlugFromEntity = () => {
+1 -1
View File
@@ -22,7 +22,7 @@
"dependencies": {
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { PropsWithChildren } from 'react';
import { renderHook } from '@testing-library/react-hooks';
import { useConsumerGroupsForEntity } from './useConsumerGroupsForEntity';
import { EntityContext } from '@backstage/plugin-catalog';
import { Entity } from '@backstage/catalog-model';
import { EntityContext } from '@backstage/plugin-catalog-common-react';
import { renderHook } from '@testing-library/react-hooks';
import React, { PropsWithChildren } from 'react';
import { useConsumerGroupsForEntity } from './useConsumerGroupsForEntity';
describe('useConsumerGroupOffsets', () => {
let entity: Entity;
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { useEntity } from '@backstage/plugin-catalog';
import { useEntity } from '@backstage/plugin-catalog-common-react';
import { useMemo } from 'react';
import { KAFKA_CONSUMER_GROUP_ANNOTATION } from '../../constants';
@@ -13,19 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { PropsWithChildren } from 'react';
import { renderHook } from '@testing-library/react-hooks';
import { EntityContext } from '@backstage/plugin-catalog';
import { Entity } from '@backstage/catalog-model';
import * as data from './__fixtures__/consumer-group-offsets.json';
import { ApiProvider, ApiRegistry, errorApiRef } from '@backstage/core';
import { EntityContext } from '@backstage/plugin-catalog-common-react';
import { renderHook } from '@testing-library/react-hooks';
import { when } from 'jest-when';
import React, { PropsWithChildren } from 'react';
import {
ConsumerGroupOffsetsResponse,
KafkaApi,
kafkaApiRef,
} from '../../api/types';
import { ApiProvider, ApiRegistry, errorApiRef } from '@backstage/core';
import { useConsumerGroupsOffsetsForEntity } from './useConsumerGroupsOffsetsForEntity';
import { when } from 'jest-when';
import * as data from './__fixtures__/consumer-group-offsets.json';
const consumerGroupOffsets = data as ConsumerGroupOffsetsResponse;
+1 -1
View File
@@ -34,7 +34,7 @@
"@backstage/catalog-model": "^0.7.0",
"@backstage/config": "^0.1.2",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
@@ -14,23 +14,22 @@
* limitations under the License.
*/
import React from 'react';
import { render } from '@testing-library/react';
import { Entity } from '@backstage/catalog-model';
import { ApiProvider, ApiRegistry, errorApiRef } from '@backstage/core';
import { EntityContext } from '@backstage/plugin-catalog-common-react';
import { lightTheme } from '@backstage/theme';
import { ThemeProvider } from '@material-ui/core';
import { render } from '@testing-library/react';
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import {
lighthouseApiRef,
LighthouseRestApi,
WebsiteListResponse,
} from '../../api';
import * as data from '../../__fixtures__/website-list-response.json';
import { EntityContext } from '@backstage/plugin-catalog';
import { Entity } from '@backstage/catalog-model';
import { AuditListForEntity } from './AuditListForEntity';
import { lightTheme } from '@backstage/theme';
import { ThemeProvider } from '@material-ui/core';
import { MemoryRouter } from 'react-router-dom';
import { useWebsiteForEntity } from '../../hooks/useWebsiteForEntity';
import * as data from '../../__fixtures__/website-list-response.json';
import { AuditListForEntity } from './AuditListForEntity';
jest.mock('../../hooks/useWebsiteForEntity', () => ({
useWebsiteForEntity: jest.fn(),
@@ -14,21 +14,21 @@
* limitations under the License.
*/
import React from 'react';
import { Entity } from '@backstage/catalog-model';
import { EntityContext } from '@backstage/plugin-catalog-common-react';
import { lightTheme } from '@backstage/theme';
import { ThemeProvider } from '@material-ui/core';
import { render } from '@testing-library/react';
import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import {
AuditCompleted,
LighthouseCategoryId,
WebsiteListResponse,
} from '../../api';
import { EntityContext } from '@backstage/plugin-catalog';
import { Entity } from '@backstage/catalog-model';
import { LastLighthouseAuditCard } from './LastLighthouseAuditCard';
import { lightTheme } from '@backstage/theme';
import { ThemeProvider } from '@material-ui/core';
import { useWebsiteForEntity } from '../../hooks/useWebsiteForEntity';
import { MemoryRouter } from 'react-router-dom';
import * as data from '../../__fixtures__/website-list-response.json';
import { LastLighthouseAuditCard } from './LastLighthouseAuditCard';
jest.mock('../../hooks/useWebsiteForEntity', () => ({
useWebsiteForEntity: jest.fn(),
@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { PropsWithChildren } from 'react';
import { renderHook } from '@testing-library/react-hooks';
import { ApiProvider, ApiRegistry, errorApiRef } from '@backstage/core';
import { lighthouseApiRef, WebsiteListResponse } from '../api';
import { useWebsiteForEntity } from './useWebsiteForEntity';
import { EntityContext } from '@backstage/plugin-catalog';
import { Entity } from '@backstage/catalog-model';
import { ApiProvider, ApiRegistry, errorApiRef } from '@backstage/core';
import { EntityContext } from '@backstage/plugin-catalog-common-react';
import { renderHook } from '@testing-library/react-hooks';
import React, { PropsWithChildren } from 'react';
import { lighthouseApiRef, WebsiteListResponse } from '../api';
import * as data from '../__fixtures__/website-list-response.json';
import { useWebsiteForEntity } from './useWebsiteForEntity';
const websiteListResponse = data as WebsiteListResponse;
const website = websiteListResponse.items[0];
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { useEntity } from '@backstage/plugin-catalog';
import { LIGHTHOUSE_WEBSITE_URL_ANNOTATION } from '../../constants';
import { errorApiRef, useApi } from '@backstage/core';
import { lighthouseApiRef } from '../api';
import { useEntity } from '@backstage/plugin-catalog-common-react';
import { useAsync } from 'react-use';
import { LIGHTHOUSE_WEBSITE_URL_ANNOTATION } from '../../constants';
import { lighthouseApiRef } from '../api';
// For the sake of simplicity we assume that an entity has only one website url. This is to avoid encoding a list
// type in an annotation which is a plain string.
+1 -1
View File
@@ -22,7 +22,7 @@
"dependencies": {
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
@@ -21,7 +21,7 @@ import {
RELATION_PARENT_OF,
} from '@backstage/catalog-model';
import { Avatar, InfoCard } from '@backstage/core';
import { entityRouteParams } from '@backstage/plugin-catalog';
import { entityRouteParams } from '@backstage/plugin-catalog-common-react';
import { Box, Grid, Link, Tooltip, Typography } from '@material-ui/core';
import AccountTreeIcon from '@material-ui/icons/AccountTree';
import EmailIcon from '@material-ui/icons/Email';
@@ -14,11 +14,14 @@
* limitations under the License.
*/
import { Entity, GroupEntity } from '@backstage/catalog-model';
import { ApiProvider, ApiRegistry } from '@backstage/core';
import {
CatalogApi,
catalogApiRef,
} from '@backstage/plugin-catalog-common-react';
import { renderWithEffects, wrapInTestApp } from '@backstage/test-utils';
import React from 'react';
import { ApiProvider, ApiRegistry } from '@backstage/core';
import { CatalogApi, catalogApiRef } from '@backstage/plugin-catalog';
import { Entity, GroupEntity } from '@backstage/catalog-model';
import { MembersListCard } from './MembersListCard';
describe('MemberTab Test', () => {
@@ -20,7 +20,10 @@ import {
UserEntity,
} from '@backstage/catalog-model';
import { Avatar, InfoCard, Progress, useApi } from '@backstage/core';
import { catalogApiRef, entityRouteParams } from '@backstage/plugin-catalog';
import {
catalogApiRef,
entityRouteParams,
} from '@backstage/plugin-catalog-common-react';
import {
Box,
createStyles,
@@ -17,7 +17,7 @@
import React from 'react';
import { InfoCard, useApi, Progress } from '@backstage/core';
import { Entity } from '@backstage/catalog-model';
import { catalogApiRef } from '@backstage/plugin-catalog';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { useAsync } from 'react-use';
import Alert from '@material-ui/lab/Alert';
import {
@@ -19,7 +19,7 @@ import {
UserEntity,
} from '@backstage/catalog-model';
import { Avatar, InfoCard } from '@backstage/core';
import { entityRouteParams } from '@backstage/plugin-catalog';
import { entityRouteParams } from '@backstage/plugin-catalog-common-react';
import { Box, Grid, Link, Tooltip, Typography } from '@material-ui/core';
import EmailIcon from '@material-ui/icons/Email';
import GroupIcon from '@material-ui/icons/Group';
+1 -1
View File
@@ -32,7 +32,7 @@
"dependencies": {
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
@@ -20,7 +20,7 @@ import {
createRouteRef,
errorApiRef,
} from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { lightTheme } from '@backstage/theme';
import { ThemeProvider } from '@material-ui/core';
import { render, screen } from '@testing-library/react';
@@ -14,23 +14,23 @@
* limitations under the License.
*/
import React, { useState } from 'react';
import { Grid, makeStyles } from '@material-ui/core';
import { Entity, Location } from '@backstage/catalog-model';
import {
InfoCard,
Page,
Content,
useApi,
ContentHeader,
errorApiRef,
Header,
SupportButton,
ContentHeader,
InfoCard,
Page,
RouteRef,
SupportButton,
useApi,
} from '@backstage/core';
import { RegisterComponentForm } from '../RegisterComponentForm';
import { catalogApiRef } from '@backstage/plugin-catalog';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { Grid, makeStyles } from '@material-ui/core';
import React, { useState } from 'react';
import { useMountedState } from 'react-use';
import { Entity, Location } from '@backstage/catalog-model';
import { RegisterComponentForm } from '../RegisterComponentForm';
import { RegisterComponentResultDialog } from '../RegisterComponentResultDialog';
const useStyles = makeStyles(theme => ({
@@ -16,7 +16,10 @@
import { Entity } from '@backstage/catalog-model';
import { RouteRef, StructuredMetadataTable } from '@backstage/core';
import { entityRoute, entityRouteParams } from '@backstage/plugin-catalog';
import {
entityRoute,
entityRouteParams,
} from '@backstage/plugin-catalog-common-react';
import {
Button,
Dialog,
+1 -1
View File
@@ -33,7 +33,7 @@
"dependencies": {
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
@@ -21,7 +21,10 @@ import {
ConfigApi,
configApiRef,
} from '@backstage/core';
import { catalogApiRef, CatalogApi } from '@backstage/plugin-catalog';
import {
catalogApiRef,
CatalogApi,
} from '@backstage/plugin-catalog-common-react';
import { wrapInTestApp } from '@backstage/test-utils';
import { render } from '@testing-library/react';
import { RollbarApi, rollbarApiRef } from '../../api/RollbarApi';
@@ -14,19 +14,22 @@
* limitations under the License.
*/
import * as React from 'react';
import {
ApiProvider,
ApiRegistry,
ConfigApi,
configApiRef,
} from '@backstage/core';
import {
CatalogApi,
catalogApiRef,
} from '@backstage/plugin-catalog-common-react';
import { wrapInTestApp } from '@backstage/test-utils';
import { render } from '@testing-library/react';
import * as React from 'react';
import { RollbarApi, rollbarApiRef } from '../../api/RollbarApi';
import { RollbarTopActiveItem } from '../../api/types';
import { RollbarProjectPage } from './RollbarProjectPage';
import { catalogApiRef, CatalogApi } from '@backstage/plugin-catalog';
describe('RollbarProjectPage component', () => {
const items: RollbarTopActiveItem[] = [
@@ -14,12 +14,12 @@
* limitations under the License.
*/
import { useAsync } from 'react-use';
import { useApi } from '@backstage/core';
import {
catalogApiRef,
useEntityCompoundName,
} from '@backstage/plugin-catalog';
} from '@backstage/plugin-catalog-common-react';
import { useAsync } from 'react-use';
export function useCatalogEntity() {
const catalogApi = useApi(catalogApiRef);
@@ -14,9 +14,9 @@
* limitations under the License.
*/
import { configApiRef, useApi } from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { useAsync } from 'react-use';
import { useApi, configApiRef } from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog';
import { ROLLBAR_ANNOTATION } from '../constants';
export function useRollbarEntities() {
+1 -1
View File
@@ -32,7 +32,7 @@
"dependencies": {
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
@@ -27,7 +27,7 @@ import {
useApi,
WarningPanel,
} from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { Button, Grid, Link, Typography } from '@material-ui/core';
import React, { useEffect } from 'react';
import { Link as RouterLink } from 'react-router-dom';
@@ -14,7 +14,10 @@
* limitations under the License.
*/
import { ApiProvider, ApiRegistry, errorApiRef } from '@backstage/core';
import { CatalogApi, catalogApiRef } from '@backstage/plugin-catalog';
import {
CatalogApi,
catalogApiRef,
} from '@backstage/plugin-catalog-common-react';
import { renderInTestApp, renderWithEffects } from '@backstage/test-utils';
import { lightTheme } from '@backstage/theme';
import { ThemeProvider } from '@material-ui/core';
@@ -27,19 +27,19 @@ import {
catalogApiRef,
entityRoute,
entityRouteParams,
} from '@backstage/plugin-catalog';
} from '@backstage/plugin-catalog-common-react';
import { LinearProgress } from '@material-ui/core';
import { IChangeEvent } from '@rjsf/core';
import React, { useState, useCallback } from 'react';
import parseGitUrl from 'git-url-parse';
import React, { useCallback, useState } from 'react';
import { generatePath, Navigate } from 'react-router';
import { useParams } from 'react-router-dom';
import { useAsync } from 'react-use';
import { scaffolderApiRef } from '../../api';
import { rootRoute } from '../../routes';
import { useJobPolling } from '../hooks/useJobPolling';
import { JobStatusModal } from '../JobStatusModal';
import { MultistepJsonForm } from '../MultistepJsonForm';
import { useJobPolling } from '../hooks/useJobPolling';
import parseGitUrl from 'git-url-parse';
const useTemplate = (
templateName: string,
+1 -1
View File
@@ -30,8 +30,8 @@
},
"dependencies": {
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/catalog-model": "^0.7.0",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
+1 -1
View File
@@ -14,8 +14,8 @@
* limitations under the License.
*/
import { CatalogApi } from '@backstage/plugin-catalog';
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
import { CatalogApi } from '@backstage/plugin-catalog-common-react';
export type Result = {
name: string;
@@ -13,23 +13,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, { useState, useEffect } from 'react';
import { useAsync } from 'react-use';
import { makeStyles, Typography, Grid, Divider } from '@material-ui/core';
import { Alert } from '@material-ui/lab';
import {
Link,
EmptyState,
Link,
Progress,
Table,
TableColumn,
useApi,
} from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog';
import { FiltersButton, Filters, FiltersState } from '../Filters';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { Divider, Grid, makeStyles, Typography } from '@material-ui/core';
import { Alert } from '@material-ui/lab';
import React, { useEffect, useState } from 'react';
import { useAsync } from 'react-use';
import SearchApi, { Result, SearchResults } from '../../apis';
import { Filters, FiltersButton, FiltersState } from '../Filters';
const useStyles = makeStyles(theme => ({
searchQuery: {
+3 -3
View File
@@ -15,17 +15,17 @@
*/
import { Entity } from '@backstage/catalog-model';
import { EntityProvider } from '@backstage/plugin-catalog';
import { Content, Header, Page } from '@backstage/core';
import { createDevApp, EntityGridItem } from '@backstage/dev-utils';
import { EntityProvider } from '@backstage/plugin-catalog-common-react';
import { Grid } from '@material-ui/core';
import React from 'react';
import {
EntitySentryCard,
EntitySentryContent,
MockSentryApi,
SentryApi,
sentryApiRef,
EntitySentryCard,
EntitySentryContent,
} from '../src';
import { SENTRY_PROJECT_SLUG_ANNOTATION } from '../src/components/useProjectSlug';
+1 -1
View File
@@ -33,7 +33,7 @@
"dependencies": {
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/theme": "^0.2.2",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
+2 -2
View File
@@ -14,12 +14,12 @@
* limitations under the License.
*/
import React from 'react';
import {
createComponentExtension,
createRoutableExtension,
} from '@backstage/core';
import { useEntity } from '@backstage/plugin-catalog';
import { useEntity } from '@backstage/plugin-catalog-common-react';
import React from 'react';
import { plugin, rootRouteRef } from './plugin';
export const EntitySentryContent = plugin.provide(
+1 -1
View File
@@ -33,7 +33,7 @@
"dependencies": {
"@backstage/catalog-model": "^0.7.0",
"@backstage/core": "^0.5.0",
"@backstage/plugin-catalog": "^0.2.14",
"@backstage/plugin-catalog-common-react": "^0.0.1",
"@backstage/test-utils": "^0.1.6",
"@backstage/theme": "^0.2.2",
"@backstage/techdocs-common": "^0.3.6",
@@ -15,7 +15,10 @@
*/
import { ApiProvider, ApiRegistry } from '@backstage/core';
import { CatalogApi, catalogApiRef } from '@backstage/plugin-catalog';
import {
CatalogApi,
catalogApiRef,
} from '@backstage/plugin-catalog-common-react';
import { wrapInTestApp } from '@backstage/test-utils';
import { render } from '@testing-library/react';
import React from 'react';
@@ -22,7 +22,7 @@ import {
Progress,
useApi,
} from '@backstage/core';
import { catalogApiRef } from '@backstage/plugin-catalog';
import { catalogApiRef } from '@backstage/plugin-catalog-common-react';
import { Grid } from '@material-ui/core';
import React from 'react';
import { generatePath, useNavigate } from 'react-router-dom';