mirror of https://github.com/grafana/grafana
parent
64973f1d57
commit
9dec50832d
@ -1,42 +0,0 @@ |
||||
define([ |
||||
'angular', |
||||
'app', |
||||
'lodash' |
||||
], |
||||
function (angular, app, _) { |
||||
'use strict'; |
||||
|
||||
var module = angular.module('grafana.controllers'); |
||||
|
||||
module.controller('PulldownCtrl', function($scope, $rootScope, $timeout) { |
||||
var _d = { |
||||
collapse: false, |
||||
notice: false, |
||||
enable: true |
||||
}; |
||||
|
||||
_.defaults($scope.pulldown,_d); |
||||
|
||||
$scope.init = function() { |
||||
// Provide a combined skeleton for panels that must interact with panel and row.
|
||||
// This might create name spacing issues.
|
||||
$scope.panel = $scope.pulldown; |
||||
$scope.row = $scope.pulldown; |
||||
}; |
||||
|
||||
$scope.toggle_pulldown = function(pulldown) { |
||||
pulldown.collapse = pulldown.collapse ? false : true; |
||||
if (!pulldown.collapse) { |
||||
$timeout(function() { |
||||
$scope.$broadcast('render'); |
||||
}); |
||||
} else { |
||||
$scope.row.notice = false; |
||||
} |
||||
}; |
||||
|
||||
$scope.init(); |
||||
|
||||
}); |
||||
|
||||
}); |
@ -0,0 +1,5 @@ |
||||
///<reference path="../headers/common.d.ts" />
|
||||
|
||||
import angular = require('angular'); |
||||
|
||||
export default angular.module('grafana.core', []); |
@ -0,0 +1,28 @@ |
||||
///<reference path="../../headers/common.d.ts" />
|
||||
|
||||
import angular = require('angular'); |
||||
import coreModule from '../core_module'; |
||||
|
||||
coreModule.directive('giveFocus', function() { |
||||
return function(scope, element, attrs) { |
||||
element.click(function(e) { |
||||
e.stopPropagation(); |
||||
}); |
||||
|
||||
scope.$watch(attrs.giveFocus, function (newValue) { |
||||
if (!newValue) { |
||||
return; |
||||
} |
||||
setTimeout(function() { |
||||
element.focus(); |
||||
var domEl = element[0]; |
||||
if (domEl.setSelectionRange) { |
||||
var pos = element.val().length * 2; |
||||
domEl.setSelectionRange(pos, pos); |
||||
} |
||||
}, 200); |
||||
}, true); |
||||
}; |
||||
}); |
||||
|
||||
export default {}; |
@ -1,29 +0,0 @@ |
||||
define([ |
||||
'angular' |
||||
], |
||||
function (angular) { |
||||
'use strict'; |
||||
|
||||
angular.module('grafana.directives').directive('giveFocus', function() { |
||||
return function(scope, element, attrs) { |
||||
element.click(function(e) { |
||||
e.stopPropagation(); |
||||
}); |
||||
|
||||
scope.$watch(attrs.giveFocus,function (newValue) { |
||||
if (!newValue) { |
||||
return; |
||||
} |
||||
setTimeout(function() { |
||||
element.focus(); |
||||
var domEl = element[0]; |
||||
if (domEl.setSelectionRange) { |
||||
var pos = element.val().length * 2; |
||||
domEl.setSelectionRange(pos, pos); |
||||
} |
||||
}, 200); |
||||
},true); |
||||
}; |
||||
}); |
||||
|
||||
}); |
Loading…
Reference in new issue