ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject git commit: AMBARI-7635. Slider View: configured with bad props, JS error (Max Shepel via onechiporenko)
Date Fri, 03 Oct 2014 16:16:24 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk def4c946b -> ac7030245


AMBARI-7635. Slider View: configured with bad props, JS error (Max Shepel via onechiporenko)


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

Branch: refs/heads/trunk
Commit: ac70302451872c9c25f8eda907e1b4d1299eec85
Parents: def4c94
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Fri Oct 3 19:12:26 2014 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Fri Oct 3 19:12:26 2014 +0300

----------------------------------------------------------------------
 .../app/controllers/application_controller.js   | 27 ++++++++++++++++++++
 .../ui/app/mappers/slider_apps_mapper.js        |  3 +++
 .../resources/ui/app/templates/application.hbs  |  2 +-
 .../resources/ui/app/views/application_view.js  |  7 +++--
 4 files changed, 36 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ac703024/contrib/views/slider/src/main/resources/ui/app/controllers/application_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/application_controller.js
b/contrib/views/slider/src/main/resources/ui/app/controllers/application_controller.js
new file mode 100644
index 0000000..7b5e025
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/application_controller.js
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+App.ApplicationController = Ember.Controller.extend({
+
+  /**
+   * Determines if Slider View instance has any configuration errors
+   * @type {boolean}
+   */
+  hasConfigErrors: false
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/ac703024/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 ac05646..74a679a 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
@@ -53,6 +53,7 @@ App.SliderAppsMapper = App.Mapper.createWithMixins(App.RunPeriodically,
{
       sender: this,
       success: 'parse'
     }).fail(function(jqXHR, textStatus){
+        App.__container__.lookup('controller:application').set('hasConfigErrors', true);
         if (!self.get('isWarningPopupShown')) {
           var message = textStatus === "timeout" ? "timeout" : jqXHR.responseText;
           self.set('isWarningPopupShown', true);
@@ -231,6 +232,8 @@ App.SliderAppsMapper = App.Mapper.createWithMixins(App.RunPeriodically,
{
       self = this,
       appsToDelete = App.SliderApp.store.all('sliderApp').get('content').mapProperty('id');
 
+    App.__container__.lookup('controller:application').set('hasConfigErrors', false);
+
     if (this.get('isWarningPopupShown')) {
       this.closeWarningPopup();
       this.set('isWarningPopupShown', false);

http://git-wip-us.apache.org/repos/asf/ambari/blob/ac703024/contrib/views/slider/src/main/resources/ui/app/templates/application.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/application.hbs b/contrib/views/slider/src/main/resources/ui/app/templates/application.hbs
index bb05287..54eb09b 100755
--- a/contrib/views/slider/src/main/resources/ui/app/templates/application.hbs
+++ b/contrib/views/slider/src/main/resources/ui/app/templates/application.hbs
@@ -35,7 +35,7 @@
 <div class="slider-header">
   {{#view view.SliderTitleView}}
       <h3 class="pull-left" id="slider-title"><span class="slider-app-title">{{App.label}}</span></h3>
-    {{#if view.isIndexPage}}
+    {{#if view.showCreateAppButton}}
       <div class="box-header pull-right">
         <div class="create-app">
           <a href="#" class="btn btn-primary" {{action createApp}}>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ac703024/contrib/views/slider/src/main/resources/ui/app/views/application_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/application_view.js b/contrib/views/slider/src/main/resources/ui/app/views/application_view.js
index e0c866f..8118a17 100644
--- a/contrib/views/slider/src/main/resources/ui/app/views/application_view.js
+++ b/contrib/views/slider/src/main/resources/ui/app/views/application_view.js
@@ -37,10 +37,13 @@ App.ApplicationView = Ember.View.extend({
       })
     }.property('content'),
 
-    isIndexPage: function () {
+    showCreateAppButton: function () {
+      if (this.get('controller.hasConfigErrors')) {
+        return false;
+      }
       var currentPath = this.get('controller.currentPath');
       return currentPath && (currentPath == 'slider_apps.index' || currentPath.indexOf('slider_apps.createAppWizard')
!= -1);
-    }.property('controller.currentPath'),
+    }.property('controller.currentPath', 'controller.hasConfigErrors'),
 
     /**
      * Set <code>popover</code> template


Mime
View raw message