@@ -28,13 +28,14 @@ import {
28
28
} from '@mui/material' ;
29
29
import { useEffect , useState } from 'react' ;
30
30
31
- import { ASSIGNED_SECRET_PLACEHOLDER , MCP_POLICY_NAME } from '../../Constants' ;
31
+ import { ASSIGNED_SECRET_PLACEHOLDER , getUnsupportedSecretMessage , MCP_POLICY_NAME } from '../../Constants' ;
32
32
import { useCatalogOperations } from '../../queries/useCatalog' ;
33
33
import { useConfig } from '../../queries/useConfig' ;
34
34
import { useSecrets } from '../../queries/useSecrets' ;
35
35
import { CatalogItemRichened } from '../../types/catalog' ;
36
36
import ConfigEditor from './ConfigEditor' ;
37
37
import { formatName } from '../../formatName' ;
38
+ import useDDInfo from '../../queries/useDDInfo' ;
38
39
39
40
interface TabPanelProps {
40
41
children ?: React . ReactNode ;
@@ -85,6 +86,8 @@ const ConfigurationModal = ({
85
86
useCatalogOperations ( client ) ;
86
87
const { configLoading } = useConfig ( client ) ;
87
88
89
+ const { ddInfo, ddInfoLoading } = useDDInfo ( client ) ;
90
+
88
91
useEffect ( ( ) => {
89
92
setLocalSecrets (
90
93
catalogItem . secrets . reduce ( ( acc , secret ) => {
@@ -281,15 +284,26 @@ const ConfigurationModal = ({
281
284
>
282
285
< Stack direction = "column" spacing = { 2 } >
283
286
< ConfigEditor catalogItem = { catalogItem } client = { client } />
284
-
285
- { catalogItem . secrets ?. length > 0 && (
286
- < Stack spacing = { 1 } >
287
- < Typography variant = "subtitle2" > Secrets</ Typography >
288
- { catalogItem . secrets . map ( ( secret ) => {
287
+ < Stack >
288
+ < Typography variant = "subtitle2" > Secrets</ Typography >
289
+ { ! ddInfo && ! ddInfoLoading && (
290
+ < Alert severity = "error" >
291
+ Failed to get Docker Desktop version
292
+ </ Alert >
293
+ ) }
294
+ { ddInfo && ! ddInfo ?. hasSecretSupport && (
295
+ < Alert severity = "error" >
296
+ { getUnsupportedSecretMessage ( ddInfo ?. parsedVersion ) }
297
+ </ Alert >
298
+ ) }
299
+ { ddInfo ?. hasSecretSupport &&
300
+ catalogItem . secrets &&
301
+ catalogItem . secrets ?. length > 0 ? (
302
+ catalogItem . secrets . map ( ( secret ) => {
289
303
const secretEdited =
290
304
( secret . assigned &&
291
305
localSecrets [ secret . name ] !==
292
- ASSIGNED_SECRET_PLACEHOLDER ) ||
306
+ ASSIGNED_SECRET_PLACEHOLDER ) ||
293
307
( ! secret . assigned &&
294
308
localSecrets [ secret . name ] !== '' ) ;
295
309
return (
@@ -360,7 +374,7 @@ const ConfigurationModal = ({
360
374
</ Stack >
361
375
) ;
362
376
} ) }
363
- </ Stack >
377
+ </Stack >
364
378
) }
365
379
</Stack >
366
380
< / Stack >
0 commit comments