You are here: Foswiki>Tasks Web>Item12180 (05 Jul 2015, GeorgeClark)Edit Attach

Item12180: Implementation for AJAXOnDemandCheckersForConfigure

pencil
Priority: Enhancement
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component: Configure
Branches: Release01x01 trunk
Reported By: TimotheLitt
Waiting For:
Last Change By: GeorgeClark
This is the implementation item for AJAXOnDemandCheckersForConfigure.

-- TimotheLitt - 22 Oct 2012

The main commit is rev 15847. There are still a few loose ends, but this seems functional enough to share. It turned into a somewhat larger project... Note also that this depends on several other items that were broken out so they could be considered for patch releases.

Thanks to everyone who was patient during the time it took to get everything sorted out, and special thanks to George Clark for his testing of intermediate code drops and his encouragement.

I'll address the loose ends list and any other discoveries as they come up, but don't anticipate another commit on this scale...

-- TimotheLitt - 03 Nov 2012

On my computer I am getting deep recursion errors:

configure: Deep recursion on subroutine "Foswiki::Configure::Checkers::PATH::check" at /Users/arthur/Sites/foswiki.trunk/core/lib/Foswiki/Configure/Checkers/ScriptDir.pm line 19.
configure: Deep recursion on subroutine "Foswiki::Configure::Checkers::ScriptDir::provideFeedback" at /Users/arthur/Sites/foswiki.trunk/core/lib/Foswiki/Configure/Checkers/PATH.pm line 67.

Mac OS X 10.7.5, perl 5.16.0.

-- ArthurClemens - 03 Nov 2012

Recursion is fixed.

-- ArthurClemens - 03 Nov 2012

Feedback.pm -> sub deliver: this has text and html hardwired in the backend, and should be using a template. It is very hard to put the message somewhere else now.

-- ArthurClemens - 03 Nov 2012

Sorry about the recursion problem. I think your Foswiki.spec got mangled in an svn update. But it shouldn't have caused the infinite recursion. You should check your .spec file. The recursion is fixed.

Feedback.pm is primarily a transport mechanism for messages generated by others (provideFeedback routines.)

It does have a few error cases and one status case - the unsaved items message you asked for - where it generates messages.

I haven't seen documentation on the template mechanism, nor am I really anxious to learn yet another pseuo-scripting language.

If you produce templates that suit you, I'm happy to call the parser routines with the right argument lists.

Note that what's happening on the other end is replacement of <div> contents (and sometimes element values).

So the templates do have to contain (or be contained) in a compatible wrapper.

The placement on the screen is entirely controlled by the existing templates; Feedback.pm simply supplies the replacement data.

Oh, except for a class of error data - anything that doesn't look like the wire protocol initiates a modal error window; this allows html formatting for things like authentication timeouts (and in development, perl crashes).

Everything I did has a CSS class so you can adjust colors, placement, backgrounds, whatever. What I provided functions, but certainly is not elegant. I hope you can help improve the look.

Let me know how I can help.

-- TimotheLitt - 03 Nov 2012

I was just in the process of refactoring the templates to use Text::Template, so you just can use Perl inside templates.

As it is now, and what I want to keep, is that the backend code provides data to the template, and the template draws. The backend should not have to know about any html structure.

I have done this refactoring a previous time - pulling frontend code out of the backend - and it has been a hell of a job. I really want to keep this separated and clean.

The choice of templating engine was "better to use any templating than none". But the currently used FreeMarker templating is too slow, and we are all Perl developers, so Text::Template is a better choice.

For now you seem to understand the template basics, and it would help to use the current engine while I am working on the transition to Text::Template.

-- ArthurClemens - 03 Nov 2012

I support your goal.

There are two places where Feedback.pm creates text. One is trivial - a completely static message. I can handle that.

The other is where I conditionally say 'nothing pending" or "some unsaved" and for the latter, optionally which ones. (Which is very helpful for debugging.) That involves a conditional and an optional formatted list.

If you write a template for the latter, I will update Feedback.pm to use it and I'll do the static one. OK?

One small concern: this is invoked every time a checked field changes. E.g. if you click or tab out of a check-on-change field, this is run. So it needs to be efficient.

Two other things:

