@@ -14,13 +14,6 @@ import (
14
14
"github.com/coder/coder/v2/codersdk"
15
15
)
16
16
17
- func getServerURL (deps Deps )string {
18
- serverURLCopy := * deps .coderClient .URL
19
- serverURLCopy .Path = ""
20
- serverURLCopy .RawQuery = ""
21
- return serverURLCopy .String ()
22
- }
23
-
24
17
type ObjectType string
25
18
26
19
const (
@@ -56,7 +49,7 @@ func createObjectID(objectType ObjectType, id string) ObjectID {
56
49
}
57
50
58
51
func searchTemplates (ctx context.Context ,deps Deps ,query string ) ([]SearchResultItem ,error ) {
59
- serverURL := getServerURL (deps )
52
+ serverURL := deps . getServerURL ()
60
53
templates ,err := deps .coderClient .Templates (ctx , codersdk.TemplateFilter {
61
54
SearchQuery :query ,
62
55
})
@@ -76,7 +69,7 @@ func searchTemplates(ctx context.Context, deps Deps, query string) ([]SearchResu
76
69
}
77
70
78
71
func searchWorkspaces (ctx context.Context ,deps Deps ,query string ) ([]SearchResultItem ,error ) {
79
- serverURL := getServerURL (deps )
72
+ serverURL := deps . getServerURL ()
80
73
workspaces ,err := deps .coderClient .Workspaces (ctx , codersdk.WorkspaceFilter {
81
74
FilterQuery :query ,
82
75
})
@@ -351,7 +344,7 @@ func fetchWorkspace(ctx context.Context, deps Deps, workspaceID string) (FetchRe
351
344
ID :workspace .ID .String (),
352
345
Title :workspace .Name ,
353
346
Text :string (workspaceJSON ),
354
- URL :fmt .Sprintf ("%s/%s/%s" ,getServerURL (deps ),workspace .OwnerName ,workspace .Name ),
347
+ URL :fmt .Sprintf ("%s/%s/%s" ,deps . getServerURL (),workspace .OwnerName ,workspace .Name ),
355
348
},nil
356
349
}
357
350
@@ -372,7 +365,7 @@ func fetchTemplate(ctx context.Context, deps Deps, templateID string) (FetchResu
372
365
ID :template .ID .String (),
373
366
Title :template .DisplayName ,
374
367
Text :string (templateJSON ),
375
- URL :fmt .Sprintf ("%s/templates/%s/%s" ,getServerURL (deps ),template .OrganizationName ,template .Name ),
368
+ URL :fmt .Sprintf ("%s/templates/%s/%s" ,deps . getServerURL (),template .OrganizationName ,template .Name ),
376
369
},nil
377
370
}
378
371