New-UDDatePicker a new calendar component

Boom 5 minutes later…minus one minute for laptop still starting, 30 seconds for adjusting file, and the other 3 mins 30 seconds spent solving the problem :smiley: so as I have said before pictures speak louder than words:-


So I right clicked on the component, did inspect element landed on **class=“DayPickerInput” ** so to the right of that I scrolled down to .ud-dashboard which was being set to white…So I changed to black and problem disappeared…However changing this could have impact on other components on your dashboard…so personally I would use ud-style to style just this component with that change

I followed your recomendation and used UD-Style.

image

Code:

New-UDStyle -Style ’

            .InputFromTo {
                color: Black;
            }' -Content {New-UDDatePicker -Id "Picker"}

Thanks a lot.

1 Like

Hi I just had a quick question about using the UDDatepicker. I have my dashboard running in IIS. I just ran the install-module universaldashboard.uddatepicker to install the module. then i import it into my script but I cant seem to get the new cmdlets. No new-uddatepicker.

Is there any other direction for running this in IIS. Do you need to copy the module into the universal dashboard website folder? I also noticed that its showing as not signed.

thanks

Hi @gerard thanks for looking to use this module. Ok so in your main IIS dashboard.ps1 file you need to import the module this will allow you to then use the module in any Content Script Block however you will most likely want to use the module inside a Endpoint Script Block I got a blog showing how to do this here:-


I did also blog about the datepicker but didn’t use this method in the demo. So look at this link under More Dynamic at the bottom of the page and in the script you will see I am importing the module in

New-UDEndpointInitialization -Module @("UniversalDashboard.UDNumber")

You see I store this as a variable and call that variable on my dashboard page, the official documentation is here https://docs.universaldashboard.io/endpoints/endpoint-initialization#loading-modules-in-endpoints
If you need more assistance let me know. Thanks

1 Like

The problem i am running in to is that If i have this at the top of my script
Import-Module UniversalDashboard.UDDatePicker

i can get the date picker to display if i am running outside of IIS. once i put the script on my production server where it runs in IIS i get a message saying uddatepicker is not a valid cmdlet.

Do i need to do the endpoint initialization if running the dashboard in IIS?

thanks again.

Hi @gerard just to confirm you have downloaded this module on the server running IIS? I mean for the dashboards I host in IIS I either type import-module ModuleName or if I have copied it to the actual site in IIS I just use the path to the module.
If you use any CUSTOM component in an ENDPOINT script-block then you will need to use the New-UDEndPointInitialization to allow the module to be used in an endpoint.
If you need some more information just ask. Peace

On the server running the dashboard i ran Install-Module UniversalDashboard.UDDatePicker. it put the module in the following location:
C:\Program Files\WindowsPowerShell\Modules\UniversalDashboard.UDDatePicker

Then in my dashboard script i have the import-module line at the top of the script. Do i need to copy the module in to the website directory with all the other universal dashboard files.

When i setup the dashboard for iis i took everything from the
C:\Program Files\WindowsPowerShell\Modules\UniversalDashboard.Community folder and copied to the web root and pointed IIS at that directory.

@gerard
here is what you need to do with some explanation
1- import-module usually imports the modules installed under C:\Program Files\WindowsPowerShell\Modules so no need to copy the module to iis directory.

2- to troubleshoot do the following
A- open ise powershell as admin
B- import-module UniversalDashboard.UDDatePicker -Force
C- check in ise if you can use the commands in UniversalDashboard.UDDatePicker this way you can determine if the module loaded correctly.
D-try to add -Force to your line in dashboard.ps1 file and test.

1 Like

Hi @gerard to further explain this have a butchers at my real-world complaints dashboard, dashboard.ps1 file located here:-


Here you will see on lines 141-145 I am importing custom modules but only one of those components I want to use in an endpoint script-block which is the gauge component, so on line 153 I import this, as well as the functions so I can use them throughout my entrie dashboard in content and endpoint script-blocks. The other custom modules I imported I can only use in CONTENT script-blocks as I didn’t import them into UD Endpoint in my line 153

I also prefer to split all my pages into separate pages as it allows me to debug issues quicker. You can see how I do this from this file as well. I hope this along with the explanation that @wsl2001 included has given you enough information now?

I do strongly recommend purchasing a professional edition of this software to help contribute, and it allows you to do even more with dashboards. Such as authentication as I am showing in this dashboard. For a $100 this is still a crazy :crazy_face: low price for all the features you get

Thanks for all the help guys. Could it have something to do with the file not being signed. I did try to manually just run the import-module to the local file and this is what i see

Import-Module “C:\Program Files\WindowsPowerShell\Modules\UniversalDashboard.UDDatePicker\UniversalDashboard.UDDatePicker.psm1” -Force

. : File C:\Program Files\WindowsPowerShell\Modules\UniversalDashboard.UDDatePic
ker\Scripts\New-UDDatePicker.ps1 cannot be loaded. The file C:\Program Files\Win
dowsPowerShell\Modules\UniversalDashboard.UDDatePicker\Scripts\New-UDDatePicker.
ps1 is not digitally signed. You cannot run this script on the current system.
For more information about running scripts and setting execution policy, see
about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At C:\Program Files\WindowsPowerShell\Modules\UniversalDashboard.UDDatePicker\Un
iversalDashboard.UDDatePicker.psm1:27 char:7

Is there a signed version of this script?

Hello @gerard sorry I do not digitally sign any of my scripts…if this is a requirement then I am sure you could do this yourself, then use that customised version?
As this is not a personal requirement then I don’t personally think I will sign these scripts as this is stuff I do in my spare time to help the community in building controls/components that do not exist yet or have yet to be released.
I mean personally I used the built in date calendar selector with two input fields for a start and end date and a button on one of my dashboards…I only built this component as a fellow dashboard user didn’t like the style of the calendar on offer. Most of my previous poweshell studio applications I built all relied on a “FROM” and “TO” date selection then a button which then revealed the results…I no longer use powershell studio since using UD but I thought this would be a good component to build. Just rambling, but saying you can achieve this same capability from the built in controls, I was just trying to make it easier for people to do this with a specific component.

Just do this to fix your issue

Gci -path module path - recurse | unblock-file and set-execution policy on your machine to unrestricted if you have to.

And your issue is fixed

1 Like