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