[ https://issues.apache.org/jira/browse/CLOUDSTACK-9611?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15901145#comment-15901145 ]
ASF GitHub Bot commented on CLOUDSTACK-9611: -------------------------------------------- Github user nitin-maharana commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1771#discussion_r104902049 --- Diff: ui/scripts/system.js --- @@ -2090,27 +2090,57 @@ fields: { vlanrange: { label: 'label.vlan.vni.range', - /* select: function(args) { - var items = []; - if(args.context.physicalNetworks[0].vlan != null && args.context.physicalNetworks[0].vlan.length > 0) { - var vlanranges = args.context.physicalNetworks[0].vlan.split(";"); - for(var i = 0; i < vlanranges.length ; i++) { - items.push({id: vlanranges[i], description: vlanranges[i]}); - } - } - args.response.success({data: items}); - },*/ validation: { required: true } }, - account: { - label: 'label.account', - validation: { - required: true + scope: { + label: 'label.scope', + docID: 'helpGuestNetworkZoneScope', + select: function(args) { + var array1 = []; + + array1.push({ + id: 'account-specific', + description: 'label.account' + }); + array1.push({ + id: 'project-specific', + description: 'label.project' + }); + + args.response.success({ + data: array1 + }); + + args.$select.change(function() { + var $form = $(this).closest('form'); + + if ($(this).val() == "account-specific") { + $form.find('.form-item[rel=domainId]').css('display', 'inline-block'); + $form.find('.form-item[rel=account]').css('display', 'inline-block'); + $form.find('.form-item[rel=projectId]').hide(); + } else if ($(this).val() == "project-specific") { + $form.find('.form-item[rel=domainId]').css('display', 'inline-block'); + $form.find('.form-item[rel=account]').hide(); + $form.find('.form-item[rel=projectId]').css('display', 'inline-block'); + } + + if (args.context.projects != null && args.context.projects.length > 0) { + $form.find('.form-item[rel=domainId]').hide(); + $form.find('.form-item[rel=account]').hide(); + $form.find('.form-item[rel=projectId]').hide(); + } --- End diff -- @ustcweizhou : The above code handles my previous explanation. > Dedicating a Guest VLAN range to Project does not work > ------------------------------------------------------ > > Key: CLOUDSTACK-9611 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9611 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Reporter: Nitin Kumar Maharana > > Trying to dedicate a guest VLAN range to an account fails. If we pass both > account and projectid parameters to the dedicateGuestVlanRange (which are not > mentioned as mutually exclusive in API description) the API layer throws > error saying both are mutually exclusive. > Steps to Reproduce: > ================ > Create an account. Create a project in that account. > Go to admin account and change view to the above project. > Navigate to Infrastructure -> Zone -> Physical Network -> Guest -> Dedicate > Guest VLAN range. > Try to dedicate the guest VLAN range from the project view for the account > associated with the project. > It fails with Error saying accountName and projectId are mutually exclusive. > Expected: > ======== > The VLAN range should get dedicated to the project account. > Notes: > ===== > If we do the dedication from default view then it works fine as no projectid > is associated over there. -- This message was sent by Atlassian JIRA (v6.3.15#6346)