I created autocheck.png as a visual indication that a field is check-on-change. It's OK, but I don't think it's up to your standards for design. Perhaps you can come up with something better. If you change it, the size is hardcoded in legend.html and UIs/Value.pm (Yes, I know, it's not a template. But that's how that part of configure works.)

George noticed that your template changes dropped legend.html - was that intentional?

-- TimotheLitt - 03 Nov 2012

I took a stab at templating Feedback.pm. I still have a mystery to solve, but I guess you're off the hook for creating a template for me, though I doubt what I did is optimal.

-- TimotheLitt - 03 Nov 2012

Arthur: Your template changes have the Logout link and the "unsaved changes" status scrolling off the top of the screen.

This isn't good. The feedback status needs to be visible no matter what item you've scrolled down to change, and Logout needs to be easy to find - In a fixed place on all configure screens.

Remember that simply typing in a value box will update the status.

I see that you left a fixed bar on the bottom for "save changes" and "change password". How about moving these two items there?

Also, if I click on 'Change password' button on the Introduction screen, no boxes appear for the required input. (Nor are they on the bottom bar.) This needs to be fixed.

I also miss the Legend - I hope it's coming back.

Thanks for your efforts; I'm sure they'll improve things.

-- TimotheLitt - 03 Nov 2012

The interface is currently too unresponsive after changing. Line 1063 has a timer to postpone calculation, however this is only called after all interface elements have been searched. The blocking code starts at line 964 at $(KeyIdSelector).closest.

Ideally the function doFeedback should be refactored into smaller functions. There would be a separate function with $(KeyIdSelector).closest that can be called from a timeOut.

-- ArthurClemens - 07 Nov 2012

I keep breaking it down, it keeps growing back. It actually has a number of private functions, but it does get unweildy. The ajax closures add to the fun.

I added that timer for you!

The timer doesn't work as you describe. It has nothing to do with the current request.

It simply tells the NEXT update not to run. That only applies to status updates; actual feedback (by button click or field change) can't be deferred. (Well, we could have a queue, but that won't help, just complicate things.) It has to happen, and it has to be in order.

The actual AJAX calls are asynchronous. doFeedback just marshalls the POST data for the request, and unmarshalls (distributes) the results.

The code at KeyIdSelector scans upward from the button that's clicked to the form (usually not far), then scans just that form's controls to build the POST data. It is painful to convert to ASCII forms/multi-part, but that's the way it's done.

The work has to be done, and it has to be the state when the user clicks. The only thing we can do is to reduce the number of controls; e.g. by breaking the screen into separate forms - perhaps one for each section. But then there are challenges when unsaved state exists in more than one form.

I have done some work to minimize the amount of data transferred by dynamically disabling some controls, which helps.

I spent some time yesterday experimenting with compressing the POST data, but I don't think there's a good way to do that. (The compression is easy, but the browser-server channel doesn't like pure binary.) I had it working, except that some data would get lost. (And yes, it went into the Ajax call,l but didn't come out.)

Fixed in HTML.next (5, they say). But no good browser-tolerant mechanism that I can find works today.

As some consolation, remember that prior to this work, updates took seconds -- even minutes -- as configure had to rebuild the whole screen.

But I'm open to other ideas. And I'll keep thinking. This is pretty good, though perfect would be better ..

-- TimotheLitt - 08 Nov 2012

I have done some more optimizations of the client javascript - I didn't measure the results, but it does feel a little faster.

But I suspect the real delay is in talking to the server. Making configure persistent would help a lot. It would take some work to make it mod_perl-safe, but it doesn't seem impossible. Not today.

The controls should not be blocked. If you have a slow network/server, you could increase the timer value so the status updates stay out of the way a bit longer. It's currently set to 1.5 seconds - a more-or-less random value. Long enough to help, not so long that the lag in updating status is obvious.

If it makes a big difference for you, I could make it adaptive. I'd rather only add the complexity if it actually helps.

-- TimotheLitt - 08 Nov 2012

I have checked-in some experimental adaptive bandwidth management code, which adjusts update frequency based on sampled queue depths.

If I click as fast as possible on a checkbox, I can get about 10 changes into the default timeout period, which increases as a result - then glides downward as activity decreases.

The interface seems responsive with my initial settings, but there are some knobs to tweak. I doubt they'll make a huge difference.

Of course, when an actual check is done, it takes longer - quite a bit more Perl code gets loaded and executed. But that's why we have the spinner.

