diff --git a/pkg/cmd/web.go b/pkg/cmd/web.go index 40ef22d8024..897cfc4f3af 100644 --- a/pkg/cmd/web.go +++ b/pkg/cmd/web.go @@ -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") diff --git a/pkg/log/console.go b/pkg/log/console.go index c290cdf45f4..401afd7e106 100644 --- a/pkg/log/console.go +++ b/pkg/log/console.go @@ -46,8 +46,8 @@ var ( // ConsoleWriter implements LoggerInterface and writes messages to terminal. type ConsoleWriter struct { lg *log.Logger - Level int `json:"level"` - Formatting bool `json:"formatting"` + Level LogLevel `json:"level"` + Formatting bool `json:"formatting"` } // create ConsoleWriter returning as LoggerInterface. @@ -63,7 +63,7 @@ func (cw *ConsoleWriter) Init(config string) error { return json.Unmarshal([]byte(config), cw) } -func (cw *ConsoleWriter) WriteMsg(msg string, skip, level int) error { +func (cw *ConsoleWriter) WriteMsg(msg string, skip int, level LogLevel) error { if cw.Level > level { return nil } @@ -82,11 +82,11 @@ func (_ *ConsoleWriter) Flush() { func (_ *ConsoleWriter) Destroy() { } -func printConsole(level int, msg string) { +func printConsole(level LogLevel, msg string) { consoleWriter.WriteMsg(msg, 0, level) } -func printfConsole(level int, format string, v ...interface{}) { +func printfConsole(level LogLevel, format string, v ...interface{}) { consoleWriter.WriteMsg(fmt.Sprintf(format, v...), 0, level) } diff --git a/pkg/log/file.go b/pkg/log/file.go index 8f005d9723b..6031cd5dede 100644 --- a/pkg/log/file.go +++ b/pkg/log/file.go @@ -41,7 +41,7 @@ type FileLogWriter struct { startLock sync.Mutex // Only one log can write to the file - Level int `json:"level"` + Level LogLevel `json:"level"` } // an *os.File writer with locker. @@ -132,7 +132,7 @@ func (w *FileLogWriter) docheck(size int) { } // write logger message into file. -func (w *FileLogWriter) WriteMsg(msg string, skip, level int) error { +func (w *FileLogWriter) WriteMsg(msg string, skip int, level LogLevel) error { if level < w.Level { return nil } diff --git a/pkg/log/log.go b/pkg/log/log.go index a7d26ce7913..6855f512d96 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -99,7 +99,7 @@ func Close() { type LogLevel int const ( - TRACE = iota + TRACE LogLevel = iota DEBUG INFO WARN @@ -111,7 +111,7 @@ const ( // LoggerInterface represents behaviors of a logger provider. type LoggerInterface interface { Init(config string) error - WriteMsg(msg string, skip, level int) error + WriteMsg(msg string, skip int, level LogLevel) error Destroy() Flush() } @@ -132,8 +132,9 @@ func Register(name string, log loggerType) { } type logMsg struct { - skip, level int - msg string + skip int + level LogLevel + msg string } // Logger is default logger in beego application. @@ -141,7 +142,7 @@ type logMsg struct { type Logger struct { adapter string lock sync.Mutex - level int + level LogLevel msg chan *logMsg outputs map[string]LoggerInterface quit chan bool @@ -188,10 +189,7 @@ func (l *Logger) DelLogger(adapter string) error { return nil } -func (l *Logger) writerMsg(skip, level int, msg string) error { - if l.level > level { - return nil - } +func (l *Logger) writerMsg(skip int, level LogLevel, msg string) error { lm := &logMsg{ skip: skip, level: level, @@ -266,36 +264,57 @@ func (l *Logger) Close() { } func (l *Logger) Trace(format string, v ...interface{}) { + if l.level > TRACE { + return + } msg := fmt.Sprintf("[T] "+format, v...) l.writerMsg(0, TRACE, msg) } func (l *Logger) Debug(format string, v ...interface{}) { + if l.level > DEBUG { + return + } msg := fmt.Sprintf("[D] "+format, v...) l.writerMsg(0, DEBUG, msg) } func (l *Logger) Info(format string, v ...interface{}) { + if l.level > INFO { + return + } msg := fmt.Sprintf("[I] "+format, v...) l.writerMsg(0, INFO, msg) } func (l *Logger) Warn(format string, v ...interface{}) { + if l.level > WARN { + return + } msg := fmt.Sprintf("[W] "+format, v...) l.writerMsg(0, WARN, msg) } func (l *Logger) Error(skip int, format string, v ...interface{}) { + if l.level > ERROR { + return + } msg := fmt.Sprintf("[E] "+format, v...) l.writerMsg(skip, ERROR, msg) } func (l *Logger) Critical(skip int, format string, v ...interface{}) { + if l.level > CRITICAL { + return + } msg := fmt.Sprintf("[C] "+format, v...) l.writerMsg(skip, CRITICAL, msg) } func (l *Logger) Fatal(skip int, format string, v ...interface{}) { + if l.level > FATAL { + return + } msg := fmt.Sprintf("[F] "+format, v...) l.writerMsg(skip, FATAL, msg) l.Close() diff --git a/pkg/log/syslog.go b/pkg/log/syslog.go index bc1780056e8..7aa58129b5b 100644 --- a/pkg/log/syslog.go +++ b/pkg/log/syslog.go @@ -39,7 +39,7 @@ func (sw *SyslogWriter) Init(config string) error { return nil } -func (sw *SyslogWriter) WriteMsg(msg string, skip, level int) error { +func (sw *SyslogWriter) WriteMsg(msg string, skip int, level LogLevel) error { var err error switch level { diff --git a/public/app/core/components/navbar/navbar.ts b/public/app/core/components/navbar/navbar.ts index 874becbe4ee..82168f72c29 100644 --- a/public/app/core/components/navbar/navbar.ts +++ b/public/app/core/components/navbar/navbar.ts @@ -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', diff --git a/public/app/core/components/search/search.ts b/public/app/core/components/search/search.ts index e28f80a9099..3f8cb495e71 100644 --- a/public/app/core/components/search/search.ts +++ b/public/app/core/components/search/search.ts @@ -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', diff --git a/public/app/core/components/sidemenu/sidemenu.ts b/public/app/core/components/sidemenu/sidemenu.ts index 503f3c81ac1..833bba1913f 100644 --- a/public/app/core/components/sidemenu/sidemenu.ts +++ b/public/app/core/components/sidemenu/sidemenu.ts @@ -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', diff --git a/public/app/core/directives/dash_edit_link.js b/public/app/core/directives/dash_edit_link.js index 846eca6f1e4..35a90ecd262 100644 --- a/public/app/core/directives/dash_edit_link.js +++ b/public/app/core/directives/dash_edit_link.js @@ -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) { diff --git a/public/app/core/directives/value_select_dropdown.js b/public/app/core/directives/value_select_dropdown.js index 1e82239ff87..656804a72d3 100644 --- a/public/app/core/directives/value_select_dropdown.js +++ b/public/app/core/directives/value_select_dropdown.js @@ -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, diff --git a/public/app/core/routes/all.js b/public/app/core/routes/all.js index d9726ee782c..ab3bef61ed7 100644 --- a/public/app/core/routes/all.js +++ b/public/app/core/routes/all.js @@ -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' }); }); diff --git a/public/app/core/services/alert_srv.js b/public/app/core/services/alert_srv.js index 463be459659..d833a0667ac 100644 --- a/public/app/core/services/alert_srv.js +++ b/public/app/core/services/alert_srv.js @@ -72,7 +72,7 @@ function (angular, _, coreModule) { scope.noText = payload.noText || "Cancel"; var confirmModal = $modal({ - template: './app/partials/confirm_modal.html', + template: 'public/app/partials/confirm_modal.html', persist: false, modalClass: 'modal-no-header confirm-modal', show: false, diff --git a/public/app/features/annotations/editor_ctrl.js b/public/app/features/annotations/editor_ctrl.js index 69bc07ae26d..d9731686a4f 100644 --- a/public/app/features/annotations/editor_ctrl.js +++ b/public/app/features/annotations/editor_ctrl.js @@ -31,7 +31,7 @@ function (angular, _, $) { }; $scope.datasourceChanged = function() { - datasourceSrv.get($scope.currentAnnotation.datasource).then(function(ds) { + return datasourceSrv.get($scope.currentAnnotation.datasource).then(function(ds) { $scope.currentDatasource = ds; $scope.currentAnnotation.datasource = ds.name; }); diff --git a/public/app/features/annotations/partials/editor.html b/public/app/features/annotations/partials/editor.html index 35adae93137..8894cb4b47f 100644 --- a/public/app/features/annotations/partials/editor.html +++ b/public/app/features/annotations/partials/editor.html @@ -33,9 +33,9 @@ -
+
diff --git a/public/app/features/annotations/query_editor.ts b/public/app/features/annotations/query_editor.ts index 4cc6416093a..42d3e9047b5 100644 --- a/public/app/features/annotations/query_editor.ts +++ b/public/app/features/annotations/query_editor.ts @@ -9,7 +9,7 @@ function annotationsQueryEditor(dynamicDirectiveSrv) { annotation: "=", datasource: "=" }, - watchPath: "datasource.type", + watchPath: "annotation.datasource", directive: scope => { return System.import(scope.datasource.meta.module).then(function(dsModule) { return { diff --git a/public/app/features/dashboard/dashboardCtrl.js b/public/app/features/dashboard/dashboardCtrl.js index 2fe21afdc35..ea0d91019b8 100644 --- a/public/app/features/dashboard/dashboardCtrl.js +++ b/public/app/features/dashboard/dashboardCtrl.js @@ -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) { diff --git a/public/app/features/dashboard/dashnav/dashnav.html b/public/app/features/dashboard/dashnav/dashnav.html index 1e416b4f90d..89f9f301729 100644 --- a/public/app/features/dashboard/dashnav/dashnav.html +++ b/public/app/features/dashboard/dashnav/dashnav.html @@ -27,13 +27,17 @@
  • + + Link to Dashboard + +
  • +
  • + + Snapshot sharing + +
  • +
  • diff --git a/public/app/features/dashboard/dashnav/dashnav.ts b/public/app/features/dashboard/dashnav/dashnav.ts index 9df3ea03eb2..39b6f34da8e 100644 --- a/public/app/features/dashboard/dashnav/dashnav.ts +++ b/public/app/features/dashboard/dashnav/dashnav.ts @@ -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, }; diff --git a/public/app/features/dashboard/keybindings.js b/public/app/features/dashboard/keybindings.js index 32980f46d7b..c85226d1266 100644 --- a/public/app/features/dashboard/keybindings.js +++ b/public/app/features/dashboard/keybindings.js @@ -21,7 +21,7 @@ function(angular, $) { helpModalScope = $rootScope.$new(); var helpModal = $modal({ - template: './app/partials/help_modal.html', + template: 'public/app/partials/help_modal.html', persist: false, show: false, scope: helpModalScope, diff --git a/public/app/features/dashboard/partials/import.html b/public/app/features/dashboard/partials/import.html index 5d1078e7e5d..a599d6a1797 100644 --- a/public/app/features/dashboard/partials/import.html +++ b/public/app/features/dashboard/partials/import.html @@ -59,7 +59,7 @@
  • -
    +
    diff --git a/public/app/features/dashboard/submenu/submenu.ts b/public/app/features/dashboard/submenu/submenu.ts index 75f0778b01f..a9899c3a4b8 100644 --- a/public/app/features/dashboard/submenu/submenu.ts +++ b/public/app/features/dashboard/submenu/submenu.ts @@ -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', diff --git a/public/app/features/dashboard/timepicker/timepicker.ts b/public/app/features/dashboard/timepicker/timepicker.ts index 59d2e62e7ae..e662757cb97 100644 --- a/public/app/features/dashboard/timepicker/timepicker.ts +++ b/public/app/features/dashboard/timepicker/timepicker.ts @@ -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', diff --git a/public/app/features/dashboard/unsavedChangesSrv.js b/public/app/features/dashboard/unsavedChangesSrv.js index bbb38d745c7..0b9ef4e18f4 100644 --- a/public/app/features/dashboard/unsavedChangesSrv.js +++ b/public/app/features/dashboard/unsavedChangesSrv.js @@ -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, }); diff --git a/public/app/features/dashlinks/module.js b/public/app/features/dashlinks/module.js index f133290ceb2..1f014bdc0a3 100644 --- a/public/app/features/dashlinks/module.js +++ b/public/app/features/dashlinks/module.js @@ -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() { } }; diff --git a/public/app/features/datasources/edit_ctrl.js b/public/app/features/datasources/edit_ctrl.js index 468be95e24b..2bd86e5f385 100644 --- a/public/app/features/datasources/edit_ctrl.js +++ b/public/app/features/datasources/edit_ctrl.js @@ -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) { diff --git a/public/app/features/org/orgApiKeysCtrl.js b/public/app/features/org/orgApiKeysCtrl.js index 918f57b42e8..7d2bc4be1c6 100644 --- a/public/app/features/org/orgApiKeysCtrl.js +++ b/public/app/features/org/orgApiKeysCtrl.js @@ -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 }); diff --git a/public/app/features/org/orgUsersCtrl.js b/public/app/features/org/orgUsersCtrl.js index 3d3e4d26ec3..0419e4d4a3b 100644 --- a/public/app/features/org/orgUsersCtrl.js +++ b/public/app/features/org/orgUsersCtrl.js @@ -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 }); diff --git a/public/app/features/panel/all.js b/public/app/features/panel/all.js index ad635d83f07..c03089bbf9b 100644 --- a/public/app/features/panel/all.js +++ b/public/app/features/panel/all.js @@ -1,8 +1,6 @@ define([ './panel_menu', './panel_directive', - './panel_srv', - './panel_helper', './solo_panel_ctrl', './panel_loader', './query_editor', diff --git a/public/app/features/panel/metrics_panel_ctrl.ts b/public/app/features/panel/metrics_panel_ctrl.ts index 896babade6d..76b6a7688e4 100644 --- a/public/app/features/panel/metrics_panel_ctrl.ts +++ b/public/app/features/panel/metrics_panel_ctrl.ts @@ -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(); } diff --git a/public/app/features/panel/panel_ctrl.ts b/public/app/features/panel/panel_ctrl.ts index 1b4749fd1cf..fa1b8663f9c 100644 --- a/public/app/features/panel/panel_ctrl.ts +++ b/public/app/features/panel/panel_ctrl.ts @@ -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 }); } diff --git a/public/app/features/panel/panel_directive.ts b/public/app/features/panel/panel_directive.ts index eac2594a26e..ab3d6001e67 100644 --- a/public/app/features/panel/panel_directive.ts +++ b/public/app/features/panel/panel_directive.ts @@ -6,6 +6,7 @@ import $ from 'jquery'; import {PanelCtrl} from './panel_ctrl'; export class DefaultPanelCtrl extends PanelCtrl { + /** @ngInject */ constructor($scope, $injector) { super($scope, $injector); } diff --git a/public/app/features/panel/panel_loader.ts b/public/app/features/panel/panel_loader.ts index 73b154e8840..58d0fe47c73 100644 --- a/public/app/features/panel/panel_loader.ts +++ b/public/app/features/panel/panel_loader.ts @@ -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 $q.when(cached); + } return $http.get(directive.templateUrl).then(res => { return res.data; }); diff --git a/public/app/features/panel/panel_menu.js b/public/app/features/panel/panel_menu.js index c0cf8e77f02..b23da0f2a88 100644 --- a/public/app/features/panel/panel_menu.js +++ b/public/app/features/panel/panel_menu.js @@ -12,7 +12,7 @@ function (angular, $, _) { var linkTemplate = '' + '{{ctrl.panel.title | interpolateTemplateVars:this}}' + - '' + + '' + ' {{ctrl.timeInfo}}' + ''; @@ -28,6 +28,7 @@ function (angular, $, _) { } return template; } + function createMenuTemplate(ctrl) { var template = '
    '; @@ -124,8 +125,8 @@ function (angular, $, _) { } var menuTemplate; - if ($(e.target).hasClass('fa-link')) { - menuTemplate = createExternalLinkMenu($scope); + if ($(e.target).hasClass('fa-external-link')) { + menuTemplate = createExternalLinkMenu(ctrl); } else { menuTemplate = createMenuTemplate(ctrl); } diff --git a/public/app/features/panel/panel_srv.js b/public/app/features/panel/panel_srv.js deleted file mode 100644 index 3fdb8d38974..00000000000 --- a/public/app/features/panel/panel_srv.js +++ /dev/null @@ -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); - } - }; - }); - -}); diff --git a/public/app/features/panel/query_editor.ts b/public/app/features/panel/query_editor.ts index 89038f0f430..c456f42cc40 100644 --- a/public/app/features/panel/query_editor.ts +++ b/public/app/features/panel/query_editor.ts @@ -87,7 +87,7 @@ function metricsQueryEditor(dynamicDirectiveSrv, datasourceSrv) { directive: scope => { let datasource = scope.target.datasource || scope.ctrl.panel.datasource; return datasourceSrv.get(datasource).then(ds => { - scope.ctrl.datasource = ds; + scope.datasource = ds; if (!scope.target.refId) { scope.target.refId = 'A'; diff --git a/public/app/features/panellinks/module.js b/public/app/features/panellinks/module.js index a4c93c397fa..bdb227547a0 100644 --- a/public/app/features/panellinks/module.js +++ b/public/app/features/panellinks/module.js @@ -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() { } }; diff --git a/public/app/features/playlist/playlist_routes.js b/public/app/features/playlist/playlist_routes.js index a3f9cc26f8c..e61ed2d6527 100644 --- a/public/app/features/playlist/playlist_routes.js +++ b/public/app/features/playlist/playlist_routes.js @@ -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' }) diff --git a/public/app/features/playlist/playlist_search.ts b/public/app/features/playlist/playlist_search.ts index 6663b106ab7..e00c2cb3a36 100644 --- a/public/app/features/playlist/playlist_search.ts +++ b/public/app/features/playlist/playlist_search.ts @@ -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', diff --git a/public/app/partials/dashboard.html b/public/app/partials/dashboard.html index 3e60b2542e9..97db5617a1c 100644 --- a/public/app/partials/dashboard.html +++ b/public/app/partials/dashboard.html @@ -107,8 +107,3 @@
    - -
    -
    - - diff --git a/public/app/partials/login.html b/public/app/partials/login.html index 98ed0899316..27983b54114 100644 --- a/public/app/partials/login.html +++ b/public/app/partials/login.html @@ -3,7 +3,8 @@
    diff --git a/public/app/plugins/datasource/cloudwatch/module.js b/public/app/plugins/datasource/cloudwatch/module.js index b4e6c2b6ccb..6f15457a43e 100644 --- a/public/app/plugins/datasource/cloudwatch/module.js +++ b/public/app/plugins/datasource/cloudwatch/module.js @@ -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 { diff --git a/public/app/plugins/datasource/cloudwatch/partials/query.editor.html b/public/app/plugins/datasource/cloudwatch/partials/query.editor.html index 09ac6279c12..fa5e74c33c2 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/query.editor.html +++ b/public/app/plugins/datasource/cloudwatch/partials/query.editor.html @@ -6,14 +6,14 @@
  • - +
  • @@ -25,7 +25,7 @@
  • @@ -35,4 +35,4 @@
  • - + diff --git a/public/app/plugins/datasource/cloudwatch/query_ctrl.js b/public/app/plugins/datasource/cloudwatch/query_ctrl.js index e24b73cd068..927c08b3f2d 100644 --- a/public/app/plugins/datasource/cloudwatch/query_ctrl.js +++ b/public/app/plugins/datasource/cloudwatch/query_ctrl.js @@ -16,7 +16,7 @@ function (angular, _) { $scope.refreshMetricData = function() { if (!_.isEqual($scope.oldTarget, $scope.target)) { $scope.oldTarget = angular.copy($scope.target); - $scope.get_data(); + $scope.ctrl.refresh(); } }; diff --git a/public/app/plugins/datasource/elasticsearch/bucket_agg.js b/public/app/plugins/datasource/elasticsearch/bucket_agg.js index bda666b3602..47d88a6ea3c 100644 --- a/public/app/plugins/datasource/elasticsearch/bucket_agg.js +++ b/public/app/plugins/datasource/elasticsearch/bucket_agg.js @@ -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: { diff --git a/public/app/plugins/datasource/elasticsearch/edit_view.ts b/public/app/plugins/datasource/elasticsearch/edit_view.ts index 8315a389953..c7e17d4fbea 100644 --- a/public/app/plugins/datasource/elasticsearch/edit_view.ts +++ b/public/app/plugins/datasource/elasticsearch/edit_view.ts @@ -5,6 +5,7 @@ import _ from 'lodash'; export class EditViewCtrl { + /** @ngInject */ constructor($scope) { $scope.indexPatternTypes = [ {name: 'No pattern', value: undefined}, @@ -29,7 +30,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, }; }; diff --git a/public/app/plugins/datasource/elasticsearch/metric_agg.js b/public/app/plugins/datasource/elasticsearch/metric_agg.js index 02a60b885bb..7fb227ab5b5 100644 --- a/public/app/plugins/datasource/elasticsearch/metric_agg.js +++ b/public/app/plugins/datasource/elasticsearch/metric_agg.js @@ -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: { diff --git a/public/app/plugins/datasource/elasticsearch/module.js b/public/app/plugins/datasource/elasticsearch/module.js index 171fa68308c..d38afe8e936 100644 --- a/public/app/plugins/datasource/elasticsearch/module.js +++ b/public/app/plugins/datasource/elasticsearch/module.js @@ -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 { diff --git a/public/app/plugins/datasource/elasticsearch/partials/query.editor.html b/public/app/plugins/datasource/elasticsearch/partials/query.editor.html index 99c6aed9aa7..bbf5964b220 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/query.editor.html +++ b/public/app/plugins/datasource/elasticsearch/partials/query.editor.html @@ -14,15 +14,15 @@
  • - +
  • @@ -33,7 +33,7 @@ {{target.refId}}
  • - +
  • @@ -44,13 +44,13 @@ Query
  • - +
  • Alias
  • - +
  • diff --git a/public/app/plugins/datasource/elasticsearch/partials/query.options.html b/public/app/plugins/datasource/elasticsearch/partials/query.options.html index eb6c6ff55fb..628a0a0bf3d 100644 --- a/public/app/plugins/datasource/elasticsearch/partials/query.options.html +++ b/public/app/plugins/datasource/elasticsearch/partials/query.options.html @@ -8,7 +8,7 @@ Group by time interval
  • -
  • @@ -23,7 +23,7 @@
  • - + alias patterns
  • @@ -34,7 +34,7 @@
    -
    +
    Alias patterns
    • {{term fieldname}} = replaced with value of term group by
    • diff --git a/public/app/plugins/datasource/elasticsearch/query_ctrl.js b/public/app/plugins/datasource/elasticsearch/query_ctrl.js index b222733e29d..90214dff17c 100644 --- a/public/app/plugins/datasource/elasticsearch/query_ctrl.js +++ b/public/app/plugins/datasource/elasticsearch/query_ctrl.js @@ -6,8 +6,9 @@ function (angular) { var module = angular.module('grafana.controllers'); - module.controller('ElasticQueryCtrl', function($scope, $timeout, uiSegmentSrv) { + module.controller('ElasticQueryCtrl', function($scope, $rootScope, $timeout, uiSegmentSrv) { $scope.esVersion = $scope.datasource.esVersion; + $scope.panelCtrl = $scope.ctrl; $scope.init = function() { var target = $scope.target; @@ -27,10 +28,10 @@ function (angular) { var newJson = angular.toJson($scope.datasource.queryBuilder.build($scope.target), true); if (newJson !== $scope.oldQueryRaw) { $scope.rawQueryOld = newJson; - $scope.get_data(); + $scope.panelCtrl.refresh(); } - $scope.appEvent('elastic-query-updated'); + $rootScope.appEvent('elastic-query-updated'); }; $scope.handleQueryError = function(err) { diff --git a/public/app/plugins/datasource/grafana/module.ts b/public/app/plugins/datasource/grafana/module.ts index 860cae89483..b9c4997af7d 100644 --- a/public/app/plugins/datasource/grafana/module.ts +++ b/public/app/plugins/datasource/grafana/module.ts @@ -4,7 +4,7 @@ import angular from 'angular'; import {GrafanaDatasource} from './datasource'; class GrafanaMetricsQueryEditor { - static templateUrl = 'app/plugins/datasource/grafana/partials/query.editor.html'; + static templateUrl = 'public/app/plugins/datasource/grafana/partials/query.editor.html'; } export { diff --git a/public/app/plugins/datasource/graphite/module.js b/public/app/plugins/datasource/graphite/module.js index 602dbb9cae8..64f0945aef3 100644 --- a/public/app/plugins/datasource/graphite/module.js +++ b/public/app/plugins/datasource/graphite/module.js @@ -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 { diff --git a/public/app/plugins/datasource/graphite/query_ctrl.js b/public/app/plugins/datasource/graphite/query_ctrl.js index ab113465262..55083aefaa2 100644 --- a/public/app/plugins/datasource/graphite/query_ctrl.js +++ b/public/app/plugins/datasource/graphite/query_ctrl.js @@ -12,6 +12,7 @@ function (angular, _, config, gfunc, Parser) { module.controller('GraphiteQueryCtrl', function($scope, uiSegmentSrv, templateSrv) { var panelCtrl = $scope.panelCtrl = $scope.ctrl; + var datasource = $scope.datasource; $scope.init = function() { if ($scope.target) { @@ -126,7 +127,7 @@ function (angular, _, config, gfunc, Parser) { } var path = getSegmentPathUpTo(fromIndex + 1); - return panelCtrl.datasource.metricFindQuery(path) + return datasource.metricFindQuery(path) .then(function(segments) { if (segments.length === 0) { if (path !== '') { @@ -160,7 +161,7 @@ function (angular, _, config, gfunc, Parser) { $scope.getAltSegments = function (index) { var query = index === 0 ? '*' : getSegmentPathUpTo(index) + '.*'; - return panelCtrl.datasource.metricFindQuery(query).then(function(segments) { + return datasource.metricFindQuery(query).then(function(segments) { var altSegments = _.map(segments, function(segment) { return uiSegmentSrv.newSegment({ value: segment.text, expandable: segment.expandable }); }); diff --git a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts index bdf339e0d27..195e872efc7 100644 --- a/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/graphite/specs/query_ctrl_specs.ts @@ -19,14 +19,13 @@ describe('GraphiteQueryCtrl', function() { ctx.scope = $rootScope.$new(); ctx.scope.ctrl = {panel: ctx.panel}; ctx.panelCtrl = ctx.scope.ctrl; + ctx.scope.datasource = ctx.datasource; + ctx.scope.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([])); ctx.controller = $controller('GraphiteQueryCtrl', {$scope: ctx.scope}); })); beforeEach(function() { ctx.scope.target = {target: 'aliasByNode(scaleToSeconds(test.prod.*,1),2)'}; - - ctx.panelCtrl.datasource = ctx.datasource; - ctx.panelCtrl.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([])); }); describe('init', function() { @@ -36,7 +35,7 @@ describe('GraphiteQueryCtrl', function() { }); it('should validate metric key exists', function() { - expect(ctx.panelCtrl.datasource.metricFindQuery.getCall(0).args[0]).to.be('test.prod.*'); + expect(ctx.scope.datasource.metricFindQuery.getCall(0).args[0]).to.be('test.prod.*'); }); it('should delete last segment if no metrics are found', function() { @@ -51,7 +50,7 @@ describe('GraphiteQueryCtrl', function() { describe('when adding function', function() { beforeEach(function() { ctx.scope.target.target = 'test.prod.*.count'; - ctx.panelCtrl.datasource.metricFindQuery.returns(ctx.$q.when([{expandable: false}])); + ctx.scope.datasource.metricFindQuery.returns(ctx.$q.when([{expandable: false}])); ctx.scope.init(); ctx.scope.$digest(); @@ -75,7 +74,7 @@ describe('GraphiteQueryCtrl', function() { describe('when adding function before any metric segment', function() { beforeEach(function() { ctx.scope.target.target = ''; - ctx.panelCtrl.datasource.metricFindQuery.returns(ctx.$q.when([{expandable: true}])); + ctx.scope.datasource.metricFindQuery.returns(ctx.$q.when([{expandable: true}])); ctx.scope.init(); ctx.scope.$digest(); ctx.scope.addFunction(gfunc.getFuncDef('asPercent')); @@ -89,7 +88,7 @@ describe('GraphiteQueryCtrl', function() { describe('when initalizing target without metric expression and only function', function() { beforeEach(function() { ctx.scope.target.target = 'asPercent(#A, #B)'; - ctx.panelCtrl.datasource.metricFindQuery.returns(ctx.$q.when([])); + ctx.scope.datasource.metricFindQuery.returns(ctx.$q.when([])); ctx.scope.init(); ctx.scope.$digest(); }); @@ -107,7 +106,7 @@ describe('GraphiteQueryCtrl', function() { describe('when initializing a target with single param func using variable', function() { beforeEach(function() { ctx.scope.target.target = 'movingAverage(prod.count, $var)'; - ctx.panelCtrl.datasource.metricFindQuery.returns(ctx.$q.when([])); + ctx.scope.datasource.metricFindQuery.returns(ctx.$q.when([])); ctx.scope.init(); ctx.scope.$digest(); }); @@ -125,7 +124,7 @@ describe('GraphiteQueryCtrl', function() { describe('when initalizing target without metric expression and function with series-ref', function() { beforeEach(function() { ctx.scope.target.target = 'asPercent(metric.node.count, #A)'; - ctx.panelCtrl.datasource.metricFindQuery.returns(ctx.$q.when([])); + ctx.scope.datasource.metricFindQuery.returns(ctx.$q.when([])); ctx.scope.init(); ctx.scope.$digest(); ctx.scope.$parent = { get_data: sinon.spy() }; @@ -143,7 +142,7 @@ describe('GraphiteQueryCtrl', function() { describe('when getting altSegments and metricFindQuery retuns empty array', function() { beforeEach(function() { ctx.scope.target.target = 'test.count'; - ctx.panelCtrl.datasource.metricFindQuery.returns(ctx.$q.when([])); + ctx.scope.datasource.metricFindQuery.returns(ctx.$q.when([])); ctx.scope.init(); ctx.scope.getAltSegments(1).then(function(results) { ctx.altSegments = results; @@ -159,7 +158,7 @@ describe('GraphiteQueryCtrl', function() { describe('targetChanged', function() { beforeEach(function() { - ctx.panelCtrl.datasource.metricFindQuery.returns(ctx.$q.when([{expandable: false}])); + ctx.scope.datasource.metricFindQuery.returns(ctx.$q.when([{expandable: false}])); ctx.scope.init(); ctx.scope.$digest(); diff --git a/public/app/plugins/datasource/influxdb/datasource.js b/public/app/plugins/datasource/influxdb/datasource.js index f5e0fa5b024..8d171deb7f9 100644 --- a/public/app/plugins/datasource/influxdb/datasource.js +++ b/public/app/plugins/datasource/influxdb/datasource.js @@ -218,5 +218,4 @@ function (angular, _, dateMath, InfluxSeries, InfluxQuery) { } return InfluxDatasource; - }); diff --git a/public/app/plugins/datasource/influxdb/module.js b/public/app/plugins/datasource/influxdb/module.js index 406690f4f2c..b7f266f9f89 100644 --- a/public/app/plugins/datasource/influxdb/module.js +++ b/public/app/plugins/datasource/influxdb/module.js @@ -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 { diff --git a/public/app/plugins/datasource/influxdb/partials/query.editor.html b/public/app/plugins/datasource/influxdb/partials/query.editor.html index 6bc7d402087..3322be6c423 100644 --- a/public/app/plugins/datasource/influxdb/partials/query.editor.html +++ b/public/app/plugins/datasource/influxdb/partials/query.editor.html @@ -16,15 +16,15 @@
  • - +
  • diff --git a/public/app/plugins/datasource/influxdb/query_ctrl.js b/public/app/plugins/datasource/influxdb/query_ctrl.js index f7f17beb459..fee1d5d1c77 100644 --- a/public/app/plugins/datasource/influxdb/query_ctrl.js +++ b/public/app/plugins/datasource/influxdb/query_ctrl.js @@ -16,6 +16,7 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { module.controller('InfluxQueryCtrl', function($scope, templateSrv, $q, uiSegmentSrv) { var panelCtrl = $scope.ctrl; + var datasource = $scope.datasource; $scope.panelCtrl = panelCtrl; $scope.init = function() { @@ -23,7 +24,7 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { $scope.target = $scope.target; $scope.queryModel = new InfluxQuery($scope.target); - $scope.queryBuilder = new InfluxQueryBuilder($scope.target, panelCtrl.datasource.database); + $scope.queryBuilder = new InfluxQueryBuilder($scope.target, datasource.database); $scope.groupBySegment = uiSegmentSrv.newPlusButton(); $scope.resultFormats = [ {text: 'Time series', value: 'time_series'}, @@ -77,7 +78,7 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { $scope.getGroupByOptions = function() { var query = $scope.queryBuilder.buildExploreQuery('TAG_KEYS'); - return panelCtrl.datasource.metricFindQuery(query) + return datasource.metricFindQuery(query) .then(function(tags) { var options = []; if (!$scope.queryModel.hasFill()) { @@ -137,7 +138,7 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { $scope.getPolicySegments = function() { var policiesQuery = $scope.queryBuilder.buildExploreQuery('RETENTION POLICIES'); - return panelCtrl.datasource.metricFindQuery(policiesQuery) + return datasource.metricFindQuery(policiesQuery) .then($scope.transformToSegments(false)) .then(null, $scope.handleQueryError); }; @@ -153,19 +154,19 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { $scope.getMeasurements = function () { var query = $scope.queryBuilder.buildExploreQuery('MEASUREMENTS'); - return panelCtrl.datasource.metricFindQuery(query) + return datasource.metricFindQuery(query) .then($scope.transformToSegments(true), $scope.handleQueryError); }; $scope.getPartOptions = function(part) { if (part.def.type === 'field') { var fieldsQuery = $scope.queryBuilder.buildExploreQuery('FIELDS'); - return panelCtrl.datasource.metricFindQuery(fieldsQuery) + return datasource.metricFindQuery(fieldsQuery) .then($scope.transformToSegments(true), $scope.handleQueryError); } if (part.def.type === 'tag') { var tagsQuery = $scope.queryBuilder.buildExploreQuery('TAG_KEYS'); - return panelCtrl.datasource.metricFindQuery(tagsQuery) + return datasource.metricFindQuery(tagsQuery) .then($scope.transformToSegments(true), $scope.handleQueryError); } }; @@ -213,7 +214,7 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { addTemplateVars = true; } - return panelCtrl.datasource.metricFindQuery(query) + return datasource.metricFindQuery(query) .then($scope.transformToSegments(addTemplateVars)) .then(function(results) { if (segment.type === 'key') { @@ -226,7 +227,7 @@ function (angular, _, InfluxQueryBuilder, InfluxQuery, queryPart) { $scope.getFieldSegments = function() { var fieldsQuery = $scope.queryBuilder.buildExploreQuery('FIELDS'); - return panelCtrl.datasource.metricFindQuery(fieldsQuery) + return datasource.metricFindQuery(fieldsQuery) .then($scope.transformToSegments(false)) .then(null, $scope.handleQueryError); }; diff --git a/public/app/plugins/datasource/influxdb/query_part_editor.js b/public/app/plugins/datasource/influxdb/query_part_editor.js index 9d81e315989..4e044eca304 100644 --- a/public/app/plugins/datasource/influxdb/query_part_editor.js +++ b/public/app/plugins/datasource/influxdb/query_part_editor.js @@ -14,7 +14,7 @@ function (angular, _, $) { ' class="input-mini tight-form-func-param">'; 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: "&", diff --git a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts index 16077513d7b..778f08e1352 100644 --- a/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts +++ b/public/app/plugins/datasource/influxdb/specs/query_ctrl_specs.ts @@ -15,6 +15,8 @@ describe('InfluxDBQueryCtrl', function() { ctx.$q = $q; ctx.scope = $rootScope.$new(); ctx.scope.ctrl = {panel: ctx.panel}; + ctx.scope.datasource = ctx.datasource; + ctx.scope.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([])); ctx.panelCtrl = ctx.scope.ctrl; ctx.controller = $controller('InfluxQueryCtrl', {$scope: ctx.scope}); })); @@ -22,8 +24,6 @@ describe('InfluxDBQueryCtrl', function() { beforeEach(function() { ctx.scope.target = {}; ctx.panelCtrl.refresh = sinon.spy(); - ctx.panelCtrl.datasource = ctx.datasource; - ctx.panelCtrl.datasource.metricFindQuery = sinon.stub().returns(ctx.$q.when([])); }); describe('init', function() { diff --git a/public/app/plugins/datasource/opentsdb/datasource.js b/public/app/plugins/datasource/opentsdb/datasource.js index 5edf4329be0..0171595060a 100644 --- a/public/app/plugins/datasource/opentsdb/datasource.js +++ b/public/app/plugins/datasource/opentsdb/datasource.js @@ -13,6 +13,8 @@ function (angular, _, dateMath) { this.type = 'opentsdb'; this.url = instanceSettings.url; this.name = instanceSettings.name; + this.withCredentials = instanceSettings.withCredentials; + this.basicAuth = instanceSettings.basicAuth; this.supportMetrics = true; // Called once per panel (graph) @@ -71,6 +73,14 @@ function (angular, _, dateMath) { url: this.url + '/api/query', data: reqBody }; + if (this.basicAuth || this.withCredentials) { + options.withCredentials = true; + } + if (this.basicAuth) { + options.headers = { + "Authorization": this.basicAuth + }; + } // In case the backend is 3rd-party hosted and does not suport OPTIONS, urlencoded requests // go as POST rather than OPTIONS+POST diff --git a/public/app/plugins/datasource/opentsdb/module.js b/public/app/plugins/datasource/opentsdb/module.js index 470f40322d7..a85daf37bba 100644 --- a/public/app/plugins/datasource/opentsdb/module.js +++ b/public/app/plugins/datasource/opentsdb/module.js @@ -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 { diff --git a/public/app/plugins/datasource/opentsdb/partials/query.editor.html b/public/app/plugins/datasource/opentsdb/partials/query.editor.html index fffa7194228..e27f068032f 100644 --- a/public/app/plugins/datasource/opentsdb/partials/query.editor.html +++ b/public/app/plugins/datasource/opentsdb/partials/query.editor.html @@ -9,15 +9,14 @@
  • - +
  • @@ -29,7 +28,7 @@
  • diff --git a/public/app/plugins/datasource/opentsdb/queryCtrl.js b/public/app/plugins/datasource/opentsdb/queryCtrl.js index 14d28c310c2..04259382390 100644 --- a/public/app/plugins/datasource/opentsdb/queryCtrl.js +++ b/public/app/plugins/datasource/opentsdb/queryCtrl.js @@ -9,6 +9,7 @@ function (angular, _, kbn) { var module = angular.module('grafana.controllers'); module.controller('OpenTSDBQueryCtrl', function($scope) { + $scope.panelCtrl = $scope.ctrl; $scope.init = function() { $scope.target.errors = validateTarget($scope.target); diff --git a/public/app/plugins/datasource/prometheus/module.js b/public/app/plugins/datasource/prometheus/module.js index 3a4a274763f..042224c2e38 100644 --- a/public/app/plugins/datasource/prometheus/module.js +++ b/public/app/plugins/datasource/prometheus/module.js @@ -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 { diff --git a/public/app/plugins/datasource/prometheus/partials/query.editor.html b/public/app/plugins/datasource/prometheus/partials/query.editor.html index 75c432862ad..4ad94d022eb 100644 --- a/public/app/plugins/datasource/prometheus/partials/query.editor.html +++ b/public/app/plugins/datasource/prometheus/partials/query.editor.html @@ -9,15 +9,14 @@
  • - +
  • @@ -29,7 +28,7 @@
  • diff --git a/public/app/plugins/datasource/prometheus/query_ctrl.js b/public/app/plugins/datasource/prometheus/query_ctrl.js index 83d92ae74a2..b78152c62d0 100644 --- a/public/app/plugins/datasource/prometheus/query_ctrl.js +++ b/public/app/plugins/datasource/prometheus/query_ctrl.js @@ -8,6 +8,8 @@ function (angular, _) { var module = angular.module('grafana.controllers'); module.controller('PrometheusQueryCtrl', function($scope, templateSrv) { + $scope.panelCtrl = $scope.ctrl; + $scope.panel = $scope.panelCtrl.panel; $scope.init = function() { var target = $scope.target; @@ -29,7 +31,7 @@ function (angular, _) { $scope.refreshMetricData = function() { if (!_.isEqual($scope.oldTarget, $scope.target)) { $scope.oldTarget = angular.copy($scope.target); - $scope.get_data(); + $scope.paneCtrl.refresh(); } }; diff --git a/public/app/plugins/panel/dashlist/module.ts b/public/app/plugins/panel/dashlist/module.ts index d64174d77ff..5922902a34a 100644 --- a/public/app/plugins/panel/dashlist/module.ts +++ b/public/app/plugins/panel/dashlist/module.ts @@ -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'}; }); } diff --git a/public/app/plugins/panel/graph/legend.js b/public/app/plugins/panel/graph/legend.js index 67b2dd525d0..a1777772c98 100644 --- a/public/app/plugins/panel/graph/legend.js +++ b/public/app/plugins/panel/graph/legend.js @@ -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 }); } diff --git a/public/app/plugins/panel/graph/seriesOverridesCtrl.js b/public/app/plugins/panel/graph/seriesOverridesCtrl.js index 4b89de684e3..ee3d6c00564 100644 --- a/public/app/plugins/panel/graph/seriesOverridesCtrl.js +++ b/public/app/plugins/panel/graph/seriesOverridesCtrl.js @@ -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 }); }; diff --git a/public/app/plugins/panel/singlestat/module.ts b/public/app/plugins/panel/singlestat/module.ts index e54dc10321a..ca892a59daf 100644 --- a/public/app/plugins/panel/singlestat/module.ts +++ b/public/app/plugins/panel/singlestat/module.ts @@ -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 */ diff --git a/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts b/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts index 4971c74ea1a..21cbfb7602c 100644 --- a/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts +++ b/public/app/plugins/panel/singlestat/specs/singlestat-specs.ts @@ -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'; diff --git a/public/app/plugins/panel/table/editor.ts b/public/app/plugins/panel/table/editor.ts index dde691b00f3..65c8b51cab8 100644 --- a/public/app/plugins/panel/table/editor.ts +++ b/public/app/plugins/panel/table/editor.ts @@ -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, }; } diff --git a/public/app/plugins/panel/table/module.ts b/public/app/plugins/panel/table/module.ts index a273b8b08d0..bb48da3f08a 100644 --- a/public/app/plugins/panel/table/module.ts +++ b/public/app/plugins/panel/table/module.ts @@ -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) { diff --git a/public/app/plugins/panel/text/module.ts b/public/app/plugins/panel/text/module.ts index bdef3bb4ced..3db30d1b43e 100644 --- a/public/app/plugins/panel/text/module.ts +++ b/public/app/plugins/panel/text/module.ts @@ -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; } diff --git a/public/app/plugins/panel/unknown/module.html b/public/app/plugins/panel/unknown/module.html index 1e2e475428e..02c4dc97fc1 100644 --- a/public/app/plugins/panel/unknown/module.html +++ b/public/app/plugins/panel/unknown/module.html @@ -1,5 +1,5 @@
    Unknown panel type: {{ctrl.panel.type}} -
    diff --git a/public/app/plugins/plugin_api.md b/public/app/plugins/plugin_api.md index 707838ba8fd..71db1ef8f09 100644 --- a/public/app/plugins/plugin_api.md +++ b/public/app/plugins/plugin_api.md @@ -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'}; } ``` diff --git a/public/dashboards/home.json b/public/dashboards/home.json index 735586c0f40..e05a882ef57 100644 --- a/public/dashboards/home.json +++ b/public/dashboards/home.json @@ -12,10 +12,10 @@ { "collapse": false, "editable": true, - "height": "100px", + "height": "90px", "panels": [ { - "content": "
    \nHome Dashboard\n
    ", + "content": "
    \n Home Dashboard\n
    ", "editable": true, "id": 1, "mode": "html", @@ -23,7 +23,8 @@ "style": {}, "title": "", "transparent": true, - "type": "text" + "type": "text", + "links": [] } ], "title": "New row" diff --git a/public/less/grafana.less b/public/less/grafana.less index 041636d5448..88745f6a57b 100644 --- a/public/less/grafana.less +++ b/public/less/grafana.less @@ -391,12 +391,15 @@ } .dashboard-header { - margin-top: 1rem; font-family: "grafana-icons"; font-size: 22px; - padding-bottom: 1rem; - border: none; - border-bottom: 2px solid transparent; - border-image: linear-gradient(to right, rgba(255,213,0,1) 0%, rgba(255,68,0,1) 99%, rgba(255,68,0,1) 100%); - border-image-slice: 1; + text-align: center; + span { + display: inline-block; + border: none; + border-image: linear-gradient(to right, rgba(255,213,0,1) 0%, rgba(255,68,0,1) 99%, rgba(255,68,0,1) 100%); + border-image-slice: 1; + border-bottom: 2px solid transparent; + padding: 1.2rem 3rem 0.8rem 3rem; + } } diff --git a/public/less/login.less b/public/less/login.less index e599bca1927..77213fa7301 100644 --- a/public/less/login.less +++ b/public/less/login.less @@ -9,15 +9,23 @@ .login-box { width: 700px; - margin: 100px auto 0 auto; + margin: 70px auto 0 auto; } .login-box-logo { text-align: center; - padding-bottom: 50px; + img { + width: 125px; + } + .icon-gf-grafana_wordmark { + color: @linkColor; + position: relative; + top: -90px; + font-size: 3rem; + text-shadow: 3px 3px 5px black; + } } - .login-inner-box { background: @grafanaPanelBackground; } diff --git a/public/less/timepicker.less b/public/less/timepicker.less index fe7936f5d75..7910d18c23c 100644 --- a/public/less/timepicker.less +++ b/public/less/timepicker.less @@ -7,7 +7,7 @@ } .gf-timepicker-dropdown { - margin: -5px -10px; + margin: -5px -10px 10px 5px; padding: 10px 20px; float: right; background-color: @grafanaPanelBackground; diff --git a/public/test/specs/panelSrv-specs.js b/public/test/specs/panelSrv-specs.js deleted file mode 100644 index a0267cba420..00000000000 --- a/public/test/specs/panelSrv-specs.js +++ /dev/null @@ -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); - }); - - }); - }); - -}); - diff --git a/tasks/options/ngtemplates.js b/tasks/options/ngtemplates.js index 66ca44896c7..ad0581416bb 100644 --- a/tasks/options/ngtemplates.js +++ b/tasks/options/ngtemplates.js @@ -5,6 +5,7 @@ module.exports = function(config) { src: ['app/**/*.html'], dest: '<%= genDir %>/app/core/partials.js', options: { + prefix: 'public/', bootstrap: function(module, script) { return "define('app/core/partials', ['app/core/core_module'], function(coreModule) { \n" + "coreModule.default.run(['$templateCache', function($templateCache) { \n" +