Fix up tsc

Signed-off-by: Elliot Greenwood <hello@elliotgreenwood.co.uk>
This commit is contained in:
Elliot Greenwood
2021-02-14 02:58:46 +00:00
parent 8e8413d741
commit 87b921af67
4 changed files with 36 additions and 15 deletions
@@ -35,6 +35,7 @@ const dummyDepartment = {
};
const defaultEntity: GroupEntity = {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Group',
metadata: {
name: 'team-a',
@@ -47,6 +48,8 @@ const defaultEntity: GroupEntity = {
picture:
'https://avatars.dicebear.com/api/identicon/team-a@example.com.svg?background=%23fff&margin=25',
},
type: 'group',
children: [],
},
relations: [dummyDepartment],
};
@@ -56,7 +59,7 @@ export const Default = () => (
<EntityContext.Provider value={{ entity: defaultEntity, loading: false }}>
<Grid container spacing={4}>
<Grid item xs={12} md={4}>
<GroupProfileCard />
<GroupProfileCard variant="gridItem" />
</Grid>
</Grid>
</EntityContext.Provider>
@@ -16,12 +16,8 @@
import { Grid } from '@material-ui/core';
import React from 'react';
import { MemoryRouter } from 'react-router';
import { GroupEntity, UserEntity } from '@backstage/catalog-model';
import {
EntityContext,
CatalogApi,
catalogApiRef,
} from '@backstage/plugin-catalog-react';
import { Entity, GroupEntity } from '@backstage/catalog-model';
import { EntityContext, catalogApiRef } from '@backstage/plugin-catalog-react';
import { ApiProvider, ApiRegistry } from '@backstage/core-api';
import { MembersListCard } from '.';
@@ -31,7 +27,18 @@ export default {
component: MembersListCard,
};
const makeUser = ({ name, uid, displayName, email }) => ({
const makeUser = ({
name,
uid,
displayName,
email,
}: {
name: string;
uid: string;
displayName: string;
email: string;
}) => ({
apiVersion: 'backstage.io/v1alpha1',
kind: 'User',
metadata: {
name,
@@ -57,6 +64,7 @@ const makeUser = ({ name, uid, displayName, email }) => ({
});
const defaultEntity: GroupEntity = {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Group',
metadata: {
name: 'team-a',
@@ -69,6 +77,8 @@ const defaultEntity: GroupEntity = {
picture:
'https://avatars.dicebear.com/api/identicon/team-a@example.com.svg?background=%23fff&margin=25',
},
type: 'group',
children: [],
},
};
@@ -85,11 +95,11 @@ const bob = makeUser({
email: 'bob@example.com',
});
const catalogApi = items => ({
const catalogApi = (items: Entity[]) => ({
getEntities: () => Promise.resolve({ items }),
});
const apiRegistry = items =>
const apiRegistry = (items: Entity[]) =>
ApiRegistry.from([[catalogApiRef, catalogApi(items)]]);
export const Default = () => (
@@ -16,7 +16,7 @@
import { Grid } from '@material-ui/core';
import React from 'react';
import { MemoryRouter } from 'react-router';
import { GroupEntity, UserEntity } from '@backstage/catalog-model';
import { GroupEntity } from '@backstage/catalog-model';
import {
EntityContext,
CatalogApi,
@@ -32,6 +32,7 @@ export default {
};
const defaultEntity: GroupEntity = {
apiVersion: 'backstage.io/v1alpha1',
kind: 'Group',
metadata: {
name: 'team-a',
@@ -44,10 +45,13 @@ const defaultEntity: GroupEntity = {
picture:
'https://avatars.dicebear.com/api/identicon/team-a@example.com.svg?background=%23fff&margin=25',
},
type: 'group',
children: [],
},
};
const makeComponent = ({ type, name }: { type: string; name: string }) => ({
apiVersion: 'backstage.io/v1alpha1',
kind: 'Component',
metadata: {
name,
@@ -83,7 +87,7 @@ export const Default = () => (
<EntityContext.Provider value={{ entity: defaultEntity, loading: false }}>
<Grid container spacing={4}>
<Grid item xs={12} md={6}>
<OwnershipCard />
<OwnershipCard variant="gridItem" />
</Grid>
</Grid>
</EntityContext.Provider>
@@ -35,6 +35,7 @@ const dummyGroup = {
};
const defaultEntity: UserEntity = {
apiVersion: 'backstage.io/v1alpha1',
kind: 'User',
metadata: {
name: 'guest',
@@ -46,6 +47,7 @@ const defaultEntity: UserEntity = {
picture:
'https://avatars.dicebear.com/api/avataaars/guest@example.com.svg?background=%23fff',
},
memberOf: ['team-a'],
},
relations: [dummyGroup],
};
@@ -55,7 +57,7 @@ export const Default = () => (
<EntityContext.Provider value={{ entity: defaultEntity, loading: false }}>
<Grid container spacing={4}>
<Grid item xs={12} md={4}>
<UserProfileCard />
<UserProfileCard variant="gridItem" />
</Grid>
</Grid>
</EntityContext.Provider>
@@ -63,7 +65,8 @@ export const Default = () => (
);
const noImageEntity: UserEntity = {
kind: 'user',
apiVersion: 'backstage.io/v1alpha1',
kind: 'User',
metadata: {
name: 'guest',
},
@@ -72,6 +75,7 @@ const noImageEntity: UserEntity = {
displayName: 'Guest User',
email: 'guest@example.com',
},
memberOf: ['team-a'],
},
relations: [dummyGroup],
};
@@ -81,7 +85,7 @@ export const NoImage = () => (
<EntityContext.Provider value={{ entity: noImageEntity, loading: false }}>
<Grid container spacing={4}>
<Grid item xs={12} md={4}>
<UserProfileCard />
<UserProfileCard variant="gridItem" />
</Grid>
</Grid>
</EntityContext.Provider>