Refresh data when target was changed.
This commit is contained in:
@@ -160,7 +160,7 @@
|
|||||||
ng-model="target.item.filter"
|
ng-model="target.item.filter"
|
||||||
bs-typeahead="getItemNames"
|
bs-typeahead="getItemNames"
|
||||||
ng-change="onTargetPartChange(target.item)"
|
ng-change="onTargetPartChange(target.item)"
|
||||||
ng-blur="parseTarget()"
|
ng-blur="onItemBlur()"
|
||||||
data-min-length=0
|
data-min-length=0
|
||||||
data-items=100
|
data-items=100
|
||||||
class="input-large tight-form-input"
|
class="input-large tight-form-input"
|
||||||
|
|||||||
@@ -55,8 +55,6 @@ define([
|
|||||||
$scope.itserviceList = [{name: "test"}];
|
$scope.itserviceList = [{name: "test"}];
|
||||||
$scope.updateITServiceList();
|
$scope.updateITServiceList();
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.target.errors = validateTarget($scope.target);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.initFilters = function () {
|
$scope.initFilters = function () {
|
||||||
@@ -189,22 +187,36 @@ define([
|
|||||||
// Handle group blur and filter hosts
|
// Handle group blur and filter hosts
|
||||||
$scope.onGroupBlur = function() {
|
$scope.onGroupBlur = function() {
|
||||||
$scope.metric.filteredHosts = $scope.filterHosts();
|
$scope.metric.filteredHosts = $scope.filterHosts();
|
||||||
|
$scope.parseTarget();
|
||||||
|
$scope.get_data();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle host blur and filter applications
|
// Handle host blur and filter applications
|
||||||
$scope.onHostBlur = function() {
|
$scope.onHostBlur = function() {
|
||||||
$scope.metric.filteredApplications = $scope.filterApplications();
|
$scope.metric.filteredApplications = $scope.filterApplications();
|
||||||
|
$scope.parseTarget();
|
||||||
|
$scope.get_data();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Handle application blur and filter items
|
// Handle application blur and filter items
|
||||||
$scope.onApplicationBlur = function() {
|
$scope.onApplicationBlur = function() {
|
||||||
$scope.metric.filteredItems = $scope.filterItems();
|
$scope.metric.filteredItems = $scope.filterItems();
|
||||||
|
$scope.parseTarget();
|
||||||
|
$scope.get_data();
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.onItemBlur = function () {
|
||||||
|
$scope.parseTarget();
|
||||||
|
$scope.get_data();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.parseTarget = function() {
|
$scope.parseTarget = function() {
|
||||||
// Parse target
|
// Parse target
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Validate target and set validation info
|
||||||
|
$scope.validateTarget = function () {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switch query editor to specified mode.
|
* Switch query editor to specified mode.
|
||||||
* Modes:
|
* Modes:
|
||||||
@@ -228,7 +240,6 @@ define([
|
|||||||
|
|
||||||
$scope.targetBlur = function () {
|
$scope.targetBlur = function () {
|
||||||
setItemAlias();
|
setItemAlias();
|
||||||
$scope.target.errors = validateTarget($scope.target);
|
|
||||||
if (!_.isEqual($scope.oldTarget, $scope.target) && _.isEmpty($scope.target.errors)) {
|
if (!_.isEqual($scope.oldTarget, $scope.target) && _.isEmpty($scope.target.errors)) {
|
||||||
$scope.oldTarget = angular.copy($scope.target);
|
$scope.oldTarget = angular.copy($scope.target);
|
||||||
$scope.get_data();
|
$scope.get_data();
|
||||||
@@ -239,7 +250,6 @@ define([
|
|||||||
* Call when IT service is selected.
|
* Call when IT service is selected.
|
||||||
*/
|
*/
|
||||||
$scope.selectITService = function () {
|
$scope.selectITService = function () {
|
||||||
$scope.target.errors = validateTarget($scope.target);
|
|
||||||
if (!_.isEqual($scope.oldTarget, $scope.target) && _.isEmpty($scope.target.errors)) {
|
if (!_.isEqual($scope.oldTarget, $scope.target) && _.isEmpty($scope.target.errors)) {
|
||||||
$scope.oldTarget = angular.copy($scope.target);
|
$scope.oldTarget = angular.copy($scope.target);
|
||||||
$scope.get_data();
|
$scope.get_data();
|
||||||
@@ -279,18 +289,6 @@ define([
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
|
||||||
// VALIDATION
|
|
||||||
//////////////////////////////
|
|
||||||
|
|
||||||
function validateTarget(target) {
|
|
||||||
var errs = {};
|
|
||||||
if (!target) {
|
|
||||||
errs = 'Not defined';
|
|
||||||
}
|
|
||||||
return errs;
|
|
||||||
}
|
|
||||||
|
|
||||||
$scope.init();
|
$scope.init();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user