Skip to content
Permalink
Browse files
AMBARI-25066 Update AngularJS version to 1.7.5 due to known vulnerabi…
…lities
  • Loading branch information
atkach committed Dec 26, 2018
1 parent 563d508 commit a030fe12d62f7a74c4602b2110c5df438dc82403
Show file tree
Hide file tree
Showing 26 changed files with 145 additions and 184 deletions.
@@ -87,47 +87,6 @@ angular.module('ambariAdminConsole', [
}]);
$httpProvider.interceptors.push('TimestampHttpInterceptor');

$provide.decorator('ngFormDirective', ['$delegate', function($delegate) {
var ngForm = $delegate[0], controller = ngForm.controller;
ngForm.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) {
var $interpolate = $injector.get('$interpolate');
attrs.$set('name', $interpolate(attrs.name || '')(scope));
$injector.invoke(controller, this, {
'$scope': scope,
'$element': element,
'$attrs': attrs
});
}];
return $delegate;
}]);

$provide.decorator('ngModelDirective', ['$delegate', function($delegate) {
var ngModel = $delegate[0], controller = ngModel.controller;
ngModel.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) {
var $interpolate = $injector.get('$interpolate');
attrs.$set('name', $interpolate(attrs.name || '')(scope));
$injector.invoke(controller, this, {
'$scope': scope,
'$element': element,
'$attrs': attrs
});
}];
return $delegate;
}]);

$provide.decorator('formDirective', ['$delegate', function($delegate) {
var form = $delegate[0], controller = form.controller;
form.controller = ['$scope', '$element', '$attrs', '$injector', function(scope, element, attrs, $injector) {
var $interpolate = $injector.get('$interpolate');
attrs.$set('name', $interpolate(attrs.name || attrs.ngForm || '')(scope));
$injector.invoke(controller, this, {
'$scope': scope,
'$element': element,
'$attrs': attrs
});
}];
return $delegate;
}]);

