minor: update hardcoded link color with theme (#16290)

* minor: update hardcoded primary color with theme

* test: fix unit tests
This commit is contained in:
Sachin Chaurasiya 2024-05-16 12:09:32 +05:30 committed by GitHub
parent a47191ecaf
commit dfb3cdfb69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 49 additions and 21 deletions

View File

@ -62,7 +62,7 @@ const SampleDataTable = ({
permissions,
}: SampleDataProps) => {
const { isTourPage } = useTourProvider();
const { currentUser } = useApplicationStore();
const { currentUser, theme } = useApplicationStore();
const [sampleData, setSampleData] = useState<SampleData>();
const [isLoading, setIsLoading] = useState(true);
@ -201,7 +201,7 @@ const SampleDataTable = ({
<a
href={WORKFLOWS_PROFILER_DOCS}
rel="noreferrer"
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
target="_blank"
/>
}

View File

@ -19,6 +19,7 @@ import { WORKFLOWS_METADATA_DOCS } from '../../../constants/docs.constants';
import { EntityType } from '../../../enums/entity.enum';
import { SearchIndexSampleData } from '../../../generated/entity/data/searchIndex';
import { TopicSampleData } from '../../../generated/entity/data/topic';
import { useApplicationStore } from '../../../hooks/useApplicationStore';
import { getSampleDataBySearchIndexId } from '../../../rest/SearchIndexAPI';
import { getSampleDataByTopicId } from '../../../rest/topicsAPI';
import { Transi18next } from '../../../utils/CommonUtils';
@ -31,6 +32,7 @@ const SampleDataWithMessages: FC<{
entityType: EntityType;
}> = ({ entityId, entityType }) => {
const { t } = useTranslation();
const { theme } = useApplicationStore();
const [data, setData] = useState<TopicSampleData | SearchIndexSampleData>();
const [loading, setLoading] = useState(false);
@ -67,7 +69,7 @@ const SampleDataWithMessages: FC<{
<a
href={WORKFLOWS_METADATA_DOCS}
rel="noreferrer"
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
target="_blank"
/>
}

View File

@ -56,6 +56,7 @@ import { GlossaryTerm } from '../../../../generated/entity/data/glossaryTerm';
import { DataProduct } from '../../../../generated/entity/domains/dataProduct';
import { Domain } from '../../../../generated/entity/domains/domain';
import { usePaging } from '../../../../hooks/paging/usePaging';
import { useApplicationStore } from '../../../../hooks/useApplicationStore';
import { useFqn } from '../../../../hooks/useFqn';
import { Aggregations } from '../../../../interface/search.interface';
import {
@ -125,6 +126,7 @@ const AssetsTabs = forwardRef(
}: AssetsTabsProps,
ref
) => {
const { theme } = useApplicationStore();
const [itemCount, setItemCount] = useState<Record<EntityType, number>>(
{} as Record<EntityType, number>
);
@ -505,7 +507,7 @@ const AssetsTabs = forwardRef(
<a
href={GLOSSARIES_DOCS}
rel="noreferrer"
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
target="_blank"
/>
}

View File

@ -82,9 +82,12 @@ jest.mock('../../../PageLayoutV1/PageLayoutV1', () => {
});
jest.mock('../../../../hooks/useApplicationStore', () => ({
useApplicationStore: jest
.fn()
.mockImplementation(() => ({ currentUser: mockUserData })),
useApplicationStore: jest.fn().mockImplementation(() => ({
currentUser: mockUserData,
theme: {
primaryColor: '#00ff00',
},
})),
}));
jest.mock('../../../../rest/feedsAPI', () => ({

View File

@ -65,7 +65,7 @@ function CustomizeMyData({
handleSaveCurrentPageLayout,
}: Readonly<CustomizeMyDataProps>) {
const { t } = useTranslation();
const { currentUser } = useApplicationStore();
const { currentUser, theme } = useApplicationStore();
const history = useHistory();
const { fqn: decodedPersonaFQN } = useFqn();
const [layout, setLayout] = useState<Array<WidgetConfig>>(
@ -264,7 +264,7 @@ function CustomizeMyData({
i18nKey="message.customize-landing-page-header"
renderElement={
<Link
style={{ color: '#1890ff', fontSize: '16px' }}
style={{ color: theme.primaryColor, fontSize: '16px' }}
to={getPersonaDetailsPath(decodedPersonaFQN)}
/>
}

View File

@ -44,7 +44,7 @@ const AppInstallVerifyCard = ({
onSave,
}: AppInstallVerifyCardProps) => {
const { t } = useTranslation();
const { currentUser } = useApplicationStore();
const { currentUser, theme } = useApplicationStore();
return (
<div className="flex-center flex-col">
@ -87,7 +87,7 @@ const AppInstallVerifyCard = ({
<a
href={appData?.developerUrl}
rel="noreferrer"
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
target="_blank"
/>
}

View File

@ -28,6 +28,9 @@ jest.mock('../../../../utils/EntityUtils', () => ({
jest.mock('../../../../hooks/useApplicationStore', () => ({
useApplicationStore: jest.fn(() => ({
currentUser: mockUserData,
theme: {
primaryColor: '#00ff00',
},
})),
}));

View File

@ -20,6 +20,7 @@ import { DISABLED, NO_DATA_PLACEHOLDER } from '../../../../constants/constants';
import { IngestionPipeline } from '../../../../generated/entity/services/ingestionPipelines/ingestionPipeline';
import { usePaging } from '../../../../hooks/paging/usePaging';
import { useAirflowStatus } from '../../../../hooks/useAirflowStatus';
import { useApplicationStore } from '../../../../hooks/useApplicationStore';
import { getEntityName } from '../../../../utils/EntityUtils';
import { getErrorPlaceHolder } from '../../../../utils/IngestionUtils';
import NextPrevious from '../../../common/NextPrevious/NextPrevious';
@ -51,6 +52,7 @@ function IngestionListTable({
}: IngestionListTableProps) {
const { t } = useTranslation();
const { isFetchingStatus, platform } = useAirflowStatus();
const { theme } = useApplicationStore();
const {
currentPage,
@ -204,6 +206,7 @@ function IngestionListTable({
isRequiredDetailsAvailable,
ingestionData.length,
isPlatFormDisabled,
theme,
pipelineType
),
}}

View File

@ -23,6 +23,7 @@ import { NO_PERMISSION_FOR_ACTION } from '../../../constants/HelperTextUtil';
import { EntityType } from '../../../enums/entity.enum';
import { SearchIndex } from '../../../enums/search.enum';
import { EntityReference } from '../../../generated/entity/type';
import { useApplicationStore } from '../../../hooks/useApplicationStore';
import { getDomainList } from '../../../rest/domainAPI';
import { searchData } from '../../../rest/miscAPI';
import { formatDomainsResponse } from '../../../utils/APIUtils';
@ -58,6 +59,7 @@ const DomainSelectableList = ({
selectedDomain,
}: DomainSelectableListProps) => {
const { t } = useTranslation();
const { theme } = useApplicationStore();
const [popupVisible, setPopupVisible] = useState(false);
const fetchOptions = async (searchText: string) => {
@ -125,7 +127,7 @@ const DomainSelectableList = ({
<a
href={getDomainPath()}
rel="noreferrer"
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
target="_blank"
/>
}

View File

@ -17,6 +17,7 @@ import classNames from 'classnames';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { ReactComponent as AddPlaceHolderIcon } from '../../../assets/svg/add-placeholder.svg';
import { useApplicationStore } from '../../../hooks/useApplicationStore';
import { Transi18next } from '../../../utils/CommonUtils';
import PermissionErrorPlaceholder from './PermissionErrorPlaceholder';
import { CreatePlaceholderProps } from './placeholder.interface';
@ -32,6 +33,7 @@ const CreateErrorPlaceHolder = ({
placeholderText,
}: CreatePlaceholderProps) => {
const { t } = useTranslation();
const { theme } = useApplicationStore();
if (!permission) {
return <PermissionErrorPlaceholder className={className} size={size} />;
@ -62,7 +64,7 @@ const CreateErrorPlaceHolder = ({
<a
href={doc}
rel="noreferrer"
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
target="_blank"
/>
}

View File

@ -30,6 +30,7 @@ import {
ELASTICSEARCH_ERROR_PLACEHOLDER_TYPE,
ERROR_PLACEHOLDER_TYPE,
} from '../../../enums/common.enum';
import { useApplicationStore } from '../../../hooks/useApplicationStore';
import { useDomainStore } from '../../../hooks/useDomainStore';
import { Transi18next } from '../../../utils/CommonUtils';
import i18n from '../../../utils/i18next/LocalUtil';
@ -74,6 +75,7 @@ const ErrorPlaceHolderES = ({ type, errorMessage, query }: Props) => {
const { t } = useTranslation();
const history = useHistory();
const { activeDomain } = useDomainStore();
const { theme } = useApplicationStore();
const isQuery = useMemo(
() =>
@ -117,7 +119,7 @@ const ErrorPlaceHolderES = ({ type, errorMessage, query }: Props) => {
<a
href={DATA_DISCOVERY_DOCS}
rel="noreferrer"
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
target="_blank"
/>
}

View File

@ -16,6 +16,7 @@ import classNames from 'classnames';
import React from 'react';
import { useTranslation } from 'react-i18next';
import { ReactComponent as FilterPlaceHolderIcon } from '../../../assets/svg/no-search-placeholder.svg';
import { useApplicationStore } from '../../../hooks/useApplicationStore';
import { Transi18next } from '../../../utils/CommonUtils';
import { FilterPlaceholderProps } from './placeholder.interface';
@ -26,6 +27,7 @@ const FilterErrorPlaceHolder = ({
placeholderText,
}: FilterPlaceholderProps) => {
const { t } = useTranslation();
const { theme } = useApplicationStore();
return (
<div
@ -58,7 +60,7 @@ const FilterErrorPlaceHolder = ({
<a
href={doc}
rel="noreferrer"
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
target="_blank"
/>
}

View File

@ -35,6 +35,7 @@ import { Persona } from '../../generated/entity/teams/persona';
import { PageType } from '../../generated/system/ui/page';
import { Paging } from '../../generated/type/paging';
import { usePaging } from '../../hooks/paging/usePaging';
import { useApplicationStore } from '../../hooks/useApplicationStore';
import { getAllPersonas } from '../../rest/PersonaAPI';
import { Transi18next } from '../../utils/CommonUtils';
import { getEntityName } from '../../utils/EntityUtils';
@ -49,6 +50,7 @@ import './custom-page-settings.less';
export const CustomPageSettings = () => {
const { t } = useTranslation();
const history = useHistory();
const { theme } = useApplicationStore();
const [isLoading, setIsLoading] = useState(true);
@ -124,7 +126,7 @@ export const CustomPageSettings = () => {
i18nKey="message.no-persona-message"
renderElement={
<Link
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
to={getSettingPath(
GlobalSettingsMenuCategory.MEMBERS,
GlobalSettingOptions.PERSONA

View File

@ -30,6 +30,7 @@ import { EntityType } from '../../enums/entity.enum';
import { Document } from '../../generated/entity/docStore/document';
import { Persona } from '../../generated/entity/teams/persona';
import { PageType } from '../../generated/system/ui/page';
import { useApplicationStore } from '../../hooks/useApplicationStore';
import { useFqn } from '../../hooks/useFqn';
import {
createDocument,
@ -46,6 +47,7 @@ export const CustomizablePage = () => {
const { pageFqn } = useParams<{ pageFqn: PageType }>();
const { fqn: decodedPageFQN } = useFqn();
const { t } = useTranslation();
const { theme } = useApplicationStore();
const [page, setPage] = useState<Document>({} as Document);
const [editedPage, setEditedPage] = useState<Document>({} as Document);
const [isLoading, setIsLoading] = useState(false);
@ -166,7 +168,7 @@ export const CustomizablePage = () => {
i18nKey="message.no-persona-message"
renderElement={
<Link
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
to={getSettingPath(
GlobalSettingsMenuCategory.MEMBERS,
GlobalSettingOptions.PERSONA

View File

@ -38,6 +38,7 @@ import { ERROR_PLACEHOLDER_TYPE } from '../enums/common.enum';
import { ELASTIC_SEARCH_RE_INDEX_PAGE_TABS } from '../enums/ElasticSearch.enum';
import { FormSubmitType } from '../enums/form.enum';
import { PipelineType } from '../generated/api/services/ingestionPipelines/createIngestionPipeline';
import { UIThemePreference } from '../generated/configuration/uiThemePreference';
import { HiveMetastoreConnection as Connection } from '../generated/entity/services/databaseService';
import {
IngestionPipeline,
@ -201,6 +202,7 @@ export const getIngestionTypes = (
const getPipelineExtraInfo = (
isPlatFormDisabled: boolean,
theme: UIThemePreference['customTheme'],
pipelineType?: PipelineType
) => {
switch (pipelineType) {
@ -214,7 +216,7 @@ const getPipelineExtraInfo = (
<a
href={DATA_INSIGHTS_PIPELINE_DOCS}
rel="noreferrer"
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
target="_blank"
/>
}
@ -235,7 +237,7 @@ const getPipelineExtraInfo = (
<a
href={ELASTIC_SEARCH_RE_INDEX_PIPELINE_DOCS}
rel="noreferrer"
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
target="_blank"
/>
}
@ -263,7 +265,7 @@ const getPipelineExtraInfo = (
: WORKFLOWS_METADATA_DOCS
}
rel="noreferrer"
style={{ color: '#1890ff' }}
style={{ color: theme.primaryColor }}
target="_blank"
/>
}
@ -286,12 +288,13 @@ export const getErrorPlaceHolder = (
isRequiredDetailsAvailable: boolean,
ingestionDataLength: number,
isPlatFormDisabled: boolean,
theme: UIThemePreference['customTheme'],
pipelineType?: PipelineType
) => {
if (isRequiredDetailsAvailable && ingestionDataLength === 0) {
return (
<ErrorPlaceHolder className="p-y-lg" type={ERROR_PLACEHOLDER_TYPE.CUSTOM}>
{getPipelineExtraInfo(isPlatFormDisabled, pipelineType)}
{getPipelineExtraInfo(isPlatFormDisabled, theme, pipelineType)}
</ErrorPlaceHolder>
);
}