Rename useProjectSlug.ts to useProjectId.ts

Signed-off-by: Karan Shah <karan.shah@simplybusiness.co.uk>
This commit is contained in:
Karan Shah
2022-01-27 14:21:27 +00:00
parent f3238a1a6c
commit 6b5b9f2f1b
3 changed files with 4 additions and 7 deletions
+1 -1
View File
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AIRBRAKE_PROJECT_ID_ANNOTATION } from '../../components/useProjectSlug';
import { AIRBRAKE_PROJECT_ID_ANNOTATION } from '../../components/useProjectId';
import { Entity } from '@backstage/catalog-model';
export const createEntity = (projectId?: number) => {
@@ -28,10 +28,7 @@ import { BackstageTheme } from '@backstage/theme';
import { ErrorApi, errorApiRef, useApi } from '@backstage/core-plugin-api';
import { airbrakeApiRef } from '../../api';
import useAsync from 'react-use/lib/useAsync';
import {
AIRBRAKE_PROJECT_ID_ANNOTATION,
useProjectSlug,
} from '../useProjectSlug';
import { AIRBRAKE_PROJECT_ID_ANNOTATION, useProjectId } from '../useProjectId';
const useStyles = makeStyles<BackstageTheme>(() => ({
multilineText: {
@@ -42,7 +39,7 @@ const useStyles = makeStyles<BackstageTheme>(() => ({
export const EntityAirbrakeWidget = ({ entity }: { entity: Entity }) => {
const classes = useStyles();
const projectId = useProjectSlug(entity);
const projectId = useProjectId(entity);
const errorApi = useApi<ErrorApi>(errorApiRef);
const airbrakeApi = useApi(airbrakeApiRef);
@@ -18,6 +18,6 @@ import { Entity } from '@backstage/catalog-model';
export const AIRBRAKE_PROJECT_ID_ANNOTATION = 'airbrake.io/project-id';
export const useProjectSlug = (entity: Entity) => {
export const useProjectId = (entity: Entity) => {
return entity?.metadata.annotations?.[AIRBRAKE_PROJECT_ID_ANNOTATION] ?? '';
};