Skip to content

Commit

Permalink
feat: hide Talos metal agent extension on the UI
Browse files Browse the repository at this point in the history
It is an internal extension, so we don't want to list it on the UI.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
  • Loading branch information
utkuozdemir committed Nov 6, 2024
1 parent d98b007 commit 8e66370
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
17 changes: 14 additions & 3 deletions internal/frontend/http/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func (f *Frontend) wizardArch(_ context.Context, params WizardParams) (string, a

// wizardExtensions handles the 'pick extensions' step.
func (f *Frontend) wizardExtensions(ctx context.Context, params WizardParams) (string, any, url.Values, error) {
extensions, err := f.artifactsManager.GetOfficialExtensions(ctx, params.Version)
extensions, err := f.getOfficialExtensions(ctx, params.Version)
if err != nil {
return "", nil, nil, err
}
Expand Down Expand Up @@ -534,7 +534,7 @@ func (f *Frontend) handleUIExtensionsList(ctx context.Context, w http.ResponseWr
filter := r.FormValue("search")
extensions := r.Form["extensions"]

extensionList, err := f.artifactsManager.GetOfficialExtensions(ctx, version)
extensionList, err := f.getOfficialExtensions(ctx, version)
if err != nil {
return err
}
Expand Down Expand Up @@ -660,7 +660,7 @@ func (f *Frontend) handleUISchematicConfig(ctx context.Context, w http.ResponseW
return fmt.Errorf("error parsing version: %w", err)
}

extensions, err := f.artifactsManager.GetOfficialExtensions(ctx, version.String())
extensions, err := f.getOfficialExtensions(ctx, version.String())
if err != nil {
return err
}
Expand Down Expand Up @@ -785,3 +785,14 @@ func (f *Frontend) handleUISchematics(ctx context.Context, w http.ResponseWriter
},
})
}

func (f *Frontend) getOfficialExtensions(ctx context.Context, version string) ([]artifacts.ExtensionRef, error) {
extensions, err := f.artifactsManager.GetOfficialExtensions(ctx, version)
if err != nil {
return nil, err
}

return xslices.Filter(extensions, func(ext artifacts.ExtensionRef) bool {
return ext.TaggedReference.Context().RepositoryStr() != "siderolabs/metal-agent" // hide the internal metal-agent extension on the UI
}), nil
}
2 changes: 1 addition & 1 deletion internal/integration/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func testDownloadFrontend(ctx context.Context, t *testing.T, baseURL string) {
const MiB = 1024 * 1024

talosVersions := []string{
"v1.8.0-alpha.2",
"v1.8.2",
"v1.5.1",
}

Expand Down

0 comments on commit 8e66370

Please sign in to comment.