diff --git a/package.json b/package.json index 72eee2f37d4..6030416d1dc 100644 --- a/package.json +++ b/package.json @@ -60,8 +60,7 @@ }, "scripts": { "test": "grunt test", - "coveralls": "grunt karma:coveralls && rm -rf ./coverage", - "postinstall": "./node_modules/.bin/grunt copy:node_modules" + "coveralls": "grunt karma:coveralls && rm -rf ./coverage" }, "license": "Apache-2.0", "dependencies": { diff --git a/pkg/api/cloudwatch/metrics.go b/pkg/api/cloudwatch/metrics.go index 7a98386347c..b4321791926 100644 --- a/pkg/api/cloudwatch/metrics.go +++ b/pkg/api/cloudwatch/metrics.go @@ -126,6 +126,11 @@ func handleGetNamespaces(req *cwRequest, c *middleware.Context) { for key := range metricsMap { keys = append(keys, key) } + if customMetricsNamespaces, ok := req.DataSource.JsonData["customMetricsNamespaces"].(string); ok { + for _, key := range strings.Split(customMetricsNamespaces, ",") { + keys = append(keys, key) + } + } sort.Sort(sort.StringSlice(keys)) result := []interface{}{} diff --git a/pkg/api/org.go b/pkg/api/org.go index 0316116b6d3..61af62311c6 100644 --- a/pkg/api/org.go +++ b/pkg/api/org.go @@ -84,7 +84,7 @@ func CreateOrg(c *middleware.Context, cmd m.CreateOrgCommand) Response { cmd.UserId = c.UserId if err := bus.Dispatch(&cmd); err != nil { if err == m.ErrOrgNameTaken { - return ApiError(400, "Organization name taken", err) + return ApiError(409, "Organization name taken", err) } return ApiError(500, "Failed to create organization", err) } diff --git a/pkg/services/sqlstore/sqlstore.go b/pkg/services/sqlstore/sqlstore.go index 3ab4bf1c00b..e3db2d7f537 100644 --- a/pkg/services/sqlstore/sqlstore.go +++ b/pkg/services/sqlstore/sqlstore.go @@ -149,8 +149,13 @@ func getEngine() (*xorm.Engine, error) { if len(fields) > 1 && len(strings.TrimSpace(fields[1])) > 0 { port = fields[1] } - cnnstr = fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s sslmode=%s", - DbCfg.User, DbCfg.Pwd, host, port, DbCfg.Name, DbCfg.SslMode) + if DbCfg.Pwd == "" { + DbCfg.Pwd = "''" + } + if DbCfg.User == "" { + DbCfg.User = "''" + } + cnnstr = fmt.Sprintf("user=%s password=%s host=%s port=%s dbname=%s sslmode=%s", DbCfg.User, DbCfg.Pwd, host, port, DbCfg.Name, DbCfg.SslMode) case "sqlite3": if !filepath.IsAbs(DbCfg.Path) { DbCfg.Path = filepath.Join(setting.DataPath, DbCfg.Path) diff --git a/public/app/core/routes/routes.ts b/public/app/core/routes/routes.ts index 8963228210b..82da84fbc56 100644 --- a/public/app/core/routes/routes.ts +++ b/public/app/core/routes/routes.ts @@ -45,6 +45,7 @@ function setupAngularRoutes($routeProvider, $locationProvider) { .when('/datasources', { templateUrl: 'public/app/features/datasources/partials/list.html', controller : 'DataSourcesCtrl', + controllerAs: 'ctrl', resolve: loadOrgBundle, }) .when('/datasources/edit/:id', { diff --git a/public/app/features/datasources/list_ctrl.js b/public/app/features/datasources/list_ctrl.js deleted file mode 100644 index da77df252e1..00000000000 --- a/public/app/features/datasources/list_ctrl.js +++ /dev/null @@ -1,36 +0,0 @@ -define([ - 'angular', - 'lodash', -], -function (angular) { - 'use strict'; - - var module = angular.module('grafana.controllers'); - - module.controller('DataSourcesCtrl', function($scope, $http, backendSrv, datasourceSrv) { - - $scope.init = function() { - $scope.datasources = []; - $scope.getDatasources(); - }; - - $scope.getDatasources = function() { - backendSrv.get('/api/datasources').then(function(results) { - $scope.datasources = results; - }); - }; - - $scope.remove = function(ds) { - backendSrv.delete('/api/datasources/' + ds.id).then(function() { - $scope.getDatasources(); - - backendSrv.get('/api/frontend/settings').then(function(settings) { - datasourceSrv.init(settings.datasources); - }); - }); - }; - - $scope.init(); - - }); -}); diff --git a/public/app/features/datasources/list_ctrl.ts b/public/app/features/datasources/list_ctrl.ts new file mode 100644 index 00000000000..b1f93f1a158 --- /dev/null +++ b/public/app/features/datasources/list_ctrl.ts @@ -0,0 +1,52 @@ +/// + +import angular from 'angular'; +import _ from 'lodash'; +import coreModule from '../../core/core_module'; + +export class DataSourcesCtrl { + datasources: any; + + /** @ngInject */ + constructor(private $scope, private $location, private $http, private backendSrv, private datasourceSrv) { + backendSrv.get('/api/datasources') + .then((result) => { + this.datasources = result; + }); + } + + removeDataSourceConfirmed(ds) { + + this.backendSrv.delete('/api/datasources/' + ds.id) + .then(() => { + this.$scope.appEvent('alert-success', ['Datasource deleted', '']); + }, () => { + this.$scope.appEvent('alert-error', ['Unable to delete datasource', '']); + }).then(() => { + this.backendSrv.get('/api/datasources') + .then((result) => { + this.datasources = result; + }); + this.backendSrv.get('/api/frontend/settings') + .then((settings) => { + this.datasourceSrv.init(settings.datasources); + }); + }); + } + + removeDataSource(ds) { + + this.$scope.appEvent('confirm-modal', { + title: 'Confirm delete datasource', + text: 'Are you sure you want to delete datasource ' + ds.name + '?', + yesText: "Delete", + icon: "fa-warning", + onConfirm: () => { + this.removeDataSourceConfirmed(ds); + } + }); + } + +} + +coreModule.controller('DataSourcesCtrl', DataSourcesCtrl); diff --git a/public/app/features/datasources/partials/list.html b/public/app/features/datasources/partials/list.html index fe1c7176b99..54276454be1 100644 --- a/public/app/features/datasources/partials/list.html +++ b/public/app/features/datasources/partials/list.html @@ -20,11 +20,11 @@
-
+
No data sources defined
- +
@@ -35,7 +35,7 @@ - + diff --git a/public/app/plugins/datasource/cloudwatch/partials/config.html b/public/app/plugins/datasource/cloudwatch/partials/config.html index 92a963da7c6..69ec729a160 100644 --- a/public/app/plugins/datasource/cloudwatch/partials/config.html +++ b/public/app/plugins/datasource/cloudwatch/partials/config.html @@ -29,5 +29,16 @@
+
+
    +
  • + Custom Metrics namespaceNamespaces of Custom Metrics +
  • +
  • + +
  • +
+
+
diff --git a/public/views/index.html b/public/views/index.html index 7c492c01480..e24d4ec6e7d 100644 --- a/public/views/index.html +++ b/public/views/index.html @@ -81,7 +81,7 @@ }]; - + diff --git a/tasks/build_task.js b/tasks/build_task.js index d844b661722..3ace8514164 100644 --- a/tasks/build_task.js +++ b/tasks/build_task.js @@ -8,6 +8,7 @@ module.exports = function(grunt) { 'jscs', 'tslint', 'clean:release', + 'copy:node_modules', 'copy:public_to_gen', 'typescript:build', 'karma:test', diff --git a/tasks/default_task.js b/tasks/default_task.js index 7877fc2a34b..033acb3921e 100644 --- a/tasks/default_task.js +++ b/tasks/default_task.js @@ -8,6 +8,7 @@ module.exports = function(grunt) { 'jshint', 'tslint', 'clean:gen', + 'copy:node_modules', 'copy:public_to_gen', 'phantomjs', 'css',
Name
  {{ds.name}} @@ -56,7 +56,7 @@ - +