@@ -29,13 +29,14 @@ import {
29
29
} from '@mui/material' ;
30
30
import { useEffect , useState } from 'react' ;
31
31
32
- import { ASSIGNED_SECRET_PLACEHOLDER , MCP_POLICY_NAME } from '../../Constants' ;
32
+ import { ASSIGNED_SECRET_PLACEHOLDER , getUnsupportedSecretMessage , MCP_POLICY_NAME } from '../../Constants' ;
33
33
import { useCatalogOperations } from '../../queries/useCatalog' ;
34
34
import { useConfig } from '../../queries/useConfig' ;
35
35
import { useSecrets } from '../../queries/useSecrets' ;
36
36
import { CatalogItemRichened } from '../../types/catalog' ;
37
37
import ConfigEditor from './ConfigEditor' ;
38
38
import { formatName } from '../../formatName' ;
39
+ import useDDInfo from '../../queries/useDDInfo' ;
39
40
40
41
interface TabPanelProps {
41
42
children ?: React . ReactNode ;
@@ -86,6 +87,8 @@ const ConfigurationModal = ({
86
87
useCatalogOperations ( client ) ;
87
88
const { configLoading } = useConfig ( client ) ;
88
89
90
+ const { ddInfo, ddInfoLoading } = useDDInfo ( client ) ;
91
+
89
92
useEffect ( ( ) => {
90
93
setLocalSecrets (
91
94
catalogItem . secrets . reduce ( ( acc , secret ) => {
@@ -293,11 +296,22 @@ const ConfigurationModal = ({
293
296
>
294
297
< Stack direction = "column" spacing = { 2 } >
295
298
< ConfigEditor catalogItem = { catalogItem } client = { client } />
296
-
297
- { catalogItem . secrets ?. length > 0 && (
298
- < Stack spacing = { 1 } >
299
- < Typography variant = "subtitle2" > Secrets</ Typography >
300
- { catalogItem . secrets . map ( ( secret ) => {
299
+ < Stack >
300
+ < Typography variant = "subtitle2" > Secrets</ Typography >
301
+ { ! ddInfo && ! ddInfoLoading && (
302
+ < Alert severity = "error" >
303
+ Failed to get Docker Desktop version
304
+ </ Alert >
305
+ ) }
306
+ { ddInfo && ! ddInfo ?. hasSecretSupport && (
307
+ < Alert severity = "error" >
308
+ { getUnsupportedSecretMessage ( ddInfo ?. parsedVersion ) }
309
+ </ Alert >
310
+ ) }
311
+ { ddInfo ?. hasSecretSupport &&
312
+ catalogItem . secrets &&
313
+ catalogItem . secrets ?. length > 0 ? (
314
+ catalogItem . secrets . map ( ( secret ) => {
301
315
const secretEdited =
302
316
( secret . assigned &&
303
317
localSecrets [ secret . name ] !==
@@ -371,9 +385,11 @@ const ConfigurationModal = ({
371
385
) }
372
386
</ Stack >
373
387
) ;
374
- } ) }
375
- </ Stack >
376
- ) }
388
+ } )
389
+ ) : (
390
+ < Typography > No secrets available.</ Typography >
391
+ ) }
392
+ </ Stack >
377
393
</ Stack >
378
394
</ Stack >
379
395
</ TabPanel >
0 commit comments