$provide.decorator('$exceptionHandler', ['$delegate', 'Utility', '$window', function ($delegate, Utility, $window) {
return function (error, cause) {
@@ -44,6 +44,8 @@ angular.module('ambariAdminConsole')

Utility.getUserPref('user-pref-' + Auth.getCurrentUser() + '-supports').then(function (data) {
$rootScope.supports = data.data ? data.data : {};
}).catch(function() {
console.warn('user-pref-' + Auth.getCurrentUser() + '-supports is missing');
});

$http.get(Settings.baseUrl + '/users/' + Auth.getCurrentUser() + '/authorizations?fields=*')
@@ -262,7 +262,7 @@ angular.module('ambariAdminConsole')
}
});
return View.updateInstance($routeParams.viewId, $routeParams.version, $routeParams.instanceId, data)
.success(function() {
.then(function() {
if( callback ){
callback();
} else {
@@ -293,7 +293,7 @@ angular.module('ambariAdminConsole')
}
};
return View.updateInstance($routeParams.viewId, $routeParams.version, $routeParams.instanceId, data)
.success(function() {
.then(function() {
$scope.$root.$emit('instancesUpdate');
if( callback ){
callback();
@@ -358,7 +358,7 @@ angular.module('ambariAdminConsole')

$scope.originalClusterType = $scope.data.clusterType;
return View.updateInstance($routeParams.viewId, $routeParams.version, $routeParams.instanceId, data)
.success(function() {
.then(function() {
$scope.editConfigurationDisabled = true;
$scope.propertiesForm.$setPristine();
})
@@ -82,7 +82,7 @@ function ($scope, $routeParams, $translate, RemoteCluster, Settings, Pagination,
Filters.initFilterOptions($scope.filters, $scope.remoteClusters);
})
.catch(function (data) {
console.error($t('remoteClusters.alerts.fetchError'), data);
console.warn($t('remoteClusters.alerts.fetchError'), data);
});
}

@@ -28,7 +28,7 @@ angular.module('ambariAdminConsole')
id: '@'
},

template: '<a href="#{{href}}" ng-transclude></a>',
template: '<a href="#!{{href}}" ng-transclude></a>',
controller: ['$scope', 'ROUTES', function($scope, ROUTES) {
var route = ROUTES;
angular.forEach($scope.route.split('.'), function(routeObj) {
@@ -122,8 +122,8 @@ angular.module('ambariAdminConsole')
'PermissionInfo/resource_name': 'CLUSTER'
}
})
.success(function(data) {
deferred.resolve(data.items);
.then(function(data) {
deferred.resolve(data.data.items);
})
.catch(function(data) {
deferred.reject(data); });
@@ -164,9 +164,9 @@ angular.module('ambariAdminConsole')
fields: 'PermissionInfo/*,authorizations/AuthorizationInfo/*'
}
})
.success(function (data) {
rolesWithAuthorizations = data.items;
deferred.resolve(data.items);
.then(function (data) {
rolesWithAuthorizations = data.data.items;
deferred.resolve(data.data.items);
})
.catch(function (data) {
deferred.reject(data);
@@ -186,8 +186,8 @@ angular.module('ambariAdminConsole')
'fields': 'privileges/PrivilegeInfo'
}
})
.success(function(data) {
deferred.resolve(data.privileges);
.then(function(data) {
deferred.resolve(data.data.privileges);
})
.catch(function(data) {
deferred.reject(data);
@@ -205,8 +205,8 @@ angular.module('ambariAdminConsole')
method : 'GET',
url : Settings.baseUrl + endpoint + '?' + 'fields=privileges/PrivilegeInfo/*' + nameFilter
})
.success(function(data) {
deferred.resolve(data);
.then(function(data) {
deferred.resolve(data.data);
})
.catch(function(data) {
deferred.reject(data);
@@ -265,8 +265,8 @@ angular.module('ambariAdminConsole')
method: 'GET',
url: Settings.baseUrl + '/clusters/' + clusterName + '?' + 'format=blueprint'
})
.success(function(data) {
deferred.resolve(data);
.then(function(data) {
deferred.resolve(data.data);
})
.catch(function(data) {
deferred.reject(data);
@@ -279,8 +279,8 @@ angular.module('ambariAdminConsole')
var url = Settings.baseUrl + '/clusters/' + clusterName +
'/stack_versions?fields=*&ClusterStackVersions/repository_version=' + repoId;
$http.get(url, {mock: 'cluster/repoVersionStatus.json'})
.success(function (data) {
data = data.items;
.then(function (data) {
data = data.data.items;
var response = {};
if (data.length > 0) {
var hostStatus = data[0].ClusterStackVersions.host_states;
@@ -56,10 +56,10 @@ angular.module('ambariAdminConsole')
Group.prototype.destroy = function() {
var deferred = $q.defer();
$http.delete(Settings.baseUrl + '/groups/' +this.group_name)
.success(function() {
.then(function() {
deferred.resolve();
})
.error(function(data) {
.catch(function(data) {
deferred.reject(data);
});

@@ -83,10 +83,10 @@ angular.module('ambariAdminConsole')
url: Settings.baseUrl + '/groups/' + this.group_name + '/members',
data: members
})
.success(function(data) {
deferred.resolve(data);
.then(function(data) {
deferred.resolve(data.data);
})
.error(function(data) {
.catch(function(data) {
deferred.reject(data);
});
return deferred.promise;
@@ -104,10 +104,10 @@ angular.module('ambariAdminConsole')
var deferred = $q.defer();

$http.get(Settings.baseUrl + '/groups?fields=*')
.success(function(data) {
deferred.resolve(data.items);
.then(function(data) {
deferred.resolve(data.data.items);
})
.error(function(data) {
.catch(function(data) {
deferred.reject(data);
});

@@ -134,8 +134,8 @@ angular.module('ambariAdminConsole')
method: 'GET',
url: Settings.baseUrl + '/groups/' + group_name +
'?fields=Groups,privileges/PrivilegeInfo/*,members/MemberInfo'
}).success(function (data) {
deferred.resolve(Group.makeGroup(data));
}).then(function (data) {
deferred.resolve(Group.makeGroup(data.data));
});

return deferred.promise;
@@ -27,10 +27,10 @@ angular.module('ambariAdminConsole')
var deferred = $q.defer();

$http.put(Settings.baseUrl + '/remoteclusters/' + payload.ClusterInfo.name , payload, config)
.success(function (data) {
deferred.resolve(data)
.then(function (data) {
deferred.resolve(data.data)
})
.error(function (data) {
.catch(function (data) {
deferred.reject(data);
});
return deferred.promise;
@@ -41,10 +41,10 @@ angular.module('ambariAdminConsole')
var deferred = $q.defer();

$http.get( Settings.baseUrl + '/remoteclusters/' + clusterName)
.success(function(response) {
deferred.resolve(response);
.then(function(response) {
deferred.resolve(response.data);
})
.error(function(data) {
.catch(function(data) {
deferred.reject(data);
});

@@ -56,10 +56,10 @@ angular.module('ambariAdminConsole')
var deferred = $q.defer();

$http.delete( Settings.baseUrl + '/remoteclusters/' + clusterName)
.success(function(response) {
deferred.resolve(response);
.then(function(response) {
deferred.resolve(response.data);
})
.error(function(data) {
.catch(function(data) {
deferred.reject(data);
});

@@ -71,10 +71,10 @@ angular.module('ambariAdminConsole')
var deferred = $q.defer();

$http.post(Settings.baseUrl + '/remoteclusters/' + payload.ClusterInfo.name , payload, config)
.success(function (data) {
deferred.resolve(data)
.then(function (data) {
deferred.resolve(data.data)
})
.error(function (data) {
.catch(function (data) {
deferred.reject(data);
});
return deferred.promise;
@@ -84,10 +84,10 @@ angular.module('ambariAdminConsole')
var deferred = $q.defer();

$http.get(Settings.baseUrl + "/remoteclusters")
.success(function(response) {
deferred.resolve(response);
.then(function(response) {
deferred.resolve(response.data);
})
.error(function(data) {
.catch(function(data) {
deferred.reject(data);
});
return deferred.promise;
@@ -100,10 +100,10 @@ angular.module('ambariAdminConsole')
+ 'fields=versions%2Finstances/ViewInstanceInfo/cluster_handle,versions%2Finstances/ViewInstanceInfo/cluster_type&versions%2FViewVersionInfo%2Fsystem=false&versions%2Finstances/ViewInstanceInfo/cluster_type=REMOTE_AMBARI&versions%2Finstances/ViewInstanceInfo/cluster_handle=' + clustername

)
.success(function(response) {
deferred.resolve(response);
.then(function(response) {
deferred.resolve(response.data);
})
.error(function(data) {
.catch(function(data) {
deferred.reject(data);
});
return deferred.promise;
@@ -114,10 +114,10 @@ angular.module('ambariAdminConsole')

/* TODO :: Add params like RemoteCluster.matches and &from , &page_size */
$http.get(Settings.baseUrl + "/remoteclusters?fields=ClusterInfo/services,ClusterInfo/cluster_id")
.success(function(response) {
deferred.resolve(response.items);
.then(function(response) {
deferred.resolve(response.data.items);
})
.error(function(data) {
.catch(function(data) {
deferred.reject(data);
});
return deferred.promise;

0 comments on commit a030fe1

Please sign in to comment.