Skip to content

Commit 4f1ae9d

Browse files
fix(ui): remove invalid HTML nesting and add cache TTL to request access URL (#27014)
1 parent 821d35b commit 4f1ae9d

File tree

3 files changed

+28
-17
lines changed

3 files changed

+28
-17
lines changed

openmetadata-ui/src/main/resources/ui/src/components/DataAssets/DataAssetsHeader/DataAssetsHeader.component.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -695,16 +695,14 @@ export const DataAssetsHeader = ({
695695
</Tooltip>
696696
)}
697697
{requestAccessUrl && (
698-
<Typography.Link
698+
<Button
699+
className="font-semibold"
700+
data-testid="request-access-button"
699701
href={requestAccessUrl}
700702
rel="noopener noreferrer"
701703
target="_blank">
702-
<Button
703-
className="font-semibold"
704-
data-testid="request-access-button">
705-
{t('label.request-access')}
706-
</Button>
707-
</Typography.Link>
704+
{t('label.request-access')}
705+
</Button>
708706
)}
709707
<ManageButton
710708
isAsyncDelete

openmetadata-ui/src/main/resources/ui/src/components/ExploreV1/ExploreSearchCard/ExploreSearchCard.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,14 +425,14 @@ const ExploreSearchCard: React.FC<ExploreSearchCardProps> = forwardRef<
425425
<Space className="explore-card-actions">
426426
{actionPopoverContent}
427427
{requestAccessUrl && (
428-
<Typography.Link
428+
<Button
429+
data-testid="request-access-button"
429430
href={requestAccessUrl}
430431
rel="noopener noreferrer"
431-
target="_blank">
432-
<Button data-testid="request-access-button" type="link">
433-
{t('label.request-access')}
434-
</Button>
435-
</Typography.Link>
432+
target="_blank"
433+
type="link">
434+
{t('label.request-access')}
435+
</Button>
436436
)}
437437
</Space>
438438
)}

openmetadata-ui/src/main/resources/ui/src/hooks/useRequestAccessUrl.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ import { getServiceByFQN } from '../rest/serviceAPI';
1818
import { getEntityDetailsPath } from '../utils/RouterUtils';
1919
import { getRequestAccessUrl } from '../utils/RequestAccessUtils';
2020

21-
const connectionOptionsCache = new Map<string, Record<string, string> | undefined>();
21+
type CacheEntry = {
22+
value: Record<string, string> | undefined;
23+
timestamp: number;
24+
};
25+
26+
const CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
27+
const connectionOptionsCache = new Map<string, CacheEntry>();
2228

2329
const SUPPORTED_ENTITY_TYPES = new Set<EntityType>([
2430
EntityType.DATABASE,
@@ -79,15 +85,22 @@ export const useRequestAccessUrl = ({
7985
const cacheKey = `${serviceCategory}::${serviceName}`;
8086
let connectionOptions: Record<string, string> | undefined;
8187

82-
if (connectionOptionsCache.has(cacheKey)) {
83-
connectionOptions = connectionOptionsCache.get(cacheKey);
88+
const cachedEntry = connectionOptionsCache.get(cacheKey);
89+
if (
90+
cachedEntry &&
91+
Date.now() - cachedEntry.timestamp < CACHE_TTL_MS
92+
) {
93+
connectionOptions = cachedEntry.value;
8494
} else {
8595
const service = await getServiceByFQN(serviceCategory, serviceName);
8696
connectionOptions = get(
8797
service,
8898
'connection.config.connectionOptions'
8999
) as Record<string, string> | undefined;
90-
connectionOptionsCache.set(cacheKey, connectionOptions);
100+
connectionOptionsCache.set(cacheKey, {
101+
value: connectionOptions,
102+
timestamp: Date.now(),
103+
});
91104
}
92105
const entityUrl = `${window.location.origin}${getEntityDetailsPath(
93106
entityType,

0 commit comments

Comments
 (0)