Skip to content

Commit 816a712

Browse files
authored
fix!: remove internal-specific solution (#2261)
1 parent 33a4973 commit 816a712

File tree

6 files changed

+8
-102
lines changed

6 files changed

+8
-102
lines changed

src/containers/AppWithClusters/AppWithClusters.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@ import React from 'react';
33
import type {Store} from '@reduxjs/toolkit';
44
import type {History} from 'history';
55

6-
import {getLogsLink as getLogsLinkDefault} from '../../utils/logs';
7-
import type {
8-
GetLogsLink,
9-
GetMonitoringClusterLink,
10-
GetMonitoringLink,
11-
} from '../../utils/monitoring';
6+
import type {GetLogsLink} from '../../utils/logs';
7+
import type {GetMonitoringClusterLink, GetMonitoringLink} from '../../utils/monitoring';
128
import {
139
getMonitoringClusterLink as getMonitoringClusterLinkDefault,
1410
getMonitoringLink as getMonitoringLinkDefault,
@@ -32,7 +28,7 @@ export interface AppWithClustersProps {
3228
export function AppWithClusters({
3329
store,
3430
history,
35-
getLogsLink = getLogsLinkDefault,
31+
getLogsLink,
3632
getMonitoringLink = getMonitoringLinkDefault,
3733
getMonitoringClusterLink = getMonitoringClusterLinkDefault,
3834
userSettings,

src/containers/AppWithClusters/ExtendedCluster/ExtendedCluster.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ import {cn} from '../../../utils/cn';
88
import {USE_CLUSTER_BALANCER_AS_BACKEND_KEY} from '../../../utils/constants';
99
import {useSetting} from '../../../utils/hooks';
1010
import {useAdditionalNodesProps} from '../../../utils/hooks/useAdditionalNodesProps';
11-
import type {
12-
GetLogsLink,
13-
GetMonitoringClusterLink,
14-
GetMonitoringLink,
15-
} from '../../../utils/monitoring';
11+
import type {GetLogsLink} from '../../../utils/logs';
12+
import type {GetMonitoringClusterLink, GetMonitoringLink} from '../../../utils/monitoring';
1613
import {getCleanBalancerValue, prepareBackendFromBalancer} from '../../../utils/parseBalancer';
1714
import {getBackendFromBalancerAndNodeId} from '../../../utils/prepareBackend';
1815
import type {Cluster} from '../../Cluster/Cluster';

src/containers/AppWithClusters/ExtendedTenant/ExtendedTenant.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {useClusterBaseInfo} from '../../../store/reducers/cluster/cluster';
22
import type {ETenantType} from '../../../types/api/tenant';
33
import {useAdditionalNodesProps} from '../../../utils/hooks/useAdditionalNodesProps';
4-
import type {GetLogsLink, GetMonitoringLink} from '../../../utils/monitoring';
4+
import type {GetLogsLink} from '../../../utils/logs';
5+
import type {GetMonitoringLink} from '../../../utils/monitoring';
56
import type {Tenant} from '../../Tenant/Tenant';
67

78
export interface ExtendedTenantProps {

src/utils/__test__/logs.test.ts

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/utils/logs.ts

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,6 @@
1-
interface GetLogsLinkProps {
1+
export interface GetLogsLinkProps {
22
dbName: string;
33
logging: string;
44
}
55

66
export type GetLogsLink = (props: GetLogsLinkProps) => string;
7-
8-
export function getLogsLink({dbName, logging}: GetLogsLinkProps): string {
9-
try {
10-
const data = JSON.parse(logging);
11-
12-
if (typeof data === 'object' && 'url' in data) {
13-
const logUrl = data.url;
14-
if (!logUrl) {
15-
return '';
16-
}
17-
18-
const url = new URL(logUrl);
19-
20-
const queryParam = url.searchParams.get('query');
21-
if (queryParam) {
22-
const decodedQuery = decodeURIComponent(queryParam);
23-
24-
const queryBetweenBraces = decodedQuery.slice(1, -1);
25-
const witComma = queryBetweenBraces.length > 0;
26-
const updatedQuery = `{${queryBetweenBraces}${witComma ? ', ' : ''}database = "${dbName}"}`;
27-
28-
url.searchParams.set('query', updatedQuery);
29-
}
30-
31-
return url.toString();
32-
}
33-
} catch {}
34-
35-
return '';
36-
}

src/utils/monitoring.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,3 @@ export function parseMonitoringData(monitoring: string): ParsedMonitoringData |
9999

100100
return undefined;
101101
}
102-
103-
interface GetLogsLinkProps {
104-
dbName: string;
105-
logging: string;
106-
}
107-
108-
export type GetLogsLink = (props: GetLogsLinkProps) => string;

0 commit comments

Comments
 (0)