Use Cases

This document contains UML sequence diagrams that model the primary use cases supported by JiraTUI. Each diagram illustrates the interaction flow between user actions, the TUI/CLI interface, and the underlying Python classes that orchestrate the communication with the Jira REST API.

Diagrams are organized into two main categories:

  • Work Item Operations: Create, retrieve, delete, and search work items via keyword and full-text search. These operations map directly to the Jira Cloud Platform REST API v3 (and v2 for on-premises installations).

  • Resource Management: Manage ancillary resources tied to work items: comments (add, view, delete), related tasks, web links, attachments, and subtasks. Additionally, covers work logging (time tracking) for work items, allowing teams to record effort and view historical work logs.

Each sequence diagram references the relevant Python classes from the codebase. This helps maintainers and contributors trace the flow from entry point through the application layers to API invocation.

Search Work Items

Search Single Work Item

To search a single work item the user needs to provide the item’s key in the Work Item Key input field. After pressing ^r the UI will fetch and show the details of the work item or, an error message if the item can not be found.

The following sequence diagram depicts the interaction of the user with the application and the series of steps that the application takes to search and retrieve an existing work item.

            sequenceDiagram
        actor User
        participant MainScreen
        participant APIController
        participant JiraAPI

        User->>MainScreen: Set Work Item Key input filter
        MainScreen->>MainScreen: Update Filter State

        User->>MainScreen: Press ^r (Search)
        activate MainScreen
        MainScreen->>MainScreen: action_search()

        MainScreen->>APIController: Execute search<br/>(with collected filters)
        activate APIController

        APIController->>JiraAPI: POST/GET search request<br/>(JQL or REST endpoint)
        activate JiraAPI

        JiraAPI-->>APIController: Return matched<br/>work item
        deactivate JiraAPI
        deactivate APIController

        MainScreen->>MainScreen: Process results<br/>(populate search table)

        deactivate MainScreen

        MainScreen->>User: Show filtered work item

        User->>MainScreen: Select work item from results<br/>(optional)
        MainScreen->>APIController: Fetch work item details
        APIController->>JiraAPI: GET work item details
        JiraAPI-->>APIController: Return full work item
        APIController-->>MainScreen: Return details
        MainScreen->>MainScreen: Populate detail tabs<br/>(Info, Comments, Attachments, etc.)
        MainScreen->>User: Display work item details
    

Create Work Items

The following sequence diagram depicts the interaction of the user with the application and the series of steps that the application takes to create a new work item.

The following are the main components used by the application to support this use case:

            ---
    config:
        theme: "default"
    ---
    sequenceDiagram
        actor User
        participant MainScreen
        participant AddWorkItemScreen
        participant APIController
        participant JiraAPI as Jira REST API

        User->>MainScreen: Press '^n'
        activate MainScreen
        MainScreen->>MainScreen: action_create_work_item()

        MainScreen->>AddWorkItemScreen: push_screen(AddWorkItemScreen)
        activate AddWorkItemScreen

        AddWorkItemScreen->>APIController: on_mount(): Fetch available projects
        activate APIController
        APIController->>JiraAPI: GET /rest/api/3/projects
        JiraAPI-->>APIController: Return list of projects
        deactivate APIController

        AddWorkItemScreen->>User: Display create work item form<br/>(Project selector, Issue Type selector, etc.)
        deactivate MainScreen

        Note over AddWorkItemScreen: Form Fields:<br/>- Project (*)<br/>- Issue Type (*)<br/>- Reporter (*)<br/>- Assignee<br/>- Summary (*)<br/>- Description<br/>- Parent Key<br/>- Additional custom fields

        User->>AddWorkItemScreen: Select Project
        activate AddWorkItemScreen
        AddWorkItemScreen->>APIController: Fetch available issue types<br/>for selected project
        activate APIController
        APIController->>JiraAPI: GET /rest/api/3/issue/createmeta
        JiraAPI-->>APIController: Return issue types
        deactivate APIController
        AddWorkItemScreen->>User: Update Issue Type dropdown

        User->>AddWorkItemScreen: Select Issue Type
        AddWorkItemScreen->>APIController: Fetch issue create metadata<br/>(for project + issue type)
        activate APIController
        APIController->>JiraAPI: GET /rest/api/3/issue/createmeta<br/>(with project + issue type)
        JiraAPI-->>APIController: Return field metadata
        deactivate APIController

        AddWorkItemScreen->>AddWorkItemScreen: Build dynamic widgets<br/>(based on metadata)
        AddWorkItemScreen->>User: Display dynamic form fields<br/>(custom fields, labels, etc.)

        User->>AddWorkItemScreen: Fill required fields<br/>(in any order)
        Note right of AddWorkItemScreen: User provides:<br/>- Project<br/>- Issue Type<br/>- Summary<br/>- Reporter<br/>- Optional: Assignee, Description,<br/>Parent Key, Custom Fields

        AddWorkItemScreen->>AddWorkItemScreen: Validate required fields<br/>(on each field change)

        alt All required fields filled
            AddWorkItemScreen->>AddWorkItemScreen: Enable Save button
        else Missing required fields
            AddWorkItemScreen->>AddWorkItemScreen: Keep Save button disabled
        end

        User->>AddWorkItemScreen: Press '^s' or click Save
        activate AddWorkItemScreen
        AddWorkItemScreen->>AddWorkItemScreen: Validate all required fields

        alt Validation passed
            AddWorkItemScreen->>AddWorkItemScreen: Collect all field values<br/>(static + dynamic)
            AddWorkItemScreen->>AddWorkItemScreen: Format field values<br/>(user pickers, labels,<br/>select fields, etc.)

            AddWorkItemScreen->>AddWorkItemScreen: Build work item payload<br/>(fields: {...})

            AddWorkItemScreen->>MainScreen: pop_screen()<br/>(return payload data)
            deactivate AddWorkItemScreen
            activate MainScreen

            MainScreen->>APIController: Create work item<br/>(with payload)
            activate APIController
            APIController->>JiraAPI: POST /rest/api/3/issues<br/>(with work item payload)
            JiraAPI-->>APIController: Return created work item<br/>(with new key)
            deactivate APIController

            MainScreen->>MainScreen: Update search results<br/>(add new work item)

            MainScreen->>User: Display success notification<br/>(New work item created: KEY-123)
            deactivate MainScreen

        else Validation failed
            AddWorkItemScreen->>User: Show validation error<br/>(Fields marked with (*) required)
            deactivate AddWorkItemScreen
        end

        User->>AddWorkItemScreen: Press 'escape' or click Cancel<br/>(optional - dismiss without saving)
        AddWorkItemScreen->>MainScreen: pop_screen()<br/>(no payload)
        AddWorkItemScreen->>User: Return to main screen
    

Update Work Items

The following sequence diagram depicts the interaction of the user with the application and the series of steps that the application takes to update an existing work item.

