     $scope.node = {}
     $scope.package = {}
     $scope.packageByName = {}
+    $scope.querying = {}
 
     $scope.show = {}
     $scope.nodeVisible = {}

      x instanceof Array and x.length == 0

    fetchAllUnpaginated = (field, action, opts = {}) ->
      # fetch the field
      Restangular.all(field).getList( opts.query || {} ).then(
        (data) ->
          # if we have a result, process it
          console.log "fetched #{field} (no pagination)"
          action(data)
        , () ->
          # otherwise we have a fetch error
          fetchError("fetch #{field} (no pagination)")
        )

    fetchAllPaginated = (field, action, opts = {})->
      stop_when = opts.stop_when || isEmptyArray
      page = opts.page || 1
      limit = opts.limit || 50
      # construct a query for pagination
      query = _.merge(
        {page: page, limit: limit},

            return fetchAllUnpaginated(field, action, opts)
          # otherwise we have a fetch error
          fetchError("fetch #{field} on page #{page}, limit #{limit}")
          # end the querying indicator
          delete $scope.querying[field]
        )

    $scope.fetchNodes = (page = 1)->
