AMBARI-15824. Too long username breaks markup (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0da68672 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0da68672 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0da68672 Branch: refs/heads/trunk Commit: 0da68672a25d0f920f358f0e4b40465121db9326 Parents: 2619eee Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Tue Apr 12 11:36:09 2016 +0300 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Tue Apr 12 11:36:09 2016 +0300 ---------------------------------------------------------------------- ambari-web/app/models/configs/service_config_version.js | 2 +- ambari-web/app/router.js | 2 ++ ambari-web/app/templates/application.hbs | 2 +- .../app/templates/common/configs/config_history_flow.hbs | 8 ++++---- .../app/templates/common/configs/service_version_box.hbs | 4 ++-- ambari-web/app/templates/main/host/host_alerts.hbs | 4 ++-- .../app/views/common/configs/config_history_flow.js | 11 +++++++++-- .../test/models/configs/service_config_version_test.js | 2 +- 8 files changed, 22 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0da68672/ambari-web/app/models/configs/service_config_version.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/configs/service_config_version.js b/ambari-web/app/models/configs/service_config_version.js index bbd944d..9c83df8 100644 --- a/ambari-web/app/models/configs/service_config_version.js +++ b/ambari-web/app/models/configs/service_config_version.js @@ -53,7 +53,7 @@ App.ServiceConfigVersion = DS.Model.extend({ /** * @type {string} */ - authorFormatted: Em.computed.truncate('author', 20, 20), + authorFormatted: Em.computed.truncate('author', 15, 15), /** * @type {string} http://git-wip-us.apache.org/repos/asf/ambari/blob/0da68672/ambari-web/app/router.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js index 602bec7..b723275 100644 --- a/ambari-web/app/router.js +++ b/ambari-web/app/router.js @@ -147,6 +147,8 @@ App.Router = Em.Router.extend({ return this.getLoginName(); }.property('loggedIn'), + displayLoginName: Em.computed.truncate('loginName', 10, 10), + getAuthenticated: function () { var dfd = $.Deferred(); var self = this; http://git-wip-us.apache.org/repos/asf/ambari/blob/0da68672/ambari-web/app/templates/application.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/application.hbs b/ambari-web/app/templates/application.hbs index f06861e..9518b24 100644 --- a/ambari-web/app/templates/application.hbs +++ b/ambari-web/app/templates/application.hbs @@ -57,7 +57,7 @@ {{#if App.router.loggedIn}} <div class="top-nav-user btn-group"> <button class="btn dropdown-toggle" data-toggle="dropdown"> - <i class="icon-user"></i> {{App.router.loginName}} <span class="caret"></span> + <i class="icon-user"></i> {{App.router.displayLoginName}} <span class="caret"></span> </button> <ul class="dropdown-menu"> <li><a href="" id="about" {{action showAboutPopup target="controller"}}>{{t app.aboutAmbari}}</a></li> http://git-wip-us.apache.org/repos/asf/ambari/blob/0da68672/ambari-web/app/templates/common/configs/config_history_flow.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/config_history_flow.hbs b/ambari-web/app/templates/common/configs/config_history_flow.hbs index 027bb5f..a099a6c 100644 --- a/ambari-web/app/templates/common/configs/config_history_flow.hbs +++ b/ambari-web/app/templates/common/configs/config_history_flow.hbs @@ -44,7 +44,7 @@ {{#if view.compareServiceVersion.isCurrent}} <span class="label label-success">{{t common.current}}</span> {{/if}} - <strong>{{view.compareServiceVersion.author}}</strong> {{t dashboard.configHistory.info-bar.authoredOn}} + <strong>{{view.compareServiceVersion.authorFormatted}}</strong> {{t dashboard.configHistory.info-bar.authoredOn}} <strong>{{view.compareServiceVersion.createdDate}}</strong> </div> <div class="pull-right operations-button"> @@ -66,7 +66,7 @@ <div class="row-fluid version-in-dropdown " {{action doAction serviceVersion view.actionTypes.SWITCH target="view"}}> <div class="span2">{{serviceVersion.versionText}}</div> <div class="span6">{{serviceVersion.createdDate}}</div> - <div class="span3">{{serviceVersion.author}}</div> + <div class="span3">{{serviceVersion.authorFormatted}}</div> <div class="pull-right"><i class="icon-caret-right"></i></div> </div> <ul class="dropdown-menu version-info-operations"> @@ -74,7 +74,7 @@ <span class="label label-info">{{serviceVersion.versionText}}</span> <span class="stack">{{serviceVersion.stackVersion}}</span> <div class="group"><strong>{{serviceVersion.configGroupName}}</strong></div> - <div class="date"><strong>{{serviceVersion.author}}</strong> {{t dashboard.configHistory.info-bar.authoredOn}} <strong>{{serviceVersion.createdDate}}</strong></div> + <div class="date"><strong>{{serviceVersion.authorFormatted}}</strong> {{t dashboard.configHistory.info-bar.authoredOn}} <strong>{{serviceVersion.createdDate}}</strong></div> <div class="notes">{{serviceVersion.fullNotes}}</div> </div> <div class="version-operations-buttons"> @@ -105,7 +105,7 @@ <span class="label-current label label-success icon-ok" data-toggle="tooltip" {{translateAttr title="common.current"}}></span> {{/if}} {{#if view.displayedServiceVersion.author}} - <strong>{{view.displayedServiceVersion.author}}</strong> {{t dashboard.configHistory.info-bar.authoredOn}} <strong>{{view.displayedServiceVersion.createdDate}}</strong> + <strong>{{view.displayedServiceVersion.authorFormatted}}</strong> {{t dashboard.configHistory.info-bar.authoredOn}} <strong>{{view.displayedServiceVersion.createdDate}}</strong> {{/if}} </div> {{#isAuthorized "SERVICE.MODIFY_CONFIGS"}} http://git-wip-us.apache.org/repos/asf/ambari/blob/0da68672/ambari-web/app/templates/common/configs/service_version_box.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/common/configs/service_version_box.hbs b/ambari-web/app/templates/common/configs/service_version_box.hbs index fe5b8b4..65d7f48 100644 --- a/ambari-web/app/templates/common/configs/service_version_box.hbs +++ b/ambari-web/app/templates/common/configs/service_version_box.hbs @@ -22,7 +22,7 @@ <div {{bindAttr class=":version-info :box :pull-right view.serviceVersion.isDisplayed:displayed view.serviceVersion.isDisabled:grayedOut"}} {{action doAction view.serviceVersion view.actionTypes.SWITCH target="view.parentView"}}> <div class="top-label"> <span class="label label-info">{{view.serviceVersion.versionText}}</span> - <span class="author pull-right">{{view.serviceVersion.author}}</span> + <span class="author pull-right">{{view.serviceVersion.authorFormatted}}</span> </div> <div class="content">{{view.serviceVersion.timeSinceCreated}}</div> <div class="stack-label">{{view.serviceVersion.stackVersion}}</div> @@ -39,7 +39,7 @@ <div class="content"> <span class="label label-info">{{view.serviceVersion.versionText}}</span> <span class="pull-right"><strong>{{view.serviceVersion.configGroupName}}</strong></span> <span class="stack">{{view.serviceVersion.stackVersion}}</span> - <div class="date"><strong>{{view.serviceVersion.author}}</strong> {{t dashboard.configHistory.info-bar.authoredOn}} <strong>{{view.serviceVersion.createdDate}}</strong></div> + <div class="date"><strong>{{view.serviceVersion.authorFormatted}}</strong> {{t dashboard.configHistory.info-bar.authoredOn}} <strong>{{view.serviceVersion.createdDate}}</strong></div> <div class="notes">{{view.serviceVersion.fullNotes}}</div> </div> <div class="version-operations-buttons"> http://git-wip-us.apache.org/repos/asf/ambari/blob/0da68672/ambari-web/app/templates/main/host/host_alerts.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/host/host_alerts.hbs b/ambari-web/app/templates/main/host/host_alerts.hbs index 42029e4..658f1b0 100644 --- a/ambari-web/app/templates/main/host/host_alerts.hbs +++ b/ambari-web/app/templates/main/host/host_alerts.hbs @@ -51,8 +51,8 @@ <td> <a href="#" {{action routeToAlertDefinition instance.definitionId target="controller"}}>{{instance.label}}</a> </td> - <td>{{template "templates/main/alerts/alert_instance/status"}} - <time class="timeago" {{bindAttr data-original-title="instance.statusChangedAndLastCheckedFormatted"}}>{{instance.lastTriggeredForFormatted}}</time> + <td> + {{template "templates/main/alerts/alert_instance/status"}} </td> <td><span class="alert-text" {{bindAttr data-original-title="instance.escapeSpecialCharactersFromTooltip"}} http://git-wip-us.apache.org/repos/asf/ambari/blob/0da68672/ambari-web/app/views/common/configs/config_history_flow.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/configs/config_history_flow.js b/ambari-web/app/views/common/configs/config_history_flow.js index ba49e49..1c19a60 100644 --- a/ambari-web/app/views/common/configs/config_history_flow.js +++ b/ambari-web/app/views/common/configs/config_history_flow.js @@ -182,7 +182,8 @@ App.ConfigHistoryFlowView = Em.View.extend({ Em.get(this.get('serviceVersionsReferences'), key).destroy(); }, this); this.$('.version-info-bar-wrapper').trigger('sticky_kit:detach').off(); - this.$('[data-toggle=tooltip], [data-toggle=arrow-tooltip]').remove(); + this.$('[data-toggle=tooltip]').tooltip('destroy'); + this.$('[data-toggle=arrow-tooltip]').tooltip('destroy'); }, willInsertElement: function () { @@ -521,6 +522,11 @@ App.ConfigHistoryFlowView = Em.View.extend({ App.ConfigsServiceVersionBoxView = Em.View.extend({ + /** + * bound from template + */ + serviceVersion: null, + actionTypesBinding: 'parentView.actionTypes', disabledActionAttr: Em.computed.alias('serviceVersion.disabledActionAttr'), @@ -548,6 +554,7 @@ App.ConfigsServiceVersionBoxView = Em.View.extend({ willDestroyElement: function() { this.$('.version-box').off(); - this.$('[data-toggle=tooltip], [data-toggle=arrow-tooltip]').remove(); + this.$('[data-toggle=tooltip]').tooltip('destroy'); + this.$('[data-toggle=arrow-tooltip]').tooltip('destroy'); } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/0da68672/ambari-web/test/models/configs/service_config_version_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/models/configs/service_config_version_test.js b/ambari-web/test/models/configs/service_config_version_test.js index 1998262..721354d 100644 --- a/ambari-web/test/models/configs/service_config_version_test.js +++ b/ambari-web/test/models/configs/service_config_version_test.js @@ -33,7 +33,7 @@ describe('App.ServiceConfigVersion', function () { App.TestAliases.testAsComputedAnd(getModel(), 'canBeMadeCurrent', ['isCompatible', '!isCurrent']); - App.TestAliases.testAsComputedTruncate(getModel(), 'authorFormatted', 'author', 20, 20); + App.TestAliases.testAsComputedTruncate(getModel(), 'authorFormatted', 'author', 15, 15); App.TestAliases.testAsComputedTruncate(getModel(), 'briefNotes', 'fullNotes', 81, 81, '');