 
 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 = @getData()
+    {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     : "clean-gray"
+      style     : "modal-clean-red"
       title     : "Destroy bundle"
       callback  : =>
         group.destroyBundle (err, bundle) =>


          @emit 'BundleDestroyed', bundle

  pistachio:->
    """
    <h3>Bundle details</h3>
    <p>There will be some cool details here.</p>
    <p>For now you can only destroy it.</p>
    {{> @destroyButton}}
    """


class GroupsBundleView extends KDView


  constructor:(options, data)->
    super

    {group} = @getData()

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