Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Targetted DataTable recalc for tabs and sections #105

Merged
merged 8 commits into from
Jan 24, 2020

Conversation

opustecnica
Copy link
Contributor

Please test this changes to verify they are aligned with goals/intentions. Note that if a tab contains a collapsed/hidden section, its content is not refreshed until the section is fully shown.

@PrzemyslawKlys
Copy link
Member

Wow :-)

@PrzemyslawKlys
Copy link
Member

It's very clever.

I got this error while refreshing

image

@PrzemyslawKlys
Copy link
Member

it seems to work partially. The error happens from time to time.

TestimoCompare.zip

It's much faster but seems to be struggling with refreshing some tabs correctly.

@PrzemyslawKlys
Copy link
Member

But maybe it's me pressing too fast or refreshing during wait time?

@opustecnica
Copy link
Contributor Author

Wow, that is a big report :-)
About the error above, it seems the issue is about attempting to re-initialize a table. (https://datatables.net/manual/tech-notes/3). While there are ways to remedy this, I would like to understand the root-cause. The portions of code modified only deal with the recalc of an already initialized table. The only time I can see this happening is if two tables are mistakenly assigned the same ID. Could you please send the test code and the html output of the page that causes this issue? I want to make sure that other, seemingly unrelated, changes are not contributing to the issue. I have run my tests with 0.071 and applied only PRs 100 and 105.

@PrzemyslawKlys
Copy link
Member

I'm using this one:

Import-Module .\PSWriteHTML.psd1 -Force

$Test = Get-Process #| Select-Object -First 2 #-Property Name, Id,PriorityClass, HandleCount, WorkingSet

New-HTML -TitleText 'My title' -UseCssLinks:$true -UseJavaScriptLinks:$true -FilePath $PSScriptRoot\Example-Tabs01-Old.html -Show {
    New-HTMLTabOptions -SlimTabs -Transition -LinearGradient -SelectorColor Gold -SelectorColorTarget AliceBlue
    New-HTMLTab -Name 'Test 1' -IconBrands acquisitions-incorporated -IconColor Coriander {
        New-HTMLTab -Name 'Nested Tab 1' {
            New-HTMLSection -Invisible {
                New-HTMLPanel {
                    New-HTMLTable -DataTable $Test
                }
                New-HTMLPanel {
                    New-HTMLChart -Gradient {
                        New-ChartPie -Name 'Test' -Value 20
                        New-ChartPie -Name 'Test1' -Value 30
                        New-ChartPie -Name 'Test2' -Value 40
                        New-ChartPie -Name 'Test1' -Value 30
                        New-ChartPie -Name 'Test2' -Value 40
                    }
                }
            }
        }
        New-HTMLTab -Name 'Nested Tab 2' {
            New-HTMLSection -HeaderText 'Test' -HeaderBackGroundColor BrightRed {
                New-HTMLTable -DataTable $Test
            }
        }
    }
    New-HTMLTab -Name 'Test 2' -IconRegular check-circle -IconColor LightSkyBlue {
        New-HTMLTable -DataTable $Test -DisablePaging
    }

    New-HTMLTab -Name 'Test 3' -IconSolid code-branch -IconColor LimeGreen {
        New-HTMLTable -DataTable $Test
        New-HTMLSection -HeaderText 'Test' -HeaderBackGroundColor CottonCandy {

        }
    }
    New-HTMLTab -Name 'Test 4' -IconSolid bezier-curve {
        New-HTMLTable -DataTable $Test -DisablePaging
    }
    New-HTMLTab -Name 'Test 5' -IconSolid copy -IconColor BrinkPink {
        New-HTMLTable -DataTable $Test
    }
    New-HTMLTab -Name 'Test' -IconBrands asymmetrik {
        New-HTMLTable -DataTable $Test
    }
    New-HTMLTab -Name 'Test' -IconRegular kiss-beam -TextColor BritishRacingGreen {
        New-HTMLTable -DataTable $Test -DisablePaging
    }
}

However for Testimo .. well you need Active Directory to run it.

$TestResults = Invoke-Testimo -ShowReport:$true -ReturnResults

But I was getting that error on the 1st code as well.

@opustecnica
Copy link
Contributor Author

:-( I cannot replicate :-(
... But maybe it's me pressing too fast or refreshing during wait time? ...
I honestly suspect that to be the case. If the full document is not ready, we risk to request the re-initialization of an object that is in process of initialization. I usually work on simpler layouts 3-4 tabs max, but with large tables (1k plus records). To avoid issues, I am working on a simple "...wait while we load content..." to caution users from refreshing. For cases like the one above, I am contemplating importing the original collection ($test) in to a JS var and build tables on the fly via JS. That way I only need to import the data once vs every time I need to display it.

@PrzemyslawKlys
Copy link
Member

Ye, that would be cool having a progress bar that shows something is happening. Like if page is loading it doesn't look pretty. Also it doesn't look pretty if user has to wait 10 seconds to switch tabs and he has no clue what is happening.

@PrzemyslawKlys
Copy link
Member

As for other stuff.. all that stuff is cool :-) just time ...

@PrzemyslawKlys
Copy link
Member

Do you think we should merge it and later on work on improvements or do you want to keep it open until more tests are done?

@opustecnica
Copy link
Contributor Author

In one hand I would like to spend some time taking care of testing and the “wait while” loading feature. On the other I believe the current “reload all” behavior is so debilitating that needs immediate addressing. Thoughts?

@PrzemyslawKlys PrzemyslawKlys merged commit 75e4bbd into EvotecIT:master Jan 24, 2020
@PrzemyslawKlys
Copy link
Member

I'll be testing the wait while loading - I found some library for that (opened an issue with it). Maybe it will help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants