Skip to content
Snippets Groups Projects

Update Timeline event update mutation to consider timeline event tags

Merged Rajendra Kadam requested to merge 373853-incident-tag-timeline-event-update into master
All threads resolved!

What does this MR do and why?

This MR adds support to update timeline event tags on a timeline event.

The way this works is the API expects the net result of tag updates to do on a timeline event.

For example, assume there are event1, tag1, tag2, and tag3 on a project. event1 is already assigned with tag1. We need to update it with tag3. So from the front end, I will get [tag1, tag3]. So I compute the tags to add and tags to remove and assign/unassign them accordingly. If I have to delete the assigned tags on event1, then the frontend passes me the [] tags value. This means, we need to delete all tag links to the event and it will not have any assigned tags. If the value for tags from frontend is the same as the assigned tags, then I do not perform any operation regarding tag updates on the event.

Query plan for the scopes

  1. by_names: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/13345/commands/46839
  2. timeline_event.timeline_event_tags: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/13345/commands/46840

Mutation

Sample mutation

mutation UpdateTimelineEvent($input: TimelineEventUpdateInput!) {
  timelineEventUpdate(input: $input) {
    timelineEvent {
      id
      note
      timelineEventTags {
        nodes {
          name
        }
      }
    }
    errors
  }
}

Sample input

{
  "input": {
    "id": "<global id of the incident>",
    "note":"<strong>Updated note</strong>",
    "occurredAt": "2022-01-25T11:38:05Z",
    "timelineEventTagNames": [<name of the tag>]
  }
}

How to set up and validate locally

  1. Make sure you have maintainer access to a project.
  2. Create some tags using GraphQL by following the steps mentioned in !102870 (merged)
  3. Create a timeline event using the UI by following the steps mentioned in the docs.
  4. Get the global id of the above timeline event from the console using IncidentManagement::TimelineEvent.last.to_global_id.
  5. Follow the update mutation above with the above sample input to update the event.
  6. Pass some non-existing tags, remove some tags, add some tags using the API and check the result.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #373853 (closed)

