- def describe_node(uuid)
- bgcolor = determine_fillcolor @opts[:pips][uuid] if @opts[:pips]
-
- rsc = ArvadosBase::resource_class_for_uuid uuid.to_s
- if rsc
- href = "/#{rsc.to_s.underscore.pluralize rsc}/#{uuid}"
-
- #"\"#{uuid}\" [label=\"#{rsc}\\n#{uuid}\",href=\"#{href}\"];\n"
- if rsc == Collection
- if @pdata[uuid]
- #puts @pdata[uuid]
- if @pdata[uuid][:name]
- return "\"#{uuid}\" [label=\"#{@pdata[uuid][:name]}\",href=\"#{href}\",shape=oval,#{bgcolor}];\n"
- else
- files = nil
- if @pdata[uuid].respond_to? :files
- files = @pdata[uuid].files
- elsif @pdata[uuid][:files]
- files = @pdata[uuid][:files]
- end
-
- if files
- i = 0
- label = ""
- while i < 3 and i < files.length
- label += "\\n" unless label == ""
- label += files[i][1]
- i += 1
- end
- if i < files.length
- label += "\\n⋮"
- end
- return "\"#{uuid}\" [label=\"#{label}\",href=\"#{href}\",shape=oval,#{bgcolor}];\n"
- end
- end
- end
- return "\"#{uuid}\" [label=\"#{rsc}\",href=\"#{href}\",#{bgcolor}];\n"
+ def describe_node(uuid, describe_opts={})
+ bgcolor = determine_fillcolor (describe_opts[:pip] || @opts[:pips].andand[uuid])
+
+ rsc = ArvadosBase::resource_class_for_uuid uuid
+
+ if GenerateGraph::collection_uuid(uuid) || rsc == Collection
+ if Collection.is_empty_blob_locator? uuid.to_s
+ # special case
+ return "\"#{uuid}\" [label=\"(empty collection)\"];\n"
+ end
+
+ href = url_for ({:controller => Collection.to_s.tableize,
+ :action => :show,
+ :id => uuid.to_s })
+
+ return "\"#{uuid}\" [label=\"#{encode_quotes(describe_opts[:label] || (@pdata[uuid] and @pdata[uuid][:name]) || uuid)}\",shape=box,href=\"#{href}\",#{bgcolor}];\n"
+ else
+ href = ""
+ if describe_opts[:href]
+ href = ",href=\"#{url_for ({:controller => describe_opts[:href][:controller],
+ :action => :show,
+ :id => describe_opts[:href][:id] })}\""