You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/11/13 16:57:41 UTC

[24/51] [abbrv] ambari git commit: AMBARI-22377 Ambari 3.0: Implement new design for Admin View: Views page. (atkach)

http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0421a2/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/viewsList.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/viewsList.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/viewsList.html
new file mode 100644
index 0000000..7aa25ab
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/viewsList.html
@@ -0,0 +1,134 @@
+<!--
+* 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 id="views-table">
+
+    <div class="clearfix">
+        <div class="pull-right">
+            <button ng-disabled="views.length === 0" ng-click="createInstance(views[0]);" class="btn btn-default">
+                {{'views.create' | translate}}
+            </button>
+        </div>
+    </div>
+
+    <table class="table table-striped table-hover">
+        <thead>
+        <tr class="fix-bottom">
+            <th class="fix-bottom col-md-2">
+                <span>{{'common.name' | translate}}</span>
+            </th>
+            <th class="fix-bottom col-md-3">
+                <span>{{'urls.url' | translate}}</span>
+            </th>
+            <th class="fix-bottom col-md-2">
+                <span>{{'views.table.viewType' | translate}}</span>
+            </th>
+            <th class="fix-bottom col-md-2">
+                <span>{{'urls.viewInstance' | translate}}</span>
+            </th>
+            <th class="fix-bottom col-md-2 view-instance-actions">
+                <span>{{'common.actions' | translate}}</span>
+            </th>
+        </tr>
+        <tr>
+            <th class="fix-top">
+                <div class="search-container">
+                    <input type="text" class="form-control" placeholder="{{'common.any' | translate}}"
+                           ng-model="instanceNameFilter" ng-change="filterInstances()">
+                    <button type="button" class="close clearfilter" ng-show="instanceNameFilter"
+                            ng-click="instanceNameFilter=''; filterInstances()">
+                        <span aria-hidden="true">&times;</span>
+                        <span class="sr-only">{{'common.controls.close' | translate}}</span>
+                    </button>
+                </div>
+            </th>
+            <th class="fix-top">
+                <div class="search-container">
+                    <input type="text" class="form-control" placeholder="{{'common.any' | translate}}"
+                           ng-model="instanceUrlFilter" ng-change="filterInstances()">
+                    <button type="button" class="close clearfilter" ng-show="instanceUrlFilter"
+                            ng-click="instanceUrlFilter=''; filterInstances()">
+                        <span aria-hidden="true">&times;</span>
+                        <span class="sr-only">{{'common.controls.close' | translate}}</span>
+                    </button>
+                </div>
+            </th>
+            <th class="fix-top">
+                <select class="form-control typefilter v-small-input"
+                        ng-model="instanceTypeFilter"
+                        ng-options="item.label for item in typeFilterOptions"
+                        ng-change="filterInstances()">
+                </select>
+            </th>
+            <th class="fix-top">
+            </th>
+            <th class="fix-top">
+            </th>
+        </tr>
+        </thead>
+
+        <tbody>
+        <tr ng-repeat="instance in instances | filter : { isShowed: true }">
+            <td>
+                <span>{{instance.short_url_name}}</span>
+            </td>
+            <td>
+                <a target="_blank"
+                   href="{{fromSiteRoot('/#/main/view/' + instance.view_name + '/' + instance.short_url)}}">/main/view/{{instance.view_name}}/{{instance.short_url}}
+                    &nbsp;<i class="fa fa-external-link" aria-hidden="true"></i></a>
+            </td>
+            <td>
+                <span>{{instance.view_name}} {{"{"+instance.version+"}"}} </span>
+            </td>
+            <td>
+                <span>{{instance.instance_name}}</span>
+            </td>
+            <td class="view-instance-actions">
+                <a href="#/views/{{instance.view_name}}/versions/{{instance.version}}/instances/{{instance.instance_name}}/edit">
+                    <i class="fa fa-pencil"></i>
+                </a>
+                <a href="#/views/{{instance.view_name}}/versions/{{instance.version}}/instances/{{instance.instance_name}}/clone">
+                    <i class="fa fa-copy"></i>
+                </a>
+                <a href ng-click="deleteInstance(instance)">
+                    <i class="fa fa-trash-o"></i>
+                </a>
+            </td>
+        </tr>
+        </tbody>
+    </table>
+    <div ng-if="isLoading" class="spinner-container">
+      <i class="fa fa-2x fa-spinner fa-spin" aria-hidden="true"></i>
+    </div>
+    <div class="alert empty-table-alert col-sm-12" ng-show="!tableInfo.filtered && !isLoading">
+        {{'views.emptyTable'| translate}}
+    </div>
+    <div class="col-sm-12 table-bar" ng-show="instances.length >= minInstanceForPagination">
+        <div class="pull-left filtered-info">
+            <span>{{'common.filterInfo' | translate: '{showed: tableInfo.showed, total: tableInfo.filtered, term: urs.urls}'}}</span>
+            <span ng-show="isNotEmptyFilter">- <a href ng-click="clearFilters()">{{'common.controls.clearFilters' | translate}}</a></span>
+        </div>
+        <div class="pull-right left-margin">
+            <pagination class="paginator" total-items="tableInfo.filtered" max-size="maxVisiblePages" items-per-page="instancesPerPage" ng-model="currentPage" ng-change="pageChanged()"></pagination>
+        </div>
+        <div class="pull-right">
+            <select class="form-control" ng-model="instancesPerPage" ng-change="resetPagination()" ng-options="currOption for currOption in [10, 25, 50, 100]"></select>
+        </div>
+    </div>
+
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0421a2/ambari-admin/src/main/resources/ui/admin-web/app/views/urls/create.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/urls/create.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/urls/create.html
index 0c9e1b9..c625475 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/urls/create.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/urls/create.html
@@ -25,9 +25,9 @@
 
             <form class="form-horizontal create-user-form" role="form" novalidate name="formHolder.form" autocomplete="off">
                 <div class="form-group" ng-class="{'has-error' : formHolder.form.url_name.$error.required  && formHolder.form.submitted}">
