controls/variable-create-modal.ps1

function New-UDCreateVariableModal {
    
    Show-UDModal -Content {
        New-UDPageHeader -Text ("Creating new Variable")
        New-UDParagraph -Text "Specify a new Variable Name and Value"

        New-UDCard -Content{
            New-UDTextbox -Id "NewVariableTextBoxName" -Label "Name" -Type text
            New-UDTextbox -Id "NewVariableTextBoxValue" -Label "Value" -Type text

            <#TODO Implement Secret Manager?
            New-UDSelect -Id "NewVariableSecretManagerSelect" -Label "Secret Manager Type" -Option {
                New-UDSelectOption -Name "Every Minute" -Value "Every Minute" -Selected $true
            }
            #>


            New-UDElement -Tag div -Attributes @{
                style = @{
                    textAlign = "right"
                }
            } -Content {
                New-UDButton -Text "Create Variable" -Icon folder_plus -OnClick {
                    
                    $VariableName = ((Get-UDElement -Id 'NewVariableTextBoxName').Attributes["value"])
                    $VariableValue = ((Get-UDElement -Id 'NewVariableTextBoxValue').Attributes["value"])

                    New-UAVariable -Name $VariableName -Value $VariableValue
                    Sync-UDElement -Id "VariablesGrid" -Broadcast
                    Hide-UDModal
                }
            }

        }

    }
}