The following are the main components used by the application to support this use case:

            ---
    config:
        theme: "default"
    ---
    sequenceDiagram
        actor User
        participant DetailsTab
        participant EditFieldModal
        participant APIController
        participant JiraAPI

        Note over User,JiraAPI: User has already selected a work item<br/>and is viewing the Details tab

        User->>DetailsTab: View work item details
        activate DetailsTab

        DetailsTab->>DetailsTab: on_mount(): Load work item fields<br/>(from work item context)
        DetailsTab->>User: Display editable field widgets<br/>(clickable/selectable fields)

        User->>DetailsTab: Click on field to edit<br/>(e.g., Assignee, Status, Labels)
        activate DetailsTab

        alt Field is inline editable
            DetailsTab->>EditFieldModal: push_screen(EditFieldModal)<br/>or show inline edit widget
            activate EditFieldModal

            EditFieldModal->>APIController: on_mount(): Fetch field metadata<br/>(for allowed values)
            activate APIController
            APIController->>JiraAPI: GET /rest/api/3/issue/createmeta<br/>or GET /rest/api/3/fields/{fieldId}
            JiraAPI-->>APIController: Return field metadata<br/>(allowed values, constraints)
            deactivate APIController

            EditFieldModal->>User: Display edit form<br/>(field-specific widget:<br/>Dropdown, Text input, User picker, etc.)

        else Field requires external action
            DetailsTab->>User: Show validation message<br/>(e.g., "Cannot edit this field")
        end

        User->>EditFieldModal: Select/enter new value<br/>(based on field type)
        Note right of EditFieldModal: Field types:<br/>- Select (Status, Priority)<br/>- User picker (Assignee, Reporter)<br/>- Text (Summary, Description)<br/>- Labels, Components, etc.

        User->>EditFieldModal: Press '^s' or click Save
        activate EditFieldModal
        EditFieldModal->>EditFieldModal: Validate new value<br/>(against field constraints)

        alt Validation passed
            EditFieldModal->>EditFieldModal: Format field value<br/>(for API - user IDs, enums, etc.)

            EditFieldModal->>EditFieldModal: Build update payload<br/>(fields: {fieldId: value})

            EditFieldModal->>DetailsTab: pop_screen()<br/>(return new value + field ID)
            deactivate EditFieldModal
            activate DetailsTab

            DetailsTab->>APIController: Update work item field<br/>(with fieldId + new value)
            activate APIController
            APIController->>JiraAPI: PUT /rest/api/3/issues/{key}<br/>(with fields: {fieldId: value})
            activate JiraAPI

            JiraAPI-->>APIController: Return updated work item
            deactivate JiraAPI
            deactivate APIController

            DetailsTab->>DetailsTab: Update field widget state<br/>with new value
            DetailsTab->>User: Refresh Details display<br/>(show updated field value)
            DetailsTab->>User: Show success notification<br/>(Field updated successfully)

        else Validation failed
            EditFieldModal->>User: Show validation error<br/>(Invalid value for field)
            Note right of EditFieldModal: User must enter valid value
        end

        deactivate DetailsTab

        User->>DetailsTab: Continue editing other fields<br/>(optional - repeat flow)
        Note right of User: Can edit multiple fields<br/>in sequence

        User->>DetailsTab: Press 'escape' or click outside<br/>(optional - exit Details tab)
        DetailsTab->>User: Return to work item view
    

Manage Comments

Add Comment

The following sequence diagram depicts the interaction of the user with the application and the series of steps that the application takes to add a new comment to an existing work item.

            ---
    config:
        theme: "default"
    ---
    sequenceDiagram
        actor User as User
        participant CommentUI as CommentsTab Widget
        participant CommentModal as AddCommentModal
        participant CommentHandler as CommentHandler
        participant JiraAPI as Jira API Client
        participant Storage as Comment Cache

        User->>CommentUI: Presses 'n' key in Comments tab
        CommentUI->>CommentModal: Create and display modal screen
        CommentModal->>User: Shows comment input form
        User->>CommentModal: Enters comment text
        User->>CommentModal: Presses 'Ctrl+s' to submit
        CommentModal->>CommentHandler: validate_and_submit_comment(text)

        alt Comment validation succeeds
            CommentHandler->>JiraAPI: POST /issues/{key}/comments
            JiraAPI-->>CommentHandler: Returns new comment with ID
            CommentHandler->>Storage: Update comment cache
            CommentHandler->>CommentUI: Refresh comments list
            CommentUI-->>User: Display new comment in list
        else Comment validation fails
            CommentHandler-->>CommentModal: Show error message
            CommentModal-->>User: Display validation error
            User->>CommentModal: Correct and resubmit
        end

        User->>CommentModal: Presses 'Escape' to close modal
        CommentModal-->>CommentUI: Close and return to Comments tab
    

Delete Comment

