Procházet zdrojové kódy

Dashboard: new config.js option to change/remove window title prefix from 'Grafana -' to anything, PR #685

Torkel Ödegaard před 11 roky
rodič
revize
6f80862517

+ 1 - 0
CHANGELOG.md

@@ -7,6 +7,7 @@
 - [Issue #709](https://github.com/grafana/grafana/issues/709). Dashboard: Small UI look polish to search results, made dashboard title link are larger
 - [Issue #425](https://github.com/grafana/grafana/issues/425). Graph: New section in 'Display Styles' tab to override any display setting on per series bases (mix and match lines, bars, points, fill, stack, line width etc)
 - [Issue #634](https://github.com/grafana/grafana/issues/634). Dashboard: Dashboard tags now in different colors (from fixed palette) determined by tag name.
+- [Issue #685](https://github.com/grafana/grafana/issues/685). Dashboard: New config.js option to change/remove window title prefix.
 
 **Fixes**
 - [Issue #696](https://github.com/grafana/grafana/issues/696). Graph: Fix for y-axis format 'none' when values are in scientific notation (ex 2.3e-13)

+ 1 - 1
src/app/components/settings.js

@@ -14,7 +14,7 @@ function (_, crypto) {
      */
     var defaults = {
       datasources                   : {},
-      title                         : 'Grafana - ',
+      window_title_prefix           : 'Grafana - ',
       panels                        : ['graph', 'text'],
       plugins                       : {},
       default_route                 : '/dashboard/file/default.json',

+ 1 - 1
src/app/controllers/dashboardCtrl.js

@@ -56,7 +56,7 @@ function (angular, $, config, _) {
       $scope.panelMoveOver = panelMove.onOver;
       $scope.panelMoveOut = panelMove.onOut;
 
-      window.document.title = (config.title ? config.title : '') + $scope.dashboard.title;
+      window.document.title = config.window_title_prefix + $scope.dashboard.title;
 
       // start auto refresh
       if($scope.dashboard.refresh) {

+ 4 - 12
src/config.sample.js

@@ -73,23 +73,12 @@ function (Settings) {
     * ========================================================
     */
 
-    /* title:
-    * The global page title prefix that is prepended before the specific dashboard titles.
-    * Defaults to 'Grafana - '.
-    *
-    * title: undefined, // default prefix, page title = 'Grafana - <dashboard title>'
-    * title: null, // no prefix, page title = <dashboard title>
-    * title: '', // no prefix, page title = <dashboard title>
-    * title: 'Custom | ', // custom prefix, page title = 'Custom | <dashboard title>'
-    */
-    title: undefined,
-
     // specify the limit for dashboard search results
     search: {
       max_results: 20
     },
 
-    // default start dashboard
+    // default home dashboard
     default_route: '/dashboard/file/default.json',
 
     // set to false to disable unsaved changes warning
@@ -105,6 +94,9 @@ function (Settings) {
       password: ''
     },
 
+    // Change window title prefix from 'Grafana - <dashboard title>'
+    window_title_prefix: 'Grafana - ',
+
     // Add your own custom pannels
     plugins: {
       // list of plugin panels