AMBARI-10012. Slider View. UI can't recreate new app with same name (page refresh fixes the issue) (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e8daa485 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e8daa485 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e8daa485 Branch: refs/heads/trunk Commit: e8daa485f66d4c14d21d81101e79ab21ae5b3d7e Parents: fea3315 Author: Alex Antonenko <[email protected]> Authored: Tue Mar 10 20:32:33 2015 +0200 Committer: Alex Antonenko <[email protected]> Committed: Tue Mar 10 23:42:00 2015 +0200 ---------------------------------------------------------------------- .../resources/ui/app/controllers/slider_app_controller.js | 7 +++++-- .../src/main/resources/ui/app/mappers/slider_apps_mapper.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/e8daa485/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js index 0684e53..bdebf13 100644 --- a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js +++ b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_app_controller.js @@ -350,9 +350,10 @@ App.SliderAppController = Ember.ObjectController.extend(App.AjaxErrorHandler, { name: 'destroyApp', sender: this, data: { + model: this.get('model'), id: this.get('model.id') }, - complete: 'destroyCompleteCallback', + success: 'destroySuccessCallback', error: 'actionErrorCallback' }); }, @@ -361,7 +362,9 @@ App.SliderAppController = Ember.ObjectController.extend(App.AjaxErrorHandler, { * Complete-callback for "destroy app"-request * @method destroyCompleteCallback */ - destroyCompleteCallback: function() { + destroySuccessCallback: function(data, opt, params) { + params.model.deleteRecord(); + this.store.dematerializeRecord(params.model); this.transitionToRoute('slider_apps'); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/e8daa485/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 4b3fae2..44ea18d 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 @@ -282,7 +282,7 @@ App.SliderAppsMapper = App.Mapper.createWithMixins(App.RunPeriodically, { appsToDelete.forEach(function (app) { var appRecord = App.SliderApp.store.getById('sliderApp', app); if (appRecord) { - appRecord.destroyRecord(); + appRecord.deleteRecord(); } }); apps.forEach(function(app) {