The following sequence diagram depicts the interaction of the user with the application and the series of steps that the application takes to delete a comment from an existing work item.

            ---
    config:
        theme: "default"
    ---
    sequenceDiagram
        actor User as User
        participant CommentUI as CommentsTab Widget
        participant CommentDisplay as CommentDisplay Widget
        participant ConfirmModal
        participant CommentHandler
        participant JiraAPI
        participant Storage as Comment Cache

        User->>CommentUI: Navigate to specific comment
        CommentUI->>CommentDisplay: Highlight selected comment
        CommentDisplay-->>User: Display comment with 'd' key hint
        User->>CommentDisplay: Presses 'd' key to delete
        CommentDisplay->>ConfirmModal: Show confirmation dialog
        ConfirmModal-->>User: "Are you sure you want to delete this comment?"

        alt User confirms deletion
            User->>ConfirmModal: Presses 'y' or Enter to confirm
            ConfirmModal->>CommentHandler: delete_comment(comment_id)
            CommentHandler->>JiraAPI: DELETE /issues/{key}/comments/{comment_id}

            alt Deletion succeeds
                JiraAPI-->>CommentHandler: Returns 204 No Content
                CommentHandler->>Storage: Remove comment from cache
                CommentHandler->>CommentUI: Refresh comments list
                CommentUI-->>User: Remove deleted comment from display
                CommentUI-->>User: Show success notification
            else Deletion fails (permission/not found error)
                JiraAPI-->>CommentHandler: Returns error (403/404)
                CommentHandler-->>ConfirmModal: Show error message
                ConfirmModal-->>User: Display error
            end
        else User cancels deletion
            User->>ConfirmModal: Presses 'n' or Escape to cancel
            ConfirmModal-->>CommentUI: Close dialog without deleting
            CommentUI-->>User: Return to comments list
        end
    

JiraTUI allows users to add comments to an existing work item as well as to view and delete existing comments.

View Comments

The following sequence diagram depicts the interaction of the user with the application and the series of steps that the application takes to view the list of comments associated to an existing work item.

            ---
    config:
        theme: "default"
    ---
    sequenceDiagram
        actor User as User
        participant SearchResults
        participant MainScreen
        participant IssueCommentsWidget
        participant CommentLoader
        participant JiraAPI
        participant CommentCache as Comment Cache

        User->>SearchResults: Selects work item from list
        SearchResults->>MainScreen: RowSelected event triggered
        MainScreen->>MainScreen: Extract selected work item key
        MainScreen->>MainScreen: Check if different from current key

        alt Item already loaded
            MainScreen-->>User: Skip reload (same item)
        else Item not yet loaded
            MainScreen->>IssueCommentsWidget: Set issue_key property
            IssueCommentsWidget->>CommentLoader: Trigger load_comments(issue_key)
            CommentLoader->>JiraAPI: GET /issues/{key}?expand=changelog
            JiraAPI-->>CommentLoader: Returns issue with comments
            CommentLoader->>CommentCache: Cache comments for issue
            CommentLoader->>IssueCommentsWidget: Update comments property
            IssueCommentsWidget-->>User: Display comments list (read-only)
            User->>MainScreen: Presses key '4' to focus Comments tab
            MainScreen->>IssueCommentsWidget: Set focus to Comments tab
            IssueCommentsWidget-->>User: Display Comments tab with comment list
        end

        User->>IssueCommentsWidget: Navigate through comments (arrow keys)
        IssueCommentsWidget-->>User: Highlight selected comment details
    

Manage Attachments

View Attachments

The following sequence diagram depicts the interaction of the user with the application and the series of steps that the application takes to view the files attached to an existing work item.

            ---
    config:
        theme: "default"
    ---
    sequenceDiagram
        actor User
        participant AttachmentsDataTable
        participant IssueAttachmentsWidget
        participant ConfirmationScreen
        participant APIController
        participant WorkItemData

        User->>AttachmentsDataTable: Select attachment row
        AttachmentsDataTable->>AttachmentsDataTable: on_data_table_row_selected()
        AttachmentsDataTable->>AttachmentsDataTable: store attachment_id and file_name

        User->>AttachmentsDataTable: Press Delete (or d)
        AttachmentsDataTable->>AttachmentsDataTable: action_delete_attachment()

        alt Attachment Selected
            AttachmentsDataTable->>IssueAttachmentsWidget: push_screen(ConfirmationScreen)
            activate ConfirmationScreen
            ConfirmationScreen->>User: Display "Are you sure you want to delete the file?"
            deactivate ConfirmationScreen

            User->>ConfirmationScreen: Confirm or Cancel
            ConfirmationScreen->>IssueAttachmentsWidget: handle_delete_choice(result)

            alt User Confirms Deletion
                IssueAttachmentsWidget->>IssueAttachmentsWidget: post_message(Deleted)
                IssueAttachmentsWidget->>IssueAttachmentsWidget: on_attachments_data_table_deleted()
                IssueAttachmentsWidget->>IssueAttachmentsWidget: run_worker(_delete_attachment)

                activate APIController
                IssueAttachmentsWidget->>APIController: delete_attachment(attachment_id)
                APIController-->>IssueAttachmentsWidget: APIControllerResponse(success)
                deactivate APIController

                alt API Call Successful
                    alt fetch_attachments_on_delete is True
                        IssueAttachmentsWidget->>APIController: get_issue(work_item_key, fields=['attachment'])
                        APIController-->>IssueAttachmentsWidget: APIControllerResponse(issue_data)
                        IssueAttachmentsWidget->>WorkItemData: update attachments list
                    else fetch_attachments_on_delete is False
                        IssueAttachmentsWidget->>IssueAttachmentsWidget: _update_attachments_after_delete(attachment_id)
                        IssueAttachmentsWidget->>AttachmentsDataTable: remove row by attachment_id
                    end
                    IssueAttachmentsWidget-->>User: Attachment deleted successfully"
                else API Call Failed
                    IssueAttachmentsWidget-->>User: Failed to delete the file
                end
            else User Cancels
                ConfirmationScreen->>User: Close dialog, no action taken
            end
        else No Attachment Selected
            AttachmentsDataTable-->>User: Select a row before attempting to delete the file
        end
    

