grafana/pkg/middleware
owensmallwood cfdea1ee30
PublicDashboards: Frontend routing for public dashboards (#48834)
* add isPublic to dashboard

* refactor routes to use route group and add placeholder method for sharing apii

* add sharing pane and utils for public dashboard config to sharing modal

* Sharing modal now persists data through the api

* moves ShareDashboard endpoint to new file and starts adding tests

* generates mocks. Adds tests for public dashboard feature flag

* Adds ability to pass in array of features to enable for the test

* test to update public flag on dashboard WIP

* Adds mock for SaveDashboardSharingConfig

* Fixes tests. Had to use FakeDashboardService

* Adds React tests for public dashboards toggle

* removes semicolons

* refactors SharePublic component to use hooks

* rename from `share publicly` to `public dashboard config`

* checkpoint. debugging tests. need to verify name changes

* checkpoint. test bugs fixed. need to finish returning proper response codes

* finish renaming. fix test

* Update pkg/api/api.go

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>

* update backend url

* rename internal objects and commands. fix configuration modal labels

* add endpoint for retrieving public dashboard configuration and populate the frontend state from it

* add test for dashboardCanBePublic

* adds backend routes

* copy DashboardPage component into component for public dashboards. WIP

* adds react routes, and doesnt render main nav bar when viewing a public route

* removes extra react route from testing

* updates component name

* Wrap the original dashboard component so we can pass props relevant to public dashboards, turn kiosk mode on/off, etc

* Wraps DashboardPage in PublicDashboardPage component. DashboardPage gets rendered in kiosk mode when public prop is passed.

* removes commented out code from exploratory work

* Makes public dashboard routes require no auth

* extracts helper to own util file to check if were viewing a public page

* Hides panel dropdown when its being viewed publicly

* formatting

* use function from utils file for determining if publicly viewed. If public, hides app notifications, searchwrapper, and commandpalette.

* adds unit tests for util function used to see if page is being viewed publicly

* cant added annotations to panel when being publicly viewed

* removes useless comment

* hides backend and frontend pubdash routes behind feature flag

* consider feature flag when checking url path to see if on public dashboard

* renames function

* still render app notifications when in public view

* Extract pubdash route logic into own file

* fixes failing tests

* Determines path using location locationUtils. This covers the case when grafana is being hosted on a subpath. Updates tests.

* renames pubdash web route to be more understandable

* rename route

* fixes failing test

* fixes failing test. Needed to update pubdash urls

* sets flag on grafana boot config for if viewing public dashboard. Removes hacky check that looks at the url

* fixes failing tests. Uses config to determine if viewing public dashboard

* renders the blue panel timeInfo on public dashboard panel

* Extracts conditional logic for rendering components out into their own functions

* removes publicDashboardView check, and uses dashboard meta instead

* the timeInfo is always displayed on the panel

* After fetch of public dashboard dto, the meta isPublic flag gets set and used to determine if viewing public dashboard for child components. Fixes tests for PanelHeader.

* Fixes failing test. Needed to add isPublic flag to dashboard meta.

Co-authored-by: Jeff Levin <jeff@levinology.com>
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2022-06-02 14:57:55 -06:00
..
cookies Backend: Remove more globals (#29644) 2020-12-15 19:09:04 +01:00
csrf API: Migrate CSRF to service and support additional options (#48120) 2022-06-02 15:52:30 +02:00
auth_test.go Chore: Remove bus from contexthandler (#47374) 2022-04-06 16:31:26 +02:00
auth.go sqlstore split: dashboard permissions (#49962) 2022-06-01 14:16:26 -04:00
csp.go Macaron: convert CSP middleware (#37672) 2021-08-10 09:03:22 +02:00
dashboard_public.go PublicDashboards: Frontend routing for public dashboards (#48834) 2022-06-02 14:57:55 -06:00
dashboard_redirect_test.go Chore: Remove endpoints that contain the slug field (#35104) 2021-06-03 16:20:13 +03:00
dashboard_redirect.go Chore: Remove endpoints that contain the slug field (#35104) 2021-06-03 16:20:13 +03:00
gziper.go Chore: replace macaron with web package (#40136) 2021-10-11 14:30:59 +02:00
logger_test.go Chore: sanitize values before being logged from request headers (#49245) 2022-05-23 14:18:33 -03:00
logger.go Chore: sanitize values before being logged from request headers (#49245) 2022-05-23 14:18:33 -03:00
middleware_basic_auth_test.go Chore: Remove bus (#47511) 2022-04-08 16:15:06 +02:00
middleware_jwt_auth_test.go Chore: Remove bus (#47511) 2022-04-08 16:15:06 +02:00
middleware_test.go fix status code 200 (#47818) 2022-04-15 08:01:58 -04:00
middleware.go Middleware: Don't require HTTPS for HSTS headers to be emitted (#35147) 2022-01-28 07:23:28 +01:00
org_redirect_test.go Chore: Remove bus (#47511) 2022-04-08 16:15:06 +02:00
org_redirect.go Chore: Remove bus from contexthandler (#47458) 2022-04-08 10:33:19 +02:00
quota_test.go Chore: Remove bus from contexthandler (#47374) 2022-04-06 16:31:26 +02:00
quota.go Chore: Remove bus from quota (#45143) 2022-02-10 12:42:06 +01:00
rate_limit_test.go fix status code 200 (#47818) 2022-04-15 08:01:58 -04:00
rate_limit.go Chore: replace macaron with web package (#40136) 2021-10-11 14:30:59 +02:00
recovery_test.go Chore: Remove bus (#47511) 2022-04-08 16:15:06 +02:00
recovery.go Chore: Fix log filters (#44681) 2022-02-03 23:20:02 +08:00
request_metrics.go Metrics: Remove support for using summaries instead of histogram for HTTP instrumentation (#49985) 2022-06-01 14:33:59 +02:00
request_tracing.go pkg/web: remove dependency injection (#49123) 2022-05-24 15:35:08 -04:00
testing.go Chore: Remove bus from authproxy (#46936) 2022-03-30 17:01:24 +02:00
validate_host.go Chore: replace macaron with web package (#40136) 2021-10-11 14:30:59 +02:00