-                    <label for="urlname" class="col-sm-2 control-label">{{'urls.name' | translate}}</label>
+                    <label for="urlname" class="col-sm-2 control-label">{{'common.name' | translate}}</label>
                     <div class="col-sm-10">
-                        <input ng-minlength="2" ng-maxlength="25" type="text" id="urlname" class="form-control urlname-input" name="url_name" placeholder="{{'urls.name' | translate}}" ng-model="url.urlName" required autocomplete="off">
+                        <input ng-minlength="2" ng-maxlength="25" type="text" id="urlname" class="form-control urlname-input" name="url_name" placeholder="{{'common.name' | translate}}" ng-model="url.urlName" required autocomplete="off">
                         <div class="alert alert-danger top-margin" ng-show="formHolder.form.url_name.$error.required  && formHolder.form.submitted">{{'common.alerts.fieldIsRequired' | translate}}</div>
                         <div class="alert alert-danger top-margin" ng-show="formHolder.form.url_name.$error.minlength   && formHolder.form.submitted">{{'common.alerts.minimumTwoChars' | translate}}</div>
                         <div class="alert alert-danger top-margin" ng-show="formHolder.form.url_name.$error.maxlength   && formHolder.form.submitted">{{'common.alerts.maxTwentyFiveChars' | translate}}</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0421a2/ambari-admin/src/main/resources/ui/admin-web/app/views/urls/edit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/urls/edit.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/urls/edit.html
index 9198818..dd5f65a 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/urls/edit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/urls/edit.html
@@ -27,9 +27,9 @@
 
 <form  class="form-horizontal create-user-form" role="form" novalidate name="url_form" autocomplete="off">
   <div class="form-group" ng-class="{'has-error' : url_form.url_name.$error.required  && url_form.submitted}">
-    <label for="urlname" class="col-sm-2 control-label">{{'urls.name' | translate}}</label>
+    <label for="urlname" class="col-sm-2 control-label">{{'common.name' | translate}}</label>
     <div class="col-sm-10">
-      <input disabled type="text" id="urlname" class="form-control urlname-input" name="url_name" placeholder="{{'urls.name' | translate}}" ng-model="url.url_name" required autocomplete="off">
+      <input disabled type="text" id="urlname" class="form-control urlname-input" name="url_name" placeholder="{{'common.name' | translate}}" ng-model="url.url_name" required autocomplete="off">
       <div class="alert alert-danger top-margin" ng-show="url_form.url_name.$error.required  && url_form.submitted">{{'common.alerts.fieldIsRequired' | translate}}</div>
     </div>
   </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0421a2/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CloneViewInstanceCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CloneViewInstanceCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CloneViewInstanceCtrl.js
