Search code examples
umlplantuml

Add participants to middle of diagram for visibility


I want to know if it's possible to add the participants to the middle of a large diagram, so it's easy to see what line each participant is without having to scroll to the top or bottom.

For example a diagram like so; When rendered it's easy to lose track of what vertical line is what participant.

In this example, it would be nice to add the participants again at point 10 / 11 to continue the flow

@startuml
autonumber

participant "Mobile App" as token
actor User as user
participant "Reseller UI" as reseller_ui
participant "Database" as db

alt For new user
    user -> reseller_ui : Visit the link provided to reset \npassword
    user <- reseller_ui : Let user reset password
    user -> reseller_ui : Complete the reset password
    reseller_ui -> db : Check if TOTP secret \n key exists
    reseller_ui <- db : TOTP secret key does \n not exist
    user <- reseller_ui : Force user to setup Mobile App
else For existing user
    user -> reseller_ui : Request to enable \ntwo-factor authentication (TFA)
    user <- reseller_ui : Request user to input \npassword for authentication
    user -> reseller_ui : Provide the correct password
end
reseller_ui -> reseller_ui : Generate secret \nkey for TOTP
reseller_ui -> db : Store the secret key \nfor that user
loop Until user input correct TOTP or cancel enable TFA
    user <- reseller_ui : Display the secret key, \nas QR Code
    user <- reseller_ui : Wait for user to input \nthe TOTP from Mobile App
    alt For Mobile App supports QR Code
        token -> reseller_ui : Decode the QR Code displayed
    else For Mobile App does not support QR Code 
        user -> reseller_ui : Request to display the secret \nkey directly
        user <- reseller_ui : Display the secret key
        user -> token : Input the secret \nkey directly 
    end
    token -> token : Store the secret key
    user -> token : Read the TOTP \ndisplayed in the app 
    user -> reseller_ui : Input the TOTP in app 
    reseller_ui -> db : Get the secret key \nof that user
    reseller_ui -> reseller_ui : Validate the TOTP
    alt If validation success
        reseller_ui -> db : Mark the TFA \nsetup complete
        user <- reseller_ui : Display successful message
    else If validation not success
        user <- reseller_ui : Display failure message
    end
end

@enduml

UML Diagram


Solution

  • Found out this isn't a possible feature in PlantUML. The closest thing that can be done is this;

    !procedure $insert_participants()
    rnote over token : Mobile App
    /rnote over user : User
    /rnote over reseller_ui : Reseller UI
    /rnote over db : Database
    !endprocedure
    

    then in the diagram where you wan to show the participants again you call the function.

    $insert_participants()