mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-01 21:23:10 +00:00
minor domain fixes (#17407)
This commit is contained in:
parent
330b97a669
commit
a654238634
@ -69,7 +69,7 @@ export const AdvanceSearchProvider = ({
|
|||||||
([, tabInfo]) => tabInfo.path === tab
|
([, tabInfo]) => tabInfo.path === tab
|
||||||
);
|
);
|
||||||
if (isNil(tabInfo)) {
|
if (isNil(tabInfo)) {
|
||||||
return SearchIndex.TABLE;
|
return SearchIndex.DATA_ASSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tabInfo[0] as SearchIndex;
|
return tabInfo[0] as SearchIndex;
|
||||||
|
@ -63,6 +63,7 @@ import {
|
|||||||
} from '../../utils/BrowserNotificationUtils';
|
} from '../../utils/BrowserNotificationUtils';
|
||||||
import { refreshPage } from '../../utils/CommonUtils';
|
import { refreshPage } from '../../utils/CommonUtils';
|
||||||
import entityUtilClassBase from '../../utils/EntityUtilClassBase';
|
import entityUtilClassBase from '../../utils/EntityUtilClassBase';
|
||||||
|
import { getEntityName } from '../../utils/EntityUtils';
|
||||||
import {
|
import {
|
||||||
getEntityFQN,
|
getEntityFQN,
|
||||||
getEntityType,
|
getEntityType,
|
||||||
@ -472,6 +473,8 @@ const NavBar = ({
|
|||||||
menu={{
|
menu={{
|
||||||
items: domainOptions,
|
items: domainOptions,
|
||||||
onClick: handleDomainChange,
|
onClick: handleDomainChange,
|
||||||
|
className: 'domain-dropdown-menu',
|
||||||
|
defaultSelectedKeys: [activeDomain],
|
||||||
}}
|
}}
|
||||||
placement="bottomRight"
|
placement="bottomRight"
|
||||||
trigger={['click']}>
|
trigger={['click']}>
|
||||||
@ -486,7 +489,9 @@ const NavBar = ({
|
|||||||
</Col>
|
</Col>
|
||||||
<Col className="flex-center">
|
<Col className="flex-center">
|
||||||
<Typography.Text>
|
<Typography.Text>
|
||||||
{activeDomainEntityRef?.displayName ?? activeDomain}
|
{activeDomainEntityRef
|
||||||
|
? getEntityName(activeDomainEntityRef)
|
||||||
|
: activeDomain}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</Col>
|
</Col>
|
||||||
<Col className="flex-center">
|
<Col className="flex-center">
|
||||||
|
@ -29,3 +29,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.domain-dropdown-menu {
|
||||||
|
max-height: 400px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import { Typography } from 'antd';
|
import { Tooltip, Typography } from 'antd';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { compare } from 'fast-json-patch';
|
import { compare } from 'fast-json-patch';
|
||||||
@ -18,6 +18,7 @@ import { get, isEmpty, isUndefined } from 'lodash';
|
|||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { ReactComponent as DomainIcon } from '../../../assets/svg/ic-domain.svg';
|
import { ReactComponent as DomainIcon } from '../../../assets/svg/ic-domain.svg';
|
||||||
|
import { ReactComponent as InheritIcon } from '../../../assets/svg/ic-inherit.svg';
|
||||||
import { DE_ACTIVE_COLOR } from '../../../constants/constants';
|
import { DE_ACTIVE_COLOR } from '../../../constants/constants';
|
||||||
import { EntityReference } from '../../../generated/entity/type';
|
import { EntityReference } from '../../../generated/entity/type';
|
||||||
import {
|
import {
|
||||||
@ -104,17 +105,37 @@ export const DomainLabel = ({
|
|||||||
Array.isArray(activeDomain) &&
|
Array.isArray(activeDomain) &&
|
||||||
activeDomain.length > 0
|
activeDomain.length > 0
|
||||||
) {
|
) {
|
||||||
return activeDomain.map((domain, index) => (
|
return activeDomain.map((domain) => {
|
||||||
<React.Fragment key={domain.id}>
|
const inheritedIcon = domain?.inherited ? (
|
||||||
{renderDomainLink(
|
<Tooltip
|
||||||
domain,
|
title={t('label.inherited-entity', {
|
||||||
domainDisplayName,
|
entity: t('label.domain'),
|
||||||
showDomainHeading,
|
})}>
|
||||||
textClassName
|
<InheritIcon className="inherit-icon cursor-pointer" width={14} />
|
||||||
)}
|
</Tooltip>
|
||||||
{index < activeDomain.length - 1 && ', '}
|
) : null;
|
||||||
</React.Fragment>
|
|
||||||
));
|
return (
|
||||||
|
<div className="d-flex items-center gap-1" key={domain.id}>
|
||||||
|
<Typography.Text className="self-center text-xs whitespace-nowrap">
|
||||||
|
<DomainIcon
|
||||||
|
className="d-flex"
|
||||||
|
color={DE_ACTIVE_COLOR}
|
||||||
|
height={16}
|
||||||
|
name="folder"
|
||||||
|
width={16}
|
||||||
|
/>
|
||||||
|
</Typography.Text>
|
||||||
|
{renderDomainLink(
|
||||||
|
domain,
|
||||||
|
domainDisplayName,
|
||||||
|
showDomainHeading,
|
||||||
|
textClassName
|
||||||
|
)}
|
||||||
|
{inheritedIcon && <div className="d-flex">{inheritedIcon}</div>}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<Typography.Text
|
<Typography.Text
|
||||||
@ -154,14 +175,7 @@ export const DomainLabel = ({
|
|||||||
{selectableList}
|
{selectableList}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="d-flex items-center gap-1">
|
<div className="d-flex items-center gap-1 flex-wrap">
|
||||||
<DomainIcon
|
|
||||||
className="d-flex"
|
|
||||||
color={DE_ACTIVE_COLOR}
|
|
||||||
height={16}
|
|
||||||
name="folder"
|
|
||||||
width={16}
|
|
||||||
/>
|
|
||||||
{domainLink}
|
{domainLink}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@ -170,19 +184,9 @@ export const DomainLabel = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="d-flex items-center gap-1"
|
className="d-flex items-center gap-1 flex-wrap"
|
||||||
data-testid="header-domain-container">
|
data-testid="header-domain-container">
|
||||||
<Typography.Text className="self-center text-xs whitespace-nowrap">
|
|
||||||
<DomainIcon
|
|
||||||
className="d-flex"
|
|
||||||
color={DE_ACTIVE_COLOR}
|
|
||||||
height={16}
|
|
||||||
name="folder"
|
|
||||||
width={16}
|
|
||||||
/>
|
|
||||||
</Typography.Text>
|
|
||||||
{domainLink}
|
{domainLink}
|
||||||
|
|
||||||
{selectableList}
|
{selectableList}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -60,14 +60,19 @@ export const useDomainStore = create<DomainStore>()(
|
|||||||
selectDefault &&
|
selectDefault &&
|
||||||
!isAdmin &&
|
!isAdmin &&
|
||||||
userDomainsObj.length > 0 &&
|
userDomainsObj.length > 0 &&
|
||||||
!get().activeDomain
|
get().activeDomain === DEFAULT_DOMAIN_VALUE
|
||||||
) {
|
) {
|
||||||
set({ activeDomain: userDomainsObj[0].fullyQualifiedName });
|
get().updateActiveDomain(userDomainsObj[0].fullyQualifiedName ?? '');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateActiveDomain: (activeDomainKey: string) => {
|
updateActiveDomain: (activeDomainKey: string) => {
|
||||||
|
const currentUser = useApplicationStore.getState().currentUser;
|
||||||
|
const { isAdmin = false, domains = [] } = currentUser ?? {};
|
||||||
|
const userDomainsObj = isAdmin ? [] : domains;
|
||||||
|
const allDomains = isAdmin ? get().domains : userDomainsObj;
|
||||||
|
|
||||||
const activeDomainEntityRef = initializeDomainEntityRef(
|
const activeDomainEntityRef = initializeDomainEntityRef(
|
||||||
get().domains,
|
allDomains as EntityReference[],
|
||||||
activeDomainKey
|
activeDomainKey
|
||||||
);
|
);
|
||||||
set({
|
set({
|
||||||
@ -93,8 +98,13 @@ export const useDomainStore = create<DomainStore>()(
|
|||||||
{
|
{
|
||||||
name: DOMAIN_STORAGE_KEY,
|
name: DOMAIN_STORAGE_KEY,
|
||||||
partialize: (state) => {
|
partialize: (state) => {
|
||||||
|
const currentUser = useApplicationStore.getState().currentUser;
|
||||||
|
const { isAdmin = false, domains = [] } = currentUser ?? {};
|
||||||
|
const userDomainsObj = isAdmin ? [] : domains;
|
||||||
|
const allDomains = isAdmin ? state.domains : userDomainsObj;
|
||||||
|
|
||||||
const activeDomainEntityRef = initializeDomainEntityRef(
|
const activeDomainEntityRef = initializeDomainEntityRef(
|
||||||
state.domains,
|
allDomains as EntityReference[],
|
||||||
state.activeDomain
|
state.activeDomain
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ import {
|
|||||||
INITIAL_PAGING_VALUE,
|
INITIAL_PAGING_VALUE,
|
||||||
PAGE_SIZE,
|
PAGE_SIZE,
|
||||||
pagingObject,
|
pagingObject,
|
||||||
|
ROUTES,
|
||||||
} from '../../constants/constants';
|
} from '../../constants/constants';
|
||||||
import {
|
import {
|
||||||
OPEN_METADATA,
|
OPEN_METADATA,
|
||||||
@ -53,6 +54,7 @@ import {
|
|||||||
} from '../../constants/Services.constant';
|
} from '../../constants/Services.constant';
|
||||||
import { usePermissionProvider } from '../../context/PermissionProvider/PermissionProvider';
|
import { usePermissionProvider } from '../../context/PermissionProvider/PermissionProvider';
|
||||||
import { OperationPermission } from '../../context/PermissionProvider/PermissionProvider.interface';
|
import { OperationPermission } from '../../context/PermissionProvider/PermissionProvider.interface';
|
||||||
|
import { ClientErrors } from '../../enums/Axios.enum';
|
||||||
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
|
import { ERROR_PLACEHOLDER_TYPE } from '../../enums/common.enum';
|
||||||
import {
|
import {
|
||||||
EntityTabs,
|
EntityTabs,
|
||||||
@ -582,6 +584,9 @@ const ServiceDetailsPage: FunctionComponent = () => {
|
|||||||
setShowDeleted(response.deleted ?? false);
|
setShowDeleted(response.deleted ?? false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Error
|
// Error
|
||||||
|
if ((error as AxiosError)?.response?.status === ClientErrors.FORBIDDEN) {
|
||||||
|
history.replace(ROUTES.FORBIDDEN);
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,19 @@ class AdvancedSearchClassBase {
|
|||||||
useAsyncSearch: true,
|
useAsyncSearch: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
tableType: {
|
||||||
|
label: t('label.table-type'),
|
||||||
|
type: 'select',
|
||||||
|
mainWidgetProps: this.mainWidgetProps,
|
||||||
|
fieldSettings: {
|
||||||
|
asyncFetch: this.autocomplete({
|
||||||
|
searchIndex: SearchIndex.TABLE,
|
||||||
|
entityField: EntityFields.TABLE_TYPE,
|
||||||
|
}),
|
||||||
|
useAsyncSearch: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -177,6 +190,24 @@ class AdvancedSearchClassBase {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fields specific to Glossary
|
||||||
|
*/
|
||||||
|
glossaryQueryBuilderFields: Fields = {
|
||||||
|
status: {
|
||||||
|
label: t('label.status'),
|
||||||
|
type: 'select',
|
||||||
|
mainWidgetProps: this.mainWidgetProps,
|
||||||
|
fieldSettings: {
|
||||||
|
asyncFetch: this.autocomplete({
|
||||||
|
searchIndex: SearchIndex.GLOSSARY_TERM,
|
||||||
|
entityField: EntityFields.GLOSSARY_TERM_STATUS,
|
||||||
|
}),
|
||||||
|
useAsyncSearch: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fields specific to dashboard
|
* Fields specific to dashboard
|
||||||
*/
|
*/
|
||||||
@ -548,6 +579,18 @@ class AdvancedSearchClassBase {
|
|||||||
...this.dataModelQueryBuilderFields,
|
...this.dataModelQueryBuilderFields,
|
||||||
...this.apiEndpointQueryBuilderFields,
|
...this.apiEndpointQueryBuilderFields,
|
||||||
},
|
},
|
||||||
|
[SearchIndex.DATA_ASSET]: {
|
||||||
|
...this.tableQueryBuilderFields,
|
||||||
|
...this.pipelineQueryBuilderFields,
|
||||||
|
...this.dashboardQueryBuilderFields,
|
||||||
|
...this.topicQueryBuilderFields,
|
||||||
|
...this.mlModelQueryBuilderFields,
|
||||||
|
...this.containerQueryBuilderFields,
|
||||||
|
...this.searchIndexQueryBuilderFields,
|
||||||
|
...this.dataModelQueryBuilderFields,
|
||||||
|
...this.apiEndpointQueryBuilderFields,
|
||||||
|
...this.glossaryQueryBuilderFields,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
entitySearchIndex.forEach((index) => {
|
entitySearchIndex.forEach((index) => {
|
||||||
|
@ -244,12 +244,12 @@ export const renderDomainLink = (
|
|||||||
);
|
);
|
||||||
|
|
||||||
export const initializeDomainEntityRef = (
|
export const initializeDomainEntityRef = (
|
||||||
domains: Domain[],
|
domains: EntityReference[],
|
||||||
activeDomainKey: string
|
activeDomainKey: string
|
||||||
) => {
|
) => {
|
||||||
const domain = domains.find(
|
const domain = domains.find((item) => {
|
||||||
(item) => item.fullyQualifiedName === activeDomainKey
|
return item.fullyQualifiedName === activeDomainKey;
|
||||||
);
|
});
|
||||||
if (domain) {
|
if (domain) {
|
||||||
return getEntityReferenceFromEntity(domain, EntityType.DOMAIN);
|
return getEntityReferenceFromEntity(domain, EntityType.DOMAIN);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user