@staticmethod
  def BuildHashFromNotification(notification):
    h = {}

    # Still display if subject doesn't get set, this will appear in the GUI with
    # a target of "None"
    urn = "/"
    if notification.subject is not None:
      urn = notification.subject

    # General Host information
    if notification.type == "Discovery":
      path = rdfvalue.RDFURN(urn)
      components = path.Path().split("/")[1:]
      h["c"] = components[0]
      h["main"] = "HostInformation"

    elif notification.type == "DownloadFile":
      h["aff4_path"] = notification.subject
      h["main"] = "DownloadFile"

    elif notification.type == "ViewObject":
      path = rdfvalue.RDFURN(urn)
      components = path.Path().split("/")[1:]
      if len(components) == 2 and components[0] == "hunts":
        h["hunt_id"] = notification.subject
        h["main"] = "ManageHunts"
      elif len(components) == 2 and components[0] == "cron":
        h["cron_job_urn"] = notification.subject
        h["main"] = "ManageCron"
      elif len(components) == 3 and components[1] == "flows":
        h["flow"] = notification.subject
        h["c"] = components[0]
        h["main"] = "ManageFlows"
      else:
        h["c"] = components[0]
        h["aff4_path"] = notification.subject
        h["t"] = renderers.DeriveIDFromPath("/".join(components[1:-1]))
        h["main"] = "VirtualFileSystemView"

    # Error with a flow
    elif notification.type == "FlowStatus":
      path = rdfvalue.RDFURN(urn)
      components = path.Path().split("/")[1:]
      h["flow"] = notification.source
      h["c"] = components[0]
      h["main"] = "ManageFlows"

    elif notification.type == "GrantAccess":
      h["main"] = "GrantAccess"
      h["acl"] = notification.subject

    return urllib.urlencode(
        dict([(x, utils.SmartStr(y)) for x, y in h.items()]))
Navigate to the most appropriate location for this navigation.
dataset/ETHPy150Open google/grr/grr/gui/plugins/notifications.py/ViewNotifications.BuildHashFromNotification