ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [2/2] ambari git commit: AMBARI-9546. Author field is not scalable on Config History Page (alexantonenko)
Date Tue, 10 Feb 2015 13:42:50 GMT
AMBARI-9546. Author field is not scalable on Config History Page (alexantonenko)


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

Branch: refs/heads/trunk
Commit: f4a6e1b6a2ff1a2c68843807e800f359090f90fc
Parents: 77a0b2b
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Tue Feb 10 14:31:49 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Tue Feb 10 15:41:19 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |  1 +
 ambari-web/app/models/service_config_version.js |  6 +++
 ambari-web/app/styles/config_history_flow.less  |  2 +-
 .../templates/main/dashboard/config_history.hbs |  2 +-
 .../test/models/service_config_version_test.js  | 54 ++++++++++++++++++++
 5 files changed, 63 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f4a6e1b6/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index 278a956..454fd8d 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -248,6 +248,7 @@ var files = ['test/init_model_test',
   'test/models/host_component_test',
   'test/models/hosts_test',
   'test/models/service_config_test',
+  'test/models/service_config_version_test',
   'test/models/stack_service_component_test',
   'test/models/service_test',
   'test/models/stack_service_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/f4a6e1b6/ambari-web/app/models/service_config_version.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service_config_version.js b/ambari-web/app/models/service_config_version.js
index 339b535..6729cfe 100644
--- a/ambari-web/app/models/service_config_version.js
+++ b/ambari-web/app/models/service_config_version.js
@@ -46,6 +46,12 @@ App.ServiceConfigVersion = DS.Model.extend({
   configGroupName: function () {
     return this.get('isDefault') ? (this.get('displayName') + ' ' + Em.I18n.t('common.default'))
: this.get('groupName');
   }.property('groupName','isDefault'),
+  authorFormatted: function () {
+    var author = this.get('author');
+    if (author) {
+      return author.length > 20 ? author.slice(0, 20) + '...' : author;
+    }
+  }.property('author'),
   fullNotes: function () {
     return (typeof this.get('notes') === 'string') ? this.get('notes') || Em.I18n.t('dashboard.configHistory.table.notes.no')
: Em.I18n.t('dashboard.configHistory.table.notes.no');
   }.property('notes'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/f4a6e1b6/ambari-web/app/styles/config_history_flow.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/config_history_flow.less b/ambari-web/app/styles/config_history_flow.less
index 372ec69..a68ec61 100644
--- a/ambari-web/app/styles/config_history_flow.less
+++ b/ambari-web/app/styles/config_history_flow.less
@@ -324,7 +324,7 @@
     // author column
     th:first-child + th + th + th,
     td:first-child + td + td + td {
-      width: 10%;
+      width: 180px;
       input.filter-input-width {
         width: 55%;
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f4a6e1b6/ambari-web/app/templates/main/dashboard/config_history.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/dashboard/config_history.hbs b/ambari-web/app/templates/main/dashboard/config_history.hbs
index b27158c..af921fb 100644
--- a/ambari-web/app/templates/main/dashboard/config_history.hbs
+++ b/ambari-web/app/templates/main/dashboard/config_history.hbs
@@ -56,7 +56,7 @@
               {{/if}}
             </td>
             <td>{{item.createdDate}}</td>
-            <td>{{item.author}}</td>
+            <td><span rel="Tooltip" {{bindAttr title="item.author"}}>{{item.authorFormatted}}</span></td>
             <td class="notes">
               {{#if item.moreNotesExists}}
                 {{#if view.showLessNotes}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/f4a6e1b6/ambari-web/test/models/service_config_version_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/service_config_version_test.js b/ambari-web/test/models/service_config_version_test.js
new file mode 100644
index 0000000..a4a93f3
--- /dev/null
+++ b/ambari-web/test/models/service_config_version_test.js
@@ -0,0 +1,54 @@
+/**
+ * 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/service_config_version');
+
+var model;
+
+describe('App.ServiceConfigVersion', function () {
+
+  beforeEach(function () {
+    model = App.ServiceConfigVersion.createRecord({});
+  });
+
+  describe('#authorFormatted', function () {
+
+    var cases = [
+      {
+        author: 'admin',
+        authorFormatted: 'admin',
+        title: 'should display username as is'
+      },
+      {
+        author: 'userNameIsTooLongToDisplay',
+        authorFormatted: 'userNameIsTooLongToD...',
+        title: 'should trim username to 20 chars'
+      }
+    ];
+
+    cases.forEach(function (item) {
+      it(item.title, function () {
+        model.set('author', item.author);
+        expect(model.get('authorFormatted')).to.equal(item.authorFormatted);
+      });
+    });
+
+  });
+
+});


Mime
View raw message