Prechádzať zdrojové kódy

AMBARI-3258. Provide UI page to enable/disable experimental functionality. (srimanth)

Srimanth Gunturi 11 rokov pred
rodič
commit
288ae2a556

+ 12 - 0
ambari-web/app/router.js

@@ -383,6 +383,18 @@ App.Router = Em.Router.extend({
     installer: require('routes/installer'),
 
     main: require('routes/main'),
+    
+    experimental: Em.Route.extend({
+      route: '/experimental',
+      enter: function (router, context) {
+        
+      },
+      connectOutlets: function (router, context) {
+        $('title').text("Ambari Experimental");
+        console.log('/experimental:connectOutlet');
+        router.get('applicationController').connectOutlet('experimental');
+      }
+    }),
 
     logoff: function (router, context) {
       router.logOff(context);

+ 68 - 0
ambari-web/app/templates/experimental.hbs

@@ -0,0 +1,68 @@
+{{!
+* 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.
+}}
+
+<div class="alert alert-error">
+  <h2>Ambari's Experimental Functionality</h2>
+  <p>
+    <span class="label label-important">Important</span> <strong>Changes made here are neither tested nor supported by Ambari</strong>
+  </p>
+  <p>
+    Ambari's experimental functionality is provided <strong>as-is</strong>.<br>
+    Any changes will effect application behavior, including data corruption. Users making changes do so at their own risk.<br>
+    Experimental functionality can be modified or removed at any time without notice.
+  </p>  
+</div>
+    
+{{#if App}}
+  {{#if App.supports}}
+    <table class="table table-bordered table-striped">
+      <thead>
+        <tr>
+          <td style="width: 20%; font-weight: bold;">Experimental Functionality</td>
+          <td style="width: 20%; font-weight: bold;">Enabled?</td>
+          <td style="width: 60%; font-weight: bold;">Description</td>
+        </tr>
+      </thead>
+      <tbody>
+		    {{#each support in view.supports}}
+		      <tr>
+		        <td>{{support.name}}</td>
+		        <td>{{view Ember.Checkbox checkedBinding="support.selected"}}</td>
+		        <td></td>
+			    </tr>
+		    {{/each}}
+    </tbody>
+    </table>
+    <div class="control-group" style="margin-bottom: 100px;">
+	    <div class="controls pull-right">
+	      <button class="btn" {{action doCancel target="view"}}>{{t form.cancel}}</button>
+	      <button class="btn btn-primary" {{action doSave target="view"}}>{{t common.save}}</button>
+	    </div>
+	  </div>
+  {{else}}
+    <div class="alert alert-error">
+      No application supports found. Please login to Ambari and revisit this page.
+    </div>
+  {{/if}}
+{{else}}
+  <div class="alert alert-error">
+    No application found. Please login to Ambari and revisit this page.
+  </div>
+{{/if}}
+
+

+ 1 - 0
ambari-web/app/views.js

@@ -226,3 +226,4 @@ require('views/wizard/stack_upgrade/step2_view');
 require('views/wizard/stack_upgrade/step3_view');
 require('views/loading');
 
+require('views/experimental');

+ 47 - 0
ambari-web/app/views/experimental.js

@@ -0,0 +1,47 @@
+/**
+ * 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.
+ */
+
+var App = require('app');
+
+App.ExperimentalView = Em.View.extend({
+  templateName: require('templates/experimental'),
+  supports: function () {
+    var supports = [];
+    for ( var sup in App.supports) {
+      supports.push(Ember.Object.create({
+        name: sup,
+        selected: App.supports[sup]
+      }));
+    }
+    return supports;
+  }.property('App.supports'),
+
+  doSave: function () {
+    var supports = this.get('supports');
+    supports.forEach(function(s){
+      var propName = 'App.supports.' + s.get('name');
+      var propValue = s.get('selected');
+      console.log(">>>>>>>> " + propName + " = "+ propValue)
+      Ember.set(propName, propValue);
+    });
+    App.router.transitionTo('root.index');
+  },
+
+  doCancel: function () {
+    App.router.transitionTo('root.index');
+  }
+});