Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nav: Fix alerting links/special cases not selecting the right MegaMenu item #85336

Merged
merged 17 commits into from
Apr 23, 2024

Conversation

tomratcliffe
Copy link
Member

What is this feature?
Fixes to rendering of the current active item in the MegaMenu

Why do we need this feature?
When rendering some URLs, the correct MegaMenu item wasn't being selected.

For example, /alerting/silence/new was highlighting the Alerting nav item, rather than Silences. This is because not all URLs follow a predictable structure, so until we have a consistent hierarchy of routing, we can't rely on matching the start of URLs. For that specific case, the parent URL is /alerting/silences (plural), so the startsWith doesn't match up.

It would be a fairly substantial overhaul of existing URLs to fix this and make them all structured consistently, so the cleanest solution right now seems to be providing a way of overriding the exact nav item that should be highlighted - any other suggestions are welcomed though!

Which issue(s) does this PR fix?:

Fixes #83507 but also fixes Administration -> Organizations -> New not selecting the correct item (it was highlighting Default preferences)

@tomratcliffe tomratcliffe requested review from a team, gillesdemey, konrad147 and soniaAguilarPeiron and removed request for a team March 28, 2024 11:28
@grafana-delivery-bot grafana-delivery-bot bot added this to the 11.1.x milestone Mar 28, 2024
@@ -38,6 +38,7 @@ export function MegaMenuItemText({ children, isActive, onClick, target, url }: P
href={url}
target={target}
onClick={onClick}
{...(isActive && { 'aria-current': 'page' })}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be slightly inaccurate, as the href of the active item doesn't exactly match the current page (e.g. it's selecting a link that refers to /dashboards, but we might be on /d/someuid/name).
Does this seem right? Or just aria-current=true?

Comment on lines -163 to -169
it('returns the alerting link if the pathname is an alert notification', () => {
const mockPathName = '/alerting/notification/foo';
expect(getActiveItem(mockNavTree, mockPathName)).toEqual({
text: 'Alerting item',
url: '/alerting/list',
});
});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I believe) When legacy alerting was removed, we also removed the need for this special case as the route doesn't exist anymore

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this was a legacy route so good riddance :)

@tomratcliffe tomratcliffe added the no-changelog Skip including change in changelog/release notes label Mar 28, 2024
@tomratcliffe tomratcliffe marked this pull request as ready for review March 28, 2024 11:31
@tomratcliffe tomratcliffe requested a review from a team as a code owner March 28, 2024 11:31
@tomratcliffe tomratcliffe requested review from Clarity-89 and JoaoSilvaGrafana and removed request for a team March 28, 2024 11:31
Copy link
Contributor

@ashharrison90 ashharrison90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we can do even better now. looking at the url was always temporary and prone to failures. but in MegaMenu we have access to state.sectionNav.node. ignore the name, it's the active page. pretty sure we use it to construct the breadcrumbs

i think we can rewrite getActiveItem as something like:

export const getActiveItem = (
  navTree: NavModelItem[],
  node: NavModelItem,
): NavModelItem | undefined => {
  if (!node || node.id === 'profile') {
    return undefined;
  }

  for (const link of navTree) {
    if (node.text === link.text && node.url === link.url) {
      return link;
    } else if (link.children) {
      const activeChild = getActiveItem(link.children, node);
      if (activeChild) {
        return activeChild;
      }
    }
  }
  
  if (node.parentItem) {
    return getActiveItem(navTree, node.parentItem);
  }

  return undefined;
};

and call it in MegaMenu with:

    const activeItem = getActiveItem(navItems, state.sectionNav.node);

think that will then ✨ just work ✨ for everything except the home page which we'll probably have to special case somehow.

that should also let us delete the stripQueryParams, isBetterMatch and isMatchOrChildMatch functions 🤞

@tomratcliffe
Copy link
Member Author

tomratcliffe commented Apr 4, 2024

Perfect, thanks @ashharrison90, much cleaner! I had tried to do something similar but I didn't realise that I could get the current page reliably through that 😃 Will have a look and a refactor to fix it. I think the starred dashboards will also need handling differently 👍

