grafana/public/app/angular/AngularApp.ts

165 lines
5.1 KiB
TypeScript
Raw Normal View History

import 'angular';
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
import 'angular-route';
import 'angular-sanitize';
import 'angular-bindonce';
import angular from 'angular'; // eslint-disable-line no-duplicate-imports
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
import { extend } from 'lodash';
Plugins: Bump SystemJS to 6.14.2 (#70068) * chore(plugins): bump systemjs to latest version * refactor(plugins): switch runtime over to use latest systemjs, add typings * refactor(plugins): use latest systemjs APIs for runtime dependency resolution * refactor(plugins): return valid urls from backend for latest systemjs import to work * revert(plugins): remove cfg from assetpath in favour of relative paths * fix(plugins): useDefault for systemjs deps to solve undefined errors * feat(plugins): add basic support for loading plugins via CDN * fix(plugins): load nested plugins with latest systemjs * feat(plugins): add back ability to transform plugin src for cdns * feat(plugins): get caching for module.js working, clean up * refactor(plugin_loader): create buildImportMap fn and more clean up * refactor(angularapp): use buildImportMap for dependencies and clean up * test(plugin_loader): fix failing test due to systemjs update * test(jest): mock systemjs amd extra in tests to prevent it breaking tests * chore(plugins): remove systemjs module-types extra, already included with system * fix(plugins): update key for invalidating cached plugins * fix: move systemjs amd define to another global so monaco can load * refactor(plugins): clean up cache buster and tests * chore(plugins): remove debug * refactor(plugins): move systemjs define to keep global cleaner * fix(plugins): set useDefault so system modules lodash references dont fail * feat(plugins): hook systemjs onload so stylesheets are applied to the dom * refactor(plugins): wrap amd formatted plugins in iife to prevent define collision * feat(plugins): support system module format for legacy plugins * test(plugincachebuster): update tests to match latest implementation * test(plugins-loader): fix up tests post module property change * fix test * Update pkg/plugins/manager/loader/assetpath/assetpath.go Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> * chore(plugin_loader): remove stray import from merge conflict * Revert "Update pkg/plugins/manager/loader/assetpath/assetpath.go" This reverts commit 0df57d1cf20f49c22c93369001c70aae46a97c42. * fix(plugin_loader): set use default for shared plugin dependencies * refactor(plugins): use leading slash for Module and BaseUrl * fix(plugins): fix resolve appending extension to cache query param * refactor(plugins): align baseurl and module paths * refactor(plugins): update builtInPlugins keys to match naming convention * refactor(plugins): minor loader clean up, fix up types * test(plugins): fix failing tests * refactor(plugins): rename cache buster systemjs plugin to cache * refactor(plugins): separate plugin_loader into smaller files * chore(plugins): clean up plugin_loader types * chore(plugin_sandbox): fix typescript error * chore(npm): remove unplug debug and pin systemjs to 6.14.1 * refactor(plugins-cdn): update loaders to use absolute module url from backend * fix(plugins): escape period in systemjs module regex * chore(plugins): delete redundant systemjs plugins * refactor(plugin_loader): move hooks into own file, add types * test(plugins): add tests for systemjs loader hooks * chore(plugins): rename systemjshooks file * chore(plugins): remove redundant systemjs cdn backend code * fix(plugins): handle loading with config.appSubUrl * chore(plugins): delete redundant plugin-cdn angular code * test(plugins): fix failing systemjs test missing pluginsCDNBaseUrl * refactor(plugins): backend provides base and module properties with AppSubUrl * fix(plugins): consider AppSubUrl for plugin logos * fix(plugins): use isHostedOnCDN util when checking for cdn hosted plugins * add new appSubURL field to config * refactor relative URL func * fix path for core app * refactor asset path input * fix(plugins): catch errors in loadPluginCss * feat(plugins-cdn): selectively transform sourceMapURL * re-add deleted test case * chore(plugins): bump to latest systemjs@6.14.2 * feat(plugins): add systemjs-cjs-extra for loading commonjs plugins --------- Co-authored-by: Will Browne <will.browne@grafana.com> Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2023-08-31 08:45:44 -05:00
import { getTemplateSrv, SystemJS } from '@grafana/runtime';
import { coreModule, angularModules } from 'app/angular/core_module';
import appEvents from 'app/core/app_events';
import { config } from 'app/core/config';
import { contextSrv } from 'app/core/services/context_srv';
import { DashboardLoaderSrv } from 'app/features/dashboard/services/DashboardLoaderSrv';
import { getTimeSrv } from 'app/features/dashboard/services/TimeSrv';
import { setAngularPanelReactWrapper } from 'app/features/plugins/importPanelPlugin';
Plugins: Bump SystemJS to 6.14.2 (#70068) * chore(plugins): bump systemjs to latest version * refactor(plugins): switch runtime over to use latest systemjs, add typings * refactor(plugins): use latest systemjs APIs for runtime dependency resolution * refactor(plugins): return valid urls from backend for latest systemjs import to work * revert(plugins): remove cfg from assetpath in favour of relative paths * fix(plugins): useDefault for systemjs deps to solve undefined errors * feat(plugins): add basic support for loading plugins via CDN * fix(plugins): load nested plugins with latest systemjs * feat(plugins): add back ability to transform plugin src for cdns * feat(plugins): get caching for module.js working, clean up * refactor(plugin_loader): create buildImportMap fn and more clean up * refactor(angularapp): use buildImportMap for dependencies and clean up * test(plugin_loader): fix failing test due to systemjs update * test(jest): mock systemjs amd extra in tests to prevent it breaking tests * chore(plugins): remove systemjs module-types extra, already included with system * fix(plugins): update key for invalidating cached plugins * fix: move systemjs amd define to another global so monaco can load * refactor(plugins): clean up cache buster and tests * chore(plugins): remove debug * refactor(plugins): move systemjs define to keep global cleaner * fix(plugins): set useDefault so system modules lodash references dont fail * feat(plugins): hook systemjs onload so stylesheets are applied to the dom * refactor(plugins): wrap amd formatted plugins in iife to prevent define collision * feat(plugins): support system module format for legacy plugins * test(plugincachebuster): update tests to match latest implementation * test(plugins-loader): fix up tests post module property change * fix test * Update pkg/plugins/manager/loader/assetpath/assetpath.go Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> * chore(plugin_loader): remove stray import from merge conflict * Revert "Update pkg/plugins/manager/loader/assetpath/assetpath.go" This reverts commit 0df57d1cf20f49c22c93369001c70aae46a97c42. * fix(plugin_loader): set use default for shared plugin dependencies * refactor(plugins): use leading slash for Module and BaseUrl * fix(plugins): fix resolve appending extension to cache query param * refactor(plugins): align baseurl and module paths * refactor(plugins): update builtInPlugins keys to match naming convention * refactor(plugins): minor loader clean up, fix up types * test(plugins): fix failing tests * refactor(plugins): rename cache buster systemjs plugin to cache * refactor(plugins): separate plugin_loader into smaller files * chore(plugins): clean up plugin_loader types * chore(plugin_sandbox): fix typescript error * chore(npm): remove unplug debug and pin systemjs to 6.14.1 * refactor(plugins-cdn): update loaders to use absolute module url from backend * fix(plugins): escape period in systemjs module regex * chore(plugins): delete redundant systemjs plugins * refactor(plugin_loader): move hooks into own file, add types * test(plugins): add tests for systemjs loader hooks * chore(plugins): rename systemjshooks file * chore(plugins): remove redundant systemjs cdn backend code * fix(plugins): handle loading with config.appSubUrl * chore(plugins): delete redundant plugin-cdn angular code * test(plugins): fix failing systemjs test missing pluginsCDNBaseUrl * refactor(plugins): backend provides base and module properties with AppSubUrl * fix(plugins): consider AppSubUrl for plugin logos * fix(plugins): use isHostedOnCDN util when checking for cdn hosted plugins * add new appSubURL field to config * refactor relative URL func * fix path for core app * refactor asset path input * fix(plugins): catch errors in loadPluginCss * feat(plugins-cdn): selectively transform sourceMapURL * re-add deleted test case * chore(plugins): bump to latest systemjs@6.14.2 * feat(plugins): add systemjs-cjs-extra for loading commonjs plugins --------- Co-authored-by: Will Browne <will.browne@grafana.com> Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2023-08-31 08:45:44 -05:00
import { buildImportMap } from 'app/features/plugins/loader/utils';
import * as sdk from 'app/plugins/sdk';
import { registerAngularDirectives } from './angular_wrappers';
import { initAngularRoutingBridge } from './bridgeReactAngularRouting';
import { monkeyPatchInjectorWithPreAssignedBindings } from './injectorMonkeyPatch';
import { getAngularPanelReactWrapper } from './panel/AngularPanelReactWrapper';
import { promiseToDigest } from './promiseToDigest';
import { registerComponents } from './registerComponents';
Plugins: Bump SystemJS to 6.14.2 (#70068) * chore(plugins): bump systemjs to latest version * refactor(plugins): switch runtime over to use latest systemjs, add typings * refactor(plugins): use latest systemjs APIs for runtime dependency resolution * refactor(plugins): return valid urls from backend for latest systemjs import to work * revert(plugins): remove cfg from assetpath in favour of relative paths * fix(plugins): useDefault for systemjs deps to solve undefined errors * feat(plugins): add basic support for loading plugins via CDN * fix(plugins): load nested plugins with latest systemjs * feat(plugins): add back ability to transform plugin src for cdns * feat(plugins): get caching for module.js working, clean up * refactor(plugin_loader): create buildImportMap fn and more clean up * refactor(angularapp): use buildImportMap for dependencies and clean up * test(plugin_loader): fix failing test due to systemjs update * test(jest): mock systemjs amd extra in tests to prevent it breaking tests * chore(plugins): remove systemjs module-types extra, already included with system * fix(plugins): update key for invalidating cached plugins * fix: move systemjs amd define to another global so monaco can load * refactor(plugins): clean up cache buster and tests * chore(plugins): remove debug * refactor(plugins): move systemjs define to keep global cleaner * fix(plugins): set useDefault so system modules lodash references dont fail * feat(plugins): hook systemjs onload so stylesheets are applied to the dom * refactor(plugins): wrap amd formatted plugins in iife to prevent define collision * feat(plugins): support system module format for legacy plugins * test(plugincachebuster): update tests to match latest implementation * test(plugins-loader): fix up tests post module property change * fix test * Update pkg/plugins/manager/loader/assetpath/assetpath.go Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> * chore(plugin_loader): remove stray import from merge conflict * Revert "Update pkg/plugins/manager/loader/assetpath/assetpath.go" This reverts commit 0df57d1cf20f49c22c93369001c70aae46a97c42. * fix(plugin_loader): set use default for shared plugin dependencies * refactor(plugins): use leading slash for Module and BaseUrl * fix(plugins): fix resolve appending extension to cache query param * refactor(plugins): align baseurl and module paths * refactor(plugins): update builtInPlugins keys to match naming convention * refactor(plugins): minor loader clean up, fix up types * test(plugins): fix failing tests * refactor(plugins): rename cache buster systemjs plugin to cache * refactor(plugins): separate plugin_loader into smaller files * chore(plugins): clean up plugin_loader types * chore(plugin_sandbox): fix typescript error * chore(npm): remove unplug debug and pin systemjs to 6.14.1 * refactor(plugins-cdn): update loaders to use absolute module url from backend * fix(plugins): escape period in systemjs module regex * chore(plugins): delete redundant systemjs plugins * refactor(plugin_loader): move hooks into own file, add types * test(plugins): add tests for systemjs loader hooks * chore(plugins): rename systemjshooks file * chore(plugins): remove redundant systemjs cdn backend code * fix(plugins): handle loading with config.appSubUrl * chore(plugins): delete redundant plugin-cdn angular code * test(plugins): fix failing systemjs test missing pluginsCDNBaseUrl * refactor(plugins): backend provides base and module properties with AppSubUrl * fix(plugins): consider AppSubUrl for plugin logos * fix(plugins): use isHostedOnCDN util when checking for cdn hosted plugins * add new appSubURL field to config * refactor relative URL func * fix path for core app * refactor asset path input * fix(plugins): catch errors in loadPluginCss * feat(plugins-cdn): selectively transform sourceMapURL * re-add deleted test case * chore(plugins): bump to latest systemjs@6.14.2 * feat(plugins): add systemjs-cjs-extra for loading commonjs plugins --------- Co-authored-by: Will Browne <will.browne@grafana.com> Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2023-08-31 08:45:44 -05:00
// Angular plugin dependencies map
const importMap = {
angular: {
...angular,
default: angular,
},
Plugins: Bump SystemJS to 6.14.2 (#70068) * chore(plugins): bump systemjs to latest version * refactor(plugins): switch runtime over to use latest systemjs, add typings * refactor(plugins): use latest systemjs APIs for runtime dependency resolution * refactor(plugins): return valid urls from backend for latest systemjs import to work * revert(plugins): remove cfg from assetpath in favour of relative paths * fix(plugins): useDefault for systemjs deps to solve undefined errors * feat(plugins): add basic support for loading plugins via CDN * fix(plugins): load nested plugins with latest systemjs * feat(plugins): add back ability to transform plugin src for cdns * feat(plugins): get caching for module.js working, clean up * refactor(plugin_loader): create buildImportMap fn and more clean up * refactor(angularapp): use buildImportMap for dependencies and clean up * test(plugin_loader): fix failing test due to systemjs update * test(jest): mock systemjs amd extra in tests to prevent it breaking tests * chore(plugins): remove systemjs module-types extra, already included with system * fix(plugins): update key for invalidating cached plugins * fix: move systemjs amd define to another global so monaco can load * refactor(plugins): clean up cache buster and tests * chore(plugins): remove debug * refactor(plugins): move systemjs define to keep global cleaner * fix(plugins): set useDefault so system modules lodash references dont fail * feat(plugins): hook systemjs onload so stylesheets are applied to the dom * refactor(plugins): wrap amd formatted plugins in iife to prevent define collision * feat(plugins): support system module format for legacy plugins * test(plugincachebuster): update tests to match latest implementation * test(plugins-loader): fix up tests post module property change * fix test * Update pkg/plugins/manager/loader/assetpath/assetpath.go Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> * chore(plugin_loader): remove stray import from merge conflict * Revert "Update pkg/plugins/manager/loader/assetpath/assetpath.go" This reverts commit 0df57d1cf20f49c22c93369001c70aae46a97c42. * fix(plugin_loader): set use default for shared plugin dependencies * refactor(plugins): use leading slash for Module and BaseUrl * fix(plugins): fix resolve appending extension to cache query param * refactor(plugins): align baseurl and module paths * refactor(plugins): update builtInPlugins keys to match naming convention * refactor(plugins): minor loader clean up, fix up types * test(plugins): fix failing tests * refactor(plugins): rename cache buster systemjs plugin to cache * refactor(plugins): separate plugin_loader into smaller files * chore(plugins): clean up plugin_loader types * chore(plugin_sandbox): fix typescript error * chore(npm): remove unplug debug and pin systemjs to 6.14.1 * refactor(plugins-cdn): update loaders to use absolute module url from backend * fix(plugins): escape period in systemjs module regex * chore(plugins): delete redundant systemjs plugins * refactor(plugin_loader): move hooks into own file, add types * test(plugins): add tests for systemjs loader hooks * chore(plugins): rename systemjshooks file * chore(plugins): remove redundant systemjs cdn backend code * fix(plugins): handle loading with config.appSubUrl * chore(plugins): delete redundant plugin-cdn angular code * test(plugins): fix failing systemjs test missing pluginsCDNBaseUrl * refactor(plugins): backend provides base and module properties with AppSubUrl * fix(plugins): consider AppSubUrl for plugin logos * fix(plugins): use isHostedOnCDN util when checking for cdn hosted plugins * add new appSubURL field to config * refactor relative URL func * fix path for core app * refactor asset path input * fix(plugins): catch errors in loadPluginCss * feat(plugins-cdn): selectively transform sourceMapURL * re-add deleted test case * chore(plugins): bump to latest systemjs@6.14.2 * feat(plugins): add systemjs-cjs-extra for loading commonjs plugins --------- Co-authored-by: Will Browne <will.browne@grafana.com> Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2023-08-31 08:45:44 -05:00
'app/core/core_module': {
default: coreModule,
__useDefault: true,
},
'app/core/core': {
appEvents: appEvents,
contextSrv: contextSrv,
coreModule: coreModule,
},
'app/plugins/sdk': sdk,
'app/core/utils/promiseToDigest': { promiseToDigest },
} as Record<string, System.Module>;
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
export class AngularApp {
ngModuleDependencies: any[];
preBootModules: any[];
registerFunctions: any;
constructor() {
this.preBootModules = [];
this.ngModuleDependencies = [];
this.registerFunctions = {};
}
init() {
const app = angular.module('grafana', []);
setAngularPanelReactWrapper(getAngularPanelReactWrapper);
app.config([
'$controllerProvider',
'$compileProvider',
'$filterProvider',
'$httpProvider',
'$provide',
Plugins: Allow loading panel plugins from a CDN (#59096) * POC: Plugins CDN reverse proxy * CDN proxy POC: changed env var names * Add authorization: false for /public path in frontend plugin loader * Moved CDN settings to Cfg, add some comments * Fix error 500 in asset fetch if plugin is not using CDN * Fix EnterpriseLicensePath declared twice * Fix linter complaining about whitespaces * Plugins CDN: Skip signature verification for CDN plugins * Plugins CDN: Skip manifest and signature check for cdn plugins * Plugins: use IsValid() and IsInternal() rather than equality checks * Plugins CDN: remove comment * Plugins CDN: Fix seeker can't seek when serving plugins from local fs * Plugins CDN: add back error codes in getLocalPluginAssets * Plugins CDN: call asset.Close() rather than asset.readSeekCloser.Close() * Plugins CDN: Fix panic in JsonApiErr when errorMessageCoder wraps a nil error * Plugins CDN: Add error handling to proxyCDNPluginAsset * Plugins CDN: replace errorMessageCoder with errutil * Plugins CDN POC: expose cdn plugin paths to frontend for system.js * Plugins CDN: Fix cdn plugins showing as unsigned in frontend * WIP: Add support for formatted URL * Fix missing cdnPluginsBaseURLs in GrafanaConfig * Plugins CDN: Remove reverse proxy mode and reverse proxy references * Plugins CDN: Simplify asset serving logic * Plugins CDN: sanitize redirect path * Plugins CDN: Removed unused pluginAsset type * Plugins CDN: Removed system.js changes * Plugins CDN: Return different system.js baseURL and module for cdn plugins * Plugins CDN: Ensure CDN is disabled for non-external plugins * lint * Plugins CDN: serve images and screenshots from CDN, refactoring * Lint * Plugins CDN: Fix URLs for system.js (baseUrl and module) * Plugins CDN: Add more tests for RelativeURLForSystemJS * Plugins CDN: Iterate only on apps when preloading * Plugins CDN: Refactoring * Plugins CDN: Add comments to url_constructor.go * Plugins CDN: Update defaultHGPluginsCDNBaseURL * Plugins CDN: undo extract meta from system js config * refactor(plugins): migrate systemjs css plugin to typescript * feat(plugins): introduce systemjs cdn loader plugin * feat(plugins): add systemjs load type * Plugins CDN: Removed RelativeURLForSystemJS * Plugins CDN: Log backend redirect hits along with plugin info * Plugins CDN: Add pluginsCDNBasePath to getFrontendSettingsMap * feat(plugins): introduce cdn loading for angular plugins * refactor(plugins): move systemjs cache buster into systemjsplugins directory * Plugins CDN: Rename pluginsCDNBasePath to pluginsCDNBaseURL * refactor(plugins): introduce pluginsCDNBaseURL to the frontend * Plugins CDN: Renamed "cdn base path" to "cdn url template" in backend * Plugins CDN: lint * merge with main * Instrumentation: Add prometheus counter for backend hits, log from Info to Warn * Config: Changed key from plugins_cdn.url to plugins.plugins_cdn_base_url * CDN: Add backend tests * Lint: goimports * Default CDN URL to empty string, * Do not use CDN in setImages and module if the url template is empty * CDN: Backend: Add test for frontend settings * CDN: Do not log missing module.js warn if plugin is being loaded from CDN * CDN: Add backend test for CDN plugin loader * Removed 'cdn' signature level, switch to 'valid' * Fix pfs.TestParseTreeTestdata for cdn plugin testdata dir * Fix TestLoader_Load * Fix gocyclo complexity of loadPlugins * Plugins CDN: Moved prometheus metric to api package, removed asset_path label * Fix missing in config * Changes after review * Add pluginscdn.Service * Fix tests * Refactoring * Moved all remaining CDN checks inside pluginscdn.Service * CDN url constructor: Renamed stringURLFor to stringPath * CDN: Moved asset URL functionality to assetpath service * CDN: Renamed HasCDN() to IsEnabled() * CDN: Replace assert with require * CDN: Changes after review * Assetpath: Handle url.Parse error * Fix plugin_resource_test * CDN: Change fallback redirect from 302 to 307 * goimports * Fix tests * Switch to contextmodel.ReqContext in plugins.go Co-authored-by: Will Browne <will.browne@grafana.com> Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2023-01-27 08:08:17 -06:00
'$sceDelegateProvider',
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
(
$controllerProvider: angular.IControllerProvider,
$compileProvider: angular.ICompileProvider,
$filterProvider: angular.IFilterProvider,
$httpProvider: angular.IHttpProvider,
Plugins: Allow loading panel plugins from a CDN (#59096) * POC: Plugins CDN reverse proxy * CDN proxy POC: changed env var names * Add authorization: false for /public path in frontend plugin loader * Moved CDN settings to Cfg, add some comments * Fix error 500 in asset fetch if plugin is not using CDN * Fix EnterpriseLicensePath declared twice * Fix linter complaining about whitespaces * Plugins CDN: Skip signature verification for CDN plugins * Plugins CDN: Skip manifest and signature check for cdn plugins * Plugins: use IsValid() and IsInternal() rather than equality checks * Plugins CDN: remove comment * Plugins CDN: Fix seeker can't seek when serving plugins from local fs * Plugins CDN: add back error codes in getLocalPluginAssets * Plugins CDN: call asset.Close() rather than asset.readSeekCloser.Close() * Plugins CDN: Fix panic in JsonApiErr when errorMessageCoder wraps a nil error * Plugins CDN: Add error handling to proxyCDNPluginAsset * Plugins CDN: replace errorMessageCoder with errutil * Plugins CDN POC: expose cdn plugin paths to frontend for system.js * Plugins CDN: Fix cdn plugins showing as unsigned in frontend * WIP: Add support for formatted URL * Fix missing cdnPluginsBaseURLs in GrafanaConfig * Plugins CDN: Remove reverse proxy mode and reverse proxy references * Plugins CDN: Simplify asset serving logic * Plugins CDN: sanitize redirect path * Plugins CDN: Removed unused pluginAsset type * Plugins CDN: Removed system.js changes * Plugins CDN: Return different system.js baseURL and module for cdn plugins * Plugins CDN: Ensure CDN is disabled for non-external plugins * lint * Plugins CDN: serve images and screenshots from CDN, refactoring * Lint * Plugins CDN: Fix URLs for system.js (baseUrl and module) * Plugins CDN: Add more tests for RelativeURLForSystemJS * Plugins CDN: Iterate only on apps when preloading * Plugins CDN: Refactoring * Plugins CDN: Add comments to url_constructor.go * Plugins CDN: Update defaultHGPluginsCDNBaseURL * Plugins CDN: undo extract meta from system js config * refactor(plugins): migrate systemjs css plugin to typescript * feat(plugins): introduce systemjs cdn loader plugin * feat(plugins): add systemjs load type * Plugins CDN: Removed RelativeURLForSystemJS * Plugins CDN: Log backend redirect hits along with plugin info * Plugins CDN: Add pluginsCDNBasePath to getFrontendSettingsMap * feat(plugins): introduce cdn loading for angular plugins * refactor(plugins): move systemjs cache buster into systemjsplugins directory * Plugins CDN: Rename pluginsCDNBasePath to pluginsCDNBaseURL * refactor(plugins): introduce pluginsCDNBaseURL to the frontend * Plugins CDN: Renamed "cdn base path" to "cdn url template" in backend * Plugins CDN: lint * merge with main * Instrumentation: Add prometheus counter for backend hits, log from Info to Warn * Config: Changed key from plugins_cdn.url to plugins.plugins_cdn_base_url * CDN: Add backend tests * Lint: goimports * Default CDN URL to empty string, * Do not use CDN in setImages and module if the url template is empty * CDN: Backend: Add test for frontend settings * CDN: Do not log missing module.js warn if plugin is being loaded from CDN * CDN: Add backend test for CDN plugin loader * Removed 'cdn' signature level, switch to 'valid' * Fix pfs.TestParseTreeTestdata for cdn plugin testdata dir * Fix TestLoader_Load * Fix gocyclo complexity of loadPlugins * Plugins CDN: Moved prometheus metric to api package, removed asset_path label * Fix missing in config * Changes after review * Add pluginscdn.Service * Fix tests * Refactoring * Moved all remaining CDN checks inside pluginscdn.Service * CDN url constructor: Renamed stringURLFor to stringPath * CDN: Moved asset URL functionality to assetpath service * CDN: Renamed HasCDN() to IsEnabled() * CDN: Replace assert with require * CDN: Changes after review * Assetpath: Handle url.Parse error * Fix plugin_resource_test * CDN: Change fallback redirect from 302 to 307 * goimports * Fix tests * Switch to contextmodel.ReqContext in plugins.go Co-authored-by: Will Browne <will.browne@grafana.com> Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2023-01-27 08:08:17 -06:00
$provide: angular.auto.IProvideService,
$sceDelegateProvider: angular.ISCEDelegateProvider
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
) => {
if (config.buildInfo.env !== 'development') {
$compileProvider.debugInfoEnabled(false);
}
$httpProvider.useApplyAsync(true);
Plugins: Allow loading panel plugins from a CDN (#59096) * POC: Plugins CDN reverse proxy * CDN proxy POC: changed env var names * Add authorization: false for /public path in frontend plugin loader * Moved CDN settings to Cfg, add some comments * Fix error 500 in asset fetch if plugin is not using CDN * Fix EnterpriseLicensePath declared twice * Fix linter complaining about whitespaces * Plugins CDN: Skip signature verification for CDN plugins * Plugins CDN: Skip manifest and signature check for cdn plugins * Plugins: use IsValid() and IsInternal() rather than equality checks * Plugins CDN: remove comment * Plugins CDN: Fix seeker can't seek when serving plugins from local fs * Plugins CDN: add back error codes in getLocalPluginAssets * Plugins CDN: call asset.Close() rather than asset.readSeekCloser.Close() * Plugins CDN: Fix panic in JsonApiErr when errorMessageCoder wraps a nil error * Plugins CDN: Add error handling to proxyCDNPluginAsset * Plugins CDN: replace errorMessageCoder with errutil * Plugins CDN POC: expose cdn plugin paths to frontend for system.js * Plugins CDN: Fix cdn plugins showing as unsigned in frontend * WIP: Add support for formatted URL * Fix missing cdnPluginsBaseURLs in GrafanaConfig * Plugins CDN: Remove reverse proxy mode and reverse proxy references * Plugins CDN: Simplify asset serving logic * Plugins CDN: sanitize redirect path * Plugins CDN: Removed unused pluginAsset type * Plugins CDN: Removed system.js changes * Plugins CDN: Return different system.js baseURL and module for cdn plugins * Plugins CDN: Ensure CDN is disabled for non-external plugins * lint * Plugins CDN: serve images and screenshots from CDN, refactoring * Lint * Plugins CDN: Fix URLs for system.js (baseUrl and module) * Plugins CDN: Add more tests for RelativeURLForSystemJS * Plugins CDN: Iterate only on apps when preloading * Plugins CDN: Refactoring * Plugins CDN: Add comments to url_constructor.go * Plugins CDN: Update defaultHGPluginsCDNBaseURL * Plugins CDN: undo extract meta from system js config * refactor(plugins): migrate systemjs css plugin to typescript * feat(plugins): introduce systemjs cdn loader plugin * feat(plugins): add systemjs load type * Plugins CDN: Removed RelativeURLForSystemJS * Plugins CDN: Log backend redirect hits along with plugin info * Plugins CDN: Add pluginsCDNBasePath to getFrontendSettingsMap * feat(plugins): introduce cdn loading for angular plugins * refactor(plugins): move systemjs cache buster into systemjsplugins directory * Plugins CDN: Rename pluginsCDNBasePath to pluginsCDNBaseURL * refactor(plugins): introduce pluginsCDNBaseURL to the frontend * Plugins CDN: Renamed "cdn base path" to "cdn url template" in backend * Plugins CDN: lint * merge with main * Instrumentation: Add prometheus counter for backend hits, log from Info to Warn * Config: Changed key from plugins_cdn.url to plugins.plugins_cdn_base_url * CDN: Add backend tests * Lint: goimports * Default CDN URL to empty string, * Do not use CDN in setImages and module if the url template is empty * CDN: Backend: Add test for frontend settings * CDN: Do not log missing module.js warn if plugin is being loaded from CDN * CDN: Add backend test for CDN plugin loader * Removed 'cdn' signature level, switch to 'valid' * Fix pfs.TestParseTreeTestdata for cdn plugin testdata dir * Fix TestLoader_Load * Fix gocyclo complexity of loadPlugins * Plugins CDN: Moved prometheus metric to api package, removed asset_path label * Fix missing in config * Changes after review * Add pluginscdn.Service * Fix tests * Refactoring * Moved all remaining CDN checks inside pluginscdn.Service * CDN url constructor: Renamed stringURLFor to stringPath * CDN: Moved asset URL functionality to assetpath service * CDN: Renamed HasCDN() to IsEnabled() * CDN: Replace assert with require * CDN: Changes after review * Assetpath: Handle url.Parse error * Fix plugin_resource_test * CDN: Change fallback redirect from 302 to 307 * goimports * Fix tests * Switch to contextmodel.ReqContext in plugins.go Co-authored-by: Will Browne <will.browne@grafana.com> Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
2023-01-27 08:08:17 -06:00
if (Boolean(config.pluginsCDNBaseURL)) {
$sceDelegateProvider.trustedResourceUrlList(['self', `${config.pluginsCDNBaseURL}/**`]);
}
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
this.registerFunctions.controller = $controllerProvider.register;
this.registerFunctions.directive = $compileProvider.directive;
this.registerFunctions.factory = $provide.factory;
this.registerFunctions.service = $provide.service;
this.registerFunctions.filter = $filterProvider.register;
$provide.decorator('$http', [
'$delegate',
'$templateCache',
($delegate: any, $templateCache: any) => {
const get = $delegate.get;
$delegate.get = (url: string, config: any) => {
if (url.match(/\.html$/)) {
// some template's already exist in the cache
if (!$templateCache.get(url)) {
url += '?v=' + new Date().getTime();
}
}
return get(url, config);
};
return $delegate;
},
]);
},
]);
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
this.ngModuleDependencies = ['grafana.core', 'ngSanitize', 'grafana', 'pasvaz.bindonce', 'react'];
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
// makes it possible to add dynamic stuff
angularModules.forEach((m: angular.IModule) => {
this.useModule(m);
});
// register react angular wrappers
angular.module('grafana.services').service('dashboardLoaderSrv', DashboardLoaderSrv);
coreModule.factory('timeSrv', () => getTimeSrv());
coreModule.factory('templateSrv', () => getTemplateSrv());
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
registerAngularDirectives();
registerComponents();
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
initAngularRoutingBridge();
Plugins: Bump SystemJS to 6.14.2 (#70068) * chore(plugins): bump systemjs to latest version * refactor(plugins): switch runtime over to use latest systemjs, add typings * refactor(plugins): use latest systemjs APIs for runtime dependency resolution * refactor(plugins): return valid urls from backend for latest systemjs import to work * revert(plugins): remove cfg from assetpath in favour of relative paths * fix(plugins): useDefault for systemjs deps to solve undefined errors * feat(plugins): add basic support for loading plugins via CDN * fix(plugins): load nested plugins with latest systemjs * feat(plugins): add back ability to transform plugin src for cdns * feat(plugins): get caching for module.js working, clean up * refactor(plugin_loader): create buildImportMap fn and more clean up * refactor(angularapp): use buildImportMap for dependencies and clean up * test(plugin_loader): fix failing test due to systemjs update * test(jest): mock systemjs amd extra in tests to prevent it breaking tests * chore(plugins): remove systemjs module-types extra, already included with system * fix(plugins): update key for invalidating cached plugins * fix: move systemjs amd define to another global so monaco can load * refactor(plugins): clean up cache buster and tests * chore(plugins): remove debug * refactor(plugins): move systemjs define to keep global cleaner * fix(plugins): set useDefault so system modules lodash references dont fail * feat(plugins): hook systemjs onload so stylesheets are applied to the dom * refactor(plugins): wrap amd formatted plugins in iife to prevent define collision * feat(plugins): support system module format for legacy plugins * test(plugincachebuster): update tests to match latest implementation * test(plugins-loader): fix up tests post module property change * fix test * Update pkg/plugins/manager/loader/assetpath/assetpath.go Co-authored-by: Will Browne <wbrowne@users.noreply.github.com> * chore(plugin_loader): remove stray import from merge conflict * Revert "Update pkg/plugins/manager/loader/assetpath/assetpath.go" This reverts commit 0df57d1cf20f49c22c93369001c70aae46a97c42. * fix(plugin_loader): set use default for shared plugin dependencies * refactor(plugins): use leading slash for Module and BaseUrl * fix(plugins): fix resolve appending extension to cache query param * refactor(plugins): align baseurl and module paths * refactor(plugins): update builtInPlugins keys to match naming convention * refactor(plugins): minor loader clean up, fix up types * test(plugins): fix failing tests * refactor(plugins): rename cache buster systemjs plugin to cache * refactor(plugins): separate plugin_loader into smaller files * chore(plugins): clean up plugin_loader types * chore(plugin_sandbox): fix typescript error * chore(npm): remove unplug debug and pin systemjs to 6.14.1 * refactor(plugins-cdn): update loaders to use absolute module url from backend * fix(plugins): escape period in systemjs module regex * chore(plugins): delete redundant systemjs plugins * refactor(plugin_loader): move hooks into own file, add types * test(plugins): add tests for systemjs loader hooks * chore(plugins): rename systemjshooks file * chore(plugins): remove redundant systemjs cdn backend code * fix(plugins): handle loading with config.appSubUrl * chore(plugins): delete redundant plugin-cdn angular code * test(plugins): fix failing systemjs test missing pluginsCDNBaseUrl * refactor(plugins): backend provides base and module properties with AppSubUrl * fix(plugins): consider AppSubUrl for plugin logos * fix(plugins): use isHostedOnCDN util when checking for cdn hosted plugins * add new appSubURL field to config * refactor relative URL func * fix path for core app * refactor asset path input * fix(plugins): catch errors in loadPluginCss * feat(plugins-cdn): selectively transform sourceMapURL * re-add deleted test case * chore(plugins): bump to latest systemjs@6.14.2 * feat(plugins): add systemjs-cjs-extra for loading commonjs plugins --------- Co-authored-by: Will Browne <will.browne@grafana.com> Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2023-08-31 08:45:44 -05:00
const imports = buildImportMap(importMap);
// pass the map of module names so systemjs can resolve them
SystemJS.addImportMap({ imports });
// disable tool tip animation
$.fn.tooltip.defaults.animation = false;
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
}
useModule(module: angular.IModule) {
if (this.preBootModules) {
this.preBootModules.push(module);
} else {
extend(module, this.registerFunctions);
}
this.ngModuleDependencies.push(module.name);
return module;
}
bootstrap() {
const injector = angular.bootstrap(document.getElementById('ngRoot')!, this.ngModuleDependencies);
Routing NG: Replace Angular routing with react-router (#31463) * Add router packages * Get react app root work instead of Angular one * Logger util * Patch Angular routing ($routeProvider, $routeParamsProvider) * Use react-router-dom history instead of separate dependency * Add test routes * Sidemenu - use Link instead of anchors * Patch Angular $location service (stub) * WIP: geting rid of $location provider from TimeSrv * Intercept anchor clicks to use history under the hood * Sync Redux location slice with history state * Make login/logout work * Debug routes for testing * Make force login work * Make sure query param change does not recreate page components * Hide side menu in specified locations * Make the dashboar route query parameters work, make panel edit menu work * Enable more routes * Fix side menu * Handle view modes * Disable playlist routes * Make SafeDynamicImport work again * Bring back router-debug * Separate redux location sync from route rendering * Refactor updateLocation to thunk and move force refresh(login) to it * Fixing init dashboard issue * Support switching between dashboards without an unmount of DashboardPage * More fixes for init dashboard and panel edit * More type fixes * Moving angular location wrapper out of main LocationService, and fixing typescript issues * Fixed last typescript errors * LocationService: Move to runtime and remove getLocationService and export singleston const instead (#31523) * Moving location service implementation to runtime and removing get function and making it a package const singleton * Added test that used locationService directly * removed unused import * AngularApp: Moving angular dependencies and the app boot out of the main app into it's own file (#31525) * Fixes angular panels by calling the monkey patch * Moving angular stuff to to it's own files * udpated * Fixing clicking on divs and spans inside anchor * Moving app notifications out of angular app and removing angular directive wrapper * Moving search from angular to react and removing angular search wrapper * Clean up, tried to remove the redux location wrapper but requires a big update for DashboardPage, so adding it back * Moving AppWrapper to root to limit circular dependencies (app/core -> app/routing and back) * Open and close search now works * Hide sidemenu when in kiosk mode * Restoring some keybindings like ESC key * Removed kiosk events and simplified it, just handled through updating URL * Fixing typescript errors * Simplified GrafanaRouteComponentProps and renamed to ContainerProps * renamed back * Changed AlertRuleList to use GrafanaRouteComponentProps and location.search passed to it * Removing the reloadOnSearch property, this is not needed now for react as react by default does not unmount components when only url match or query parmas change * SafeDynamicImport causing unmount un every search update, not sure how to fix yet * Fix signature for SafeDynamicImport so we do not create new route components on every route render * Removing the redux location wrapper as it was causing errors, and making dashboard page work with RouteProps (location, match) etc * Updating DashboardPage and SoloPanelPage to use match params and history location * Fixed DashboardPage tests * Fixing solo route tests * LocationService: Rename getCurrentLocation to just getLocation * do not intercept link clicks with target blank or self * Experimental useUrlParams hook * Update DataSourceSettingsPage to use router match params * fix links with urls that have no starting / to work like before * Fix forceLogin * Add queryParams to GrafanaRouteComponentProps * PanelEditor get rid of updateLocation and location state * Improve grafana route query params typing * Add getSearchObject to LocationService * Use DashboardPAge queryParams instead of location.search parsing * Fix DashboardPage typing * Fix some tests weirdness * Bring back KeyboardSrv * Fixes typescript issues * Team pages now use router match params * Get rid of from GrafanaRouteComponent props * Removed unnessary calls to getSearchObject when calling locationService.partial * Updated DashboardPage tests after queryParams was added * Fixing dashboard settings back * GrafanaRoute: Adding tests and remove use of global locationService * Fixing tests and typescript errors * Bring back kiosk modes and add tests * Fix TimeSrv tests * Fix typecheck errors * Fixing tests * Updated SideMenu test to react-testing and wrapped component in Router, and fixed issue importing createMemoryHistory * Get rid of routeChange event from TimeSrv from * Fixed TopSectionItem test * Trying to make basename work but failing * Update TopSectionItem snapshot * Fix TopSectionItem snapshot test * Fix API keys creation * Remove Angular dependencies from KeybindingSrv (#31617) * Remove Angular dependency from KeybindingsSrv * Fix tests and typecheck issues * basename is starting to work * Make dashboard save work * KeybindingSrv: Remove as angular service and no usage angular scope * So long bridge_srv, we won't miss you * Update snapshots * Dashboard: Refactoring ChangeTracker to use History api and no angular (#31653) * Dashboard: Refactoring ChangeTracker to use History api and no angular * Updated * Removed logging * fixed unit tests * updated snapshots * Mechanism for force reloading routes (#31683) * e2e: Fixes various things in e2e scenarios after router migration (#31685) * Explore: Update reading query params from router props and updating location via locationService (ReactRouter) (#31688) * RoutingNG: Initial explore redux location to router location migration * Updated explore Wrapper tests * Fixing more tests * remove loggin * rename back to make naming consistent * Fixing return to dashboard button * fixing navigation to explore from dashboard * updated routeProps * Updated tests * Make DashboardListPage work * Fixing navigation after add new data source, and fixes explore e2e * Fixing solo panel page * PluginsPage now works * RoutingNG: When parsing and rendering url search/query params preseve old logic of handling booleans and arrays (#31725) * RoutingNG: When parsing and rendering url search/query params preserve old logic of handling booleans and arrays * Fixed test * Make snapshots list work * fixed alert notification channel edit page * Simplify LocationService, did not need special handling for login or forceLogin as target _self on link already handles that * fixed UserAdminPage * fixed edit orgs page * Fixing LdapPage * fixing dashboard import * Fixed new folder page * Fixed data source dashboards page * fixing Folder permissions and folder settings page * fixing snapshot list page nav model * remove unused file * Added placeholder page for playlist * Moved browser compatability to index-template * Restored 404/default page * Fixed reset password page * Fixed SignUpInvited page * Fixing CreateTeam, Create user page, add panel widget * Restore browwser file to make tests happy * Fixed unit tests * Removed unused import * Replacing usage of updateLocation * Fixed test * Updating search filters to use history / location service for filters * remove unused file * AppRootPage fixed * Fixing test and search issue * Changes to support enterprise extensions * remove console.log * Removing more use of redux location * Fixed signup page * removed unused old angular controllers * Fixing bugs * one final bugfix * Removed location from redux state * Fixing ts issues and tests * Fixing test issue * fixing tests * Fixing tests * removed unused stuff * Fixed search test * Adding some doc comments * Routing NG: Angular location provider patch (#31773) * Patch Angulars $location provider * Update public/app/angular/bridgeReactAngularRouting.ts * Remove only test * Update tests, disable loggers in test env * Routing NG: remove $location provider usage (#31816) * Remove dashboard_loaders * Remove $location from Analytics service, track page views form GrafanaRoute * Remove NotificationsEditCtrl * Remove Angular dependencies from uploadDashboardDirective * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/features/dashboard/containers/DashboardPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove unused test helpers (#31831) * Playlist react (#31829) * playlist list in react * Playlist start * Things started to work * Updated * Handle empty list * Fix ts * Fixes and kiosk mode stuff * Removed unused events * fixing ts issue * Another ts issue * Fixing tests Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com> * fixed test * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Update public/app/AppWrapper.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> * Remove Angular dependency from DashboardLoaderSrv (#31863) Co-authored-by: Torkel Ödegaard <torkel@grafana.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org> Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com> Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
2021-03-10 11:03:36 -06:00
monkeyPatchInjectorWithPreAssignedBindings(injector);
injector.invoke(() => {
this.preBootModules.forEach((module) => {
extend(module, this.registerFunctions);
});
// I don't know
return () => {};
});
return injector;
}
}