           pool = container
 
         default_SR = get pool.default_SR
-        default_SR = if default_SR
-          default_SR.id
-        else
-          ''
-
-        # Computes the list of templates.
-        templates = $scope.templates = []
-        forEach(vmTemplatesByContainer[host.id], (template) =>
-          templates.push(template)
-          return
-        )
-        forEach(vmTemplatesByContainer[pool.id], (template) =>
-          templates.push(template)
-          return
-        )
-
-        # Computes the list of srs.
-        SRs = []
-        forEach(srsByContainer[host.id], (template) =>
-          SRs.push(template)
-          return
-        )
-        forEach(srsByContainer[pool.id], (template) =>
-          SRs.push(template)
-          return
-        )
-
-        # Computes the list of ISO SRs.
-        $scope.ISO_SRs = (SR for SR in SRs when SR.content_type is 'iso')
-
-        # Computes the list of writable SRs.
-        $scope.writable_SRs = (SR for SR in SRs when SR.content_type isnt 'iso')
+        default_SR = if default_SR then default_SR.id else ''
     )
 
     $scope.availableMethods = {}

        result

    pool = default_SR = null
    do (
      networks = xoApi.getIndex('networksByPool')
    ) ->
      Object.defineProperties($scope, {
        networks: {
          get: () => pool && networks[pool.id]
        }
      })

    srsByContainer = xoApi.getIndex('srsByContainer')
    vmTemplatesByContainer = xoApi.getIndex('vmTemplatesByContainer')
    $scope.$watch(
      -> get $stateParams.container
      (container) ->

angular = require 'angular'
cloneDeep = require 'lodash.clonedeep'
filter = require 'lodash.filter'
forEach = require 'lodash.foreach'

#=====================================================================
