-
Notifications
You must be signed in to change notification settings - Fork 26
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
cbi: fix to work inside/along with other std directives #22
Conversation
The whitespace / indentation looks broken, did you maybe mix tabs and spaces? Another problem I see is that the uci configs are not loaded batch-wise anymore but that shouldn't be a big blocker. Will review it in more detail later |
Regarding whitespaces, I was trying out a new editor for js (Brackets) and perhaps it messed things up (or Probably I messed up the configuration...) Regarding the batch calls, it was a conscious trade off. |
An off topic question, what is the roadmap for luci? |
Currently the directive is not working inside/along with other std directives (such as ngRepeat or with {{variable}}). The initialization is done at compile or pre-link traversing the children, but they are not yet linked if (if they are not static). Change initialization to linking fase and change logic to not traverse the children. Instead each children calls the Map at the moment of initialization. While at it, move global regex variables to local scope, as now they are only needed there. Signed-off-by: Adrian Panella <ianchi74@outlook.com>
corrected my editor's config options and fixed mixed whitespaces. |
Merged, thank you! I agree that most CBIs map only one or two configs, so the benefits of your approach far outweigh the little overhead of not batching the load anymore. You can consider this |
@ianchi - I was revisting this code while testing your other PR for bumping Angular and noticed that it completely broke the waitfor / init / finish cycle of CBI widgets. One example where you can see the breakage is on the static routes configuration page - the cbiNetworkList finish function is called before The idea was that the Do you have any idea how we can easily defer calling |
@jow- I'll definitely look into it and share any ideas. |
@jow- I've been looking into this and have some coments/doubts:
I think that if it is only for that, the code should be reworked so each control is autonomous and waits on its own relevant events, instead of building a very complex hierarchical wait structure that relies on top down knowledge. In spite of that, we could leave the waitfor functionality (to allow to wait for external events) but instead of calling everything only once centralized from cbiMap, each control should wait for the promise in its own waitfor attribute and on its immediate parent (which in turns waits it's own parent). If we agree on the intended behavior I can send a PR with a proposal for the changes. Sorry for the lengthy post, and for being so disruptive again. |
Yeah, I also think we should localize the waitfor handling and I have no real problems with changing it. The only thing we must ensure is to block the cbiMap / Make it readonly while wait operations are pending. Maybe, upon calling waitfor(), we should disable the ownerMap buttons or display a loading data overlay. I basically want to avoid a case where a user hits "Save" while some input widgets are still initializing. |
Ok, I have already a modified version with localized waiting where static routes page is working again. I have a doubt there. Why do you call a "reset" of the sections just after saving it? Shouldn't data stay the same? Another doubt. I haven't completely followed all the underlying calls, but when calling save & apply as two consecutive functions that in turn call two async rpc calls independently how can you be sure that there is no race condition in the order of the calls, and that "apply" only acts after "save" has finished? I will look into the blocking feature and send the changes in a PR for your revision/comments. |
Pushed the proposed changes in PR #25 |
I think I added the The apply code path was a quick hack to get things working, it needs to be completely rebuilt to be properly synchronized. I also wanted to make it use of the apply/rollback facilities offered by rpcd to be able to react on problems. |
Currently the directive is not working inside/along with other std
directives (such as ngRepeat or with {{variable}}).
The initialization is done at compile or pre-link traversing the
children, but they are not yet linked (if they are not static).
Change initialization to linking phase and change logic to not traverse
the children. Instead each children calls the Map at the moment of
initialization.
While at it, move global regex variables to local scope, as now they are
only needed there.
Signed-off-by: Adrian Panella ianchi74@outlook.com