Skip to content

Commit 7bdff4b

Browse files
committed
Remove unused elements
Signed-off-by: Trung Nguyen <[email protected]>
1 parent 9026eee commit 7bdff4b

File tree

6 files changed

+38
-97
lines changed

6 files changed

+38
-97
lines changed

src/extension/ui/package-lock.json

Lines changed: 0 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/extension/ui/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"@mui/icons-material": "6.4.5",
1212
"@mui/material": "6.4.5",
1313
"@tanstack/react-query": "^5.69.0",
14-
"ansi-to-html": "^0.7.2",
1514
"js-base64": "^3.7.7",
1615
"json-schema-library": "^10.0.0-rc7",
1716
"lodash-es": "^4.17.21",

src/extension/ui/src/App.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useConfig } from './queries/useConfig';
88
import { useMCPClient } from './queries/useMCPClient';
99
import { useSecrets } from './queries/useSecrets';
1010
import { syncRegistryWithConfig } from './Registry';
11-
export const client = createDockerDesktopClient();
11+
const client = createDockerDesktopClient();
1212

1313
// Memoize the CatalogGrid component to prevent unnecessary re-renders
1414
const MemoizedCatalogGrid = memo(CatalogGrid);
@@ -24,7 +24,11 @@ export function App() {
2424
// Create a memoized callback for syncing registry with config we can call later
2525
const syncRegistry = useCallback(async () => {
2626
if (config.config && catalogAll.registryItems) {
27-
await syncRegistryWithConfig(client, catalogAll.registryItems, config.config);
27+
await syncRegistryWithConfig(
28+
client,
29+
catalogAll.registryItems,
30+
config.config,
31+
);
2832
}
2933
}, [config.config, catalogAll.registryItems]);
3034

src/extension/ui/src/Constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
export const POLL_INTERVAL = 1000 * 30;
21
export const MCP_POLICY_NAME = "MCP=*";
32
export const DD_BUILD_WITH_SECRET_SUPPORT = 184396;
43
export const CATALOG_URL =

src/extension/ui/src/MergeDeep.ts

Lines changed: 32 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,41 @@ import { DeepObject } from './types/utils';
66
* @returns {boolean}
77
*/
88
function isObject(item: unknown): item is DeepObject {
9-
return Boolean(item && typeof item === 'object' && !Array.isArray(item));
9+
return Boolean(item && typeof item === 'object' && !Array.isArray(item));
1010
}
1111

12-
/**
13-
* Deep merge two objects.
14-
* @param target The target object to merge into
15-
* @param sources The source objects to merge from
16-
* @returns The merged object
17-
*/
18-
export function mergeDeep<T extends DeepObject>(target: T, ...sources: DeepObject[]): T {
19-
if (!sources.length) return target;
20-
const source = sources.shift();
21-
22-
if (isObject(target) && isObject(source)) {
23-
for (const key in source) {
24-
if (isObject(source[key])) {
25-
if (!target[key]) Object.assign(target, { [key]: {} });
26-
mergeDeep(target[key], source[key]);
27-
} else {
28-
Object.assign(target, { [key]: source[key] });
29-
}
30-
}
31-
}
32-
33-
return mergeDeep(target, ...sources);
12+
export function deepFlattenObject(
13+
obj: DeepObject,
14+
prefix: string = '',
15+
): Record<string, any> {
16+
return Object.entries(obj).reduce(
17+
(acc, [key, value]) => {
18+
if (isObject(value)) {
19+
Object.assign(acc, deepFlattenObject(value, `${prefix}${key}.`));
20+
} else {
21+
acc[`${prefix}${key}`] = value;
22+
}
23+
return acc;
24+
},
25+
{} as Record<string, any>,
26+
);
3427
}
3528

36-
export function deepFlattenObject(obj: DeepObject, prefix: string = ''): Record<string, any> {
37-
return Object.entries(obj).reduce((acc, [key, value]) => {
38-
if (isObject(value)) {
39-
Object.assign(acc, deepFlattenObject(value, `${prefix}${key}.`));
40-
} else {
41-
acc[`${prefix}${key}`] = value;
42-
}
43-
return acc;
44-
}, {} as Record<string, any>);
45-
}
46-
47-
export function buildObjectFromFlattenedObject(flattenedObject: Record<string, any>): DeepObject {
48-
return Object.entries(flattenedObject).reduce((acc, [key, value]) => {
49-
const keys = key.split('.');
50-
let lastKey = keys.pop();
51-
if (!lastKey) return acc;
52-
53-
let current = acc;
54-
for (const k of keys) {
55-
if (!current[k]) current[k] = {};
56-
current = current[k];
57-
}
29+
export function buildObjectFromFlattenedObject(
30+
flattenedObject: Record<string, any>,
31+
): DeepObject {
32+
return Object.entries(flattenedObject).reduce((acc, [key, value]) => {
33+
const keys = key.split('.');
34+
let lastKey = keys.pop();
35+
if (!lastKey) return acc;
36+
37+
let current = acc;
38+
for (const k of keys) {
39+
if (!current[k]) current[k] = {};
40+
current = current[k];
41+
}
5842

59-
current[lastKey] = value;
60-
return acc;
61-
}, {} as DeepObject);
43+
current[lastKey] = value;
44+
return acc;
45+
}, {} as DeepObject);
6246
}

src/extension/ui/src/mcp-clients/index.ts

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

0 commit comments

Comments
 (0)