const stripQueryParams = (url?: string) => {
return url?.split('?')[0] ?? '';
};
/**
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still had to do some special-casing here. I looked at the dashboard page code a little bit to see if I could easily set the nav item to be a "starred" one, but I didn't fancy making changes in somewhere so critical in this PR - unless someone is able to point me in a direction to quickly fix that?

I was getting a dashboard page as only ever having a nav item with ID of dashboards/browse

Query param case happens differently in real app and is fiddly to test here
Copy link
Contributor

@ashharrison90 ashharrison90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok this is real close, nice job 🙌

i see 2 problems here, but i think we can fix them both 🤞:

  • dashboards being special cased
    • let's modify the logic for the dashboard navModel
      • search for a nav item matching the starred dashboard id
      • fall back to dashboards/browse otherwise
  • visiting Profile/Notification history/Change password shows Home as highlighted
    • let's just add a special case for profile:
      if (currentPage.id === 'profile') {
        return undefined;
      }

i've raised a PR into this branch with those changes here

i think with those we're good to go 👍

@tomratcliffe tomratcliffe requested a review from a team as a code owner April 22, 2024 10:43
@tomratcliffe tomratcliffe requested review from oscarkilhed and kaydelaney and removed request for a team April 22, 2024 10:43
@tomratcliffe
Copy link
Member Author

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes. Follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with alerting/mega-menu-fixes oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

Error building instance: Contact #proj-ephemeral-hg-instances if it is not a compile error. Logs

handling pull request comment event: running grafana-build deb: executing command: stdout= stderr=go: downloading dagger.io/dagger v0.11.0
go: downloading github.com/urfave/cli/v2 v2.27.1
go: downloading go.opentelemetry.io/otel v1.25.0
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.25.0
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.25.0
go: downloading go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.25.0
go: downloading go.opentelemetry.io/otel/sdk v1.25.0
go: downloading go.opentelemetry.io/otel/trace v1.25.0
go: downloading golang.org/x/sync v0.6.0
go: downloading github.com/Khan/genqlient v0.6.0
go: downloading github.com/vektah/gqlparser/v2 v2.5.6
go: downloading github.com/go-logr/logr v1.4.1
go: downloading go.opentelemetry.io/otel/metric v1.25.0
go: downloading golang.org/x/sys v0.18.0
go: downloading go.opentelemetry.io/proto/otlp v1.1.0
go: downloading google.golang.org/protobuf v1.33.0
go: downloading google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda
go: downloading google.golang.org/grpc v1.63.0
go: downloading github.com/adrg/xdg v0.4.0
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading github.com/99designs/gqlgen v0.17.31
go: downloading golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
go: downloading github.com/cpuguy83/go-md2man/v2 v2.0.2
go: downloading github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
go: downloading github.com/go-logr/stdr v1.2.2
go: downloading github.com/cenkalti/backoff/v4 v4.3.0
go: downloading github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0
go: downloading github.com/Masterminds/semver v1.5.0
go: downloading golang.org/x/net v0.23.0
go: downloading github.com/russross/blackfriday/v2 v2.1.0
go: downloading google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de
go: downloading golang.org/x/text v0.14.0
2024/04/22 10:46:05 OTEL_EXPORTER_OTLP_ENDPOINT not set. Disabling tracing.
time=2024-04-22T10:46:20.240Z level=INFO msg="Initializing tar.gz artifact with options" name=grafana-pro "build ID"=12345 version=10.1.0 distro=linux/amd64/dynamic static=false enterprise=true
2024/04/22 10:46:20 if git -C src checkout alerting/mega-menu-fixes; then echo "checked out alerting/mega-menu-fixes"; else exit 3; fi
2024/04/22 10:49:14 if git -C src checkout main; then echo "checked out main"; else exit 3; fi
time=2024-04-22T10:49:18.341Z level=INFO msg="Initializing backend artifact with options" static=false version=10.1.0 name=grafana-pro distro=linux/amd64/dynamic
2024/04/22 10:49:18 if git -C src checkout alerting/mega-menu-fixes; then echo "checked out alerting/mega-menu-fixes"; else exit 3; fi
time=2024-04-22T10:49:18.364Z level=INFO msg="Adding artifact to dag..." filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.deb artifact=deb:pro:linux/amd64/dynamic
time=2024-04-22T10:49:18.364Z level=INFO msg="getting dependencies..." artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.deb service=ArtifactHandler
time=2024-04-22T10:49:18.364Z level=INFO msg="got dependencies" artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.deb service=ArtifactHandler count=1
time=2024-04-22T10:49:18.364Z level=INFO msg="getting dependencies..." artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.tar.gz service=ArtifactHandler
time=2024-04-22T10:49:18.364Z level=INFO msg="got dependencies" artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.tar.gz service=ArtifactHandler count=5
time=2024-04-22T10:49:18.364Z level=INFO msg="getting dependencies..." artifact=deb:pro:linux/amd64/dynamic filename=bin/grafana-pro/linux/amd64/dynamic service=ArtifactHandler
time=2024-04-22T10:49:18.364Z level=INFO msg="got dependencies" artifact=deb:pro:linux/amd64/dynamic filename=bin/grafana-pro/linux/amd64/dynamic service=ArtifactHandler count=0
time=2024-04-22T10:49:18.364Z level=INFO msg="getting builder..." artifact=deb:pro:linux/amd64/dynamic filename=bin/grafana-pro/linux/amd64/dynamic service=ArtifactHandler
time=2024-04-22T10:49:18.364Z level=INFO msg="got builder" artifact=deb:pro:linux/amd64/dynamic filename=bin/grafana-pro/linux/amd64/dynamic service=ArtifactHandler
time=2024-04-22T10:49:18.364Z level=INFO msg="building directory..." artifact=deb:pro:linux/amd64/dynamic filename=bin/grafana-pro/linux/amd64/dynamic service=ArtifactHandler
2024/04/22 10:49:18 Building with command 'if [ -d pkg/cmd/grafana ]; then go build -ldflags="-X "main.version=10.1.0" -X "main.commit=$(cat ./.buildinfo.commit)" -X "main.buildBranch=$(cat ./.buildinfo.branch)" -X "main.enterpriseCommit=$(cat ./.buildinfo.enterprise-commit)" " -o=bin/grafana-pro/linux/amd64/dynamic/grafana -trimpath -tags=osusergo,pro ./pkg/cmd/grafana; fi'
2024/04/22 10:49:18 Building with command 'if [ -d pkg/cmd/grafana-server ]; then go build -ldflags="-X "main.version=10.1.0" -X "main.commit=$(cat ./.buildinfo.commit)" -X "main.buildBranch=$(cat ./.buildinfo.branch)" -X "main.enterpriseCommit=$(cat ./.buildinfo.enterprise-commit)" " -o=bin/grafana-pro/linux/amd64/dynamic/grafana-server -trimpath -tags=osusergo,pro ./pkg/cmd/grafana-server; fi'
2024/04/22 10:49:18 Building with command 'if [ -d pkg/cmd/grafana-cli ]; then go build -ldflags="-X "main.version=10.1.0" -X "main.commit=$(cat ./.buildinfo.commit)" -X "main.buildBranch=$(cat ./.buildinfo.branch)" -X "main.enterpriseCommit=$(cat ./.buildinfo.enterprise-commit)" " -o=bin/grafana-pro/linux/amd64/dynamic/grafana-cli -trimpath -tags=osusergo,pro ./pkg/cmd/grafana-cli; fi'
2024/04/22 10:49:18 Building with command 'if [ -d pkg/cmd/grafana-example-apiserver ]; then go build -ldflags="-X "main.version=10.1.0" -X "main.commit=$(cat ./.buildinfo.commit)" -X "main.buildBranch=$(cat ./.buildinfo.branch)" -X "main.enterpriseCommit=$(cat ./.buildinfo.enterprise-commit)" " -o=bin/grafana-pro/linux/amd64/dynamic/grafana-example-apiserver -trimpath -tags=osusergo,pro ./pkg/cmd/grafana-example-apiserver; fi'
time=2024-04-22T10:49:18.364Z level=INFO msg="done building directory" artifact=deb:pro:linux/amd64/dynamic filename=bin/grafana-pro/linux/amd64/dynamic service=ArtifactHandler
time=2024-04-22T10:49:18.364Z level=INFO msg="getting dependencies..." artifact=10.1.0 filename=deb:pro:linux/amd64/dynamic/grafana-enterprise/public service=ArtifactHandler
time=2024-04-22T10:49:18.364Z level=INFO msg="got dependencies" artifact=10.1.0 filename=deb:pro:linux/amd64/dynamic/grafana-enterprise/public service=ArtifactHandler count=0
time=2024-04-22T10:49:18.364Z level=INFO msg="getting builder..." artifact=10.1.0 filename=deb:pro:linux/amd64/dynamic/grafana-enterprise/public service=ArtifactHandler
time=2024-04-22T10:50:03.863Z level=INFO msg="got builder" artifact=10.1.0 filename=deb:pro:linux/amd64/dynamic/grafana-enterprise/public service=ArtifactHandler
time=2024-04-22T10:50:03.863Z level=INFO msg="building directory..." artifact=10.1.0 filename=deb:pro:linux/amd64/dynamic/grafana-enterprise/public service=ArtifactHandler
time=2024-04-22T10:50:03.863Z level=INFO msg="done building directory" artifact=10.1.0 filename=deb:pro:linux/amd64/dynamic/grafana-enterprise/public service=ArtifactHandler
time=2024-04-22T10:50:03.863Z level=INFO msg="getting dependencies..." artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/npm-packages service=ArtifactHandler
time=2024-04-22T10:50:03.863Z level=INFO msg="got dependencies" artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/npm-packages service=ArtifactHandler count=0
time=2024-04-22T10:50:03.863Z level=INFO msg="getting builder..." artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/npm-packages service=ArtifactHandler
time=2024-04-22T10:50:03.919Z level=INFO msg="got builder" artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/npm-packages service=ArtifactHandler
time=2024-04-22T10:50:03.919Z level=INFO msg="building directory..." artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/npm-packages service=ArtifactHandler
time=2024-04-22T10:50:03.919Z level=INFO msg="done building directory" artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/npm-packages service=ArtifactHandler
time=2024-04-22T10:50:03.919Z level=INFO msg="getting dependencies..." artifact=deb:pro:linux/amd64/dynamic filename=bin/bundled-plugins service=ArtifactHandler
time=2024-04-22T10:50:03.919Z level=INFO msg="got dependencies" artifact=deb:pro:linux/amd64/dynamic filename=bin/bundled-plugins service=ArtifactHandler count=0
time=2024-04-22T10:50:03.919Z level=INFO msg="getting builder..." artifact=deb:pro:linux/amd64/dynamic filename=bin/bundled-plugins service=ArtifactHandler
time=2024-04-22T10:50:03.940Z level=INFO msg="got builder" artifact=deb:pro:linux/amd64/dynamic filename=bin/bundled-plugins service=ArtifactHandler
time=2024-04-22T10:50:03.940Z level=INFO msg="building directory..." artifact=deb:pro:linux/amd64/dynamic filename=bin/bundled-plugins service=ArtifactHandler
time=2024-04-22T10:50:03.940Z level=INFO msg="done building directory" artifact=deb:pro:linux/amd64/dynamic filename=bin/bundled-plugins service=ArtifactHandler
time=2024-04-22T10:50:03.940Z level=INFO msg="getting dependencies..." artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/storybook service=ArtifactHandler
time=2024-04-22T10:50:03.940Z level=INFO msg="got dependencies" artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/storybook service=ArtifactHandler count=0
time=2024-04-22T10:50:03.940Z level=INFO msg="getting builder..." artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/storybook service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="got builder" artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/storybook service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="building directory..." artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/storybook service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="done building directory" artifact=deb:pro:linux/amd64/dynamic filename=10.1.0/storybook service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="getting builder..." artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.tar.gz service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="got builder" artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.tar.gz service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="building file..." artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.tar.gz service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="done building file" artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.tar.gz service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="getting builder..." artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.deb service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="got builder" artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.deb service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="building file..." artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.deb service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="done building file" artifact=deb:pro:linux/amd64/dynamic filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.deb service=ArtifactHandler
time=2024-04-22T10:50:03.961Z level=INFO msg="Done adding artifact" filename=grafana-pro_10.1.0_12345_linux_amd64-dynamic.deb artifact=deb:pro:linux/amd64/dynamic
time=2024-04-22T10:50:03.961Z level=INFO msg="Exporting artifacts..."
time=2024-04-22T10:50:03.961Z level=INFO msg="Started exporting artifact..." artifact=deb:pro:linux/amd64/dynamic action=export
time=2024-04-22T10:50:03.961Z level=INFO msg="Acquiring semaphore" artifact=deb:pro:linux/amd64/dynamic action=export
time=2024-04-22T10:50:03.961Z level=INFO msg="Acquired semaphore" artifact=deb:pro:linux/amd64/dynamic action=export
time=2024-04-22T10:50:03.961Z level=INFO msg="Exporting artifact" artifact=deb:pro:linux/amd64/dynamic action=export
error exporting artifact 'grafana-pro_10.1.0_12345_linux_amd64-dynamic.deb': input: container.from.withDirectory.withDirectory.withDirectory.withDirectory.withFile.withExec.withDirectory.withDirectory.withDirectory.withFile.withWorkdir.withExec.file resolve: process "make gen-go WIRE_TAGS=pro" did not complete successfully: exit code: 2

Stdout:
generate go files
go run ./pkg/build/wire/cmd/wire/main.go gen -tags pro ./pkg/server
Stderr:
find: scripts/drone: No such file or directory
go: downloading github.com/google/subcommands v1.2.0
go: downloading github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
go: downloading golang.org/x/tools v0.17.0
go: downloading golang.org/x/mod v0.14.0
wire: /src/pkg/server/wire.go:430:1: inject Initialize: no provider found for invalid type
needed by github.com/grafana/grafana/pkg/services/accesscontrol.DatasourcePermissionsService in provider set "wireExtsSet" (/src/pkg/server/wireexts_enterprise.go:258:19)
needed by *github.com/grafana/grafana/pkg/services/datasources/service.Service in provider set "wireExtsSet" (/src/pkg/server/wireexts_enterprise.go:258:19)
needed by github.com/grafana/grafana/pkg/services/datasources.DataSourceService in provider set "wireExtsSet" (/src/pkg/server/wireexts_enterprise.go:258:19)
needed by *github.com/grafana/grafana/pkg/services/correlations.CorrelationsService in provider set "wireExtsSet" (/src/pkg/server/wireexts_enterprise.go:258:19)
needed by github.com/grafana/grafana/pkg/services/correlations.Service in provider set "wireExtsSet" (/src/pkg/server/wireexts_enterprise.go:258:19)
needed by *github.com/grafana/grafana/pkg/api.HTTPServer in provider set "wireExtsSet" (/src/pkg/server/wireexts_enterprise.go:258:19)
needed by *github.com/grafana/grafana/pkg/server.Server in provider set "wireExtsSet" (/src/pkg/server/wireexts_enterprise.go:258:19)
wire: /src/pkg/server/wire.go:435:1: inject InitializeForTest: no provider found for invalid type
needed by github.com/grafana/grafana/pkg/services/accesscontrol.DatasourcePermissionsService in provider set "wireExtsTestSet" (/src/pkg/server/wireexts_enterprise.go:270:23)
needed by *github.com/grafana/grafana/pkg/services/datasources/service.Service in provider set "wireExtsTestSet" (/src/pkg/server/wireexts_enterprise.go:270:23)
needed by github.com/grafana/grafana/pkg/services/datasources.DataSourceService in provider set "wireExtsTestSet" (/src/pkg/server/wireexts_enterprise.go:270:23)
needed by *github.com/grafana/grafana/pkg/services/correlations.CorrelationsService in provider set "wireExtsTestSet" (/src/pkg/server/wireexts_enterprise.go:270:23)
needed by github.com/grafana/grafana/pkg/services/correlations.Service in provider set "wireExtsTestSet" (/src/pkg/server/wireexts_enterprise.go:270:23)
needed by *github.com/grafana/grafana/pkg/api.HTTPServer in provider set "wireExtsTestSet" (/src/pkg/server/wireexts_enterprise.go:270:23)
needed by *github.com/grafana/grafana/pkg/server.Server in provider set "wireExtsTestSet" (/src/pkg/server/wireexts_enterprise.go:270:23)
needed by *github.com/grafana/grafana/pkg/server.TestEnv in provider set "wireExtsTestSet" (/src/pkg/server/wireexts_enterprise.go:270:23)
wire: github.com/grafana/grafana/pkg/server: generate failed
wire: at least one generate failure
exit status 1
make: *** [Makefile:135: gen-go] Error 1
exit status 1
exit status 1

@tomratcliffe
Copy link
Member Author

/deploy-to-hg

@ephemeral-instances-bot
Copy link

  • Preparing your instance. A comment containing your instance's url will be added to this PR when the instance is ready.
  • Your instance will be ready in ~10 minutes. Follow the workflow progress
  • Slack channel: #proj-ephemeral-hg-instances
  • Building instance with alerting/mega-menu-fixes oss branch and main enterprise branch. How to choose a branch

@ephemeral-instances-bot
Copy link

Copy link
Member

@gillesdemey gillesdemey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much cleaner 🙌

@tomratcliffe
Copy link
Member Author

I just checked through the ephemeral instance, all seems to be working except for one edge case that I don't think is necessarily worth fixing in here:
When you initially star a dashboard, it won't highlight as expected in the MegaMenu until the page is refreshed, as I assume it's using the original navTree elements from page load. On refresh it works as expected

@ashharrison90
Copy link
Contributor

I just checked through the ephemeral instance, all seems to be working except for one edge case that I don't think is necessarily worth fixing in here: When you initially star a dashboard, it won't highlight as expected in the MegaMenu until the page is refreshed, as I assume it's using the original navTree elements from page load. On refresh it works as expected

ah i remember there being some special logic for this somewhere... lemme see if i can find it 🤔

@ashharrison90
Copy link
Contributor

@tomratcliffe have pushed a change for dashboard settings that should fix the remaining e2e tests - don't let anyone ever tell you they don't catch things! 😅

i'm still looking into whether there's a nice way to handle starred items. i agree it's not really a big deal, and if i can't find a nice solution by tomorrow i'll just stick an approve on this anyway 👍

@ashharrison90
Copy link
Contributor

ashharrison90 commented Apr 23, 2024

@tomratcliffe have pushed a change to handle starring/unstarring correctly. it's not particularly nice as it means we have to update 2 different slices of the state, but at least it's not regressing behaviour.

the long term solution would be to consolidate everything in one slice and move everything to rtk query then it can invalidate the cache and refetch when mutations like starring/unstarring occur, but that's a bigger task and firmly in the frontend-platform court 😅

Copy link
Contributor

@ashharrison90 ashharrison90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👍

@tomratcliffe
Copy link
Member Author

Thanks for all your help on this one Ash! 🙌

@tomratcliffe tomratcliffe enabled auto-merge (rebase) April 23, 2024 09:41
@tomratcliffe tomratcliffe merged commit 08200bc into main Apr 23, 2024
14 checks passed
@tomratcliffe tomratcliffe deleted the alerting/mega-menu-fixes branch April 23, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend no-changelog Skip including change in changelog/release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix mega menu navigation
3 participants