mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge branch 'master' into develop
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
define([
|
||||
'../core_module',
|
||||
],
|
||||
function (coreModule) {
|
||||
'use strict';
|
||||
|
||||
coreModule.default.directive('confirmClick', function() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
link: function(scope, elem, attrs) {
|
||||
elem.bind('click', function() {
|
||||
var message = attrs.confirmation || "Are you sure you want to do that?";
|
||||
if (window.confirm(message)) {
|
||||
var action = attrs.confirmClick;
|
||||
if (action) {
|
||||
scope.$apply(scope.$eval(action));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,8 @@
|
||||
define([
|
||||
'../core_module',
|
||||
'app/core/utils/rangeutil',
|
||||
],
|
||||
function (coreModule, rangeUtil) {
|
||||
'use strict';
|
||||
import coreModule from '../core_module';
|
||||
import * as rangeUtil from 'app/core/utils/rangeutil';
|
||||
|
||||
coreModule.default.directive('ngModelOnblur', function() {
|
||||
export class NgModelOnBlur {
|
||||
constructor() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
priority: 1,
|
||||
@@ -23,22 +20,27 @@ function (coreModule, rangeUtil) {
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.default.directive('emptyToNull', function () {
|
||||
|
||||
export class EmptyToNull {
|
||||
constructor() {
|
||||
return {
|
||||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
link: function (scope, elm, attrs, ctrl) {
|
||||
ctrl.$parsers.push(function (viewValue) {
|
||||
if(viewValue === "") { return null; }
|
||||
if (viewValue === "") { return null; }
|
||||
return viewValue;
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.default.directive('validTimeSpan', function() {
|
||||
export class ValidTimeSpan {
|
||||
constructor() {
|
||||
return {
|
||||
require: 'ngModel',
|
||||
link: function(scope, elm, attrs, ctrl) {
|
||||
@@ -54,5 +56,9 @@ function (coreModule, rangeUtil) {
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
coreModule.directive('ngModelOnblur', NgModelOnBlur);
|
||||
coreModule.directive('emptyToNull', EmptyToNull);
|
||||
coreModule.directive('validTimeSpan', ValidTimeSpan);
|
||||
Reference in New Issue
Block a user