Attach File

The following sequence diagram depicts the interaction of the user with the application and the series of steps that the application takes to attach a file to an existing work item.

            ---
    config:
        theme: "default"
    ---
    sequenceDiagram
        actor User
        participant IssueAttachmentsWidget
        participant AddAttachmentScreen
        participant DirectoryTree
        participant FileNameInputWidget
        participant Button
        participant APIController
        participant AttachmentsDataTable

        User->>IssueAttachmentsWidget: Press ^u or 'n'
        IssueAttachmentsWidget->>AddAttachmentScreen: push_screen(AddAttachmentScreen)
        activate AddAttachmentScreen
        AddAttachmentScreen->>AddAttachmentScreen: compose()
        AddAttachmentScreen->>DirectoryTree: render file browser
        AddAttachmentScreen->>FileNameInputWidget: render path input field
        AddAttachmentScreen->>Button: render Save & Cancel buttons
        deactivate AddAttachmentScreen

        User->>DirectoryTree: browse and select file
        DirectoryTree->>DirectoryTree: FileSelected event
        DirectoryTree->>FileNameInputWidget: populate with file path
        FileNameInputWidget->>Button: enable Save button

        User->>Button: Press Save button
        Button->>AddAttachmentScreen: handle_save()
        AddAttachmentScreen->>IssueAttachmentsWidget: dismiss(file_path)

        activate IssueAttachmentsWidget
        IssueAttachmentsWidget->>APIController: add_attachment(issue_key, file_path)
        activate APIController
        APIController-->>IssueAttachmentsWidget: APIControllerResponse(success, attachment)
        deactivate APIController

        alt Success
            IssueAttachmentsWidget->>IssueAttachmentsWidget: update attachments list
            IssueAttachmentsWidget->>IssueAttachmentsWidget: watch_attachments()
            IssueAttachmentsWidget->>AttachmentsDataTable: rebuild table with new attachment
            IssueAttachmentsWidget-->>User: Upload successful
        else Failure
            IssueAttachmentsWidget-->>User: Failed to attach file
        end
        deactivate IssueAttachmentsWidget
    

Delete Attachment