Edited by Rajendra Kadam

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Rajendra Kadam resolved all threads

    resolved all threads

  • Rajendra Kadam marked this merge request as ready

    marked this merge request as ready

  • requested review from @bauerdominic

  • added database label

  • Dominic Bauer removed review request for @bauerdominic

    removed review request for @bauerdominic

  • mentioned in work item #383135 (closed)

  • Rajendra Kadam added 1 commit

    added 1 commit

    • 9f1425a1 - Add transaction to the service

    Compare with previous version

  • A deleted user added databasereview pending label
  • Rajendra Kadam changed the description

    changed the description

  • Rajendra Kadam added 1 commit

    added 1 commit

    • 3c537929 - Add more specs, make update as a transaction

    Compare with previous version

  • Rajendra Kadam added 1 commit

    added 1 commit

    • 94a29f19 - Add more specs to check the transaction

    Compare with previous version

  • Rajendra Kadam changed the description

    changed the description

  • requested review from @bauerdominic and @OmarQunsulGitlab

  • 🤖 GitLab Bot 🤖 changed milestone to %15.7

    changed milestone to %15.7

  • Dominic Bauer requested review from @sashi_kumar and removed review request for @bauerdominic

    requested review from @sashi_kumar and removed review request for @bauerdominic

  • Omar Qunsul
  • Omar Qunsul removed review request for @OmarQunsulGitlab

    removed review request for @OmarQunsulGitlab

  • Sashi Kumar Kumaresan approved this merge request

    approved this merge request

  • :wave: @sashi_kumar, thanks for approving this merge request.

    This is the first time the merge request is approved. To ensure full test coverage, a new pipeline will be started shortly.

    For more info, please refer to the following links:

  • 🤖 GitLab Bot 🤖 added 1 deleted label

    added 1 deleted label

  • Sashi Kumar Kumaresan requested review from @engwan and removed review request for @sashi_kumar

    requested review from @engwan and removed review request for @sashi_kumar

  • Allure report

    allure-report-publisher generated test report!

    e2e-review-qa: :exclamation: test report for 94a29f19

    expand test summary
    +-----------------------------------------------------------------------------------------+
    |                                     suites summary                                      |
    +------------------------------------+--------+--------+---------+-------+-------+--------+
    |                                    | passed | failed | skipped | flaky | total | result |
    +------------------------------------+--------+--------+---------+-------+-------+--------+
    | Plan                               | 49     | 0      | 1       | 0     | 50    | ✅     |
    | Verify                             | 12     | 0      | 1       | 0     | 13    | ✅     |
    | Manage                             | 39     | 0      | 4       | 4     | 43    | ❗     |
    | Create                             | 28     | 0      | 1       | 0     | 29    | ✅     |
    | Govern                             | 10     | 0      | 5       | 0     | 15    | ✅     |
    | Configure                          | 0      | 0      | 1       | 0     | 1     | ➖     |
    | Feature flag handler sanity checks | 9      | 0      | 0       | 0     | 9     | ✅     |
    | Package                            | 0      | 0      | 1       | 0     | 1     | ➖     |
    | Version sanity check               | 0      | 0      | 1       | 0     | 1     | ➖     |
    +------------------------------------+--------+--------+---------+-------+-------+--------+
    | Total                              | 147    | 0      | 15      | 4     | 162   | ❗     |
    +------------------------------------+--------+--------+---------+-------+-------+--------+
  • Heinrich Lee Yu
  • Heinrich Lee Yu removed review request for @engwan

    removed review request for @engwan

  • Rajendra Kadam added 896 commits

    added 896 commits

    • 94a29f19...603d981a - 884 commits from branch master
    • 5c6626a2 - Add update logic for timeline event
    • f4b98a94 - Add update logic for timeline event
    • 15bf25c6 - Update gql docs
    • 5580c59d - Always execute tag updates unless nil
    • 9145208c - Rebase to master and refactor validate tags
    • 6d527e61 - Fix cop offense for spec
    • 35c16f5f - Update service for update event
    • a7958c1b - Remove passing event around in the service
    • 1c0a2b31 - Add transaction to the service
    • 54caba30 - Add more specs, make update as a transaction
    • fb2fe661 - Add more specs to check the transaction
    • 8eb01bf7 - Add db reviewer and backend suggestions

    Compare with previous version

  • requested review from @OmarQunsulGitlab and @engwan

  • Rajendra Kadam added 1 commit

    added 1 commit

    • 4215083f - Add one spec for removing all tags

    Compare with previous version

  • Rajendra Kadam added 1 commit

    added 1 commit

    • 57cd3300 - Remove redandunt method in model

    Compare with previous version

  • Rajendra Kadam added 1 commit

    added 1 commit

    • ce26c6a0 - Remove tag ids scope for tag links model

    Compare with previous version

  • Rajendra Kadam added 1 commit

    added 1 commit

    • fa739222 - Remove tag link specs for tag ids scope

    Compare with previous version

  • Rajendra Kadam changed the description

    changed the description

  • Heinrich Lee Yu removed review request for @engwan

    removed review request for @engwan

  • Rajendra Kadam added 1 commit

    added 1 commit

    • 49f22442 - Apply maintainer suggestions - 2

    Compare with previous version

  • Rajendra Kadam requested review from @engwan

    requested review from @engwan

  • Omar Qunsul approved this merge request

    approved this merge request

  • added databasereviewed label and removed databasereview pending label

  • Omar Qunsul removed review request for @OmarQunsulGitlab

    removed review request for @OmarQunsulGitlab

  • Omar Qunsul requested review from @a_akgun

    requested review from @a_akgun

  • Alper Akgun approved this merge request

    approved this merge request

  • Thanks @rkadam3 database LGTM.

  • added databaseapproved label and removed databasereviewed label

  • Alper Akgun removed review request for @a_akgun

    removed review request for @a_akgun

  • Heinrich Lee Yu approved this merge request

    approved this merge request

  • Heinrich Lee Yu resolved all threads

    resolved all threads

  • Heinrich Lee Yu enabled an automatic merge when the pipeline for 2f9e03c1 succeeds

    enabled an automatic merge when the pipeline for 2f9e03c1 succeeds

  • Heinrich Lee Yu mentioned in commit f659e594

    mentioned in commit f659e594

  • added workflowstaging label and removed workflowcanary label

  • Rajendra Kadam mentioned in merge request !109464 (merged)

    mentioned in merge request !109464 (merged)

  • Please register or sign in to reply
    Loading