ansible / awx

AWX provides a web-based user interface, REST API, and task engine built on top of Ansible. It is one of the upstream projects for Red Hat Ansible Automation Platform.
Other
14k stars 3.42k forks source link

Workflow node deletion activity stream does not link to workflow (and other workflow node activity stream weirdness) #3521

Open elyezer opened 5 years ago

elyezer commented 5 years ago
ISSUE TYPE
COMPONENT NAME
SUMMARY

When a node is deleted on a workflow the link to the workflow is not shown on the activity stream, see the screenshot on the additional information section.

This should make https://github.com/ansible/awx/issues/2760 more complete since https://github.com/ansible/awx/pull/3447 is now merged.

ADDITIONAL INFORMATION

Screenshot from 2019-03-22 15-04-31

jlmitch5 commented 3 years ago

I've moved this to be an API issue. The reason there is no link is because there is no data given for us to be able to build it. For context here is the delete event:

{
  "id": 41,
  "type": "activity_stream",
  "url": "/api/v2/activity_stream/41/",
  "related": {
    "actor": "/api/v2/users/1/"
  },
  "summary_fields": {
    "actor": {
      "id": 1,
      "username": "admin",
      "first_name": "",
      "last_name": ""
    }
  },
  "timestamp": "2021-01-14T16:19:45.794251Z",
  "operation": "delete",
  "changes": {
    "extra_data": "{}",
    "inventory": null,
    "scm_branch": null,
    "job_type": null,
    "job_tags": null,
    "skip_tags": null,
    "limit": null,
    "diff_mode": null,
    "verbosity": null,
    "workflow_job_template": "wfjt-6",
    "unified_job_template": "Approve 2-None",
    "all_parents_must_converge": false,
    "identifier": "121068bf-b022-402d-bd85-9e2a9c4199a7",
    "id": 2
  },
  "object1": "workflow_job_template_node",
  "object2": "",
  "object_association": "",
  "action_node": "awx",
  "object_type": ""
}

And here is the create event that contains the id and name of the wfjt so that we can link:

{
    "action_node": "awx",
    "changes": {
        "all_parents_must_converge": false,
        "diff_mode": null,
        "extra_data": "{}",
        "id": 1,
        "identifier": "4a515863-b42b-4d26-ae67-6607cf604c55",
        "inventory": null,
        "job_tags": null,
        "job_type": null,
        "limit": null,
        "scm_branch": null,
        "skip_tags": null,
        "unified_job_template": null,
        "verbosity": null,
        "workflow_job_template": "wfjt-6"
    },
    "id": 31,
    "object_association": "",
    "object_type": "",
    "object1": "workflow_job_template_node",
    "object2": "",
    "operation": "create",
    "related": {
        "actor": "/api/v2/users/1/",
        "workflow_job_template_node": [
            "/api/v2/workflow_job_template_nodes/1/"
        ]
    },
    "summary_fields": {
        "actor": {
            "first_name": "",
            "id": 1,
            "last_name": "",
            "username": "admin"
        },
        "workflow_job_template": [
            {
                "description": "",
                "id": 6,
                "name": "wfjt"
            }
        ],
        "workflow_job_template_node": [
            {
                "id": 1,
                "unified_job_template_id": 7
            }
        ]
    },
    "timestamp": "2021-01-14T16:19:15.998672Z",
    "type": "activity_stream",
    "url": "/api/v2/activity_stream/31/"
}

Also note there are two create events when a node is created. Similar to delete, one of these has what we need to link, the other seems superflous and also doesn't have this data (useful event on the left, not useful one on the right):

Screen Shot 2021-01-14 at 11 56 34 AM

In practice, this creates two events in the stream, one without link, which seems like a bug:

Screen Shot 2021-01-14 at 12 04 48 PM

Therer's also this event, which doesn't give me any summary info that I can use to build the description/link:

{
  "id": 36,
  "type": "activity_stream",
  "url": "/api/v2/activity_stream/36/",
  "related": {
    "actor": "/api/v2/users/1/"
  },
  "summary_fields": {
    "actor": {
      "id": 1,
      "username": "admin",
      "first_name": "",
      "last_name": ""
    }
  },
  "timestamp": "2021-01-14T16:19:33.669540Z",
  "operation": "update",
  "changes": {
    "unified_job_template": [
      null,
      "Approve 2-8"
    ]
  },
  "object1": "workflow_job_template_node",
  "object2": "",
  "object_association": "",
  "action_node": "awx",
  "object_type": ""
}