mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-09 05:56:17 +00:00
* Replace the user ID with user name in Glossary * Replace the user ID with user name in glossary version history tab * fix tests --------- Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
This commit is contained in:
parent
8746058d83
commit
bd50db250f
@ -17,6 +17,8 @@ import { capitalize, isEmpty, toString } from 'lodash';
|
||||
import React, { Fragment, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { EntityHistory } from '../../../generated/type/entityHistory';
|
||||
import { getUserById } from '../../../rest/userAPI';
|
||||
import { getEntityName } from '../../../utils/EntityUtils';
|
||||
import { getSummary, isMajorVersion } from '../../../utils/EntityVersionUtils';
|
||||
import CloseIcon from '../../Modals/CloseIcon.component';
|
||||
|
||||
@ -36,6 +38,18 @@ const EntityVersionTimeLine: React.FC<Props> = ({
|
||||
}: Props) => {
|
||||
const { t } = useTranslation();
|
||||
const [versionType] = useState<VersionType>('all');
|
||||
const [uname, setUname] = useState<string>('');
|
||||
|
||||
const fetchUserName = async (id: string) => {
|
||||
try {
|
||||
const userData = await getUserById(id, 'displayName');
|
||||
|
||||
const name: string = getEntityName(userData);
|
||||
setUname(name);
|
||||
} catch (err) {
|
||||
setUname(id);
|
||||
}
|
||||
};
|
||||
|
||||
const versions = useMemo(() => {
|
||||
let versionTypeList = [];
|
||||
@ -78,6 +92,11 @@ const EntityVersionTimeLine: React.FC<Props> = ({
|
||||
return versionTypeList.length ? (
|
||||
versionTypeList.map((v, i) => {
|
||||
const currV = JSON.parse(v);
|
||||
const userId: string = currV?.updatedBy;
|
||||
fetchUserName(userId);
|
||||
{
|
||||
userId === 'admin' ? setUname('admin') : ' ';
|
||||
}
|
||||
const majorVersionChecks = () => {
|
||||
return (
|
||||
isMajorVersion(
|
||||
@ -142,7 +161,7 @@ const EntityVersionTimeLine: React.FC<Props> = ({
|
||||
})}
|
||||
</div>
|
||||
<p className="text-xs font-italic">
|
||||
<span className="font-medium">{currV?.updatedBy}</span>
|
||||
<span className="font-medium">{uname}</span>
|
||||
<span className="text-grey-muted">
|
||||
{' '}
|
||||
{t('label.updated-on')}{' '}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user