mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
removed /app route, confusing when some assets use public/app/.. route and some use just app/... all public static assets should no use public route, app route is no more
This commit is contained in:
parent
84609a4a3b
commit
e737dab5ca
@ -36,7 +36,6 @@ func newMacaron() *macaron.Macaron {
|
||||
}
|
||||
|
||||
mapStatic(m, setting.StaticRootPath, "", "public")
|
||||
mapStatic(m, setting.StaticRootPath, "app", "app")
|
||||
mapStatic(m, setting.StaticRootPath, "css", "css")
|
||||
mapStatic(m, setting.StaticRootPath, "img", "img")
|
||||
mapStatic(m, setting.StaticRootPath, "fonts", "fonts")
|
||||
|
@ -14,7 +14,7 @@ export class NavbarCtrl {
|
||||
export function navbarDirective() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'app/core/components/navbar/navbar.html',
|
||||
templateUrl: 'public/app/core/components/navbar/navbar.html',
|
||||
controller: NavbarCtrl,
|
||||
bindToController: true,
|
||||
controllerAs: 'ctrl',
|
||||
|
@ -137,7 +137,7 @@ export class SearchCtrl {
|
||||
export function searchDirective() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'app/core/components/search/search.html',
|
||||
templateUrl: 'public/app/core/components/search/search.html',
|
||||
controller: SearchCtrl,
|
||||
bindToController: true,
|
||||
controllerAs: 'ctrl',
|
||||
|
@ -148,7 +148,7 @@ export class SideMenuCtrl {
|
||||
export function sideMenuDirective() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'app/core/components/sidemenu/sidemenu.html',
|
||||
templateUrl: 'public/app/core/components/sidemenu/sidemenu.html',
|
||||
controller: SideMenuCtrl,
|
||||
bindToController: true,
|
||||
controllerAs: 'ctrl',
|
||||
|
@ -6,9 +6,9 @@ function ($, coreModule) {
|
||||
'use strict';
|
||||
|
||||
var editViewMap = {
|
||||
'settings': { src: 'app/features/dashboard/partials/settings.html', title: "Settings" },
|
||||
'annotations': { src: 'app/features/annotations/partials/editor.html', title: "Annotations" },
|
||||
'templating': { src: 'app/features/templating/partials/editor.html', title: "Templating" }
|
||||
'settings': { src: 'public/app/features/dashboard/partials/settings.html', title: "Settings" },
|
||||
'annotations': { src: 'public/app/features/annotations/partials/editor.html', title: "Annotations" },
|
||||
'templating': { src: 'public/app/features/templating/partials/editor.html', title: "Templating" }
|
||||
};
|
||||
|
||||
coreModule.default.directive('dashEditorLink', function($timeout) {
|
||||
|
@ -227,7 +227,7 @@ function (angular, _, coreModule) {
|
||||
coreModule.default.directive('valueSelectDropdown', function($compile, $window, $timeout, $rootScope) {
|
||||
return {
|
||||
scope: { variable: "=", onUpdated: "&", getValuesForTag: "&" },
|
||||
templateUrl: 'app/partials/valueSelectDropdown.html',
|
||||
templateUrl: 'public/app/partials/valueSelectDropdown.html',
|
||||
controller: 'ValueSelectDropdownCtrl',
|
||||
controllerAs: 'vm',
|
||||
bindToController: true,
|
||||
|
@ -14,146 +14,146 @@ define([
|
||||
|
||||
$routeProvider
|
||||
.when('/', {
|
||||
templateUrl: 'app/partials/dashboard.html',
|
||||
templateUrl: 'public/app/partials/dashboard.html',
|
||||
controller : 'LoadDashboardCtrl',
|
||||
reloadOnSearch: false,
|
||||
})
|
||||
.when('/dashboard/:type/:slug', {
|
||||
templateUrl: 'app/partials/dashboard.html',
|
||||
templateUrl: 'public/app/partials/dashboard.html',
|
||||
controller : 'LoadDashboardCtrl',
|
||||
reloadOnSearch: false,
|
||||
})
|
||||
.when('/dashboard-solo/:type/:slug', {
|
||||
templateUrl: 'app/features/panel/partials/soloPanel.html',
|
||||
templateUrl: 'public/app/features/panel/partials/soloPanel.html',
|
||||
controller : 'SoloPanelCtrl',
|
||||
})
|
||||
.when('/dashboard-import/:file', {
|
||||
templateUrl: 'app/partials/dashboard.html',
|
||||
templateUrl: 'public/app/partials/dashboard.html',
|
||||
controller : 'DashFromImportCtrl',
|
||||
reloadOnSearch: false,
|
||||
})
|
||||
.when('/dashboard/new', {
|
||||
templateUrl: 'app/partials/dashboard.html',
|
||||
templateUrl: 'public/app/partials/dashboard.html',
|
||||
controller : 'NewDashboardCtrl',
|
||||
reloadOnSearch: false,
|
||||
})
|
||||
.when('/import/dashboard', {
|
||||
templateUrl: 'app/features/dashboard/partials/import.html',
|
||||
templateUrl: 'public/app/features/dashboard/partials/import.html',
|
||||
controller : 'DashboardImportCtrl',
|
||||
})
|
||||
.when('/datasources', {
|
||||
templateUrl: 'app/features/datasources/partials/list.html',
|
||||
templateUrl: 'public/app/features/datasources/partials/list.html',
|
||||
controller : 'DataSourcesCtrl',
|
||||
resolve: loadOrgBundle,
|
||||
})
|
||||
.when('/datasources/edit/:id', {
|
||||
templateUrl: 'app/features/datasources/partials/edit.html',
|
||||
templateUrl: 'public/app/features/datasources/partials/edit.html',
|
||||
controller : 'DataSourceEditCtrl',
|
||||
resolve: loadOrgBundle,
|
||||
})
|
||||
.when('/datasources/new', {
|
||||
templateUrl: 'app/features/datasources/partials/edit.html',
|
||||
templateUrl: 'public/app/features/datasources/partials/edit.html',
|
||||
controller : 'DataSourceEditCtrl',
|
||||
resolve: loadOrgBundle,
|
||||
})
|
||||
.when('/org', {
|
||||
templateUrl: 'app/features/org/partials/orgDetails.html',
|
||||
templateUrl: 'public/app/features/org/partials/orgDetails.html',
|
||||
controller : 'OrgDetailsCtrl',
|
||||
resolve: loadOrgBundle,
|
||||
})
|
||||
.when('/org/new', {
|
||||
templateUrl: 'app/features/org/partials/newOrg.html',
|
||||
templateUrl: 'public/app/features/org/partials/newOrg.html',
|
||||
controller : 'NewOrgCtrl',
|
||||
resolve: loadOrgBundle,
|
||||
})
|
||||
.when('/org/users', {
|
||||
templateUrl: 'app/features/org/partials/orgUsers.html',
|
||||
templateUrl: 'public/app/features/org/partials/orgUsers.html',
|
||||
controller : 'OrgUsersCtrl',
|
||||
resolve: loadOrgBundle,
|
||||
})
|
||||
.when('/org/apikeys', {
|
||||
templateUrl: 'app/features/org/partials/orgApiKeys.html',
|
||||
templateUrl: 'public/app/features/org/partials/orgApiKeys.html',
|
||||
controller : 'OrgApiKeysCtrl',
|
||||
resolve: loadOrgBundle,
|
||||
})
|
||||
.when('/profile', {
|
||||
templateUrl: 'app/features/profile/partials/profile.html',
|
||||
templateUrl: 'public/app/features/profile/partials/profile.html',
|
||||
controller : 'ProfileCtrl',
|
||||
})
|
||||
.when('/profile/password', {
|
||||
templateUrl: 'app/features/profile/partials/password.html',
|
||||
templateUrl: 'public/app/features/profile/partials/password.html',
|
||||
controller : 'ChangePasswordCtrl',
|
||||
})
|
||||
.when('/profile/select-org', {
|
||||
templateUrl: 'app/features/profile/partials/select_org.html',
|
||||
templateUrl: 'public/app/features/profile/partials/select_org.html',
|
||||
controller : 'SelectOrgCtrl',
|
||||
})
|
||||
.when('/admin/settings', {
|
||||
templateUrl: 'app/features/admin/partials/settings.html',
|
||||
templateUrl: 'public/app/features/admin/partials/settings.html',
|
||||
controller : 'AdminSettingsCtrl',
|
||||
})
|
||||
.when('/admin/users', {
|
||||
templateUrl: 'app/features/admin/partials/users.html',
|
||||
templateUrl: 'public/app/features/admin/partials/users.html',
|
||||
controller : 'AdminListUsersCtrl',
|
||||
})
|
||||
.when('/admin/users/create', {
|
||||
templateUrl: 'app/features/admin/partials/new_user.html',
|
||||
templateUrl: 'public/app/features/admin/partials/new_user.html',
|
||||
controller : 'AdminEditUserCtrl',
|
||||
})
|
||||
.when('/admin/users/edit/:id', {
|
||||
templateUrl: 'app/features/admin/partials/edit_user.html',
|
||||
templateUrl: 'public/app/features/admin/partials/edit_user.html',
|
||||
controller : 'AdminEditUserCtrl',
|
||||
})
|
||||
.when('/admin/orgs', {
|
||||
templateUrl: 'app/features/admin/partials/orgs.html',
|
||||
templateUrl: 'public/app/features/admin/partials/orgs.html',
|
||||
controller : 'AdminListOrgsCtrl',
|
||||
})
|
||||
.when('/admin/orgs/edit/:id', {
|
||||
templateUrl: 'app/features/admin/partials/edit_org.html',
|
||||
templateUrl: 'public/app/features/admin/partials/edit_org.html',
|
||||
controller : 'AdminEditOrgCtrl',
|
||||
})
|
||||
.when('/admin/stats', {
|
||||
templateUrl: 'app/features/admin/partials/stats.html',
|
||||
templateUrl: 'public/app/features/admin/partials/stats.html',
|
||||
controller : 'AdminStatsCtrl',
|
||||
controllerAs: 'ctrl',
|
||||
})
|
||||
.when('/login', {
|
||||
templateUrl: 'app/partials/login.html',
|
||||
templateUrl: 'public/app/partials/login.html',
|
||||
controller : 'LoginCtrl',
|
||||
})
|
||||
.when('/invite/:code', {
|
||||
templateUrl: 'app/partials/signup_invited.html',
|
||||
templateUrl: 'public/app/partials/signup_invited.html',
|
||||
controller : 'InvitedCtrl',
|
||||
})
|
||||
.when('/signup', {
|
||||
templateUrl: 'app/partials/signup_step2.html',
|
||||
templateUrl: 'public/app/partials/signup_step2.html',
|
||||
controller : 'SignUpCtrl',
|
||||
})
|
||||
.when('/user/password/send-reset-email', {
|
||||
templateUrl: 'app/partials/reset_password.html',
|
||||
templateUrl: 'public/app/partials/reset_password.html',
|
||||
controller : 'ResetPasswordCtrl',
|
||||
})
|
||||
.when('/user/password/reset', {
|
||||
templateUrl: 'app/partials/reset_password.html',
|
||||
templateUrl: 'public/app/partials/reset_password.html',
|
||||
controller : 'ResetPasswordCtrl',
|
||||
})
|
||||
.when('/apps', {
|
||||
templateUrl: 'app/features/apps/partials/list.html',
|
||||
templateUrl: 'public/app/features/apps/partials/list.html',
|
||||
controller: 'AppListCtrl',
|
||||
controllerAs: 'ctrl',
|
||||
resolve: loadAppsBundle,
|
||||
})
|
||||
.when('/apps/edit/:appId', {
|
||||
templateUrl: 'app/features/apps/partials/edit.html',
|
||||
templateUrl: 'public/app/features/apps/partials/edit.html',
|
||||
controller: 'AppEditCtrl',
|
||||
controllerAs: 'ctrl',
|
||||
resolve: loadAppsBundle,
|
||||
})
|
||||
.when('/global-alerts', {
|
||||
templateUrl: 'app/features/dashboard/partials/globalAlerts.html',
|
||||
templateUrl: 'public/app/features/dashboard/partials/globalAlerts.html',
|
||||
})
|
||||
.otherwise({
|
||||
templateUrl: 'app/partials/error.html',
|
||||
templateUrl: 'public/app/partials/error.html',
|
||||
controller: 'ErrorCtrl'
|
||||
});
|
||||
});
|
||||
|
@ -102,7 +102,7 @@ function (angular, $, config, moment) {
|
||||
var editScope = $rootScope.$new();
|
||||
editScope.object = options.object;
|
||||
editScope.updateHandler = options.updateHandler;
|
||||
$scope.appEvent('show-dash-editor', { src: 'app/partials/edit_json.html', scope: editScope });
|
||||
$scope.appEvent('show-dash-editor', { src: 'public/app/partials/edit_json.html', scope: editScope });
|
||||
};
|
||||
|
||||
$scope.onDrop = function(panelId, row, dropTarget) {
|
||||
|
@ -47,7 +47,7 @@ export class DashNavCtrl {
|
||||
modalScope.tabIndex = tabIndex;
|
||||
|
||||
$scope.appEvent('show-modal', {
|
||||
src: './app/features/dashboard/partials/shareModal.html',
|
||||
src: 'public/app/features/dashboard/partials/shareModal.html',
|
||||
scope: modalScope
|
||||
});
|
||||
};
|
||||
@ -152,7 +152,7 @@ export class DashNavCtrl {
|
||||
newScope.clone.hideControls = false;
|
||||
|
||||
$scope.appEvent('show-modal', {
|
||||
src: './app/features/dashboard/partials/saveDashboardAs.html',
|
||||
src: 'public/app/features/dashboard/partials/saveDashboardAs.html',
|
||||
scope: newScope,
|
||||
});
|
||||
};
|
||||
@ -192,7 +192,7 @@ export class DashNavCtrl {
|
||||
export function dashNavDirective() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'app/features/dashboard/dashnav/dashnav.html',
|
||||
templateUrl: 'public/app/features/dashboard/dashnav/dashnav.html',
|
||||
controller: DashNavCtrl,
|
||||
transclude: true,
|
||||
};
|
||||
|
@ -59,7 +59,7 @@
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div ng-include="'app/features/dashboard/partials/graphiteImport.html'"></div>
|
||||
<div ng-include="'public/app/features/dashboard/partials/graphiteImport.html'"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -34,7 +34,7 @@ export class SubmenuCtrl {
|
||||
export function submenuDirective() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'app/features/dashboard/submenu/submenu.html',
|
||||
templateUrl: 'public/app/features/dashboard/submenu/submenu.html',
|
||||
controller: SubmenuCtrl,
|
||||
bindToController: true,
|
||||
controllerAs: 'ctrl',
|
||||
|
@ -101,7 +101,7 @@ export class TimePickerCtrl {
|
||||
this.refresh.options.unshift({text: 'off'});
|
||||
|
||||
this.$rootScope.appEvent('show-dash-editor', {
|
||||
src: 'app/features/dashboard/timepicker/dropdown.html',
|
||||
src: 'public/app/features/dashboard/timepicker/dropdown.html',
|
||||
scope: this.$scope,
|
||||
cssClass: 'gf-timepicker-dropdown',
|
||||
});
|
||||
@ -146,7 +146,7 @@ export class TimePickerCtrl {
|
||||
export function settingsDirective() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'app/features/dashboard/timepicker/settings.html',
|
||||
templateUrl: 'public/app/features/dashboard/timepicker/settings.html',
|
||||
controller: TimePickerCtrl,
|
||||
bindToController: true,
|
||||
controllerAs: 'ctrl',
|
||||
@ -159,7 +159,7 @@ export function settingsDirective() {
|
||||
export function timePickerDirective() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'app/features/dashboard/timepicker/timepicker.html',
|
||||
templateUrl: 'public/app/features/dashboard/timepicker/timepicker.html',
|
||||
controller: TimePickerCtrl,
|
||||
bindToController: true,
|
||||
controllerAs: 'ctrl',
|
||||
|
@ -139,7 +139,7 @@ function(angular, _) {
|
||||
};
|
||||
|
||||
$rootScope.appEvent('show-modal', {
|
||||
src: './app/partials/unsaved-changes.html',
|
||||
src: 'public/app/partials/unsaved-changes.html',
|
||||
modalClass: 'modal-no-header confirm-modal',
|
||||
scope: modalScope,
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ function (angular, _) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
controller: 'DashLinkEditorCtrl',
|
||||
templateUrl: 'app/features/dashlinks/editor.html',
|
||||
templateUrl: 'public/app/features/dashlinks/editor.html',
|
||||
link: function() {
|
||||
}
|
||||
};
|
||||
|
@ -10,7 +10,7 @@ function (angular, _, config) {
|
||||
var datasourceTypes = [];
|
||||
|
||||
module.directive('datasourceHttpSettings', function() {
|
||||
return {templateUrl: 'app/features/datasources/partials/http_settings.html'};
|
||||
return {templateUrl: 'public/app/features/datasources/partials/http_settings.html'};
|
||||
});
|
||||
|
||||
module.controller('DataSourceEditCtrl', function($scope, $q, backendSrv, $routeParams, $location, datasourceSrv) {
|
||||
|
@ -32,7 +32,7 @@ function (angular) {
|
||||
modalScope.key = result.key;
|
||||
|
||||
$scope.appEvent('show-modal', {
|
||||
src: './app/features/org/partials/apikeyModal.html',
|
||||
src: 'public/app/features/org/partials/apikeyModal.html',
|
||||
scope: modalScope
|
||||
});
|
||||
|
||||
|
@ -54,7 +54,7 @@ function (angular) {
|
||||
};
|
||||
|
||||
$scope.appEvent('show-modal', {
|
||||
src: './app/features/org/partials/invite.html',
|
||||
src: 'public/app/features/org/partials/invite.html',
|
||||
modalClass: 'modal-no-header invite-modal',
|
||||
scope: modalScope
|
||||
});
|
||||
|
@ -1,8 +1,6 @@
|
||||
define([
|
||||
'./panel_menu',
|
||||
'./panel_directive',
|
||||
'./panel_srv',
|
||||
'./panel_helper',
|
||||
'./solo_panel_ctrl',
|
||||
'./panel_loader',
|
||||
'./query_editor',
|
||||
|
@ -49,7 +49,7 @@ class MetricsPanelCtrl extends PanelCtrl {
|
||||
|
||||
initEditMode() {
|
||||
this.addEditorTab('Metrics', 'public/app/partials/metrics.html');
|
||||
this.addEditorTab('Time range', 'app/features/panel/partials/panelTime.html');
|
||||
this.addEditorTab('Time range', 'public/app/features/panel/partials/panelTime.html');
|
||||
this.datasources = this.datasourceSrv.getMetricSources();
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ export class PanelCtrl {
|
||||
shareScope.dashboard = this.dashboard;
|
||||
|
||||
this.publishAppEvent('show-modal', {
|
||||
src: './app/features/dashboard/partials/shareModal.html',
|
||||
src: 'public/app/features/dashboard/partials/shareModal.html',
|
||||
scope: shareScope
|
||||
});
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ function (angular, $) {
|
||||
module.directive('grafanaPanel', function() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'app/features/panel/partials/panel.html',
|
||||
templateUrl: 'public/app/features/panel/partials/panel.html',
|
||||
transclude: true,
|
||||
scope: { ctrl: "=" },
|
||||
link: function(scope, elem) {
|
||||
|
@ -8,7 +8,7 @@ import {UnknownPanel} from '../../plugins/panel/unknown/module';
|
||||
var directiveModule = angular.module('grafana.directives');
|
||||
|
||||
/** @ngInject */
|
||||
function panelLoader($compile, dynamicDirectiveSrv, $http, $q, $injector) {
|
||||
function panelLoader($compile, dynamicDirectiveSrv, $http, $q, $injector, $templateCache) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
@ -22,6 +22,10 @@ function panelLoader($compile, dynamicDirectiveSrv, $http, $q, $injector) {
|
||||
if (directive.template) {
|
||||
return $q.when(directive.template);
|
||||
}
|
||||
var cached = $templateCache.get(directive.templateUrl);
|
||||
if (cached) {
|
||||
return cached;
|
||||
}
|
||||
return $http.get(directive.templateUrl).then(res => {
|
||||
return res.data;
|
||||
});
|
||||
|
@ -1,162 +0,0 @@
|
||||
define([
|
||||
'angular',
|
||||
'lodash',
|
||||
'app/core/config',
|
||||
],
|
||||
function (angular, _, config) {
|
||||
'use strict';
|
||||
|
||||
var module = angular.module('grafana.services');
|
||||
|
||||
module.service('panelSrv', function($rootScope, $timeout, datasourceSrv, $q) {
|
||||
|
||||
this.init = function($scope) {
|
||||
|
||||
if (!$scope.panel.span) { $scope.panel.span = 12; }
|
||||
|
||||
$scope.inspector = {};
|
||||
|
||||
$scope.editPanel = function() {
|
||||
$scope.toggleFullscreen(true);
|
||||
};
|
||||
|
||||
$scope.sharePanel = function() {
|
||||
$scope.appEvent('show-modal', {
|
||||
src: './app/features/dashboard/partials/shareModal.html',
|
||||
scope: $scope.$new()
|
||||
});
|
||||
};
|
||||
|
||||
$scope.editPanelJson = function() {
|
||||
$scope.appEvent('show-json-editor', { object: $scope.panel, updateHandler: $scope.replacePanel });
|
||||
};
|
||||
|
||||
$scope.duplicatePanel = function() {
|
||||
$scope.dashboard.duplicatePanel($scope.panel, $scope.row);
|
||||
};
|
||||
|
||||
$scope.updateColumnSpan = function(span) {
|
||||
$scope.updatePanelSpan($scope.panel, span);
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$broadcast('render');
|
||||
});
|
||||
};
|
||||
|
||||
$scope.addDataQuery = function(datasource) {
|
||||
$scope.dashboard.addDataQueryTo($scope.panel, datasource);
|
||||
};
|
||||
|
||||
$scope.removeDataQuery = function (query) {
|
||||
$scope.dashboard.removeDataQuery($scope.panel, query);
|
||||
$scope.get_data();
|
||||
};
|
||||
|
||||
$scope.duplicateDataQuery = function(query) {
|
||||
$scope.dashboard.duplicateDataQuery($scope.panel, query);
|
||||
};
|
||||
|
||||
$scope.moveDataQuery = function(fromIndex, toIndex) {
|
||||
$scope.dashboard.moveDataQuery($scope.panel, fromIndex, toIndex);
|
||||
};
|
||||
|
||||
$scope.setDatasource = function(datasource) {
|
||||
// switching to mixed
|
||||
if (datasource.meta.mixed) {
|
||||
_.each($scope.panel.targets, function(target) {
|
||||
target.datasource = $scope.panel.datasource;
|
||||
if (target.datasource === null) {
|
||||
target.datasource = config.defaultDatasource;
|
||||
}
|
||||
});
|
||||
}
|
||||
// switching from mixed
|
||||
else if ($scope.datasource && $scope.datasource.meta.mixed) {
|
||||
_.each($scope.panel.targets, function(target) {
|
||||
delete target.datasource;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.panel.datasource = datasource.value;
|
||||
$scope.datasource = null;
|
||||
$scope.get_data();
|
||||
};
|
||||
|
||||
$scope.toggleEditorHelp = function(index) {
|
||||
if ($scope.editorHelpIndex === index) {
|
||||
$scope.editorHelpIndex = null;
|
||||
return;
|
||||
}
|
||||
$scope.editorHelpIndex = index;
|
||||
};
|
||||
|
||||
$scope.isNewPanel = function() {
|
||||
return $scope.panel.title === config.new_panel_title;
|
||||
};
|
||||
|
||||
$scope.toggleFullscreen = function(edit) {
|
||||
$scope.dashboardViewState.update({ fullscreen: true, edit: edit, panelId: $scope.panel.id });
|
||||
};
|
||||
|
||||
$scope.otherPanelInFullscreenMode = function() {
|
||||
return $scope.dashboardViewState.fullscreen && !$scope.fullscreen;
|
||||
};
|
||||
|
||||
$scope.getCurrentDatasource = function() {
|
||||
if ($scope.datasource) {
|
||||
return $q.when($scope.datasource);
|
||||
}
|
||||
|
||||
return datasourceSrv.get($scope.panel.datasource);
|
||||
};
|
||||
|
||||
$scope.panelRenderingComplete = function() {
|
||||
$rootScope.performance.panelsRendered++;
|
||||
};
|
||||
|
||||
$scope.get_data = function() {
|
||||
if ($scope.otherPanelInFullscreenMode()) { return; }
|
||||
|
||||
if ($scope.panel.snapshotData) {
|
||||
if ($scope.loadSnapshot) {
|
||||
$scope.loadSnapshot($scope.panel.snapshotData);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
delete $scope.panelMeta.error;
|
||||
$scope.panelMeta.loading = true;
|
||||
|
||||
$scope.getCurrentDatasource().then(function(datasource) {
|
||||
$scope.datasource = datasource;
|
||||
return $scope.refreshData($scope.datasource) || $q.when({});
|
||||
}).then(function() {
|
||||
$scope.panelMeta.loading = false;
|
||||
}, function(err) {
|
||||
console.log('Panel data error:', err);
|
||||
$scope.panelMeta.loading = false;
|
||||
$scope.panelMeta.error = err.message || "Timeseries data request error";
|
||||
$scope.inspector.error = err;
|
||||
});
|
||||
};
|
||||
|
||||
if ($scope.refreshData) {
|
||||
$scope.$on("refresh", $scope.get_data);
|
||||
}
|
||||
|
||||
// Post init phase
|
||||
$scope.fullscreen = false;
|
||||
$scope.editor = { index: 1 };
|
||||
|
||||
$scope.dashboardViewState.registerPanel($scope);
|
||||
$scope.datasources = datasourceSrv.getMetricSources();
|
||||
|
||||
if (!$scope.skipDataOnInit) {
|
||||
$timeout(function() {
|
||||
$scope.get_data();
|
||||
}, 30);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
});
|
@ -15,7 +15,7 @@ function (angular, _) {
|
||||
},
|
||||
restrict: 'E',
|
||||
controller: 'PanelLinksEditorCtrl',
|
||||
templateUrl: 'app/features/panellinks/module.html',
|
||||
templateUrl: 'public/app/features/panellinks/module.html',
|
||||
link: function() {
|
||||
}
|
||||
};
|
||||
|
@ -11,17 +11,17 @@ function (angular) {
|
||||
module.config(function($routeProvider) {
|
||||
$routeProvider
|
||||
.when('/playlists', {
|
||||
templateUrl: 'app/features/playlist/partials/playlists.html',
|
||||
templateUrl: 'public/app/features/playlist/partials/playlists.html',
|
||||
controllerAs: 'ctrl',
|
||||
controller : 'PlaylistsCtrl'
|
||||
})
|
||||
.when('/playlists/create', {
|
||||
templateUrl: 'app/features/playlist/partials/playlist.html',
|
||||
templateUrl: 'public/app/features/playlist/partials/playlist.html',
|
||||
controllerAs: 'ctrl',
|
||||
controller : 'PlaylistEditCtrl'
|
||||
})
|
||||
.when('/playlists/edit/:id', {
|
||||
templateUrl: 'app/features/playlist/partials/playlist.html',
|
||||
templateUrl: 'public/app/features/playlist/partials/playlist.html',
|
||||
controllerAs: 'ctrl',
|
||||
controller : 'PlaylistEditCtrl'
|
||||
})
|
||||
|
@ -70,7 +70,7 @@ export class PlaylistSearchCtrl {
|
||||
export function playlistSearchDirective() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'app/features/playlist/partials/playlist_search.html',
|
||||
templateUrl: 'public/app/features/playlist/partials/playlist_search.html',
|
||||
controller: PlaylistSearchCtrl,
|
||||
bindToController: true,
|
||||
controllerAs: 'ctrl',
|
||||
|
@ -107,8 +107,3 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-include="'app/partials/console.html'" ng-if="consoleEnabled">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -7,15 +7,15 @@ function (CloudWatchDatasource) {
|
||||
'use strict';
|
||||
|
||||
function metricsQueryEditor() {
|
||||
return {controller: 'CloudWatchQueryCtrl', templateUrl: 'app/plugins/datasource/cloudwatch/partials/query.editor.html'};
|
||||
return {controller: 'CloudWatchQueryCtrl', templateUrl: 'public/app/plugins/datasource/cloudwatch/partials/query.editor.html'};
|
||||
}
|
||||
|
||||
function annotationsQueryEditor() {
|
||||
return {templateUrl: 'app/plugins/datasource/cloudwatch/partials/annotations.editor.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/cloudwatch/partials/annotations.editor.html'};
|
||||
}
|
||||
|
||||
function configView() {
|
||||
return {templateUrl: 'app/plugins/datasource/cloudwatch/partials/edit_view.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/cloudwatch/partials/edit_view.html'};
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -10,7 +10,7 @@ function (angular, _, queryDef) {
|
||||
|
||||
module.directive('elasticBucketAgg', function() {
|
||||
return {
|
||||
templateUrl: 'app/plugins/datasource/elasticsearch/partials/bucket_agg.html',
|
||||
templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/bucket_agg.html',
|
||||
controller: 'ElasticBucketAggCtrl',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
|
@ -29,7 +29,7 @@ export class EditViewCtrl {
|
||||
|
||||
function editViewDirective() {
|
||||
return {
|
||||
templateUrl: 'app/plugins/datasource/elasticsearch/partials/edit_view.html',
|
||||
templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/edit_view.html',
|
||||
controller: EditViewCtrl,
|
||||
};
|
||||
};
|
||||
|
@ -10,7 +10,7 @@ function (angular, _, queryDef) {
|
||||
|
||||
module.directive('elasticMetricAgg', function() {
|
||||
return {
|
||||
templateUrl: 'app/plugins/datasource/elasticsearch/partials/metric_agg.html',
|
||||
templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/metric_agg.html',
|
||||
controller: 'ElasticMetricAggCtrl',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
|
@ -8,15 +8,15 @@ function (ElasticDatasource, editView) {
|
||||
'use strict';
|
||||
|
||||
function metricsQueryEditor() {
|
||||
return {controller: 'ElasticQueryCtrl', templateUrl: 'app/plugins/datasource/elasticsearch/partials/query.editor.html'};
|
||||
return {controller: 'ElasticQueryCtrl', templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/query.editor.html'};
|
||||
}
|
||||
|
||||
function metricsQueryOptions() {
|
||||
return {templateUrl: 'app/plugins/datasource/elasticsearch/partials/query.options.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/query.options.html'};
|
||||
}
|
||||
|
||||
function annotationsQueryEditor() {
|
||||
return {templateUrl: 'app/plugins/datasource/elasticsearch/partials/annotations.editor.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/annotations.editor.html'};
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -6,7 +6,7 @@ import {GrafanaDatasource} from './datasource';
|
||||
var module = angular.module('grafana.directives');
|
||||
|
||||
function grafanaMetricsQueryEditor() {
|
||||
return {templateUrl: 'app/plugins/datasource/grafana/partials/query.editor.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/grafana/partials/query.editor.html'};
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,20 +7,20 @@ function (GraphiteDatasource) {
|
||||
function metricsQueryEditor() {
|
||||
return {
|
||||
controller: 'GraphiteQueryCtrl',
|
||||
templateUrl: 'app/plugins/datasource/graphite/partials/query.editor.html'
|
||||
templateUrl: 'public/app/plugins/datasource/graphite/partials/query.editor.html'
|
||||
};
|
||||
}
|
||||
|
||||
function metricsQueryOptions() {
|
||||
return {templateUrl: 'app/plugins/datasource/graphite/partials/query.options.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/graphite/partials/query.options.html'};
|
||||
}
|
||||
|
||||
function annotationsQueryEditor() {
|
||||
return {templateUrl: 'app/plugins/datasource/graphite/partials/annotations.editor.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/graphite/partials/annotations.editor.html'};
|
||||
}
|
||||
|
||||
function configView() {
|
||||
return {templateUrl: 'app/plugins/datasource/graphite/partials/config.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/graphite/partials/config.html'};
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -218,5 +218,4 @@ function (angular, _, dateMath, InfluxSeries, InfluxQuery) {
|
||||
}
|
||||
|
||||
return InfluxDatasource;
|
||||
|
||||
});
|
||||
|
@ -5,19 +5,19 @@ function (InfluxDatasource) {
|
||||
'use strict';
|
||||
|
||||
function influxMetricsQueryEditor() {
|
||||
return {controller: 'InfluxQueryCtrl', templateUrl: 'app/plugins/datasource/influxdb/partials/query.editor.html'};
|
||||
return {controller: 'InfluxQueryCtrl', templateUrl: 'public/app/plugins/datasource/influxdb/partials/query.editor.html'};
|
||||
}
|
||||
|
||||
function influxMetricsQueryOptions() {
|
||||
return {templateUrl: 'app/plugins/datasource/influxdb/partials/query.options.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/influxdb/partials/query.options.html'};
|
||||
}
|
||||
|
||||
function influxAnnotationsQueryEditor() {
|
||||
return {templateUrl: 'app/plugins/datasource/influxdb/partials/annotations.editor.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/influxdb/partials/annotations.editor.html'};
|
||||
}
|
||||
|
||||
function influxConfigView() {
|
||||
return {templateUrl: 'app/plugins/datasource/influxdb/partials/config.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/influxdb/partials/config.html'};
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -14,7 +14,7 @@ function (angular, _, $) {
|
||||
' class="input-mini tight-form-func-param"></input>';
|
||||
return {
|
||||
restrict: 'E',
|
||||
templateUrl: 'app/plugins/datasource/influxdb/partials/query_part.html',
|
||||
templateUrl: 'public/app/plugins/datasource/influxdb/partials/query_part.html',
|
||||
scope: {
|
||||
part: "=",
|
||||
removeAction: "&",
|
||||
|
@ -7,12 +7,12 @@ function (OpenTsDatasource) {
|
||||
function metricsQueryEditor() {
|
||||
return {
|
||||
controller: 'OpenTSDBQueryCtrl',
|
||||
templateUrl: 'app/plugins/datasource/opentsdb/partials/query.editor.html',
|
||||
templateUrl: 'public/app/plugins/datasource/opentsdb/partials/query.editor.html',
|
||||
};
|
||||
}
|
||||
|
||||
function configView() {
|
||||
return {templateUrl: 'app/plugins/datasource/opentsdb/partials/config.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/opentsdb/partials/config.html'};
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -5,11 +5,11 @@ function (PromDatasource) {
|
||||
'use strict';
|
||||
|
||||
function metricsQueryEditor() {
|
||||
return {controller: 'PrometheusQueryCtrl', templateUrl: 'app/plugins/datasource/prometheus/partials/query.editor.html'};
|
||||
return {controller: 'PrometheusQueryCtrl', templateUrl: 'public/app/plugins/datasource/prometheus/partials/query.editor.html'};
|
||||
}
|
||||
|
||||
function configView() {
|
||||
return {templateUrl: 'app/plugins/datasource/prometheus/partials/config.html'};
|
||||
return {templateUrl: 'public/app/plugins/datasource/prometheus/partials/config.html'};
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -31,7 +31,7 @@ class DashListCtrl extends PanelCtrl {
|
||||
this.modes = ['starred', 'search'];
|
||||
this.icon = "fa fa-star";
|
||||
this.addEditorTab('Options', () => {
|
||||
return {templateUrl: 'app/plugins/panel/dashlist/editor.html'};
|
||||
return {templateUrl: 'public/app/plugins/panel/dashlist/editor.html'};
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ function (angular, _, $) {
|
||||
popoverScope.series = seriesInfo;
|
||||
popoverSrv.show({
|
||||
element: el,
|
||||
templateUrl: 'app/plugins/panel/graph/legend.popover.html',
|
||||
templateUrl: 'public/app/plugins/panel/graph/legend.popover.html',
|
||||
scope: popoverScope
|
||||
});
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ define([
|
||||
popoverSrv.show({
|
||||
element: $element.find(".dropdown"),
|
||||
placement: 'top',
|
||||
templateUrl: 'app/partials/colorpicker.html',
|
||||
templateUrl: 'public/app/partials/colorpicker.html',
|
||||
scope: popoverScope
|
||||
});
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ import {SingleStatCtrl} from './controller';
|
||||
import {PanelDirective} from '../../../features/panel/panel';
|
||||
|
||||
class SingleStatPanel extends PanelDirective {
|
||||
templateUrl = 'app/plugins/panel/singlestat/module.html';
|
||||
templateUrl = 'public/app/plugins/panel/singlestat/module.html';
|
||||
controller = SingleStatCtrl;
|
||||
|
||||
/** @ngInject */
|
||||
|
@ -2,9 +2,6 @@
|
||||
|
||||
import {describe, beforeEach, it, sinon, expect, angularMocks} from '../../../../../test/lib/common';
|
||||
|
||||
import 'app/features/panel/panel_srv';
|
||||
import 'app/features/panel/panel_helper';
|
||||
|
||||
import angular from 'angular';
|
||||
import helpers from '../../../../../test/specs/helpers';
|
||||
import {SingleStatCtrl} from '../controller';
|
||||
|
@ -136,7 +136,7 @@ export function tablePanelEditor($q, uiSegmentSrv) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: true,
|
||||
templateUrl: 'app/plugins/panel/table/editor.html',
|
||||
templateUrl: 'public/app/plugins/panel/table/editor.html',
|
||||
controller: TablePanelEditorCtrl,
|
||||
};
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import {TablePanelCtrl} from './controller';
|
||||
import {TableRenderer} from './renderer';
|
||||
|
||||
class TablePanel extends PanelDirective {
|
||||
templateUrl = 'app/plugins/panel/table/module.html';
|
||||
templateUrl = 'public/app/plugins/panel/table/module.html';
|
||||
controller = TablePanelCtrl;
|
||||
|
||||
link(scope, elem, attrs, ctrl) {
|
||||
|
@ -78,7 +78,7 @@ export class TextPanelCtrl extends PanelCtrl {
|
||||
}
|
||||
|
||||
class TextPanel extends PanelDirective {
|
||||
templateUrl = `app/plugins/panel/text/module.html`;
|
||||
templateUrl = `public/app/plugins/panel/text/module.html`;
|
||||
controller = TextPanelCtrl;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="text-center" style="padding-top: 2rem">
|
||||
Unknown panel type: <strong>{{ctrl.panel.type}}</strong>
|
||||
</div
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ Example:
|
||||
|
||||
```javascript
|
||||
function metricsQueryEditor() {
|
||||
return {controller: 'ElasticQueryCtrl', templateUrl: 'app/plugins/datasource/elasticsearch/partials/query.editor.html'};
|
||||
return {controller: 'ElasticQueryCtrl', templateUrl: 'public/app/plugins/datasource/elasticsearch/partials/query.editor.html'};
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -1,40 +0,0 @@
|
||||
define([
|
||||
'./helpers',
|
||||
'app/features/panel/panel_srv',
|
||||
], function() {
|
||||
'use strict';
|
||||
|
||||
describe('PanelSrv', function() {
|
||||
var _panelSrv;
|
||||
var _panelScope;
|
||||
var _datasourceSrvStub;
|
||||
|
||||
beforeEach(module('grafana.services'));
|
||||
beforeEach(module(function($provide) {
|
||||
_datasourceSrvStub = {
|
||||
getMetricSources: sinon.spy(),
|
||||
};
|
||||
$provide.value('datasourceSrv', _datasourceSrvStub);
|
||||
}));
|
||||
|
||||
beforeEach(inject(function(panelSrv, $rootScope) {
|
||||
_panelSrv = panelSrv;
|
||||
_panelScope = $rootScope.$new();
|
||||
_panelScope.panel = {
|
||||
targets: [],
|
||||
};
|
||||
_panelScope.dashboardViewState = {
|
||||
registerPanel: sinon.spy(),
|
||||
};
|
||||
}));
|
||||
|
||||
describe('init', function() {
|
||||
beforeEach(function() {
|
||||
_panelSrv.init(_panelScope);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -19,9 +19,9 @@ module.exports = function(grunt) {
|
||||
'ngAnnotate:build',
|
||||
'systemjs:build',
|
||||
'concat:js',
|
||||
'filerev',
|
||||
'remapFilerev',
|
||||
'usemin',
|
||||
// 'filerev',
|
||||
// 'remapFilerev',
|
||||
// 'usemin',
|
||||
'uglify:genDir'
|
||||
]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user