BoSen29
21
Hi @augustin.ziegler
This example is working in my build:
New-UDButton -Text "EditText" -OnClick {
Set-UDElement -Id "Editable" -Attributes @{text = (Get-random)}
}
New-UDButton -Text "Hidemeh" -OnClick {
Set-UDElement -Id "Editable" -Attributes @{hidden = $true}
}
New-UDButton -Text "Showmeh" -OnClick {
Set-UDElement -Id "Editable" -Attributes @{hidden = $false}
}
Does these not work in the nightly?
Any errors in the developer console?
If so, i’ll download the nightly later today and give it a go.
I tried with your code snippets too and still not working for me with the latest nightly build.
No errors in the console.
adam
23
How are you installing the nightly? Sometimes when multiple versions are installed or the module isn’t installed quite right there can be problems.
Already had that problem and checked the module paths but it seams that the
.\build.ps1
for custom UD components is installing the module always in an different folder that the
install-nightly.ps1
After checking with, you are right
($env:PSModulePath -split ';' | %{Get-ChildItem $_}).FullName | ?{$_ -like '*Universal*'}
After installing the second module, I tries it again and its still not working for me.
none of the button actions are working in my project:
New-UDButton -ID 'Button1' -Text "Click me ..." -OnClick (New-UDEndpoint -Endpoint {
<#
Invoke-UDJavaScript -Javascript "
var btn = document.getElementById('$ButtonID');
btn.textContent = 'You clicked the button!';
btn.style.backgroundColor = 'green'"
#>
Show-UDToast -Message "set text of button OnClick" -Duration 2000
Set-UDElement -Id "Button1" -Attributes @{text = (Get-random)}
})
New-UDButton -Text "EditText" -OnClick {
Show-UDToast -Message "set text of button" -Duration 2000
Set-UDElement -Id "Button1" -Attributes @{text = (Get-random)}
}
New-UDButton -Text "Hidemeh" -OnClick {
Show-UDToast -Message "hide button" -Duration 2000
Set-UDElement -Id "Button1" -Attributes @{hidden = $true}
}
New-UDButton -Text "Showmeh" -OnClick {
Show-UDToast -Message "show button" -Duration 2000
Set-UDElement -Id "Button1" -Attributes @{hidden = $false}
}
install-nightly.ps1
param(
[switch]$Enterprise,
[switch]$Force,
[switch]$Core
)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$Url = "https://api.github.com/repos/ironmansoftware/universal-dashboard"
if ($Enterprise)
{
$Url = "https://api.github.com/repos/ironmansoftware/universal-dashboard-enterprise"
}
$Url += "/releases"
$Release = (Invoke-RestMethod $Url) | Select-Object -First 1
$Asset = (Invoke-RestMethod $Release.assets_url) | Select-Object -First 1
Write-Host $Release.body
$Zip = (Join-Path ([IO.Path]::GetTempPath()) "UniversalDashboard.zip")
Invoke-WebRequest $Asset.browser_download_url -OutFile $Zip
$ModuleName = "UniversalDashboard.Community"
if ($Enterprise)
{
$ModuleName = "UniversalDashboard"
}
$TempPath = (Join-Path ([IO.Path]::GetTempPath()) $ModuleName)
if (Test-Path $TempPath)
{
Remove-Item $TempPath -Force -Recurse
}
Expand-Archive $Zip $TempPath
$Manifest = Get-Content (Join-Path $TempPath "$ModuleName.psd1") -Raw
$UdManifest = Invoke-Expression $Manifest
$Version = $UdManifest.ModuleVersion
if ($Core)
{
$ModulePath = [IO.Path]::Combine("$env:USERPROFILE/Documents/PowerShell/Modules", $ModuleName, $Version)
}
else
{
$ModulePath = [IO.Path]::Combine("$env:USERPROFILE/Documents/WindowsPowerShell/Modules", $ModuleName, $Version)
}
Write-Host "ModulePath: $ModulePath"
if ($Force -and (Test-Path $ModulePath))
{
Remove-Item $ModulePath -Force -Recurse
}
Copy-Item $TempPath $ModulePath -Recurse
if (Test-Path $Zip)
{
Remove-Item $Zip -Force -Recurse
}
if (Test-Path $TempPath)
{
Remove-Item $TempPath -Force -Recurse
}
@adam @BoSen29
after restarting my server the nightly build is loaded and for this reason the set Button is working.
Thanks for your support
2 Likes
BoSen29
26
Awesome dude!
Anytime bro 
2 Likes