The following sequence diagram depicts the interaction of the user with the application and the series of steps that the application takes to delete an attachment from an existing work item.

            ---
    config:
        theme: "default"
    ---
    sequenceDiagram
        actor User
        participant MainScreen
        participant TabbedContent
        participant IssueAttachmentsWidget
        participant APIController
        participant AttachmentsDataTable

        User->>MainScreen: Press '6'
        MainScreen->>TabbedContent: switch to attachments tab
        MainScreen->>IssueAttachmentsWidget: set issue_key of selected work item

        activate IssueAttachmentsWidget
        IssueAttachmentsWidget->>IssueAttachmentsWidget: issue_key setter
        deactivate IssueAttachmentsWidget

        Note over MainScreen,APIController: Fetch attachment data from API

        activate IssueAttachmentsWidget
        IssueAttachmentsWidget->>APIController: get_issue(work_item_key, fields=['attachment'])
        activate APIController
        APIController-->>IssueAttachmentsWidget: APIControllerResponse(issue_data)
        deactivate APIController

        IssueAttachmentsWidget->>IssueAttachmentsWidget: attachments = WorkItemAttachments(...)
        deactivate IssueAttachmentsWidget

        Note over IssueAttachmentsWidget,AttachmentsDataTable: Render attachments list

        activate IssueAttachmentsWidget
        IssueAttachmentsWidget->>IssueAttachmentsWidget: watch_attachments(data)

        alt Attachments exist
            IssueAttachmentsWidget->>AttachmentsDataTable: create table
            loop for each attachment
                IssueAttachmentsWidget->>AttachmentsDataTable: add_row(filename, size, date, author, type)
            end
            IssueAttachmentsWidget->>IssueAttachmentsWidget: mount(table)
            IssueAttachmentsWidget-->>User: Display attachments table with list of files
        else No attachments
            IssueAttachmentsWidget-->>User: Display empty widget
        end
        deactivate IssueAttachmentsWidget

        Note over User,AttachmentsDataTable: User can interact with table

        User->>AttachmentsDataTable: Highlight or Select row
        AttachmentsDataTable->>AttachmentsDataTable: store selected attachment metadata
        AttachmentsDataTable-->>User: Show file details
    

Manage Log Work

View Item Work Log

The following sequence diagram depicts the interaction of the user with the application and the series of steps that the application takes to view the work logged for a selected work item.

            ---
    config:
        theme: "default"
    ---
    sequenceDiagram
        actor User
        participant IssueDetailsWidget
        participant WorkItemWorkLogScreen
        participant APICtrl as APIController
        participant Jira as JiraAPI

        User->>IssueDetailsWidget: Press ^l
        activate IssueDetailsWidget
        IssueDetailsWidget->>WorkItemWorkLogScreen: show modal screen
        deactivate IssueDetailsWidget
        activate WorkItemWorkLogScreen

        WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Mount screen
        WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Start worker to fetch_work_log()

        WorkItemWorkLogScreen->>APICtrl: Call get_work_item_worklog(work_item_key)
        deactivate WorkItemWorkLogScreen
        activate APICtrl

        APICtrl->>Jira: GET worklogs for work item
        deactivate APICtrl
        activate Jira

        Jira->>Jira: Query worklogs and pagination
        Jira-->>APICtrl: Return PaginatedJiraWorklog with logs list
        deactivate Jira
        activate APICtrl

        APICtrl-->>WorkItemWorkLogScreen: Return APIControllerResponse with result
        deactivate APICtrl
        activate WorkItemWorkLogScreen

        WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Extract worklog list from response
        WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Set worklog_counter and worklog_total_count
        WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Update subtitle with counts

        loop For each worklog in logs
            WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Build WorkLogCollapsible widget
            WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Create DataTable with worklog details
            WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Add rows with details
            WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Mount WorkLogCollapsible to container
        end

        WorkItemWorkLogScreen->>User: Display list of worklogs in collapsible widgets
        deactivate WorkItemWorkLogScreen

        User->>WorkItemWorkLogScreen: (Optional) Press Ctrl+O on worklog
        activate WorkItemWorkLogScreen
        WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Open worklog URL in default browser
        deactivate WorkItemWorkLogScreen

        User->>WorkItemWorkLogScreen: (Optional) Press D on worklog
        activate WorkItemWorkLogScreen
        WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Start worker to delete worklog
        WorkItemWorkLogScreen->>APICtrl: Call remove_worklog(work_item_key, worklog_id)
        deactivate WorkItemWorkLogScreen
        activate APICtrl

        APICtrl->>Jira: DELETE worklog
        deactivate APICtrl
        activate Jira

        Jira->>Jira: Remove worklog entry
        Jira-->>APICtrl: Success response
        deactivate Jira
        activate APICtrl

        APICtrl-->>WorkItemWorkLogScreen: Return APIControllerResponse
        deactivate APICtrl
        activate WorkItemWorkLogScreen

        WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Notify "Worklog deleted"
        WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Hide WorkLogCollapsible (display: none)
        WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Update counters and subtitle
        WorkItemWorkLogScreen->>WorkItemWorkLogScreen: Set work_logs_deleted = true
        deactivate WorkItemWorkLogScreen

        User->>WorkItemWorkLogScreen: Press Escape to close
        activate WorkItemWorkLogScreen
        WorkItemWorkLogScreen->>IssueDetailsWidget: Dismiss with work_logs_deleted flag
        deactivate WorkItemWorkLogScreen
        activate IssueDetailsWidget

        IssueDetailsWidget->>IssueDetailsWidget: Check if work_logs_deleted is true

        alt work_logs_deleted == true
            IssueDetailsWidget->>APICtrl: Call get_issue() to refresh
            deactivate IssueDetailsWidget
            activate APICtrl
            APICtrl->>Jira: GET issue details
            Jira-->>APICtrl: Return updated issue
            APICtrl-->>DetaIssueDetailsWidgetils: Return updated JiraIssue
            deactivate APICtrl
            activate IssueDetailsWidget
            IssueDetailsWidget->>IssueDetailsWidget: Update work item details
        end

        deactivate IssueDetailsWidget
    

