@@ -2,17 +2,11 @@ import { v1 } from "@docker/extension-api-client-types";
2
2
import { useMutation , useQuery , useQueryClient } from "@tanstack/react-query" ;
3
3
import { useCallback , useEffect , useMemo , useState } from "react" ;
4
4
import { parse , stringify } from "yaml" ;
5
- import {
6
- CATALOG_URL ,
7
- REGISTRY_YAML
8
- } from "../Constants" ;
5
+ import { CATALOG_URL , REGISTRY_YAML } from "../Constants" ;
9
6
import { writeToPromptsVolume } from "../FileUtils" ;
10
7
import { getRegistry , syncRegistryWithConfig } from "../Registry" ;
11
8
import Secrets from "../Secrets" ;
12
- import {
13
- CatalogItemRichened ,
14
- CatalogItemWithName
15
- } from "../types/catalog" ;
9
+ import { CatalogItemRichened , CatalogItemWithName } from "../types/catalog" ;
16
10
import { getTemplateForItem , useConfig } from "./useConfig" ;
17
11
import { useSecrets } from "./useSecrets" ;
18
12
@@ -43,7 +37,7 @@ function useCatalog(client: v1.DockerDesktopClient) {
43
37
Boolean ( item . config ) &&
44
38
( neverOnceConfigured ||
45
39
JSON . stringify ( itemConfigValue ) ===
46
- JSON . stringify ( baseConfigTemplate ) ) ;
40
+ JSON . stringify ( baseConfigTemplate ) ) ;
47
41
48
42
const missingASecret = secretsWithAssignment . some (
49
43
( secret ) => ! secret . assigned
@@ -152,6 +146,7 @@ function useRegistry(client: v1.DockerDesktopClient) {
152
146
isLoading : registryLoading ,
153
147
} = useQuery ( {
154
148
queryKey : [ "registry" ] ,
149
+ networkMode : "always" ,
155
150
queryFn : async ( ) => {
156
151
setCanRegister ( false ) ;
157
152
try {
@@ -171,7 +166,7 @@ function useRegistry(client: v1.DockerDesktopClient) {
171
166
setCanRegister ( true ) ;
172
167
throw error ;
173
168
}
174
- }
169
+ } ,
175
170
} ) ;
176
171
177
172
useQuery ( {
@@ -214,7 +209,11 @@ function useRegistry(client: v1.DockerDesktopClient) {
214
209
mutationFn : async ( newRegistry : {
215
210
[ key : string ] : { ref : string ; config ?: any } ;
216
211
} ) => {
217
- await writeToPromptsVolume ( client , REGISTRY_YAML , stringify ( { registry : newRegistry } ) ) ;
212
+ await writeToPromptsVolume (
213
+ client ,
214
+ REGISTRY_YAML ,
215
+ stringify ( { registry : newRegistry } )
216
+ ) ;
218
217
219
218
return newRegistry ;
220
219
} ,
@@ -252,7 +251,11 @@ export function useCatalogOperations(client: v1.DockerDesktopClient) {
252
251
[ item . name ] : { ref : item . ref } ,
253
252
} ;
254
253
255
- await writeToPromptsVolume ( client , REGISTRY_YAML , stringify ( { registry : newRegistry } ) ) ;
254
+ await writeToPromptsVolume (
255
+ client ,
256
+ REGISTRY_YAML ,
257
+ stringify ( { registry : newRegistry } )
258
+ ) ;
256
259
return { success : true , newRegistry } ;
257
260
} catch ( error ) {
258
261
client . desktopUI . toast . error (
@@ -281,7 +284,11 @@ export function useCatalogOperations(client: v1.DockerDesktopClient) {
281
284
delete currentRegistry [ item . name ] ;
282
285
}
283
286
284
- await writeToPromptsVolume ( client , REGISTRY_YAML , stringify ( { registry : currentRegistry } ) ) ;
287
+ await writeToPromptsVolume (
288
+ client ,
289
+ REGISTRY_YAML ,
290
+ stringify ( { registry : currentRegistry } )
291
+ ) ;
285
292
286
293
return { success : true , newRegistry : currentRegistry } ;
287
294
} catch ( error ) {
0 commit comments