This splits the request handlers into two functions, one which is the actual
handler and one which is independent from the Grafana `ReqContext` object. This
is to make it easier to reuse the implementation in other code.
Part of the refactoring changes the functions which get query parameters from
the request to operate on a `url.Values` instead of the request object.
The change also makes the code consistently use `req.Form` instead of a
combination of `req.URL.Query()` and `req.Form`, though I have left
`api_ruler` as-is to avoid this PR growing too large.
* Show list of labels on the alert rule form in a more visual way, and use a modal for managing them
* fix test
* Fix more tests
* Show orange badge when no labels are selected
* Remove unused datasource property in LabelsField
* Remove unused div and add comment
* Use button instead of icon for editing labels
* Use subform for labels
* Move logic fetching labels from different places in a separate hook
* Fix tests
* remove unused getLabelInput const in test
* Add ellispis and tooltip for long labels and move labels list in modal to the bottom
* Use text instead of badge when no using labels
* Fix tests after adding ellipsis and tooltip to the labels
* simplify styles
* Fix fetching values from gops when new key is used
* Address pr review comments
* Address pr review comments part2
* Fix tag on rtkq
* Remove color for no labels selected text
* Disable already used keys in the labels sub form
* Fix typo
* use the UseFieldArrayRemove type from react-hook-form
* Update some styles and text in the labels modal
* Address some review comments (nits)
* Address review comments part1
* Move logic getting labels in useCombinedLabels hook
---------
Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
* implement SaveAndApplyConfig in the remote Alertmanager struct
* remove ID from CreateGrafanaAlertmanagerConfig call
* decrypt, test that we decrypt, refactor
* fix duplicated declaration in test
* rephrase comment, remove unnecessary conversion to slice of bytes
* fix test
* Alerting: Implement SaveAndApplyDefaultConfig in the forked Alertmanager (remote primary)
* log the error for the internal AM instead of returning it
* FE Sandbox: Fix worker post message not handling proxy objects correctly
* use expect error instead of ignore
* use assertion instead of ignore
* Fix formatting
* Render current MegaMenu link as `aria-current=page`
* Add overrides capability for mega menu links
* Pass pageNav into getActiveItem so we can use override capability
* Test MegaMenu special cases for starred & dashboards
* Test that overrides for megamenu util works correctly
* Alpha-sort megamenu overrides
* Refactor util for getting active item for megamenu
Update parameters to getActiveItem
Update tests for getActiveItem
* Fix test for starred dashboard and remove query param test
Query param case happens differently in real app and is fiddly to test here
* handle edge cases
* restore handling home page test
* fix dashboard settings
* handle starring properly
---------
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
* Add timezone selector to Storybook toolbar
So that it's possible to preview how components that are using date functions, behave when timezone differs from browser/client.
* Re-order imports
* apply empty state in a bunch of places
* fix unit tests
* put alert back on top
* add data-testids so e2e tests keep working
* remove info boxes
* fix annotations empty state alignment with new maxWidth
* Add setting for changing shortlink expiration time
* Add docs, add better language
* put all the numbers in the duration 🤷
* 🙄
* update language to be correct and clear
* Add max limit and more documentation
This test has been skipped for a long time, so it doesn't work anymore. I've
fixed the test so it works again, but left some tests disabled which were
apparently flaky. If we see the other test cases flaking, we'll have to
disable it again.
Fixes:
- Use fake access control for most test cases, and real one for FGAC test cases.
- Check that "file" in API responses the full folder path, not folder title.