Log Work for Item

The following sequence diagram depicts the interaction of the user with the application and the series of steps that the application takes to log work for a selected work item.

            ---
    config:
        theme: "default"
    ---
    sequenceDiagram
        actor User
        participant IssueDetailsWidget
        participant LogWorkScreen
        participant APICtrl as APIController
        participant Jira as JiraAPI

        User ->> IssueDetailsWidget: Press ^t
        activate IssueDetailsWidget
        IssueDetailsWidget->>LogWorkScreen: Push LogWorkScreen with work_item.key and current_remaining_estimate
        deactivate IssueDetailsWidget
        activate LogWorkScreen

        LogWorkScreen->>User: Display form (Time Spent, Time Remaining, Date Started, Work Description)

        User->>LogWorkScreen: Enter time spent value
        activate User
        LogWorkScreen->>LogWorkScreen: Validate time format
        LogWorkScreen->>LogWorkScreen: Enable/disable related fields and save button
        deactivate User

        User->>LogWorkScreen: (Optional) Enter time remaining
        activate User
        LogWorkScreen->>LogWorkScreen: Validate time format
        deactivate User

        User->>LogWorkScreen: (Optional) Add work description
        User->>LogWorkScreen: Click Save

        LogWorkScreen->>IssueDetailsWidget: Dismiss with form data dict
        deactivate LogWorkScreen
        activate IssueDetailsWidget

        IssueDetailsWidget->>IssueDetailsWidget: Extract data from result dict
        IssueDetailsWidget->>IssueDetailsWidget: Start worker for async execution

        IssueDetailsWidget->>APICtrl: Call add_work_item_worklog()
        deactivate IssueDetailsWidget
        activate APICtrl

        APICtrl->>APICtrl: Convert local datetime to UTC
        APICtrl->>Jira: POST worklog with time_spent, time_remaining, started, comment
        deactivate APICtrl
        activate Jira

        Jira->>Jira: Create worklog entry and update time tracking
        Jira-->>APICtrl: Success response
        deactivate Jira
        activate APICtrl

        APICtrl-->>IssueDetailsWidget: Return APIControllerResponse
        deactivate APICtrl
        activate IssueDetailsWidget

        IssueDetailsWidget->>IssueDetailsWidget: Check response.success
        IssueDetailsWidget->>User: Notify "Work logged successfully"

        IssueDetailsWidget->>APICtrl: Call get_issue() to refresh
        deactivate IssueDetailsWidget
        activate APICtrl
        APICtrl->>Jira: GET issue details
        Jira-->>APICtrl: Return updated issue
        APICtrl-->>IssueDetailsWidget: Return updated JiraIssue
        deactivate APICtrl
        activate IssueDetailsWidget

        IssueDetailsWidget->>IssueDetailsWidget: Update form fields with refreshed data
        IssueDetailsWidget->>IssueDetailsWidget: Re-render time tracking widget
        deactivate IssueDetailsWidget