On another subject: I changed an icon and added a button to the status bar. The new icon came from glyphicons_free, though I changed it a little, but I'm not wedded to it. But I see you already saw that. Thanks!

-- TimotheLitt - 10 Nov 2012

Usability concerns: selecting/unselecting languages will immediately trigger actions on the language cache ... for each checkbox clicked. That's pretty annoying. Better would be to make a selection and then click a "go do it" button.

I also get a
Use of uninitialized value $Foswiki::cfg{"DataDir"} in concatenation (.) or string at ....foswiki/trunk/core/lib/Foswiki/Plugins/GenPDFWebkitPlugin/Config.spec line 7

-- MichaelDaum - 31 Jan 2013

Howdy! Working on some checkers for Item12285 (commits on Item12391, Eg. distro:1828327c92d2) I notice that you have to manually go in and validate Web server environment under Configuration Audit. I guess I can live with that but the thing that needs fixing is that none of the ERROR or WARN messages generated during the CGISetup.pm's analyzeWebserver checks are ever propagated to the user.

I know they're working because if I place a die $content; just before the return statement in that method, we can see the errors/warnings decorated in the HTML page that is rendered inside the ajax-loaded response div thingy.

Suggestions?

-- PaulHarvey - 12 Feb 2013

Regrading this from "Enhancement" to "Urgent" because it is blocking 1.2.0 release.

-- CrawfordCurrie - 25 Jul 2013

I think it's time to set this mega-task "Waiting for release", and open individual tasks for remaining issues. We are loosing track of what needs to be fixed to make this a usable system.

-- GeorgeClark - 18 Oct 2013
 

ItemTemplate edit

