mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-22 00:39:24 +00:00
misc fixes (#202)
* misc fixes * minor changes * minor fix * removed commented code
This commit is contained in:
parent
0dbbc9644b
commit
c53f3c7d60
@ -168,7 +168,7 @@ const ManageTab: FunctionComponent<Props> = ({
|
||||
<NonAdminAction
|
||||
html={
|
||||
<>
|
||||
<p>You need ownership to perform this action</p>
|
||||
<p>You need to be owner to perform this action</p>
|
||||
<p>Claim ownership from above </p>
|
||||
</>
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ import useToastContext from '../../hooks/useToastContext';
|
||||
import { getCurrentUserId, isEven } from '../../utils/CommonUtils';
|
||||
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
||||
import SVGIcons from '../../utils/SvgUtils';
|
||||
import { getUsagePercentile } from '../../utils/TableUtils';
|
||||
import { getOwnerFromId, getUsagePercentile } from '../../utils/TableUtils';
|
||||
import { getTableTags } from '../../utils/TagsUtils';
|
||||
|
||||
const DatabaseDetails: FunctionComponent = () => {
|
||||
@ -308,7 +308,9 @@ const DatabaseDetails: FunctionComponent = () => {
|
||||
)}
|
||||
</td>
|
||||
<td className="tableBody-cell">
|
||||
<p>{table?.owner?.name || '--'}</p>
|
||||
<p>
|
||||
{getOwnerFromId(table?.owner?.id)?.name || '--'}
|
||||
</p>
|
||||
</td>
|
||||
<td className="tableBody-cell">
|
||||
<p>
|
||||
|
@ -23,7 +23,6 @@ import { observer } from 'mobx-react';
|
||||
import { ColumnTags, TableColumn, TableDetail, TableJoinsData } from 'Models';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import AppState from '../../AppState';
|
||||
import { getDatabase } from '../../axiosAPIs/databaseAPI';
|
||||
import { postFeed } from '../../axiosAPIs/feedsAPI';
|
||||
import { getServiceById } from '../../axiosAPIs/serviceAPI';
|
||||
@ -56,6 +55,7 @@ import {
|
||||
getCurrentUserId,
|
||||
getPartialNameFromFQN,
|
||||
getTableFQNFromColumnFQN,
|
||||
getUserTeams,
|
||||
} from '../../utils/CommonUtils';
|
||||
import { serviceTypeLogo } from '../../utils/ServiceUtils';
|
||||
import SVGIcons from '../../utils/SvgUtils';
|
||||
@ -184,7 +184,7 @@ const MyDataDetailsPage = () => {
|
||||
if (owner?.type === 'user') {
|
||||
return owner.id === getCurrentUserId();
|
||||
} else {
|
||||
return AppState.userTeams.some((team) => team.id === owner?.id);
|
||||
return getUserTeams().some((team) => team.id === owner?.id);
|
||||
}
|
||||
};
|
||||
|
||||
@ -450,7 +450,7 @@ const MyDataDetailsPage = () => {
|
||||
</button>
|
||||
<NonAdminAction
|
||||
isOwner={!owner || hasEditAccess()}
|
||||
title="You need ownership to perform this action">
|
||||
title="You need to be owner to perform this action">
|
||||
<button
|
||||
className={getTabClasses(6, activeTab)}
|
||||
data-testid="tab"
|
||||
@ -474,7 +474,7 @@ const MyDataDetailsPage = () => {
|
||||
<NonAdminAction
|
||||
html={
|
||||
<>
|
||||
<p>You need ownership to perform this action</p>
|
||||
<p>You need to be owner to perform this action</p>
|
||||
{!owner ? (
|
||||
<p>Claim ownership in Manage </p>
|
||||
) : null}
|
||||
|
@ -16,8 +16,10 @@
|
||||
*/
|
||||
|
||||
import { AxiosError } from 'axios';
|
||||
import { observer } from 'mobx-react';
|
||||
import { FormatedTableData, SearchResponse } from 'Models';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import AppState from '../../AppState';
|
||||
import { searchData } from '../../axiosAPIs/miscAPI';
|
||||
import Error from '../../components/common/error/Error';
|
||||
import Loader from '../../components/Loader/Loader';
|
||||
@ -41,21 +43,28 @@ const MyDataPage: React.FC = (): React.ReactElement => {
|
||||
const [filter, setFilter] = useState<string>('');
|
||||
const [countServices, setCountServices] = useState<number>(0);
|
||||
const [countAssets, setCountAssets] = useState<number>(0);
|
||||
|
||||
const isMounted = useRef<boolean>(false);
|
||||
|
||||
const getActiveTabClass = (tab: number) => {
|
||||
return tab === currentTab ? 'active' : '';
|
||||
};
|
||||
|
||||
const getFilters = (): string => {
|
||||
if (filter === 'owner') {
|
||||
const ownerIds = [
|
||||
...AppState.userDetails.teams.map((team) => `${filter}:${team.id}`),
|
||||
`${filter}:${getCurrentUserId()}`,
|
||||
];
|
||||
|
||||
return `(${ownerIds.join(' OR ')})`;
|
||||
}
|
||||
|
||||
return `${filter}:${getCurrentUserId()}`;
|
||||
};
|
||||
|
||||
const fetchTableData = (setAssetCount = false) => {
|
||||
setIsLoading(true);
|
||||
searchData(
|
||||
'',
|
||||
currentPage,
|
||||
PAGE_SIZE,
|
||||
filter ? `${filter}:${getCurrentUserId()}` : ''
|
||||
)
|
||||
searchData('', currentPage, PAGE_SIZE, filter ? getFilters() : '')
|
||||
.then((res: SearchResponse) => {
|
||||
const hits = res.data.hits.hits;
|
||||
const total = res.data.hits.total.value;
|
||||
@ -166,4 +175,4 @@ const MyDataPage: React.FC = (): React.ReactElement => {
|
||||
);
|
||||
};
|
||||
|
||||
export default MyDataPage;
|
||||
export default observer(MyDataPage);
|
||||
|
@ -3,7 +3,6 @@ import React from 'react';
|
||||
import AppState from '../AppState';
|
||||
import PopOver from '../components/common/popover/PopOver';
|
||||
import { ConstraintTypes } from '../enums/table.enum';
|
||||
import { getUserTeams } from './CommonUtils';
|
||||
import { ordinalize } from './StringsUtils';
|
||||
import SVGIcons from './SvgUtils';
|
||||
|
||||
@ -90,7 +89,7 @@ export const getOwnerFromId = (
|
||||
type: 'user',
|
||||
};
|
||||
} else {
|
||||
const team = getUserTeams().find((item) => item.id === id);
|
||||
const team = AppState.userTeams.find((item) => item.id === id);
|
||||
if (team) {
|
||||
retVal = {
|
||||
name: team.displayName || team.name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user