You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by ahgittin <gi...@git.apache.org> on 2018/11/13 09:01:08 UTC

[GitHub] brooklyn-ui pull request #108: improve logic and ui for inferring bundle and...

GitHub user ahgittin opened a pull request:

    https://github.com/apache/brooklyn-ui/pull/108

    improve logic and ui for inferring bundle and type name when saving to catalog

    previously showed "untitled" if you clilcked to expand on a new blueprint, now defaults to tidied version of display name (which is required)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ahgittin/brooklyn-ui catalog-saver-autocomplete

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/brooklyn-ui/pull/108.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #108
    
----
commit b6f0281dafb2be6067cf51307f20eef401d3d7ac
Author: Alex Heneveld <al...@...>
Date:   2018-11-12T16:09:06Z

    improve logic and ui for inferring bundle and type name when saving to catalog

----


---

[GitHub] brooklyn-ui issue #108: improve logic and ui for inferring bundle and type n...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the issue:

    https://github.com/apache/brooklyn-ui/pull/108
  
    good comments, all addressed


---

[GitHub] brooklyn-ui pull request #108: improve logic and ui for inferring bundle and...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-ui/pull/108#discussion_r232974919
  
    --- Diff: ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html ---
    @@ -57,19 +60,17 @@ <h3 class="modal-title">{{getTitle()}}</h3>
                     <label class="control-label">Bundle ID</label>
                     <div class="input-group">
                         <span class="input-group-addon">catalog-bom-</span>
    -                    <input ng-model="config.bundle" ng-disabled="state.saving" class="form-control" placeholder="E.g my-bundle" name="bundle" required ng-pattern="state.pattern" autofocus />
    +                    <input ng-model="config.bundle" ng-disabled="state.saving" class="form-control" name="bundle" ng-pattern="state.pattern" autofocus placeholder="{{ config.name | bundlize }}"/>
                     </div>
                     <p class="help-block" ng-show="form.bundle.$invalid">
    -                    <span ng-if="form.bundle.$error.required">You must specify a bundle ID</span>
                         <span ng-if="form.bundle.$error.pattern">The bundle ID can contains only letters, numbers as well a the following characters: <code>.</code>, <code>-</code> and <code>_</code></span>
                     </p>
                 </div>
     
                 <div class="form-group" ng-class="{'has-error': form.symbolicName.$invalid}">
                     <label class="control-label">Blueprint symbolic name</label>
    -                <input ng-model="config.symbolicName" ng-disabled="state.saving" class="form-control" placeholder="E.g my-catalog-id" name="symbolicName" required ng-pattern="state.pattern" autofocus />
    +                <input ng-model="config.symbolicName" ng-disabled="state.saving" class="form-control" name="symbolicName" ng-pattern="state.pattern" autofocus placeholder="{{ config.name | bundlize }}"/>
    --- End diff --
    
    good spot, fitxed


---

[GitHub] brooklyn-ui pull request #108: improve logic and ui for inferring bundle and...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/brooklyn-ui/pull/108


---

[GitHub] brooklyn-ui pull request #108: improve logic and ui for inferring bundle and...

Posted by tbouron <gi...@git.apache.org>.
Github user tbouron commented on a diff in the pull request:

    https://github.com/apache/brooklyn-ui/pull/108#discussion_r232966244
  
    --- Diff: ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html ---
    @@ -57,19 +60,17 @@ <h3 class="modal-title">{{getTitle()}}</h3>
                     <label class="control-label">Bundle ID</label>
                     <div class="input-group">
                         <span class="input-group-addon">catalog-bom-</span>
    -                    <input ng-model="config.bundle" ng-disabled="state.saving" class="form-control" placeholder="E.g my-bundle" name="bundle" required ng-pattern="state.pattern" autofocus />
    +                    <input ng-model="config.bundle" ng-disabled="state.saving" class="form-control" name="bundle" ng-pattern="state.pattern" autofocus placeholder="{{ config.name | bundlize }}"/>
    --- End diff --
    
    I get that `config.name` is required but until you set it, there will be no placeholder. So you should do `{{(config.name | bundlize) || 'E.g my-bundle'}}`