Summary Implementation for AJAXOnDemandCheckersForConfigure
ReportedBy TimotheLitt
Codebase trunk
SVN Range
AppliesTo Engine
Component Configure
Priority Enhancement
CurrentState Closed
WaitingFor
Checkins distro:c794eae3dae4 distro:d80730481a53 distro:4aa34bdc9fc6 distro:ce9e29d73c14 distro:011e84431907 distro:fcd5011e7e0f distro:68fddfba3246 distro:bf772554be4e distro:58a7048e330c distro:18b360138a03 distro:5da42ab9bac9 distro:fb82a33b0ab5 distro:58f9ed6b6192 distro:155dcb46d9b6 distro:b12f7cf334d7 distro:c55c5766455d distro:cc3d1c259c72 distro:dc84c186a8a3 distro:a4df5b428a10 distro:942e88a8a67f distro:bbbe0593b1f6 distro:07744592913c distro:2f12d7380113 distro:b14c283cc78c distro:9ae49f7627b1 distro:74b6f7d7385b distro:9c2a3ed7c429 distro:3a8f20148940 distro:4a603934c07a distro:2f2b18f60d83 distro:0b425de46ee7 distro:52a4c6bae541 distro:bfc1fbfa4a41 distro:3ac93d5282b8 distro:945c4dfe546d distro:4fd7ba46cdc1 distro:67a5f4a73837 distro:14bdb767b37d distro:ec62b8ae6b61 distro:cb1539da5521 distro:f8e57c28b71c distro:a5b20ca7c5ba distro:41bb2f7ed728 distro:85dc2fb9d362 distro:7d323857d216 distro:47315c5df704 distro:f0ac82d8db17 distro:48ae5a35f8be distro:499ee901e026 distro:113afd0d22e2 distro:700ffdfb9d7b distro:14cee747f403 distro:199e1300cd38 distro:4db853e269c2 distro:5deb1365833c distro:eacaa43fda53 distro:6a06752a1630 distro:04bddd6ad0bb distro:e9f8dc245609 distro:0159393df931 distro:ccabfc2972ce distro:3abcbf62beb7 distro:5d93eb534921 distro:f3e5d2ce0f6a distro:0aac2af1af40 distro:80ceb068ee77 distro:254046fa6dba distro:dd02a1021c6c distro:48152e5078c6 distro:a8f15c37004e distro:835827dd04c8 distro:65a352a7d441 distro:d1448065b8c0 distro:3367eb727716 distro:af0606da8234 distro:f0ebfb6d3c28 distro:5542aea74357 distro:69213980c0fe distro:c4d304d8ae01 distro:51d48e306889 distro:9ec84d5186fc distro:9368c0b45506 distro:bee3d43110bd distro:06f736eca150 distro:f1a649aa976b distro:8d0b0bce4ed6 distro:526eb1af5baa distro:33f6110de8ae distro:b92220b9a879 distro:9a248a51f714 distro:1ea62ba7699c distro:94082a940808 distro:2dcaead844df distro:a511d15bcedc distro:cf4d59afd0ba distro:b644eecec505 distro:d44e9d3ca812 distro:c2b8ab987777 distro:563b0c530759 distro:29fdf4587ada distro:87e97c1b4548 distro:96a8fc34455a distro:c2485aa3ce24 distro:896fe70885be distro:71ec9b6f0c48 distro:bc885fe10b6e distro:ed934bf18563 distro:528b1e2be57e distro:9f2eeb263d33 distro:782614a999d1 distro:7377d462d467 distro:8083fd675dcc distro:a1d44c486a3e distro:69d823891660 distro:bcf0427e2816 distro:d9638b92f2fa distro:7225fe186b13 distro:bcf0901517cf distro:1d6ac2e24976 distro:afb9ebd13af1 distro:ae1e53d23049 distro:8653127d2edd distro:5176f0af4303 distro:5e31b9e835b7 distro:214f4bf532e2 distro:f1d18a2ee524 distro:f262f849fdd8 distro:5c0c7b52bede distro:07981f2e668f distro:7969e882873b distro:18f44df8efeb distro:1d8bdeace983 distro:761b14c6e36a distro:8775e506378b distro:d4197a77f4a4 distro:0205b1f7e148 distro:14c238d3efc9 distro:09c9afc49154 distro:c2672a55a599 distro:1f4c3de8b33c distro:56ddd2edb35b distro:d61a81e32b3a distro:cbce4e2f3d39 distro:0793a1de5120 distro:b6b4ea7de8dc distro:b5bd928e1441 distro:802239d55e6f distro:7a98c3581352 distro:5de0f7ddf378 distro:5cc55af23565 distro:732e918b0ba8 distro:af95709a8c88 distro:049b1df829e1 distro:18b29aca0002 distro:326d4e09a94e distro:73199d396026 distro:85862ea0443c distro:14dfde390a17 distro:6d1eb2f13b69 distro:5c0c86a98150 distro:1aeaa4d5e357 distro:4f41db2f90cc distro:f639af4a3b5b distro:01c20782591b distro:6a84bbaae6f8 distro:392622600b78 distro:a080badca42d distro:4bb030f740a2 distro:4923dfcd055b distro:3570510f790c distro:7c3413bf1757 distro:0f364fd63b1d distro:8a25749ad656 distro:d52d790ac945 distro:c5c78373f622 distro:625d5b2d7283 distro:d678872f896a distro:f2d00006c1f8 distro:8102719432fa distro:e803e27978b0 distro:84032ab3f3ef distro:b56e83b7a537 distro:29f946bfa233 distro:3d3fe2a50623 distro:22cb378be3a0
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches Release01x01 trunk
trunkCheckins distro:c794eae3dae4 distro:d80730481a53 distro:4aa34bdc9fc6 distro:ce9e29d73c14 distro:011e84431907 distro:fcd5011e7e0f distro:68fddfba3246 distro:bf772554be4e distro:58a7048e330c distro:18b360138a03 distro:5da42ab9bac9 distro:fb82a33b0ab5 distro:58f9ed6b6192 distro:155dcb46d9b6 distro:b12f7cf334d7 distro:c55c5766455d distro:cc3d1c259c72 distro:dc84c186a8a3 distro:a4df5b428a10 distro:942e88a8a67f distro:bbbe0593b1f6 distro:07744592913c distro:2f12d7380113 distro:b14c283cc78c distro:9ae49f7627b1 distro:74b6f7d7385b distro:9c2a3ed7c429 distro:3a8f20148940 distro:4a603934c07a distro:2f2b18f60d83 distro:0b425de46ee7 distro:52a4c6bae541 distro:bfc1fbfa4a41 distro:3ac93d5282b8 distro:945c4dfe546d distro:4fd7ba46cdc1 distro:67a5f4a73837 distro:14bdb767b37d distro:ec62b8ae6b61 distro:cb1539da5521 distro:f8e57c28b71c distro:a5b20ca7c5ba distro:41bb2f7ed728 distro:85dc2fb9d362 distro:7d323857d216 distro:47315c5df704 distro:f0ac82d8db17 distro:48ae5a35f8be distro:499ee901e026 distro:113afd0d22e2 distro:700ffdfb9d7b distro:14cee747f403 distro:199e1300cd38 distro:4db853e269c2 distro:5deb1365833c distro:eacaa43fda53 distro:6a06752a1630 distro:04bddd6ad0bb distro:e9f8dc245609 distro:0159393df931 distro:ccabfc2972ce distro:3abcbf62beb7 distro:5d93eb534921 distro:f3e5d2ce0f6a distro:0aac2af1af40 distro:80ceb068ee77 distro:254046fa6dba distro:dd02a1021c6c distro:48152e5078c6 distro:a8f15c37004e distro:835827dd04c8 distro:65a352a7d441 distro:d1448065b8c0 distro:3367eb727716 distro:af0606da8234 distro:f0ebfb6d3c28 distro:5542aea74357 distro:69213980c0fe distro:c4d304d8ae01 distro:51d48e306889 distro:9ec84d5186fc distro:9368c0b45506 distro:bee3d43110bd distro:06f736eca150 distro:f1a649aa976b distro:8d0b0bce4ed6 distro:526eb1af5baa distro:33f6110de8ae distro:b92220b9a879 distro:9a248a51f714 distro:1ea62ba7699c distro:94082a940808 distro:2dcaead844df distro:a511d15bcedc distro:cf4d59afd0ba distro:b644eecec505 distro:d44e9d3ca812 distro:c2b8ab987777 distro:563b0c530759 distro:29fdf4587ada distro:87e97c1b4548 distro:96a8fc34455a distro:c2485aa3ce24 distro:896fe70885be distro:71ec9b6f0c48 distro:bc885fe10b6e distro:ed934bf18563 distro:528b1e2be57e distro:9f2eeb263d33 distro:782614a999d1 distro:7377d462d467 distro:8083fd675dcc distro:a1d44c486a3e distro:69d823891660 distro:bcf0427e2816 distro:d9638b92f2fa distro:bcf0901517cf distro:1d6ac2e24976 distro:afb9ebd13af1 distro:ae1e53d23049 distro:8653127d2edd distro:5176f0af4303 distro:5e31b9e835b7 distro:214f4bf532e2 distro:f1d18a2ee524 distro:f262f849fdd8 distro:5c0c7b52bede distro:07981f2e668f distro:7969e882873b distro:18f44df8efeb distro:1d8bdeace983 distro:761b14c6e36a distro:8775e506378b distro:d4197a77f4a4 distro:0205b1f7e148 distro:14c238d3efc9 distro:09c9afc49154 distro:c2672a55a599 distro:1f4c3de8b33c distro:56ddd2edb35b distro:d61a81e32b3a distro:cbce4e2f3d39 distro:0793a1de5120 distro:b6b4ea7de8dc distro:b5bd928e1441 distro:802239d55e6f distro:7a98c3581352 distro:5de0f7ddf378 distro:5cc55af23565 distro:732e918b0ba8 distro:af95709a8c88 distro:049b1df829e1 distro:18b29aca0002 distro:326d4e09a94e distro:73199d396026 distro:85862ea0443c distro:14dfde390a17 distro:6d1eb2f13b69 distro:5c0c86a98150 distro:1aeaa4d5e357 distro:4f41db2f90cc distro:f639af4a3b5b distro:01c20782591b distro:6a84bbaae6f8 distro:392622600b78 distro:a080badca42d distro:4bb030f740a2 distro:4923dfcd055b distro:3570510f790c distro:7c3413bf1757 distro:0f364fd63b1d distro:8a25749ad656 distro:d52d790ac945 distro:c5c78373f622 distro:625d5b2d7283 distro:d678872f896a distro:f2d00006c1f8 distro:8102719432fa distro:e803e27978b0 distro:84032ab3f3ef distro:b56e83b7a537 distro:29f946bfa233 distro:3d3fe2a50623 distro:22cb378be3a0
Release01x01Checkins distro:7225fe186b13
Topic revision: r204 - 05 Jul 2015, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy