Ver Fonte

AMBARI-12737. Add Service Wizard. After page refresh all left-menu items are available for a while (alexantonenko)

Alex Antonenko há 10 anos atrás
pai
commit
049bfa8a64
1 ficheiros alterados com 27 adições e 1 exclusões
  1. 27 1
      ambari-web/app/controllers/wizard.js

+ 27 - 1
ambari-web/app/controllers/wizard.js

@@ -56,12 +56,38 @@ App.WizardController = Em.Controller.extend(App.LocalStorage, App.ThemesMappingM
     this.setIsStepDisabled();
   },
 
+  connectOutlet:function(name, context) {
+    if (name !== 'loading') this.set('isStepDisabled.isLocked', false);
+    return this._super.apply(this,arguments);
+  },
+
   /**
    * Set <code>isStepDisabled</code> with list of available steps (basing on <code>totalSteps</code>)
    * @method setIsStepDisabled
    */
   setIsStepDisabled: function () {
-      this.set('isStepDisabled', []);
+      this.set('isStepDisabled', Ember.ArrayProxy.create({
+        content:[],
+        isLocked:true,
+        objectAtContent: function(idx) {
+            var obj = this.get('content').objectAt(idx);
+            if (obj && !obj.hasOwnProperty('isLocked')) {
+              obj.reopen({
+                isLocked:true,
+                get:function (key) {
+                  return (key === 'value' && this.get('isLocked')) || this._super.apply(this,arguments);
+                },
+                notifyValues:function () {
+                  this.notifyPropertyChange('value');
+                }.observes('isLocked')
+              });
+            }
+            return obj;
+        },
+        toggleLock:function () {
+          this.setEach('isLocked',this.get('isLocked'));
+        }.observes('isLocked')
+      }));
       this.get('isStepDisabled').pushObject(Em.Object.create({
         step: 1,
         value: false