Rename useProjectSlug.ts to useProjectId.ts
Signed-off-by: Karan Shah <karan.shah@simplybusiness.co.uk>
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
+1
-1
@@ -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] ?? '';
|
||||
};
|
||||
Reference in New Issue
Block a user