feat(user-settings): Search for user avatar also in the entities
If the identity system doesn't provide an avatar, but the existing user entity does have the correct annotation use that as the profile avatar. Fixes #26838 Signed-off-by: Łukasz Jernaś <lukasz.jernas@allegro.com>
This commit is contained in:
@@ -17,10 +17,37 @@
|
||||
import React from 'react';
|
||||
import { CatalogEntityPage } from '@backstage/plugin-catalog';
|
||||
import { createDevApp } from '@backstage/dev-utils';
|
||||
import { userSettingsPlugin, UserSettingsPage } from '../src/plugin';
|
||||
import { UserSettingsPage, userSettingsPlugin } from '../src';
|
||||
import { CatalogApi, catalogApiRef } from '@backstage/plugin-catalog-react';
|
||||
import {
|
||||
CompoundEntityRef,
|
||||
Entity,
|
||||
UserEntity,
|
||||
} from '@backstage/catalog-model';
|
||||
|
||||
const userEntity: UserEntity = {
|
||||
apiVersion: 'backstage.io/v1beta1',
|
||||
kind: 'User',
|
||||
metadata: {
|
||||
name: 'Guest',
|
||||
},
|
||||
spec: {},
|
||||
};
|
||||
createDevApp()
|
||||
.registerPlugin(userSettingsPlugin)
|
||||
.registerApi({
|
||||
api: catalogApiRef,
|
||||
deps: {},
|
||||
factory() {
|
||||
return {
|
||||
async getEntityByRef(
|
||||
_: string | CompoundEntityRef,
|
||||
): Promise<Entity | undefined> {
|
||||
return userEntity;
|
||||
},
|
||||
} as Partial<CatalogApi> as unknown as CatalogApi;
|
||||
},
|
||||
})
|
||||
.addPage({
|
||||
title: 'Settings',
|
||||
path: '/settings',
|
||||
|
||||
Reference in New Issue
Block a user