[GitHub] brooklyn-ui pull request #112: DSL editor: support referencing `brooklyn.par...
Github user asfgit closed the pull request at: https://github.com/apache/brooklyn-ui/pull/112 ---
[GitHub] brooklyn-ui pull request #112: DSL editor: support referencing `brooklyn.par...
Github user ahgittin commented on a diff in the pull request: https://github.com/apache/brooklyn-ui/pull/112#discussion_r235936483 --- Diff: ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js --- @@ -512,6 +514,16 @@ function BlueprintService($log, $q, $sce, paletteApi, iconGenerator, dslService) entity.miscData.set('config', allConfig); } +function addUnlistedParameterDefinitions(entity) { +let allParams = entity.miscData.get('parameters') || []; +entity.parameters.forEach((param) => { +if (!allParams.some((e) => e.name === param.name)) { +allParams.push(param); +} +}); +entity.miscData.set('parameters', allParams); +} --- End diff -- @tbouron noted to me > Hum but the parameters are already definitions, we just need to add them into the model which Aled did. There is no need to loop over the parameters to add them again i think that makes sense so he is right, let's remove this method @aledsage -- and be sure to test DSL when we have parameters defined via the UI ---
[GitHub] brooklyn-ui pull request #112: DSL editor: support referencing `brooklyn.par...
Github user ahgittin commented on a diff in the pull request: https://github.com/apache/brooklyn-ui/pull/112#discussion_r235935687 --- Diff: ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js --- @@ -512,6 +514,16 @@ function BlueprintService($log, $q, $sce, paletteApi, iconGenerator, dslService) entity.miscData.set('config', allConfig); } +function addUnlistedParameterDefinitions(entity) { +let allParams = entity.miscData.get('parameters') || []; +entity.parameters.forEach((param) => { +if (!allParams.some((e) => e.name === param.name)) { +allParams.push(param); +} +}); +entity.miscData.set('parameters', allParams); +} --- End diff -- aha TY. when we add paramters via the UI (coming soon) this will be needed. okay to add with a comment to this effect in the `addUnlilstedParameters` method? ---
[GitHub] brooklyn-ui pull request #112: DSL editor: support referencing `brooklyn.par...
Github user tbouron commented on a diff in the pull request: https://github.com/apache/brooklyn-ui/pull/112#discussion_r235930249 --- Diff: ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js --- @@ -512,6 +514,16 @@ function BlueprintService($log, $q, $sce, paletteApi, iconGenerator, dslService) entity.miscData.set('config', allConfig); } +function addUnlistedParameterDefinitions(entity) { +let allParams = entity.miscData.get('parameters') || []; +entity.parameters.forEach((param) => { +if (!allParams.some((e) => e.name === param.name)) { +allParams.push(param); +} +}); +entity.miscData.set('parameters', allParams); +} --- End diff -- `addUnlistedConfigKeyDefinition` has the specific function to create the definition of a config key that we add. We don't do that for parameters hence we should remove this method **before merging it** ---
[GitHub] brooklyn-ui pull request #112: DSL editor: support referencing `brooklyn.par...
Github user ahgittin commented on a diff in the pull request: https://github.com/apache/brooklyn-ui/pull/112#discussion_r235929789 --- Diff: ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js --- @@ -512,6 +514,16 @@ function BlueprintService($log, $q, $sce, paletteApi, iconGenerator, dslService) entity.miscData.set('config', allConfig); } +function addUnlistedParameterDefinitions(entity) { +let allParams = entity.miscData.get('parameters') || []; +entity.parameters.forEach((param) => { +if (!allParams.some((e) => e.name === param.name)) { +allParams.push(param); +} +}); +entity.miscData.set('parameters', allParams); +} --- End diff -- it's doing the same as `addUnlistedConfigKeyDefinition` -- although why it is needed I'm not clear, feels like it should be the responsibility of `miscData` to populate those, not this code here. worth a comment to explain but not needed for this PR. i say this is good to merge. ---
[GitHub] brooklyn-ui pull request #112: DSL editor: support referencing `brooklyn.par...
Github user tbouron commented on a diff in the pull request: https://github.com/apache/brooklyn-ui/pull/112#discussion_r235510831 --- Diff: ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js --- @@ -512,6 +514,16 @@ function BlueprintService($log, $q, $sce, paletteApi, iconGenerator, dslService) entity.miscData.set('config', allConfig); } +function addUnlistedParameterDefinitions(entity) { +let allParams = entity.miscData.get('parameters') || []; +entity.parameters.forEach((param) => { +if (!allParams.some((e) => e.name === param.name)) { +allParams.push(param); +} +}); +entity.miscData.set('parameters', allParams); +} --- End diff -- I don't understand what this method is doing. It seems that you compare `entity.miscData.get('parameters')` and `entity.parameters` but these are the same. ---
[GitHub] brooklyn-ui pull request #112: DSL editor: support referencing `brooklyn.par...
GitHub user aledsage opened a pull request: https://github.com/apache/brooklyn-ui/pull/112 DSL editor: support referencing `brooklyn.parameters` Allows a blueprint to use `brooklyn.parameters`, and to reference that parameter using the DSL editor. For example, I wrote the blueprint below in YAML (except the values of foo and bar), then switched to graphical view. I used the DSL editor to set the values for foo and bar to reference the brooklyn.parameters at the top-level app and on another entity. ``` brooklyn.config: toplevelkey: toplevelval brooklyn.parameters: - name: toplevelParam services: - type: server id: server1 brooklyn.parameters: - name: MyParameter type: string - type: server id: server2 brooklyn.config: bar: '$brooklyn:component("server1").config("MyParameter")' foo: '$brooklyn:parent().config("toplevelParam")' ``` You can merge this pull request into a Git repository by running: $ git pull https://github.com/aledsage/brooklyn-ui dsl-editor-reference-brooklyn-parameter Alternatively you can review and apply these changes as the patch at: https://github.com/apache/brooklyn-ui/pull/112.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 #112 commit dc8ee4e019ae581db0fe72a4d09890db566c3045 Author: Aled Sage Date: 2018-11-21T16:55:24Z DSL editor: support referencing `brooklyn.parameters` ---