---

[GitHub] brooklyn-ui pull request #108: improve logic and ui for inferring bundle and...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-ui/pull/108#discussion_r232973583
  
    --- Diff: ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js ---
    @@ -223,3 +228,7 @@ function templateCache($templateCache) {
         $templateCache.put(TEMPLATE_URL, template);
         $templateCache.put(TEMPLATE_MODAL_URL, modalTemplate);
     }
    +
    +var bundlize = (input) => input && input.split(/[^a-zA-Z0-9]+/).filter(x => x).join('-').toLowerCase();
    --- End diff --
    
    i didn't like `bundlizeProvider()(textToBundlize)`, but `$filter('bundlize')(text)` is not bad, changed


---

[GitHub] brooklyn-ui pull request #108: improve logic and ui for inferring bundle and...

Posted by tbouron <gi...@git.apache.org>.
Github user tbouron commented on a diff in the pull request:

    https://github.com/apache/brooklyn-ui/pull/108#discussion_r232965561
  
    --- Diff: ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js ---
    @@ -223,3 +228,7 @@ function templateCache($templateCache) {
         $templateCache.put(TEMPLATE_URL, template);
         $templateCache.put(TEMPLATE_MODAL_URL, modalTemplate);
     }
    +
    +var bundlize = (input) => input && input.split(/[^a-zA-Z0-9]+/).filter(x => x).join('-').toLowerCase();
    --- End diff --
    
    Why create this `var` (which should be `let`) ? The function should live within `bundlizeProvider` which you can then call directly within this file with `bundlizeProvider()(input);`. Actually, as better way would be to rely on the `$filter` service like so: `$filter('bundlize`)(input);`


---

[GitHub] brooklyn-ui pull request #108: improve logic and ui for inferring bundle and...

Posted by tbouron <gi...@git.apache.org>.
Github user tbouron commented on a diff in the pull request:

    https://github.com/apache/brooklyn-ui/pull/108#discussion_r232966239
  
    --- Diff: ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html ---
    @@ -57,19 +60,17 @@ <h3 class="modal-title">{{getTitle()}}</h3>
                     <label class="control-label">Bundle ID</label>
                     <div class="input-group">
                         <span class="input-group-addon">catalog-bom-</span>
    -                    <input ng-model="config.bundle" ng-disabled="state.saving" class="form-control" placeholder="E.g my-bundle" name="bundle" required ng-pattern="state.pattern" autofocus />
    +                    <input ng-model="config.bundle" ng-disabled="state.saving" class="form-control" name="bundle" ng-pattern="state.pattern" autofocus placeholder="{{ config.name | bundlize }}"/>
                     </div>
                     <p class="help-block" ng-show="form.bundle.$invalid">
    -                    <span ng-if="form.bundle.$error.required">You must specify a bundle ID</span>
                         <span ng-if="form.bundle.$error.pattern">The bundle ID can contains only letters, numbers as well a the following characters: <code>.</code>, <code>-</code> and <code>_</code></span>
                     </p>
                 </div>
     
                 <div class="form-group" ng-class="{'has-error': form.symbolicName.$invalid}">
                     <label class="control-label">Blueprint symbolic name</label>
    -                <input ng-model="config.symbolicName" ng-disabled="state.saving" class="form-control" placeholder="E.g my-catalog-id" name="symbolicName" required ng-pattern="state.pattern" autofocus />
    +                <input ng-model="config.symbolicName" ng-disabled="state.saving" class="form-control" name="symbolicName" ng-pattern="state.pattern" autofocus placeholder="{{ config.name | bundlize }}"/>
    --- End diff --
    
    I get that `config.name` is required but until you set it, there will be no placeholder. So you should do `{{(config.name | bundlize) || 'E.g my-catalog-id'}}`


---