Repository: ambari Updated Branches: refs/heads/trunk 45adeff46 -> 66848d4d6
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/66848d4d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/66848d4d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/66848d4d Branch: refs/heads/trunk Commit: 66848d4d693dcfcb83e846f65d6fd1dd75a604d5 Parents: 45adeff Author: Alex Antonenko <[email protected]> Authored: Thu May 29 22:12:15 2014 +0300 Committer: Alex Antonenko <[email protected]> Committed: Thu May 29 22:12:15 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/66848d4d/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); }
