diff --git a/apps/advisor/pkg/app/checks/authchecks/check.go b/apps/advisor/pkg/app/checks/authchecks/check.go index ff3158a2ad2..e1f9f0c204b 100644 --- a/apps/advisor/pkg/app/checks/authchecks/check.go +++ b/apps/advisor/pkg/app/checks/authchecks/check.go @@ -29,6 +29,10 @@ func (c *check) ID() string { return CheckID } +func (c *check) Name() string { + return "SSO Setting" +} + func (c *check) Init(ctx context.Context) error { return nil } diff --git a/apps/advisor/pkg/app/checks/datasourcecheck/check.go b/apps/advisor/pkg/app/checks/datasourcecheck/check.go index 7bcab079160..1cc2c6e2d9d 100644 --- a/apps/advisor/pkg/app/checks/datasourcecheck/check.go +++ b/apps/advisor/pkg/app/checks/datasourcecheck/check.go @@ -87,6 +87,10 @@ func (c *check) ID() string { return CheckID } +func (c *check) Name() string { + return "Data Source" +} + func (c *check) Init(ctx context.Context) error { return nil } @@ -154,7 +158,7 @@ func (s *healthCheckStep) Title() string { } func (s *healthCheckStep) Description() string { - return "Checks if a data sources is healthy." + return "Checks if a data source is healthy." } func (s *healthCheckStep) Resolution() string { @@ -228,7 +232,7 @@ func (s *missingPluginStep) Title() string { } func (s *missingPluginStep) Description() string { - return "Checks if the plugin associated with the data source is installed." + return "Checks if the plugin associated with the data source is installed and available." } func (s *missingPluginStep) Resolution() string { @@ -263,7 +267,7 @@ func (s *missingPluginStep) Run(ctx context.Context, log logging.Logger, obj *ad if len(plugins) > 0 { // Plugin is available in the repo links = append(links, advisor.CheckErrorLink{ - Message: "Install plugin", + Message: "View plugin", Url: fmt.Sprintf("/plugins/%s", ds.Type), }) } diff --git a/apps/advisor/pkg/app/checks/ifaces.go b/apps/advisor/pkg/app/checks/ifaces.go index 06ebcb53436..6573253b557 100644 --- a/apps/advisor/pkg/app/checks/ifaces.go +++ b/apps/advisor/pkg/app/checks/ifaces.go @@ -11,6 +11,8 @@ import ( type Check interface { // ID returns the unique identifier of the check ID() string + // Name returns the human-readable name of the check + Name() string // Item returns the item that will be checked Item(ctx context.Context, id string) (any, error) // Items returns the list of items that will be checked diff --git a/apps/advisor/pkg/app/checks/plugincheck/check.go b/apps/advisor/pkg/app/checks/plugincheck/check.go index 43a5491f235..08458df6e50 100644 --- a/apps/advisor/pkg/app/checks/plugincheck/check.go +++ b/apps/advisor/pkg/app/checks/plugincheck/check.go @@ -45,6 +45,10 @@ func (c *check) ID() string { return CheckID } +func (c *check) Name() string { + return "Plugin" +} + func (c *check) Items(ctx context.Context) ([]any, error) { ps := c.PluginStore.Plugins(ctx) res := make([]any, len(ps)) diff --git a/apps/advisor/pkg/app/checks/utils.go b/apps/advisor/pkg/app/checks/utils.go index 08cfa12dc6b..7ca9cc473b4 100644 --- a/apps/advisor/pkg/app/checks/utils.go +++ b/apps/advisor/pkg/app/checks/utils.go @@ -18,6 +18,7 @@ const ( RetryAnnotation = "advisor.grafana.app/retry" IgnoreStepsAnnotation = "advisor.grafana.app/ignore-steps" IgnoreStepsAnnotationList = "advisor.grafana.app/ignore-steps-list" + NameAnnotation = "advisor.grafana.app/checktype-name" StatusAnnotationError = "error" StatusAnnotationProcessed = "processed" ) diff --git a/apps/advisor/pkg/app/checktyperegisterer/checktyperegisterer.go b/apps/advisor/pkg/app/checktyperegisterer/checktyperegisterer.go index 1326adc96a6..f154a7afb51 100644 --- a/apps/advisor/pkg/app/checktyperegisterer/checktyperegisterer.go +++ b/apps/advisor/pkg/app/checktyperegisterer/checktyperegisterer.go @@ -3,6 +3,7 @@ package checktyperegisterer import ( "context" "fmt" + "maps" "time" "github.com/grafana/grafana-app-sdk/app" @@ -70,7 +71,9 @@ func (r *Runner) createOrUpdate(ctx context.Context, log logging.Logger, obj res if err != nil { return err } - annotations := current.GetAnnotations() + currentAnnotations := current.GetAnnotations() + annotations := obj.GetAnnotations() + maps.Copy(annotations, currentAnnotations) obj.SetAnnotations(annotations) _, err = r.client.Update(ctx, id, obj, resource.UpdateOptions{}) if err != nil { @@ -103,6 +106,7 @@ func (r *Runner) Run(ctx context.Context) error { Name: t.ID(), Namespace: r.namespace, Annotations: map[string]string{ + checks.NameAnnotation: t.Name(), // Flag to indicate feature availability checks.RetryAnnotation: "1", checks.IgnoreStepsAnnotation: "1", diff --git a/apps/advisor/pkg/app/checktyperegisterer/checktyperegisterer_test.go b/apps/advisor/pkg/app/checktyperegisterer/checktyperegisterer_test.go index c92cef96e9f..6d00ac9e295 100644 --- a/apps/advisor/pkg/app/checktyperegisterer/checktyperegisterer_test.go +++ b/apps/advisor/pkg/app/checktyperegisterer/checktyperegisterer_test.go @@ -178,20 +178,34 @@ func (m *mockCheckRegistry) Checks() []checks.Check { } type mockCheck struct { - checks.Check - id string steps []checks.Step } +func (m *mockCheck) Init(ctx context.Context) error { + return nil +} + func (m *mockCheck) ID() string { return m.id } +func (m *mockCheck) Name() string { + return "mock" +} + func (m *mockCheck) Steps() []checks.Step { return m.steps } +func (m *mockCheck) Item(ctx context.Context, id string) (any, error) { + return nil, nil +} + +func (m *mockCheck) Items(ctx context.Context) ([]any, error) { + return nil, nil +} + type mockStep struct { id string title string diff --git a/apps/advisor/pkg/app/utils_test.go b/apps/advisor/pkg/app/utils_test.go index d852696d78d..f813b9dfea6 100644 --- a/apps/advisor/pkg/app/utils_test.go +++ b/apps/advisor/pkg/app/utils_test.go @@ -322,6 +322,10 @@ func (m *mockCheck) ID() string { return "mock" } +func (m *mockCheck) Name() string { + return "Mock" +} + func (m *mockCheck) Items(ctx context.Context) ([]any, error) { return m.items, nil }