controls/tag-add-modal.ps1
function New-UDAddTagModal { param( $Script ) Show-UDModal -Content { New-UDPageHeader -Text ("Add New Tag to Script: $($Script.Name)") New-UDParagraph -Text "Select an existing Tag to add to the Script" New-UDInput -Id "AddTagToScriptInput" -Content { $Tags = Get-UATag New-UDInputField -Type 'select' -Name 'TagNameToAdd' -Placeholder 'Select a Tag' -Values @($Tags.Name) } -Endpoint { param($TagNameToAdd) $TagToAdd = Get-UATag -Name $TagNameToAdd Add-UAScriptTag -Script $Script -Tag $TagToAdd Sync-UDElement -Id "ScriptsGrid" -Broadcast Sync-UDElement -Id "ScriptPageHeader" -Broadcast Sync-UDElement -Id "ScriptPageTagDiv" -Broadcast Invoke-UDRedirect -Url "/script/$($Script.Id)" # TODO This could be improved } } -Height "80%" } |