brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-ui pull request #34: Use new pinned and constraints flag returned b...
Date Fri, 30 Sep 2016 15:06:51 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-ui/pull/34#discussion_r81356873
  
    --- Diff: src/main/webapp/assets/js/view/application-add-wizard.js ---
    @@ -680,8 +680,13 @@ define([
                     this.$('.required-config-loading').hide()
                     if (catalogEntryItem!=null && catalogEntryItem.config!=null)
{
                         var that = this
    -                    _.each(catalogEntryItem.config, function (cfg) {
    -                        if (cfg.priority !== undefined) {
    +                    _.chain(catalogEntryItem.config).sortBy(function (cfg){
    +                        return cfg.priority ? cfg.priority : 99999;
    +                    }).each(function (cfg) {
    +                        if (cfg.pinned === true) {
    +                            var html = _.template(RequiredConfigEntryHtml, {data:cfg});
    +                            that.$('.config-table').append(html);
    +                        } else if (cfg.constraints.indexOf('required') > - 1 &&
(!cfg.defaultValue || cfg.defaultValue === '')) {
    --- End diff --
    
    Both cases have the same body so can merge the check by `||`-ing the two alternatives
(two make it clear that teartment is the same)
    `''` is treated as false so could change `(!cfg.defaultValue || cfg.defaultValue === '')`
to `!cfg.defaultValue`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message