       return error err  if err?
 
       unless bundle?
-        @createBundleView = new GroupsBundleCreateView {}, group
+        @createBundleView = new GroupsBundleCreateView {}, { group }
         @createBundleView.once 'BundleCreated', @bound 'resetBundleView'
         @addSubView @createBundleView
       else
-        @editBundleView = new GroupsBundleEditView {}, group
+        @editBundleView = new GroupsBundleEditView {}, { group, bundle }
         @editBundleView.once 'BundleDestroyed', @bound 'resetBundleView'
         @addSubView @editBundleView

  constructor:(options, data)->
    super

    group = @getData()

    @createButton = new KDButtonView
      style     : "clean-gray"


class GroupsBundleEditView extends JView

  computeUnitMap =
    vms   : 1
    cpu   : 1
    ram   : 0.25
    disk  : 0.5

  computeUnitVisibility =
    users : yes
    vms   : yes
    cpu   : no
    ram   : no
    disk  : no

  constructor: (options, data) ->
    super

    {group, bundle} = @getData()

    {JLimit} = KD.remote.api

    computeLimit = new JLimit { usage: 0, quota: 0, unit: 'VM', title: 'vms' }

    bundle.fetchLimits (err, limits) =>
      return error err      if err?
      limits.splice 1, 0, computeLimit
      @renderLimits limits  if limits?

    @usersLabel = new KDLabelView
      title       : 'Users'

    @usersSlider = new KDInputView
      label       : @usersLabel
      type        : 'range'
      change      : (event) =>
        userData = @limitsData.users
        userData.quota = @usersSlider.getValue()
        userData.emit 'update'
      attributes  :
        min       : 0
        max       : 50000

    @computeLabel = new KDLabelView
      title       : 'Computing resources'

    @computeSlider = new KDInputView
      label       : @computeLabel
      type        : 'range'
      change      : (event) =>
        computeValue = @computeSlider.getValue()
        ['cpu','ram','disk','vms'].forEach (resource) =>
          resourceData = @limitsData[resource]
          resourceData.quota = computeValue * computeUnitMap[resource]
          resourceData.emit 'update'
      attributes  :
        min       : 0
        max       : 50000

    @limits = new KDView
      tagName   : 'span'
      cssClass  : 'group-bundle-limits clearfix'

    @destroyButton = new KDButtonView
      style     : "modal-clean-red"
      title     : "Destroy bundle"
      callback  : =>
        group.destroyBundle (err, bundle) =>
