Repository: ambari Updated Branches: refs/heads/branch-1.6.0.slider a1a9c4598 -> ac8a51cbf
AMBARI-5932. Slider apps table does not remove entry when app is removed (alexantonenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ac8a51cb Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ac8a51cb Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ac8a51cb Branch: refs/heads/branch-1.6.0.slider Commit: ac8a51cbfe5d8ef0d63354c65cc250b8a54359b3 Parents: a1a9c45 Author: Alex Antonenko <[email protected]> Authored: Thu May 29 22:27:38 2014 +0300 Committer: Alex Antonenko <[email protected]> Committed: Thu May 29 22:27:38 2014 +0300 ---------------------------------------------------------------------- .../main/resources/ui/app/mappers/slider_apps_mapper.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ac8a51cb/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 4f69ba2..488390b 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 @@ -127,7 +127,8 @@ App.SliderAppsMapper = App.Mapper.createWithMixins(App.RunPeriodically, { */ parse: function(data) { var apps = [], - self = this; + self = this, + appsToDelete = App.SliderApp.store.all('sliderApp').get('content').mapProperty('id'); data.items.forEach(function(app) { var componentsId = app.components ? self.parseComponents(app) : [], @@ -153,6 +154,15 @@ App.SliderAppsMapper = App.Mapper.createWithMixins(App.RunPeriodically, { runtimeProperties: app.configs }) ); + + appsToDelete.splice(appsToDelete.indexOf(app.id), 1); + }); + + appsToDelete.forEach(function (app) { + var appRecord = App.SliderApp.store.getById('sliderApp', app); + if(appRecord){ + appRecord.destroyRecord(); + } }); App.SliderApp.store.pushMany('sliderApp', apps); }