new file mode 100644
index 0000000..f78333a
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CloneViewInstanceCtrl.js
@@ -0,0 +1,135 @@
+/**
+ * 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.
+ */
+
+describe('#CloneViewInstanceCtrl', function () {
+  var scope, ctrl, $httpBackend, View;
+
+  beforeEach(module('ambariAdminConsole', function($provide){
+    $provide.value('$routeParams', {viewId: 'TestView'});
+  }));
+
+  afterEach(function() {
+    $httpBackend.verifyNoOutstandingExpectation();
+    $httpBackend.verifyNoOutstandingRequest();
+  });
+
+  beforeEach(inject(function (_$httpBackend_, $rootScope, $controller, _View_, $q) {
+    View = _View_;
+    spyOn(View, 'createInstance').andReturn($q.defer().promise);
+    spyOn(View, 'getInstance').andReturn($q.defer().promise);
+
+    $httpBackend = _$httpBackend_;
+    $httpBackend.whenGET(/\/api\/v1\/views\/TestView\?.+/).respond(200, {
+      "versions": [{"ViewVersionInfo": {}}]
+    });
+    $httpBackend.whenGET(/\/api\/v1\/views\/TestView\/versions\/1\.0\.0/).respond(200, {
+      "ViewVersionInfo": {"parameters": [{"name": "n", "defaultValue": "d"}]}
+    });
+    $httpBackend.whenGET('template/modal/backdrop.html').respond(200, '<div></div>');
+    $httpBackend.whenGET('template/modal/window.html').respond(200, '<div></div>');
+    scope = $rootScope.$new();
+    ctrl = $controller('CloneViewInstanceCtrl', {$scope: scope});
+  }));
+
+  it('it should invoke View.createInstance on save', function () {
+    scope.form = {
+      instanceCreateForm: {
+        submitted: false,
+        $valid: true
+      }
+    };
+    $httpBackend.flush();
+    scope.instance = {};
+    scope.save();
+    expect(View.createInstance).toHaveBeenCalled();
+  });
+
+  it('should set default property value before creating view instance', function () {
+    scope.form = {
+      instanceCreateForm: {
+        $dirty: true
+      }
+    };
+    scope.instance = {};
+    scope.version = '1.0.0';
+    scope.isClone=false;
+    $httpBackend.expectGET('template/modal/backdrop.html');
+    $httpBackend.expectGET('template/modal/window.html');
+    $httpBackend.whenGET(/\/api\/v1\/clusters\?fields=Clusters\/cluster_id&_=\d+/).respond(200, {
+      "items" : [
+        {
+          "Clusters" : {
+            "cluster_name" : "c1",
+            "version" : "HDP-2.2"
+          }
+        }
+      ]
+    });
+    $httpBackend.whenGET(/\/api\/v1\/remoteclusters\?fields=ClusterInfo\/services,ClusterInfo\/cluster_id&_=\d+/).respond(200, {
+      "items" : [
+         {
+           "ClusterInfo" : {
+            "name" : "c1",
+            "services" : ["HDFS"]
+          }
+        }
+      ]
+    });
+    scope.$digest();
+    $httpBackend.flush();
+    chai.expect(scope.view.ViewVersionInfo.parameters[0].value).to.equal('d');
+    expect(View.getInstance).not.toHaveBeenCalled();
+  });
+
+  it('before cloning view instance confirm that View.getInstance is called', function () {
+    scope.form = {
+      instanceCreateForm: {
+        $dirty: true
+      }
+    };
+    scope.instance = {};
+    scope.version = '1.0.0';
+    scope.isClone=true;
+    $httpBackend.expectGET('template/modal/backdrop.html');
+    $httpBackend.expectGET('template/modal/window.html');
+    $httpBackend.whenGET(/\/api\/v1\/clusters\?fields=Clusters\/cluster_id&_=\d+/).respond(200, {
+      "items" : [
+        {
+          "Clusters" : {
+            "cluster_name" : "c1",
+            "version" : "HDP-2.2"
+          }
+        }
+      ]
+    });
+    $httpBackend.whenGET(/\/api\/v1\/remoteclusters\?fields=ClusterInfo\/services,ClusterInfo\/cluster_id&_=\d+/).respond(200, {
+      "items" : [
+         {
+           "ClusterInfo" : {
+            "name" : "c1",
+            "services" : ["HDFS"]
+          }
+        }
+      ]
+    });
+    scope.$digest();
+    $httpBackend.flush();
+    expect(View.getInstance).toHaveBeenCalled(); 
+  });
+
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/dd0421a2/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CreateViewInstanceCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CreateViewInstanceCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CreateViewInstanceCtrl.js
deleted file mode 100644
index f8ccc24..0000000
--- a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/CreateViewInstanceCtrl.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * 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.
- */
-
-describe('#CreateViewInstanceCtrl', function () {
-  var scope, ctrl, $httpBackend, View;
-
-  beforeEach(module('ambariAdminConsole', function($provide){
-    $provide.value('$routeParams', {viewId: 'TestView'});
-  }));
-
-  afterEach(function() {
-    $httpBackend.verifyNoOutstandingExpectation();
-    $httpBackend.verifyNoOutstandingRequest();
-  });
-
-  beforeEach(inject(function (_$httpBackend_, $rootScope, $controller, _View_, $q) {
-    View = _View_;
-    spyOn(View, 'createInstance').andReturn($q.defer().promise);
-    spyOn(View, 'getInstance').andReturn($q.defer().promise);
-
-    $httpBackend = _$httpBackend_;
-    $httpBackend.whenGET(/\/api\/v1\/views\/TestView\?.+/).respond(200, {
-      "versions": [{"ViewVersionInfo": {}}]
-    });
-    $httpBackend.whenGET(/\/api\/v1\/views\/TestView\/versions\/1\.0\.0/).respond(200, {
-      "ViewVersionInfo": {"parameters": [{"name": "n", "defaultValue": "d"}]}
-    });
-    $httpBackend.whenGET('template/modal/backdrop.html').respond(200, '<div></div>');
-    $httpBackend.whenGET('template/modal/window.html').respond(200, '<div></div>');
-    scope = $rootScope.$new();
-    ctrl = $controller('CreateViewInstanceCtrl', {$scope: scope});
-  }));
-
-  it('it should invoke View.createInstance on save', function () {
-    scope.form = {
-      instanceCreateForm: {
-        submitted: false,
-        $valid: true
-      }
-    };
-    $httpBackend.flush();
-    scope.instance = {};
-    scope.save();
-    expect(View.createInstance).toHaveBeenCalled();
-  });
-
-  it('should set default property value before creating view instance', function () {
-    scope.form = {
-      instanceCreateForm: {
-        $dirty: true
-      }
-    };
-    scope.instance = {};
-    scope.version = '1.0.0';
-    scope.isClone=false;
-    $httpBackend.expectGET('template/modal/backdrop.html');
-    $httpBackend.expectGET('template/modal/window.html');
-    $httpBackend.whenGET(/\/api\/v1\/clusters\?fields=Clusters\/cluster_id&_=\d+/).respond(200, {
-      "items" : [
-        {
-          "Clusters" : {
-            "cluster_name" : "c1",
-            "version" : "HDP-2.2"
-          }
-        }
-      ]
-    });
-    $httpBackend.whenGET(/\/api\/v1\/remoteclusters\?fields=ClusterInfo\/services,ClusterInfo\/cluster_id&_=\d+/).respond(200, {
-      "items" : [
-         {
-           "ClusterInfo" : {
-            "name" : "c1",
-            "services" : ["HDFS"]
-          }
-        }
-      ]
-    });
-    scope.$digest();
-    $httpBackend.flush();
-    chai.expect(scope.view.ViewVersionInfo.parameters[0].value).to.equal('d');
-    expect(View.getInstance).not.toHaveBeenCalled();
-  });
-
-  it('before cloning view instance confirm that View.getInstance is called', function () {
-    scope.form = {
-      instanceCreateForm: {
-        $dirty: true
-      }
-    };
-    scope.instance = {};
-    scope.version = '1.0.0';
-    scope.isClone=true;
-    $httpBackend.expectGET('template/modal/backdrop.html');
-    $httpBackend.expectGET('template/modal/window.html');
-    $httpBackend.whenGET(/\/api\/v1\/clusters\?fields=Clusters\/cluster_id&_=\d+/).respond(200, {
-      "items" : [
-        {
-          "Clusters" : {
-            "cluster_name" : "c1",
-            "version" : "HDP-2.2"
-          }
-        }
-      ]
-    });
-    $httpBackend.whenGET(/\/api\/v1\/remoteclusters\?fields=ClusterInfo\/services,ClusterInfo\/cluster_id&_=\d+/).respond(200, {
-      "items" : [
-         {
-           "ClusterInfo" : {
-            "name" : "c1",
-            "services" : ["HDFS"]
-          }
-        }
-      ]
-    });
-    scope.$digest();
-    $httpBackend.flush();
-    expect(View.getInstance).toHaveBeenCalled(); 
-  });
-
-});