mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
Prevent from setting a blank query title. Fixes #34
This commit is contained in:
parent
3cb8365ef3
commit
5c78760649
@ -262,7 +262,6 @@
|
||||
return $filter('refreshRateHumanize')(value);
|
||||
}
|
||||
}
|
||||
// id: 672,
|
||||
]
|
||||
$scope.tabs = [{"name": "My Queries", "key": "my"}, {"key": "all", "name": "All Queries"}, {"key": "drafts", "name": "Drafts"}];
|
||||
|
||||
|
@ -158,7 +158,10 @@ directives.directive('newWidgetForm', ['$http', function($http) {
|
||||
directives.directive('editInPlace', function () {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: { value: '=' },
|
||||
scope: {
|
||||
value: '=',
|
||||
ignoreBlanks: '='
|
||||
},
|
||||
template: '<span ng-click="edit()" ng-bind="value"></span><input ng-model="value"></input>',
|
||||
link: function ($scope, element, attrs) {
|
||||
// Let's get a reference to the input element, as we'll want to reference it.
|
||||
@ -172,6 +175,10 @@ directives.directive('editInPlace', function () {
|
||||
|
||||
// ng-click handler to activate edit-in-place
|
||||
$scope.edit = function () {
|
||||
if ($scope.ignoreBlanks) {
|
||||
$scope.oldValue = $scope.value;
|
||||
}
|
||||
|
||||
$scope.editing = true;
|
||||
|
||||
// We control display through a class on the directive itself. See the CSS.
|
||||
@ -184,6 +191,9 @@ directives.directive('editInPlace', function () {
|
||||
};
|
||||
|
||||
$(inputElement).blur(function() {
|
||||
if ($scope.ignoreBlanks && _.isEmpty($scope.value)) {
|
||||
$scope.value = $scope.oldValue;
|
||||
}
|
||||
$scope.editing = false;
|
||||
element.removeClass('active');
|
||||
})
|
||||
|
@ -3,14 +3,12 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">
|
||||
<span class="glyphicon glyphicon-pencil"></span> <edit-in-place value="query.name"></edit-in-place>
|
||||
<span class="glyphicon glyphicon-pencil"></span> <edit-in-place ignore-blanks='true' value="query.name"></edit-in-place>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<textarea ui-codemirror="editorOptions" ng-model="query.query"></textarea>
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<a class="btn btn-default" ng-disabled="queryExecuting || !queryResult.getData()" ng-href="{{dataUri}}" download="{{dataFilename}}" target="_self">
|
||||
<span class="glyphicon glyphicon-floppy-disk"></span> Download Data Set
|
||||
|
Loading…
Reference in New Issue
Block a user