You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2012/10/04 01:49:00 UTC

svn commit: r1393835 [2/2] - in /incubator/ambari/branches/AMBARI-666: ./ ambari-web/app/ ambari-web/app/controllers/ ambari-web/app/controllers/installer/ ambari-web/app/controllers/main/ ambari-web/app/controllers/main/admin/ ambari-web/app/controlle...

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/security.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/security.hbs?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/security.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/security.hbs Wed Oct  3 23:48:57 2012
@@ -17,7 +17,7 @@
 -->
 
 <h5>{{t admin.security.title}}<i class="icon-question-sign"></i></h5>
-<div class="row">
+<div>
   <button class="btn">
     <i class="icon-lock"></i>
     {{t admin.security.button.enable}}

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/user.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/user.hbs?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/user.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/user.hbs Wed Oct  3 23:48:57 2012
@@ -19,7 +19,7 @@
 {{#if view.ldapUser}}
   <p class="text-info">{{t admin.users.ldapAuthentionUsed}}.</p>
 {{else}}
-<table class="table table-bordered span5">
+<table class="table table-bordered table-striped span5">
   <thead>
   <tr>
     <th>ID (test)</th>

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/user/edit.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/user/edit.hbs?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/user/edit.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/admin/user/edit.hbs Wed Oct  3 23:48:57 2012
@@ -27,8 +27,10 @@
   </div>
   {{/each}}
   <div class="control-group">
-    <button type="submit" class="btn" {{action gotoUsers}}>{{t form.cancel}}</button>
-    <button type="submit"
-            class="btn btn-primary" {{action create target="view"}}>{{view.userForm.saveButtonText}}</button>
+    <div class="controls">
+      <button type="submit" class="btn" {{action gotoUsers}}>{{t form.cancel}}</button>
+      <button type="submit"
+              class="btn btn-primary" {{action create target="view"}}>{{view.userForm.saveButtonText}}</button>
+    </div>
   </div>
 </form>
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard.hbs?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/dashboard.hbs Wed Oct  3 23:48:57 2012
@@ -49,20 +49,22 @@
           <div class="box-header">
             <h4>Services</h4>
           </div>
-          <ul class="services">
+          <dl class="dl-horizontal services">
             {{#each service in controller.services}}
-              <li class="health-status-{{unbound service.healthStatus}}">
-                <a {{action selectService service href=true}} href="javascript:void(null)">{{service.label}}</a> -
+              <dt class="health-status-{{unbound service.healthStatus}}">
+                <a {{action selectService service href=true}}>{{service.label}}</a> -
+              </dt>
+              <dd>
                 {{#each component in service.components}}
                   {{#if component.type}}
-                    <a {{action selectHost component.host href=true}} href="javascript:void(null)">{{component.componentName}}</a>,
+                    <a href="#" {{action selectHost component.host}}>{{component.componentName}}</a>,
                   {{else}}
-                    <a {{action filterHosts component}} href="javascript:void(null)">{{component.componentName}}</a>
+                    <a href="#" {{action filterHosts component}}>{{component.componentName}}</a>
                   {{/if}}
                 {{/each}}
-              </li>
+              </dd>
             {{/each}}
-          </ul>
+          </dl>
         </div>
       </div>
     </div>
@@ -84,7 +86,7 @@
       <ul class="alerts">
         {{#each controller.alerts}}
         <li class="status-{{unbound status}}">
-          <p><span class="title">{{title}}</span> <a href="javascript:void(null)">{{service.label}}</a><span class="date-time">{{date}}</span></p>
+          <p><span class="title">{{title}}</span> <a {{action selectService service href=true}}>{{service.label}}</a><span class="date-time">{{date}}</span></p>
           <p><span>{{status}}:</span> <span>{{message}}</span></p>
         </li>
         {{/each}}

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host.hbs Wed Oct  3 23:48:57 2012
@@ -16,114 +16,123 @@
 * limitations under the License.
 -->
 <div id="hosts" class="box">
-    <div class="box-header">
-        <div class="button-section">
-            <div class="btn-group">
-                <button {{bindAttr disabled="controller.isDisabled"}} class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
-                    Rack
-                    <span class="caret"></span>
-                </button>
-                <ul class="dropdown-menu">
-                    {{#each clusters}}
-                    <li>
-                      <a href="javascript:void(null)" data-toggle="modal" {{action "assignedToRackPopup" this target="controller"}}>
-                        {{clusterName}}
-                      </a>
-                    </li>
-                    {{/each}}
-                </ul>
-            </div>
-            <button {{bindAttr disabled="controller.isDisabled"}} class="btn btn-primary decommission" data-toggle="modal" {{action "decommissionButtonPopup" target="controller"}}>
-              Decommission
-            </button>
-            <button {{bindAttr disabled="controller.isDisabled"}} class="btn btn-primary" data-toggle="modal" {{action "deleteButtonPopup" target="controller"}}>
-              Delete
-            </button>
-            <button class="btn btn-inverse add-host-button" disabled="disabled">
-                <i class="icon-plus icon-white"></i>
-                Add New Host
-            </button>
-        </div>
+  <div class="box-header">
+    <div class="button-section">
+      <div class="btn-group">
+        <button {{bindAttr disabled="controller.isDisabled"}} class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
+          Rack
+          <span class="caret"></span>
+        </button>
+        <ul class="dropdown-menu">
+          {{#each clusters}}
+          <li>
+            <a href="javascript:void(null)" data-toggle="modal" {{action "assignedToRackPopup" this target="controller"}}>
+              {{clusterName}}
+            </a>
+          </li>
+          {{/each}}
+        </ul>
+      </div>
+      <button {{bindAttr disabled="controller.isDisabled"}} class="btn btn-primary decommission" data-toggle="modal" {{action "decommissionButtonPopup" target="controller"}}>
+        Decommission
+      </button>
+      <button {{bindAttr disabled="controller.isDisabled"}} class="btn btn-primary" data-toggle="modal" {{action "deleteButtonPopup" target="controller"}}>
+        Delete
+      </button>
+      <button class="btn btn-inverse add-host-button" disabled="disabled">
+        <i class="icon-plus icon-white"></i>
+        Add New Host
+      </button>
     </div>
-    <table class="table table-bordered table-striped">
-        <thead>
-        <tr>
-            <th class="first">
-                <label class="checkbox">
-                  {{view Ember.Checkbox checkedBinding="allChecked" class="checkbox"}}
-                </label>
-            </th>
-            <th>
-              <a href="#" {{action sortByName target="controller" }}>Name</a>
-            </th>
-            <th>Rack</th>
-            <th>CPU</th>
-            <th>RAM</th>
-            <th>Disk Usage</th>
-            <th>Load Avg</th>
-            <th>
-                <div class="btn-group">
-                    <button class="btn btn-info dropdown-toggle" data-toggle="dropdown">
-                        Components
-                        <span class="caret"></span>
-                    </button>
-                    <ul class="dropdown-menu filter-components">
-                        {{#each component in allComponents}}
-                        <li>
-                            <label>
-                                {{view view.ComponentCheckboxView checkedBinding="this.isChecked"contentBinding="component.id"}}                                {{component.componentName}}
-                            </label>
-                        </li>
-                        {{/each}}
-                    </ul>
-                </div>
-            </th>
-        </tr>
-        </thead>
-        <tbody>
-        {{#each host in controller}}
-        <tr>
-            <td class="first">
-                <label class="checkbox">
-                  {{view view.HostCheckboxView checkedBinding="host.isChecked" contentBinding="host"}}
-                  <span class="health-status-{{unbound host.healthStatus}}"></span>
-                </label>
-            </td>
-            <td><a href="#" {{action showDetails host}}>{{unbound host.hostName}}</a></td>
-            <td>{{host.cluster.clusterName}}</td>
-            <td>{{host.cpu}}</td>
-            <td>{{host.memory}}</td>
-            <td>{{host.diskUsage}}</td>
-            <td>{{host.loadAvg}}</td>
-            <td>
-                {{#each component in host.components}}
-                  {{component.label}},
-                {{/each}}
-            </td>
-        </tr>
-        {{/each}}
-        </tbody>
-    </table>
-    <div class="box-footer">
-        <hr />
-        <div class="footer-pagination">
-            <ul class="nav nav-pills">
-                <li class="disabled">Show Hosts</li>
-                <li class="dropdown">
-                    {{view Em.Select contentBinding="pageSizeRange"
+  </div>
+  <table class="table table-bordered table-striped">
+    <thead>
+    <tr>
+      <th class="first">
+        <label class="checkbox">
+          {{view Ember.Checkbox checkedBinding="allChecked" class="checkbox"}}
+        </label>
+      </th>
+      <th>
+        <a href="#" {{action sortByName target="controller" }}>Name</a>
+        {{#if controller.isSort}}
+        <i class="icon-arrow-up"{{bindAttr class="controller.sortClass"}}></i>
+        {{/if}}
+      </th>
+      <th>Rack</th>
+      <th>CPU</th>
+      <th>RAM</th>
+      <th>Disk Usage</th>
+      <th>Load Avg</th>
+      <th>
+        <div {{bindAttr class="view.btnGroupClass"}} >
+          <button class="btn btn-info" {{action "clickFilterButton" target="view"}}>
+            Components
+            <span class="caret"></span>
+          </button>
+          <ul class="dropdown-menu filter-components" id="filter-dropdown">
+            {{#each component in componentsForFilter}}
+            <li>
+              <label>
+                {{view view.ComponentCheckboxView contentBinding="component"}}                                {{unbound component.componentName}}
+              </label>
+            </li>
+            {{/each}}
+          </ul>
+          <button {{bindAttr disabled="view.isApplyDisabled"}} class="btn" {{action "applyFilters" target="view"}}>
+            Apply
+          </button>
+        </div>
+
+      </th>
+    </tr>
+    </thead>
+    <tbody>
+    {{#each host in controller}}
+    {{#view view.HostView contentBinding="host"}}
+    <tr>
+      <td class="first">
+        <label class="checkbox">
+          {{view view.HostCheckboxView checkedBinding="host.isChecked" contentBinding="host"}}
+        </label>
+      </td>
+      <td class="name">
+        <span class="health-status-{{unbound host.healthStatus}}"></span>
+        <a href="#" {{action "showDetails" host}}>{{unbound host.hostName}}</a>
+      </td>
+      <td>{{host.cluster.clusterName}}</td>
+      <td>{{host.cpu}}</td>
+      <td>{{host.memory}}</td>
+      <td>{{host.diskUsage}}</td>
+      <td>{{host.loadAvg}}</td>
+      <td>
+        {{view.labels}}
+      </td>
+    </tr>
+    {{/view}}
+    {{/each}}
+    </tbody>
+  </table>
+  <div class="box-footer">
+    <hr />
+    <div class="footer-pagination">
+      <ul class="nav nav-pills">
+        <li class="disabled">Show Hosts</li>
+        <li class="dropdown">
+          {{view Em.Select contentBinding="pageSizeRange"
                     selectionBinding="pageSize"
                     optionValuePath="this"}}
-                </li>
-                <li class="disabled">{{startPosition}}-{{rangeStop}} of {{total}}</li>
-                <li class="disabled page-listing">
-                    {{#if hasPrevious}}
-                    <a href="#" {{action showPreviousPage target="controller"}}>previous</a>
-                    {{/if}}
-                    {{#if hasNext}}
-                    <a href="#" {{action showNextPage target="controller"}}>next</a>
-                    {{/if}}
-                </li>
-            </ul>
-        </div>
+        </li>
+        <li class="disabled">{{startPosition}}-{{rangeStop}} of {{total}}</li>
+        <li class="disabled page-listing">
+          {{#if hasPrevious}}
+          <a href="#" {{action showPreviousPage target="controller"}}>previous</a>
+          {{/if}}
+          {{#if hasNext}}
+          <a href="#" {{action showNextPage target="controller"}}>next</a>
+          {{/if}}
+        </li>
+      </ul>
     </div>
+  </div>
 </div>

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/details.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/details.hbs?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/details.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/details.hbs Wed Oct  3 23:48:57 2012
@@ -16,25 +16,27 @@
 * limitations under the License.
 -->
 <div id="host-details" class="row">
-    <a class="btn back" {{action backToHostsList}}>← Back to Hosts</a>
-    <div class="box ">
-        <div class="box-header">
-            <div class="span1 host-title health-status-{{unbound view.content.healthStatus}}">{{unbound view.content.hostName}}</div>
-            <div class="button-section pull-right clearfix">
-              <button {{bindAttr disabled="controller.startComponents"}} class="btn btn-success" data-toggle="modal" {{action "startConfirmPopup" target="controller"}}>
-                <i class="icon-play"></i>
-                Start
-              </button>
-              <button {{bindAttr disabled="controller.stopComponents"}} class="btn btn-danger" data-toggle="modal" {{action "stopConfirmPopup" target="controller"}}>
-                <i class="icon-stop"></i>
-                Stop
-              </button>
-            </div>
-            <hr />
-        </div>
-        <div class="content">
-            {{view App.MainHostMenuView}}
-            {{outlet}}
-        </div>
+  {{#if controller.isFromHosts}}
+  <a class="btn back" {{action backToHostsList}}>← Back to Hosts</a>
+  {{/if}}
+  <div class="box ">
+    <div class="box-header">
+      <div class="span1 host-title health-status-{{unbound view.content.healthStatus}}">{{unbound view.content.hostName}}</div>
+      <div class="button-section pull-right clearfix">
+        <button {{bindAttr disabled="controller.isStarting"}} class="btn btn-success" data-toggle="modal" {{action "startConfirmPopup" target="controller"}}>
+          <i class="icon-play"></i>
+          Start
+        </button>
+        <button {{bindAttr disabled="controller.isStopping"}} class="btn btn-danger" data-toggle="modal" {{action "stopConfirmPopup" target="controller"}}>
+          <i class="icon-stop"></i>
+          Stop
+        </button>
+      </div>
+      <hr />
     </div>
+    <div class="content">
+      {{view App.MainHostMenuView}}
+      {{outlet}}
+    </div>
+  </div>
 </div>

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/summary.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/summary.hbs?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/summary.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/host/summary.hbs Wed Oct  3 23:48:57 2012
@@ -16,26 +16,42 @@
 * limitations under the License.
 -->
 <div class="row">
-    <div class="span5 host-configuration">
-        <dl class="dl-horizontal">
-            <dt>IP:</dt><dd>{{view.content.ip}}</dd>
-            <dt>CPU:</dt><dd>{{view.content.cpu}}</dd>
-            <dt>OS:</dt><dd>type</dd>
-            <dt>Disk Usage:</dt><dd>{{view.content.diskUsage}}</dd>
-            <dt>Memory:</dt><dd>{{view.content.memory}}</dd>
-            <dt>Load Avg:</dt><dd>{{view.content.loadAvg}}</dd>
-            <dt>Agent:</dt><dd>running</dd>
-        </dl>
+  <div class="span5 host-configuration">
+    <dl class="dl-horizontal">
+      <dt>IP:</dt><dd>{{view.content.ip}}</dd>
+      <dt>CPU:</dt><dd>{{view.content.cpu}}</dd>
+      <dt>OS:</dt><dd>type</dd>
+      <dt>Disk Usage:</dt><dd>{{view.content.diskUsage}}</dd>
+      <dt>Memory:</dt><dd>{{view.content.memory}}</dd>
+      <dt>Load Avg:</dt><dd>{{view.content.loadAvg}}</dd>
+      <dt>Agent:</dt><dd>running</dd>
+    </dl>
+  </div>
+  {{#if view.content.components.length}}
+  <div class="span3 host-components pull-right">
+    {{#each component in view.content.components}}
+    {{#view view.ComponentButtonView contentBinding="component"}}
+    <div class="btn-group">
+      <button {{bindAttr class="view.buttonClass"}} data-toggle="dropdown">
+        {{unbound view.content.componentName}}
+        <span class="caret"></span>
+      </button>
+      <ul class="dropdown-menu">
+        <li>
+          <a href="javascript:void(null)" data-toggle="modal" {{action "startComponent" view.content target="controller"}}>
+            Start
+          </a>
+        </li>
+        <li>
+          <a href="javascript:void(null)" data-toggle="modal" {{action "stopComponent" view.content target="controller"}}>
+            Stop
+          </a>
+        </li>
+      </ul>
     </div>
-    {{#if view.content.components.length}}
-    <div class="span3 host-components pull-right">
-        {{#each component in view.content.components}}
-          <button class="btn btn-{{bind view.buttonClass}}">
-            {{component.componentName}}
-            <i class="icon-{{unbound view.content.iconClass}}"></i>
-          </button>
-        {{/each}}
-    </div>
-    {{/if}}
+    {{/view}}
+    {{/each}}
+  </div>
+  {{/if}}
 </div>
 

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/main/service/info/summary.hbs Wed Oct  3 23:48:57 2012
@@ -31,17 +31,11 @@
 		<div class="service-content">
 			{{#each component in controller.content.components}}
         {{#if component.type}}
-          <div class="service-links">{{component.componentName}}:<a {{action selectHost component.host href=true}} href="javascript:void(null)">{{component.host.hostName}}</a></div>
+          <div class="service-links">{{component.componentName}}: <a {{action selectHost component.host}} href="javascript:void(null)">{{component.host.hostName}}</a></div>
         {{else}}
-          <div class="service-links">{{component.componentName}}:<a {{action filterHosts component}} href="javascript:void(null)">{{component.componentName}}</a></div>
+          <div class="service-links">{{component.componentName}}: <a {{action filterHosts component}} href="javascript:void(null)">{{component.componentName}}</a></div>
         {{/if}}
 			{{/each}}
-			Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the
-			industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and
-			scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into
-			electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of
-			Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like
-			Aldus PageMaker including versions of Lorem Ipsum.
 		</div>
 	</div>
 	<div class="span6">

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/db.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/db.js?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/db.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/db.js Wed Oct  3 23:48:57 2012
@@ -76,6 +76,14 @@ App.db.setLoginName = function(name) {
   localStorage.setObject('ambari',App.db.data);
 }
 
+// that works incorrectly
+App.db.setUser = function(user) {
+  console.log('TRACE: Entering db:setUser function');
+  App.db.data = localStorage.getObject('ambari');
+  App.db.data.app.user = user;
+  localStorage.setObject('ambari',App.db.data);
+}
+
 App.db.setAuthenticated = function(authenticated) {
   console.log('TRACE: Entering db:setAuthenticated function');
 
@@ -213,6 +221,13 @@ App.db.setServiceConfigProperties = func
  *  getter methods
  */
 
+// that works incorrectly
+App.db.getUser = function() {
+  console.log('TRACE: Entering db:getUser function');
+  App.db.data = localStorage.getObject('ambari');
+  return App.db.data.app.user;
+}
+
 App.db.getLoginName = function() {
   console.log('Trace: Entering db:getLoginName function');
   App.db.data = localStorage.getObject('ambari');

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/helper.js Wed Oct  3 23:48:57 2012
@@ -24,4 +24,16 @@ Em.CoreObject.reopen({
   t: function(key, attrs){
     return Em.I18n.t(key, attrs)
   }
-});
\ No newline at end of file
+});
+
+
+//Em.Object.getMixinProperties = function(){
+//  var properties = {};
+//  this.PrototypeMixin.mixins.forEach(function(i,mix){
+//    if(mix.properties) {
+//      properties = mix.properties;
+//    }
+//  });
+//
+//  return properties;
+//}
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/validator.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/validator.js?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/validator.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/utils/validator.js Wed Oct  3 23:48:57 2012
@@ -36,11 +36,26 @@ module.exports = {
     return floatRegex.test(value);
   },
 
+  /**
+   * validate ip address with port
+   * @param value
+   * @return {Boolean}
+   */
   isIpAddress: function(value) {
-    var ipRegex = /^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}$/;
+    var ipRegex = /^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(\:[0-9]{1,5})?$/;
     return ipRegex.test(value);
   },
 
+  /**
+   * validate domain name with port
+   * @param value
+   * @return {Boolean}
+   */
+  isDomainName: function(value) {
+    var domainRegex = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/;
+    return domainRegex.test(value);
+  },
+
   empty:function (e) {
     switch (e) {
       case "":

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/grid.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/grid.js?rev=1393835&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/grid.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/common/grid.js Wed Oct  3 23:48:57 2012
@@ -0,0 +1,309 @@
+/**
+ * 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');
+var validator = require('utils/validator');
+
+App.GridFilterObject = Em.Object.extend({
+  checked:false
+});
+
+App.GridFilter = Em.View.extend({
+  tagName:"ul",
+  classNames:['filter'],
+  templateName:require('templates/common/grid/filter'),
+  attributeBindings:['style'],
+  getHeader:function () {
+    return this.get('header')
+  },
+  filters:function () {
+    return this.get('header._filters');
+  }.property('header._filters')
+});
+
+App.GridHeader = Em.View.extend({
+  templateName:require('templates/common/grid/header'),
+  tagName:'th',
+  filterable:true,
+  showFilter:false,
+  getGrid:function () {
+    return this.get('grid');
+  },
+  _filters:[],
+  doFilter:function () {
+    console.log(this.get('grid'));
+  },
+  toggleFilter:function () {
+    this.set('showFilter', 1 - this.get('showFilter'));
+  },
+  applyFilter:function () {
+    console.warn('APPLYING FILTERS');
+
+    var filters = this.get('_filters');
+    var filterValues = [];
+    $.each(filters, function(){
+      if(this.get('checked')) {
+        filterValues.push(this.get('value'));
+      }
+    });
+
+    var grid = this.get('grid');
+    grid.addFilters(this.get('name'), filterValues);
+    this.set('showFilter', false);
+  },
+  init:function () {
+    this._super();
+    if (!this.get('_filters').length) {
+      this.filterValues();
+      var thisHeader = this;
+      this.set('filter', App.GridFilter.extend({ header:thisHeader }));
+    }
+  },
+
+  filterValues:function () {
+    var gridFilters = this.get('grid._filters');
+    if (gridFilters && gridFilters[this.get('name')]) {
+      var filters = this.get('grid._filters')[this.get('name')];
+      // there should be something like filter preparing
+      var newFilters = [];
+      $.each(filters, function (i, v) {
+        newFilters.push(App.GridFilterObject.create({label:v, value:v}));
+      });
+
+      this.set('_filters', newFilters);
+    }
+  }.observes('grid._filters')
+});
+
+App.GridRow = Em.View.extend({
+  tagName:'tr',
+  init:function (options) {
+    var object = this.get('object');
+    var grid = this.get('grid');
+    var fieldNames = grid.get('fieldNames');
+    var template = '';
+
+    if (fieldNames) {
+      $.each(grid.get('fieldNames'), function (i, field) {
+        template += "<td>" + object.get(field) + "</td>";
+      });
+
+      this.set('template', Em.Handlebars.compile(template));
+    }
+    return this._super();
+  }
+});
+
+App.GridPage = Em.Object.extend({
+  activeClass:function () {
+    return this.get('active') ? "active" : "";
+  }.property('active'),
+  active:function () {
+    return parseInt(this.get('number')) == parseInt(this.get('pager.grid.currentPage'));
+  }.property('pager.grid.currentPage')
+});
+
+App.GridPager = Em.View.extend({
+
+  pages:[],
+  templateName:require('templates/common/grid/pager'),
+  classNames:['pagination'],
+
+  activatePrevPage:function () {
+    var current = this.get('grid.currentPage');
+    if (current > 1) this.set('grid.currentPage', current - 1);
+  },
+  activateNextPage:function () {
+    var current = this.get('grid.currentPage');
+    if (current < this.get('pages').length) this.set('grid.currentPage', current + 1);
+  },
+
+  prevPageDisabled:function () {
+    return this.get('grid.currentPage') > 1 ? false : "disabled";
+  }.property('grid.currentPage'),
+
+  nextPageDisabled:function () {
+    return this.get('grid.currentPage') < this.get('pages').length ? false : "disabled";
+  }.property('grid.currentPage'),
+
+  init:function () {
+    this._super();
+    this.clearPages()
+    this.pushPages();
+  },
+
+  activatePage:function (event) {
+    var page = event.context;
+    this.get('grid').set('currentPage', parseInt(event.context.get('number')));
+  },
+
+  clearPages:function () {
+    this.set('pages', []);
+  },
+
+  pushPages:function () {
+    var thisPager = this;
+    var pages = this.get('grid._pager.pages');
+    $.each(pages, function () {
+      var thisNumber = this;
+      thisPager.get('pages').push(App.GridPage.create({
+        number:thisNumber,
+        pager:thisPager
+      }));
+    })
+  }.observes('grid._pager')
+});
+
+App.Grid = Em.View.extend({
+  _columns:{}, // not used
+  _filters:{}, // prepared filters from data values
+  _pager:{pages:[1, 2, 3, 4, 5]}, // observed by pager to config it
+
+  _collection:{className:false, staticOptions:{}}, // collection config
+  currentPage:1,
+  fieldNames:[],
+  appliedFilters:{},
+  filteredArray:[],
+  columns:[],
+  collection:[],
+  initComleted:false,
+  rows:[],
+  templateName:require('templates/main/admin/audit'),
+
+  init:function () {
+    console.warn("  Grid INIT  ");
+    this._super();
+    this.prepareColumns(); // should be the 1
+    this.prepareCollection();
+    this.preparePager();
+  },
+
+  preparePager:function () {
+//    this.set('pager', App.GridPager.extend({ grid:this })); ask to hide
+  },
+
+  addFilters: function(field, values){
+    var filters = this.get('appliedFilters');
+    filters[field] = values;
+
+    var collection = this.get('_collection.className');
+    collection = collection.find();
+    arrayCollection = collection.filter(function(data) {
+      var oneFilterFail = false;
+      $.each(filters, function(fieldname, values){
+        if(values.length && values.indexOf(data.get(fieldname)) == -1) {
+          return oneFilterFail = true;
+        }
+      });
+      return !oneFilterFail;
+    });
+
+    this.set('filteredArray', arrayCollection);
+  },
+
+  prepareCollection:function () {
+    if (validator.empty(this.get('_collection.className'))) {
+      throw "_collection.className field is not defined";
+    }
+    var collection = this.get('_collection.className');
+    this.set('collection', collection.find(this.get('_collection.staticOptions')));
+  },
+
+  addColumn:function (options) {
+    options.grid = this;
+    if (validator.empty(options.name)) {
+      throw "define column name";
+    }
+
+    if (this.get('_columns.' + options.name)) {
+      throw "column with this '" + options.name + "' already exists";
+    }
+
+    var field = App.GridHeader.extend(options);
+    this.columns.push(field);
+
+    if (field.filterable || 1) { // .filterable - field not working :(
+      this.fieldNames.push(options.name);
+    }
+  },
+
+  clearColumns:function () {
+    this.set('_columns', {});
+    this.set('columns', []);
+    this.set('fieldNames', []);
+  },
+
+  prepareColumns:function () {
+    this.clearColumns();
+  },
+
+  prepareFilters:function () {
+    var thisGrid = this;
+    var collection = this.get('collection');
+    var fieldNames = this.get('fieldNames');
+    var options = {};
+
+    if (collection && collection.content) {
+      collection.forEach(function (object, i) {
+        $.each(fieldNames, function (j, field) {
+          if (!options[field]) {
+            options[field] = [];
+          }
+
+          var filter = object.get(field);
+          if (options[field].indexOf(filter) == -1) {
+            options[field].push(filter);
+          }
+        });
+      })
+
+      thisGrid.set('_filters', options);
+    }
+  }.observes('collection.length'),
+
+
+  clearRows:function () {
+    this.set('rows', [])
+  },
+
+  prepareRows:function () {
+    var collection = this.get('collection');
+    var thisGrid = this;
+    this.clearRows();
+    console.warn("PREPARE ROWS LEN:", collection.get('length'));
+    var i=1;
+
+    if (collection && collection.content) {
+      collection.forEach(function (object, i) {
+        var row = App.GridRow.extend({grid:thisGrid, object:object});
+        thisGrid.rows.push(row);
+      });
+    }
+  }.observes('collection.length'),
+
+  filteredRows:function () {
+    var collection = this.get('filteredArray');
+    var thisGrid = this;
+    this.clearRows();
+
+    collection.forEach(function (object) {
+      var row = App.GridRow.extend({grid:thisGrid, object:object});
+      thisGrid.rows.push(row);
+    });
+  }.observes('filteredArray')
+});
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/admin/audit.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/admin/audit.js?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/admin/audit.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/admin/audit.js Wed Oct  3 23:48:57 2012
@@ -17,99 +17,29 @@
  */
 
 var App = require('app');
-var validator = require('utils/validator');
 
-App.GridHeader = Em.View.extend({
-  templateName:require('templates/common/grid/header'),
-  tagName:'th',
-  filterable:true,
-  getGrid:function () {
-    return this.get('grid');
-  },
-  doFilter:function () {
-    console.log(this.get('grid'));
-  },
-  click:function (event) {
-    // will be called when when an instance's
-    // rendered element is clicked
-  }
-});
+require('views/common/grid');
 
-App.MainAdminAuditView = Em.View.extend({
-  _columns:{},
-  columns:[],
-  initComleted:false,
-  collection:[],
-  templateName:require('templates/main/admin/audit'),
-  fieldNames:[],
-  init:function () {
+App.MainAdminAuditView = App.Grid.extend({
+  _collection: {className: App.ServiceAudit},
+  prepareColumns:function () {
     this._super();
-    if (!this.columns.length) { // init completed on this
-      this.prepareColumns();
-      this.prepareFilters();
-      this.prepareCollection();
-    }
-  },
-  prepareCollection:function () {
-    this.set('collection', App.ServiceAudit.find());
-  },
-
-  addColumn:function (options) {
-    options.grid = this;
-    if (validator.empty(options.name)) {
-      throw "define column name";
-    }
-
-    if (this.get('_columns.' + options.name)) {
-      throw "column with this '" + options.name + "' already exists";
-    }
 
-    var field = App.GridHeader.extend(options);
-    this.columns.push(field);
-
-//    console.log("FI:", field.filterable);
-    if (field.filterable || 1) { // .filterable - field not working :(
-      this.fieldNames.push(options.name);
-    }
-  },
-  prepareColumns:function () {
     this.addColumn({
       name:"date",
       label:Em.I18n.t("admin.audit.grid.date")
     });
     this.addColumn({
+      name:"service.label",
+      label:Em.I18n.t("admin.audit.grid.service")
+    });
+    this.addColumn({
       name:"operationName",
       label:Em.I18n.t("admin.audit.grid.operationName")
     });
-  },
-  prepareFilters:function () {
-    var collection = this.get('collection');
-    var fieldNames = this.get('fieldNames');
-    var options = {};
-
-    if (collection && collection.content && collection.content.length) {
-      collection.forEach(function (i, object) {
-        console.warn("INTO");
-        console.warn(object, object.content);
-        $.each(fieldNames, function (j, field) {
-          if (!options[field]) {
-            options[field] = [];
-          }
-//          var value = object.get(field); repair this
-//          options[field].push({value:value});
-        });
-      })
-
-      console.warn("SORT OPTIONS:", options);
-      this.set('fieldNames', false);
-//      indexOf
-
-//      console.warn("LENGTH:" + collection.content.length);
-//      console.warn("fieldNames:", this.get('fieldNames'));
-    }
-//    var fieldNames = this.get('fieldNames');
-
-//    $.each(this.get('collection'), function(){})
-
-  }.observes('collection')
+    this.addColumn({
+      name:"user.userName",
+      label:Em.I18n.t("admin.audit.grid.performedBy")
+    });
+  }
 });
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/admin/menu.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/admin/menu.js?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/admin/menu.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/admin/menu.js Wed Oct  3 23:48:57 2012
@@ -35,24 +35,32 @@ App.MainAdminMenuView = Em.CollectionVie
     {
       route:'audit',
       label:'Audit'
-    },
+    }
+    /*,
     {
       route:'advanced',
       label:'Advanced'
     }
+    */
   ],
   tagName: "ul",
-  classNames: ["nav", "nav-list", "span2"],
+  classNames: ["nav", "nav-stacked", "nav-pills"],
+
+  init: function(){
+    this._super();
+    this.activateView(); // default selected menu
+  },
 
-  activateView:function (route) {
+  activateView:function () {
+    var route = App.get('router.mainAdminController.category');
     $.each(this._childViews, function () {
       this.set('active', (this.get('content.route') == route ? "active" : ""));
     });
-  },
+  }.observes('App.router.mainAdminController.category'),
 
   itemViewClass:Em.View.extend({
     classNameBindings:["active"],
     active:"",
-    template:Ember.Handlebars.compile('<a {{action adminNavigate view.content }} href="#"> {{unbound view.content.label}}</a>')
+    template:Ember.Handlebars.compile('<a {{action adminNavigate view.content.route }} href="#"> {{unbound view.content.label}}</a>')
   })
 });
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host.js?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host.js Wed Oct  3 23:48:57 2012
@@ -20,23 +20,79 @@ var App = require('app');
 
 App.MainHostView = Em.View.extend({
   templateName: require('templates/main/host'),
-  content: [],
+  content:function(){
+    return App.router.get('mainHostController.content');
+  }.property('App.router.mainHostController.content'),
+  componentsIds: [],
+  isFilterOpen: false,
+  isApplyDisabled: function(){
+    return !this.get('isFilterOpen')
+  }.property('isFilterOpen'),
+  btnGroupClass: function(){
+    return this.get('isFilterOpen') ? 'btn-group open' : 'btn-group';
+  }.property('isFilterOpen'),
 
-  ComponentCheckboxView: Em.Checkbox.extend({
-    content: null,
-    isChecked: false,
-    change: function(event) {
-      this.set('isChecked', !this.get('isChecked'));
-      App.router.get('mainHostController').setFilters(this.get('isChecked'), this.get('content'));
+  applyFilters: function(){
+    this.set('isFilterOpen', false);
+    App.router.get('mainHostController').filterByComponentsIds(this.get('componentsIds'));
+  },
+
+  clickFilterButton: function(){
+    var self = this;
+    this.set('isFilterOpen', !this.get('isFilterOpen'));
+    if (this.get('isFilterOpen')){
+      var filters = App.router.get('mainHostController.filters.components');
+      $('.filter-component').each(function () {
+        var componentId = parseInt($(this).attr('id').replace('component-',''));
+        var index = filters.indexOf(componentId);
+        $(this).attr('checked', index!=-1);
+      });
+      this.set('componentsIds', filters.toArray());
+
+      var dropDown = $('#filter-dropdown');
+      var firstClick = true;
+      $(document).bind('click', function(e) {
+        if (!firstClick && $(e.target).closest(dropDown).length == 0) {
+          self.set('isFilterOpen', false);
+          $(document).unbind('click');
+        }
+        firstClick = false;
+      });
     }
+  },
+  HostView: Em.View.extend({
+    content: null,
+    labels: '',
+    init: function(){
+      this._super();
+      var labels = this.get('content.components').getEach('label');
+      this.set('labels', labels.join(', '));
+    },
+    HostCheckboxView: Em.Checkbox.extend({
+      content: null,
+      isChecked: false,
+      change: function(event) {
+        this.set('isChecked', !this.get('content.isChecked'));
+        App.router.get('mainHostController').onHostChecked(this.get('content'));
+      }
+    })
   }),
-  HostCheckboxView: Em.Checkbox.extend({
+  ComponentCheckboxView: Em.Checkbox.extend({
     content: null,
-    isChecked: false,
+    elementId: function(){
+      return 'component-' + this.get('content.id');
+    }.property('content.id'),
+    classNames: ['filter-component'],
+    parentView: function(){
+      return this._parentView.templateData.view;
+    }.property(),
     change: function(event) {
-      this.set('isChecked', !this.get('content.isChecked'));
-      App.router.get('mainHostController').onHostChecked(this.get('isChecked'), this.get('content.id'));
+      var parent = this._parentView.templateData.view;
+      var componentsIds = parent.get('componentsIds');
+      var componentId = this.get('content.id');
+      var index = componentsIds.indexOf(componentId);
+      if(index==-1) componentsIds.push(componentId);
+      else componentsIds.splice(index, 1);
     }
   })
-
 });
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host/summary.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host/summary.js?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host/summary.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/host/summary.js Wed Oct  3 23:48:57 2012
@@ -23,7 +23,11 @@ App.MainHostSummaryView = Em.View.extend
   content:function(){
     return App.router.get('mainHostDetailsController.content');
   }.property('App.router.mainHostDetailsController.content'),
-  buttonClass: function(){
-    return this.get('startComponents') ? 'success' : 'danger';
-  }.property('startComponents')
+  ComponentButtonView: Em.View.extend({
+    content: null,
+    buttonClass: function(){
+      return this.get('content.workStatus') ? 'btn btn-success dropdown-toggle' : 'btn btn-danger dropdown-toggle';
+    }.property('content.workStatus')
+  })
+
 });
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/audit.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/audit.js?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/audit.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/main/service/info/audit.js Wed Oct  3 23:48:57 2012
@@ -18,7 +18,55 @@
 
 var App = require('app');
 
-App.MainServiceInfoAuditView = Em.View.extend({
-  templateName: require('templates/main/service/info/audit'),
-  content: App.ServiceAudit.find()
+require('views/common/grid');
+
+App.MainServiceInfoAuditView = App.Grid.extend({
+//  audits: function() {
+//    return App.router.get('mainServiceInfoAuditController.content').get('serviceAudit');
+//  }.property('App.router.mainServiceInfoAuditController.content'),
+
+  prepareCollection:function () {
+    var audits = App.router.get('mainServiceInfoAuditController.content').get('serviceAudit');
+    console.warn(" AUDITS: ", audits);
+    this.set('collection', audits);
+  },
+
+  addFilters: function(field, values){
+    var filters = this.get('appliedFilters');
+    filters[field] = values;
+    var collection = App.router.get('mainServiceInfoAuditController.content').get('serviceAudit');
+    arrayCollection = collection.filter(function(data) {
+      var oneFilterFail = false;
+      $.each(filters, function(fieldname, values){
+        if(values.indexOf(data.get(fieldname)) == -1) {
+          return oneFilterFail = true;
+        }
+      });
+      return !oneFilterFail;
+    });
+
+    this.set('filteredArray', arrayCollection);
+  },
+
+  _collection: {className: App.ServiceAudit},
+  prepareColumns:function () {
+    this._super();
+
+    this.addColumn({
+      name:"date",
+      label:Em.I18n.t("admin.audit.grid.date")
+    });
+    this.addColumn({
+      name:"service.label",
+      label:Em.I18n.t("admin.audit.grid.service")
+    });
+    this.addColumn({
+      name:"operationName",
+      label:Em.I18n.t("admin.audit.grid.operationName")
+    });
+    this.addColumn({
+      name:"user.userName",
+      label:Em.I18n.t("admin.audit.grid.performedBy")
+    });
+  }
 });
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/test/login_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/login_test.js?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/login_test.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/login_test.js Wed Oct  3 23:48:57 2012
@@ -21,22 +21,23 @@ require('controllers/login_controller');
 
 describe('App.LoginController', function () {
 
+  var loginController = App.LoginController.create();
+
   describe('#validateCredentials()', function () {
-    it('should return false if no username is present', function () {
-      var loginController = App.LoginController.create();
+    it('should return undefined if no username is present', function () {
       loginController.set('loginName', '');
-      expect(loginController.validateCredentials()).to.equal(false);
+      expect(loginController.validateCredentials()).to.equal(undefined);
     })
-    it('should return false if no password is present', function () {
-      var loginController = App.LoginController.create();
+    it('should return undefined if no password is present', function () {
       loginController.set('password', '');
-      expect(loginController.validateCredentials()).to.equal(false);
+      expect(loginController.validateCredentials()).to.equal(undefined);
     })
-    it('should return true if username and password are the same (dummy until actual integration)', function () {
-      var loginController = App.LoginController.create();
-      loginController.set('loginName', 'abc');
-      loginController.set('password', 'abc');
-      expect(loginController.validateCredentials()).to.equal(true);
+    /*
+    it('should return the user object with the specified username and password (dummy until actual integration)', function () {
+      loginController.set('loginName', 'admin');
+      loginController.set('password', 'admin');
+      expect(loginController.validateCredentials().get('loginName'), 'admin');
     })
+    */
   })
-})
\ No newline at end of file
+})

Added: incubator/ambari/branches/AMBARI-666/ambari-web/test/main/dashboard_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/main/dashboard_test.js?rev=1393835&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/main/dashboard_test.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/main/dashboard_test.js Wed Oct  3 23:48:57 2012
@@ -0,0 +1,34 @@
+/**
+ * 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');
+
+require('models/alert'); 
+App.Alert.FIXTURES = [{ status: 'ok' }, { status: 'corrupt' }, { status: 'corrupt',}];
+require('controllers/main/dashboard');
+ 
+describe('MainDashboard', function () {
+ 
+  var controller = App.MainDashboardController.create();
+  
+  describe('#alertsCount', function () {
+    it('should return 2 if 2 alerts has status corrupt', function () {
+        expect(controller.get('alertsCount')).to.equal(2);
+    })
+  })
+})
\ No newline at end of file

Added: incubator/ambari/branches/AMBARI-666/ambari-web/test/main/host/details_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/main/host/details_test.js?rev=1393835&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/main/host/details_test.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/main/host/details_test.js Wed Oct  3 23:48:57 2012
@@ -0,0 +1,49 @@
+/**
+ * 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 Ember = require('ember');
+ var App = require('app');
+ 
+require('controllers/main/host/details');
+
+describe('MainHostdetails', function () {
+  var controller = App.MainHostDetailsController.create();
+  controller.content = Ember.Object.create({});
+   
+  describe('#setBack(value)', function () {
+    it('should return true if value is true', function () {
+      controller.setBack(true);
+      expect(controller.get('isFromHosts')).to.equal(true);
+    })
+  }),
+  describe('#workStatus positive', function () {
+    it('should return true if workstatus is true', function () {
+      controller.content.set('workStatus',true);   
+      expect(controller.get('isStarting')).to.equal(true);
+      }),
+    it('should return false if workStatus is true', function () {
+      expect(controller.get('isStopping')).to.equal(false);
+    })
+    it('should return false if workstatus is false', function () {
+      controller.content.set('workStatus',false);   
+      expect(controller.get('isStarting')).to.equal(false);
+      }),
+    it('should return true if workStatus is false', function () {
+      expect(controller.get('isStopping')).to.equal(true);
+    })
+  })
+})
\ No newline at end of file

Added: incubator/ambari/branches/AMBARI-666/ambari-web/test/main/host_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/main/host_test.js?rev=1393835&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/main/host_test.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/main/host_test.js Wed Oct  3 23:48:57 2012
@@ -0,0 +1,84 @@
+/**
+ * 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');
+require('models/cluster');
+require('models/service');
+require('models/pagination');
+require('controllers/main/host');
+
+
+describe('MainHostController', function () {
+    describe('#sortByName()', function () {
+        it('should change isSort value to true', function () {
+            var mainHostController = App.MainHostController.create();
+            mainHostController.set('isSort', false);
+            mainHostController.sortByName();
+            expect(mainHostController.get('isSort')).to.equal(true);
+        });
+
+
+        it('should inverse sortingAsc ', function () {
+            var mainHostController = App.MainHostController.create();
+            mainHostController.set('sortingAsc', false);
+            mainHostController.sortByName();
+            expect(mainHostController.get('sortingAsc')).to.equal(true);
+            mainHostController.sortByName();
+            expect(mainHostController.get('sortingAsc')).to.equal(false);
+        })
+    });
+
+
+    describe('#showNextPage, #showPreviousPage()', function () {
+        it('should change rangeStart according to page', function () {
+            var mainHostController = App.MainHostController.create();
+            mainHostController.set('pageSize', 3);
+            mainHostController.showNextPage();
+            expect(mainHostController.get('rangeStart')).to.equal(3);
+            mainHostController.showPreviousPage();
+            expect(mainHostController.get('rangeStart')).to.equal(0);
+        })
+    });
+
+
+    describe('#sortClass()', function () {
+        it('should return \'icon-arrow-down\' if sortingAsc is true', function () {
+            var mainHostController = App.MainHostController.create({});
+            mainHostController.set('sortingAsc', true);
+            expect(mainHostController.get('sortClass')).to.equal('icon-arrow-down');
+        });
+        it('should return \'icon-arrow-up\' if sortingAsc is false', function () {
+            var mainHostController = App.MainHostController.create({});
+            mainHostController.set('sortingAsc', false);
+            expect(mainHostController.get('sortClass')).to.equal('icon-arrow-up');
+        })
+    });
+
+
+    describe('#allChecked', function () {
+        it('should fill selectedhostsids array', function () {
+            var mainHostController = App.MainHostController.create();
+            mainHostController.set('allChecked', false);
+            expect(mainHostController.get('selectedHostsIds').length).to.equal(0);
+            mainHostController.set('allChecked', true);
+            expect(!!(mainHostController.get('selectedHostsIds').length)).to.equal(true);
+        })
+    });
+
+
+});

Added: incubator/ambari/branches/AMBARI-666/ambari-web/test/main/item_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/main/item_test.js?rev=1393835&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/main/item_test.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/main/item_test.js Wed Oct  3 23:48:57 2012
@@ -0,0 +1,32 @@
+/**
+ * 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');
+require('views/common/modal_popup');
+require('controllers/main/service/item');
+
+describe('App.MainServiceItemController', function () {
+
+    describe('#showRebalancer', function () {
+        it('should return true if serviceName is hdfs', function () {
+            var mainServiceItemController = App.MainServiceItemController.create({
+            });
+            mainServiceItemController.content.set('serviceName', 'hdfs');
+            expect(mainServiceItemController.get('showRebalancer')).to.equal(true);
+        })
+    })
+})

Added: incubator/ambari/branches/AMBARI-666/ambari-web/test/utils/form_field_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/utils/form_field_test.js?rev=1393835&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/utils/form_field_test.js (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/utils/form_field_test.js Wed Oct  3 23:48:57 2012
@@ -0,0 +1,164 @@
+/**
+ * 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');
+require('models/form');
+
+
+/*
+ * formField.isValid property doesn't update correctly, so I have to work with errorMessage property
+ */
+describe('App.FormField', function () {
+
+  describe('#validate()', function () {
+    /*DIGITS TYPE*/
+    it('123456789 is correct digits', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'digits');
+      formField.set('value', 123456789);
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(true);
+    })
+    it('"a33bc" is incorrect digits', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'digits');
+      formField.set('value', 'a33bc');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(false);
+    })
+    /*DIGITS TYPE END*/
+    /*NUMBER TYPE*/
+    it('+1234 is correct number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '+1234');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(true);
+    })
+    it('-1234 is correct number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '-1234');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(true);
+    })
+    it('-1.23.6 is incorrect number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '-1.23.6');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(false);
+    })
+    it('+1.6 is correct number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', +1.6);
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(true);
+    })
+    it('-1.6 is correct number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', -1.6);
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(true);
+    })
+    it('1.6 is correct number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', 1.6);
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(true);
+    })
+    it('-.356 is correct number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '-.356');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(true);
+    })
+    it('+.356 is correct number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '+.356');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(true);
+    })
+    it('-1. is incorrect number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '-1.');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(false);
+    })
+    it('+1. is incorrect number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '+1.');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(false);
+    })
+    it('1. is incorrect number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '1.');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(false);
+    })
+    it('-1,23,6 is incorrect number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '-1,23,6');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(false);
+    })
+    it('-1234567890 is correct number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '-1234567890');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(true);
+    })
+    it('+1234567890 is correct number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '+1234567890');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(true);
+    })
+    it('123eed is incorrect number', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'number');
+      formField.set('value', '123eed');
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(false);
+    })
+    /*NUMBER TYPE END*/
+    /*REQUIRE*/
+    it('Required field shouldn\'t be empty', function () {
+      var formField = App.FormField.create();
+      formField.set('displayType', 'string');
+      formField.set('value', '');
+      formField.set('isRequired', true);
+      formField.validate();
+      expect(formField.get('errorMessage') === '').to.equal(false);
+    })
+    /*REQUIRE END*/
+
+  })
+})
\ No newline at end of file

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/test/utils/validator_test.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/test/utils/validator_test.js?rev=1393835&r1=1393834&r2=1393835&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/test/utils/validator_test.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/test/utils/validator_test.js Wed Oct  3 23:48:57 2012
@@ -137,5 +137,66 @@ describe('validator', function () {
     })
 
   })
+  /*describe('#isIpAddress(value)', function () {
+    it('"127.0.0.1" - valid IP', function () {
+      expect(validator.isIpAddress('127.0.0.1')).to.equal(true);
+    })
+    it('"227.3.67.196" - valid IP', function () {
+      expect(validator.isIpAddress('227.3.67.196')).to.equal(true);
+    })
+    it('"327.0.0.0" - invalid IP', function () {
+      expect(validator.isIpAddress('327.0.0.0')).to.equal(false);
+    })
+    it('"127.0.0." - invalid IP', function () {
+      expect(validator.isIpAddress('127.0.0.')).to.equal(false);
+    })
+    it('"127.0." - invalid IP', function () {
+      expect(validator.isIpAddress('127.0.')).to.equal(false);
+    })
+    it('"127" - invalid IP', function () {
+      expect(validator.isIpAddress('127')).to.equal(false);
+    })
+    it('"127.333.0.1" - invalid IP', function () {
+      expect(validator.isIpAddress('127.333.0.1')).to.equal(false);
+    })
+    it('"127.0.333.1" - invalid IP', function () {
+      expect(validator.isIpAddress('127.0.333.1')).to.equal(false);
+    })
+    it('"127.0.1.333" - invalid IP', function () {
+      expect(validator.isIpAddress('127.0.1.333')).to.equal(false);
+    })
+    it('"127.0.0.0:45555" - valid IP', function () {
+      expect(validator.isIpAddress('127.0.0.0:45555')).to.equal(true);
+    })
+    it('"327.0.0.0:45555" - invalid IP', function () {
+      expect(validator.isIpAddress('327.0.0.0:45555')).to.equal(false);
+    })
+    it('"0.0.0.0" - invalid IP', function () {
+      expect(validator.isIpAddress('0.0.0.0')).to.equal(false);
+    })
+    it('"0.0.0.0:12" - invalid IP', function () {
+      expect(validator.isIpAddress('0.0.0.0:12')).to.equal(false);
+    })
+    it('"1.0.0.0:0" - invalid IP', function () {
+      expect(validator.isIpAddress('1.0.0.0:0')).to.equal(false);
+    })
+  })*/
+  describe('#isDomainName(value)', function () {
+    it('"google.com" - valid Domain Name', function () {
+      expect(validator.isDomainName('google.com')).to.equal(true);
+    })
+    it('"google" - invalid Domain Name', function () {
+      expect(validator.isDomainName('google')).to.equal(false);
+    })
+    it('"123.123" - invalid Domain Name', function () {
+      expect(validator.isDomainName('123.123')).to.equal(false);
+    })
+    it('"4goog.le" - valid Domain Name', function () {
+      expect(validator.isDomainName('4goog.le')).to.equal(true);
+    })
+    it('"55454" - invalid Domain Name', function () {
+      expect(validator.isDomainName('55454')).to.equal(false);
+    })
+  })
 
 })
\ No newline at end of file