diff --git a/plugins/bazaar-backend/migrations/20210923133506_init.js b/plugins/bazaar-backend/migrations/20210923133506_init.js index 3076592754..f40125ea42 100644 --- a/plugins/bazaar-backend/migrations/20210923133506_init.js +++ b/plugins/bazaar-backend/migrations/20210923133506_init.js @@ -51,6 +51,7 @@ exports.up = async function up(knex) { .defaultTo(knex.fn.now()) .notNullable() .comment('The timestamp when this member joined'); + table.text('picture').comment('Link to profile picture'); }); }; diff --git a/plugins/bazaar-backend/src/service/DatabaseHandler.ts b/plugins/bazaar-backend/src/service/DatabaseHandler.ts index 7a5ad77afb..8a96f4212f 100644 --- a/plugins/bazaar-backend/src/service/DatabaseHandler.ts +++ b/plugins/bazaar-backend/src/service/DatabaseHandler.ts @@ -50,11 +50,12 @@ export class DatabaseHandler { .where({ entity_ref: entityRef }); } - async addMember(userId: any, entityRef: any) { + async addMember(userId: any, entityRef: any, picture?: string) { await this.database .insert({ entity_ref: entityRef, user_id: userId, + picture: picture, }) .into('public.members'); } diff --git a/plugins/bazaar-backend/src/service/router.ts b/plugins/bazaar-backend/src/service/router.ts index 8d4866408a..46d26c3c37 100644 --- a/plugins/bazaar-backend/src/service/router.ts +++ b/plugins/bazaar-backend/src/service/router.ts @@ -52,8 +52,8 @@ export async function createRouter( }); router.put('/member', async (request, response) => { - const { user_id, entity_ref } = request.body; - await dbHandler.addMember(user_id, entity_ref); + const { user_id, entity_ref, picture } = request.body; + await dbHandler.addMember(user_id, entity_ref, picture); response.json({ status: 'ok' }); }); diff --git a/plugins/bazaar/src/api.ts b/plugins/bazaar/src/api.ts index e825d8d46a..b3f7857511 100644 --- a/plugins/bazaar/src/api.ts +++ b/plugins/bazaar/src/api.ts @@ -122,6 +122,7 @@ export class BazaarClient implements BazaarApi { body: JSON.stringify({ entity_ref: stringifyEntityRef(entity), user_id: this.identityApi.getUserId(), + picture: this.identityApi.getProfile()?.picture, }), }); } diff --git a/plugins/bazaar/src/components/EntityBazaarInfoCard/EntityBazaarInfoCard.tsx b/plugins/bazaar/src/components/EntityBazaarInfoCard/EntityBazaarInfoCard.tsx index 24eb064951..6bf844d592 100644 --- a/plugins/bazaar/src/components/EntityBazaarInfoCard/EntityBazaarInfoCard.tsx +++ b/plugins/bazaar/src/components/EntityBazaarInfoCard/EntityBazaarInfoCard.tsx @@ -28,6 +28,7 @@ import { MenuList, MenuItem, ListItemText, + Link, } from '@material-ui/core'; import { Progress, @@ -35,7 +36,6 @@ import { IconLinkVerticalProps, Avatar, } from '@backstage/core-components'; -import { Link } from 'react-router-dom'; import { useEntity } from '@backstage/plugin-catalog-react'; import { AboutField } from '@backstage/plugin-catalog'; import { StatusTag } from '../StatusTag'; @@ -95,6 +95,7 @@ export const EntityBazaarInfoCard = () => { userId: obj.user_id, entityRef: obj.entity_ref, joinDate: obj.join_date, + picture: obj.picture, }; return member; @@ -299,10 +300,12 @@ export const EntityBazaarInfoCard = () => { float: 'left', marginRight: '0.3rem', }} + picture={member.picture} /> {member?.userId} diff --git a/plugins/bazaar/src/components/InputField/InputField.tsx b/plugins/bazaar/src/components/InputField/InputField.tsx index de2179ef23..fc25cd7a43 100644 --- a/plugins/bazaar/src/components/InputField/InputField.tsx +++ b/plugins/bazaar/src/components/InputField/InputField.tsx @@ -36,7 +36,8 @@ export const InputField = ({ placeholder, required, }: Props) => { - const label = inputType.charAt(0).toUpperCase() + inputType.slice(1); + const label = + inputType.charAt(0).toLocaleUpperCase('en-US') + inputType.slice(1); return ( { - const label = name.charAt(0).toUpperCase() + name.slice(1); + const label = name.charAt(0).toLocaleUpperCase('en-US') + name.slice(1); return (