Clean up after rebase

This commit is contained in:
Alex DeBrie 2016-03-24 02:46:59 +00:00
parent df2067eec1
commit ee29f07802
3 changed files with 2 additions and 86 deletions

View File

@ -108,8 +108,8 @@ angular.module('redash', [
});
$routeProvider.when('/destinations/:destinationId', {
templateurl: '/views/destinations/edit.html',
controller: 'destinationctrl'
templateUrl: '/views/destinations/edit.html',
controller: 'DestinationCtrl'
});
$routeProvider.when('/destinations', {
templateUrl: '/views/destinations/list.html',

View File

@ -156,7 +156,6 @@
growl.addSuccessMessage("Subscribed.");
$scope.subscribers.push($scope.sub);
}, function(response) {
console.log(response);
growl.addErrorMessage("Failed saving subscription.");
});
};

View File

@ -1,83 +0,0 @@
(function () {
'use strict';
var directives = angular.module('redash.directives');
// Angular strips data- from the directive, so data-source-form becomes sourceForm...
directives.directive('sourceForm', ['$http', 'growl', '$q', function ($http, growl, $q) {
return {
restrict: 'E',
replace: true,
templateUrl: '/views/data_sources/form.html',
scope: {
'dataSource': '='
},
link: function ($scope) {
var setType = function(types) {
if ($scope.dataSource.type === undefined) {
$scope.dataSource.type = types[0].type;
return types[0];
}
$scope.type = _.find(types, function (t) {
return t.type == $scope.dataSource.type;
});
};
$scope.files = {};
$scope.$watchCollection('files', function() {
_.each($scope.files, function(v, k) {
if (v) {
$scope.dataSource.options[k] = v.base64;
}
});
});
var typesPromise = $http.get('api/data_sources/types');
$q.all([typesPromise, $scope.dataSource.$promise]).then(function(responses) {
var types = responses[0].data;
setType(types);
$scope.dataSourceTypes = types;
_.each(types, function (type) {
_.each(type.configuration_schema.properties, function (prop, name) {
if (name == 'password' || name == 'passwd') {
prop.type = 'password';
}
if (_.string.endsWith(name, "File")) {
prop.type = 'file';
}
if (prop.type == 'boolean') {
prop.type = 'checkbox';
}
prop.required = _.contains(type.configuration_schema.required, name);
});
});
});
$scope.$watch('dataSource.type', function(current, prev) {
if (prev !== current) {
if (prev !== undefined) {
$scope.dataSource.options = {};
}
setType($scope.dataSourceTypes);
}
});
$scope.saveChanges = function() {
$scope.dataSource.$save(function() {
growl.addSuccessMessage("Saved.");
}, function() {
growl.addErrorMessage("Failed saving.");
});
}
}
}
}]);
})();