ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject [1/2] git commit: AMBARI-7861. Apps table contains two apps with equal names after app start. (onechiporenko)
Date Mon, 20 Oct 2014 17:51:56 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk d54b747ae -> 7711dadb2


AMBARI-7861. Apps table contains two apps with equal names after app start. (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/06f9816b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/06f9816b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/06f9816b

Branch: refs/heads/trunk
Commit: 06f9816b7eff019c2e2e5f0ef6e0453e6effd2c6
Parents: 5dd65e5
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Mon Oct 20 17:30:58 2014 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Mon Oct 20 17:30:58 2014 +0300

----------------------------------------------------------------------
 .../ui/app/mappers/slider_apps_mapper.js        |  5 ++-
 .../unit/mappers/slider_apps_mapper_test.js     | 32 +++++++++++++++++++-
 2 files changed, 33 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/06f9816b/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
b/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
index 2d724eb..4718654 100644
--- a/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
+++ b/contrib/views/slider/src/main/resources/ui/app/mappers/slider_apps_mapper.js
@@ -230,7 +230,7 @@ App.SliderAppsMapper = App.Mapper.createWithMixins(App.RunPeriodically,
{
   parse: function (data) {
     var apps = [],
       self = this,
-      appsToDelete = App.SliderApp.store.all('sliderApp').get('content').mapProperty('id');
+      appsToDelete = App.SliderApp.store.all('sliderApp').mapBy('id');
 
     App.__container__.lookup('controller:application').set('hasConfigErrors', false);
 
@@ -277,9 +277,8 @@ App.SliderAppsMapper = App.Mapper.createWithMixins(App.RunPeriodically,
{
         })
       );
 
-      appsToDelete.splice(appsToDelete.indexOf(app.id), 1);
+      appsToDelete = appsToDelete.without(app.id);
     });
-
     appsToDelete.forEach(function (app) {
       var appRecord = App.SliderApp.store.getById('sliderApp', app);
       if (appRecord) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/06f9816b/contrib/views/slider/src/main/resources/ui/test/unit/mappers/slider_apps_mapper_test.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/test/unit/mappers/slider_apps_mapper_test.js
b/contrib/views/slider/src/main/resources/ui/test/unit/mappers/slider_apps_mapper_test.js
index 8c02e71..012951f 100644
--- a/contrib/views/slider/src/main/resources/ui/test/unit/mappers/slider_apps_mapper_test.js
+++ b/contrib/views/slider/src/main/resources/ui/test/unit/mappers/slider_apps_mapper_test.js
@@ -28,7 +28,7 @@ QUnit.module('App.SliderAppsMapper', {
 
 });
 
-test('App.SliderAppsMapper.parseQuickLinks', function () {
+test('parseQuickLinks', function () {
 
   var mapper = App.SliderAppsMapper;
 
@@ -53,3 +53,33 @@ test('App.SliderAppsMapper.parseQuickLinks', function () {
   equal(mapper.get('result')[0].get('id'), 'YARN application 1', 'model id set correctly');
 
 });
+
+test('parse | add/remove apps', function () {
+
+  Em.run(function () {
+
+    App.SliderAppsMapper.parse({
+      items: [
+        {id: '1', type: 't1'},
+        {id: '2', type: 't2'}
+      ]
+    });
+
+  });
+
+  deepEqual(App.SliderApp.store.all('sliderApp').mapBy('id'), ['1', '2'], 'Mapped all apps');
+
+  Em.run(function () {
+
+    App.SliderAppsMapper.parse({
+      items: [
+        {id: '2', type: 't2'},
+        {id: '3', type: 't3'}
+      ]
+    });
+
+  });
+
+  deepEqual(App.SliderApp.store.all('sliderApp').mapBy('id'), ['2', '3'], 'Delete not-existing
app and add new');
+
+});
\ No newline at end of file


Mime
View raw message