You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2016/02/16 19:30:41 UTC
[36/50] [abbrv] ambari git commit: AMBARI-15049 Sometimes background
operations have incorrect order. (atkach)
AMBARI-15049 Sometimes background operations have incorrect order. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7f3928ba
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7f3928ba
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7f3928ba
Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7f3928bad958f9c57bb21afd43634e3d9ddfedff
Parents: c86964b
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Mon Feb 15 17:24:48 2016 +0200
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Mon Feb 15 17:48:35 2016 +0200
----------------------------------------------------------------------
.../global/background_operations_controller.js | 15 +++++++++++----
ambari-web/app/utils/host_progress_popup.js | 10 ++++++----
.../global/background_operations_test.js | 16 ++++++++++++++++
3 files changed, 33 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7f3928ba/ambari-web/app/controllers/global/background_operations_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/background_operations_controller.js b/ambari-web/app/controllers/global/background_operations_controller.js
index 76c517c..4156e46 100644
--- a/ambari-web/app/controllers/global/background_operations_controller.js
+++ b/ambari-web/app/controllers/global/background_operations_controller.js
@@ -261,19 +261,26 @@ App.BackgroundOperationsController = Em.Controller.extend({
this.set('isShowMoreAvailable', countGot >= countIssued);
this.set('serviceTimestamp', App.dateTimeWithTimeZone());
},
+
isShowMoreAvailable: null,
+
/**
* remove old requests
* as API returns 10, or 20 , or 30 ...etc latest request, the requests that absent in response should be removed
* @param currentRequestIds
*/
removeOldRequests: function (currentRequestIds) {
- this.get('services').forEach(function (service, index, services) {
- if (!currentRequestIds.contains(service.id)) {
- services.splice(index, 1);
+ var services = this.get('services');
+
+ for (var i = 0, l = services.length; i < l; i++) {
+ if (!currentRequestIds.contains(services[i].id)) {
+ services.splice(i, 1);
+ i--;
+ l--;
}
- });
+ }
},
+
/**
* identify whether request is running by task counters
* @param request
http://git-wip-us.apache.org/repos/asf/ambari/blob/7f3928ba/ambari-web/app/utils/host_progress_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/host_progress_popup.js b/ambari-web/app/utils/host_progress_popup.js
index 726a96a..395afb5 100644
--- a/ambari-web/app/utils/host_progress_popup.js
+++ b/ambari-web/app/utils/host_progress_popup.js
@@ -523,11 +523,13 @@ App.HostPopup = Em.Object.create({
* @method removeOldServices
*/
removeOldServices: function (services, currentServicesIds) {
- services.forEach(function (service, index, services) {
- if (!currentServicesIds.contains(service.id)) {
- services.removeAt(index, 1);
+ for (var i = 0, l = services.length; i < l; i++) {
+ if (!currentServicesIds.contains(services[i].id)) {
+ services.splice(i, 1);
+ i--;
+ l--;
}
- });
+ }
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/7f3928ba/ambari-web/test/controllers/global/background_operations_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/background_operations_test.js b/ambari-web/test/controllers/global/background_operations_test.js
index 445eeb0..b22c105 100644
--- a/ambari-web/test/controllers/global/background_operations_test.js
+++ b/ambari-web/test/controllers/global/background_operations_test.js
@@ -310,6 +310,22 @@ describe('App.BackgroundOperationsController', function () {
result: [
{id: 2}
]
+ },
+ {
+ title: 'two old request and two current',
+ content: {
+ currentRequestIds: [3, 4],
+ services: [
+ {id: 1},
+ {id: 2},
+ {id: 3},
+ {id: 4}
+ ]
+ },
+ result: [
+ {id: 3},
+ {id: 4}
+ ]
}
];