-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Rewrite jquery.dashboard.js as Angular app #18971
Conversation
(Standard links)
|
There used to be a refresh button because dashlet output gets cached. I can't see how to refresh them now? I tried removing and re-adding. Even clearing caches didn't seem to update them. Anyone familiar with the current screen will be able to figure out how to drag dashlets in and out, but I think the old text intro that was at the top was useful for new users and would still be useful here. If a dashlet itself is angular, do they fight? Nowadays that would pass for entertainment. |
68f3e97
to
8973a4f
Compare
Thanks @demeritcowboy for taking a look. I've just pushed up a couple changes based on your suggestions:
|
Cool. This may or may not be related - I don't see it on dmaster.demo but I do see it on the test site here - creating a new contact on the fly, e.g. from a new contribution, hangs, but it doesn't seem to be a 500 error. I'll see if I can track down if it's related to the PR. Otherwise I just see some help text that needs updating: These two lines aren't accurate anymore. There's no "configure dashboard" and no "Done" button. I haven't looked at the code, just r-run, with the stock widgets. |
js/Common.js
Outdated
// If the server returns an error msg call the error handler | ||
var status = $.isPlainObject(data) && (data.is_error || data.status === 'error') ? 'error' : 'success'; | ||
handle(status, data); | ||
}) | ||
.fail(function(data) { | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it seems to be these changes. If I apply the common.js diff alone to a site then I get the hang when creating contacts on the fly.
f868e6b
to
1b591cf
Compare
@demeritcowboy ok I'm going to leave changes to Common.js out of this PR and tackle them separately since fixing |
d64227c
to
2951ae1
Compare
Updated a bit more help text, as the Report UI has changed significantly since it was written. |
@colemanw please merge this once @demeritcowboy indicates he is happy with it. The approach / plan has been discussed & agreed and despite the large number of changes I perceive this as a low-risk change because it doesn't have complex interactions on mulitple subsystems & and problems will be very much in dev's faces over the remaining time until release |
@colemanw this needs a rebase - blame @seamuslee001 |
New home dashboard written with Angular + APIv4. Functionality is mostly unchanged. The motivation for this is to support afforms embedded within dashboard dashlets.
2951ae1
to
f263929
Compare
Rebased it. Should be good to go. Want to take one last look @demeritcowboy? |
|
Thanks @demeritcowboy. |
Hi @colemanw Some clients are using the dashboard as a live dashboard system, where we want the page to refresh every 15 seconds or so - Otherwise the report appears out of date when we have complex actions. I have been using a hacky approach to set the dashboard timeout which has worked until now - However it appears to have been deprecated by the changes here and doesn't work in 5.34.0 with the switch to Angular.
I've looked at the various hooks and it doesn't appear there is a current better approach - Or I can't find a hook I can find use that enables me to alter the data going to the dashboard - Only an angular one where I can modify the HTML content of ~/crmDashboard/Dashlet.html What approach do you recommend to setting a timeout value on reports that is a float...as part of a hook? The database cache time out field only allows for integers, and 0 causes a constant refresh of the page. Is the solution for a change request to make this field a float? FYI - I did test some code which triggers the refresh function on your Angular refresh code - This seems hacky and not ideal for long term maintenance.
|
It seems like the best approach would be to allow non-integers & make that field a float as you suggested. |
Overview
This is a code rewrite of the home dashboard. The look, feel & functionality is mostly unchanged.
The new dashboard supports embedded afforms (which can contain search kit displays).
Before
Dashboard code based on an old jquery widget which I believe was copied from a Drupal 6 module.
After
Dashboard code based on Angular, APIv4 & flex css.
Technical Details
A dashlet can now specify a "directive" instead of a "url" and that angular directive + its dependencies will be automatically loaded.