-
Notifications
You must be signed in to change notification settings - Fork 175
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
Refactor dashboard to move widgets into modules. #5896
Conversation
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.
Changes I intend to make before taking this out of draft mode, in case anyone's wondering.
@@ -0,0 +1,343 @@ | |||
<?php | |||
/** |
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.
Note: I'll probably move this endpoint into a different PR to simplify things.
This adds a "renderTemplate" function to the module class, in order to render a template from a module, given its \Module descriptor. This is a helper extracted from aces#5896 which is mostly self-contained enough to stand on its own.
It would be good to coordinate this with #5829 |
There is no way to coordinate with that PR other than blocking because git has no concept of code being moved from one place to another, it's just a bunch of lines deleted in one place and unrelated code added in another. As I said last year in a comment on that PR, it shouldn't be worked on until this is done. (On the other hand, it should make it a lot easier to split up #5829 since PRs can be sent one widget or module at a time and there's really not much left in the dashboard itself to 'Reactify') |
OK it seems that you and @maltheism are in agreement that this PR will probably go forward first/instead of #5829. I just wanted to make sure everyone was clear on that. |
This moves the query to get the last user login from the dashboard code to the User class, where it more accurately belongs. (This was extracted from aces#5896 where it was necessary because multiple modules use the last login time to determine if something is new.)
…ics module This moves the ajax calls from the dashboard module into the more appropriate statistics module for the graph endpoints. It also converts some inexplicable "post" requests into "get" requests but otherwise behaviour should remain unchanged. This was extracted from aces#5896 and is sent as a separate PR in order to simplify that PR and make it easier to rebase data/permission related PRs which would otherwise conflict.
These bugs were also discovered/fixed fixed by this PR:
|
2ffdaa8
to
4734533
Compare
…ics module (#5900) This moves the ajax calls from the dashboard module into the more appropriate statistics module for the graph endpoints. It also converts some inexplicable "post" requests into "get" requests but otherwise behaviour should remain unchanged. This was extracted from #5896 and is sent as a separate PR in order to simplify that PR and make it easier to rebase data/permission related PRs which would otherwise conflict.
I will re-write the integration test and continue working on this PR. |
The tests shouldn't need to be rewritten, the dashboard should behave identically to before with the default configuration |
[ | ||
'baseURL' => $baseURL, | ||
'notifications' => $frontend_feedback | ||
], |
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.
remove " , "
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.
Those shouldn't make a difference Travis only runs PHP 7.3+ but I'll remove them and see what happens.
'notifications' => $frontend_feedback | ||
], | ||
), | ||
"", |
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.
same
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.
I tried to run your PR locally, but I got all same error "syntax error, unexpected ')' in /var/www/Loris/modules/dashboard/php/module.class.inc on line 120"
modules/bvl_feedback/php/module.class.inc
modules/dashboard/php/dashboard.class.inc
modules/dashboard/php/module.class.inc
modules/document_repository/php/module.class.inc
modules/statistics/php/module.class.inc
You seem like add a unnecessary comma in the functioins.
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.
What version of PHP are you using?
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.
7.2
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.
Trailing commas being optional in function calls was added to PHP in 7.3 (and Travis now only runs 7.3 and 7.4, so that's not why it's failing.. ), but I removed the comma anyways
91aeb9c
to
060ac51
Compare
"//*[@id='lorisworkspace']/div/di". | ||
"v[1]/div[2]/div[1]/div/div/button" | ||
"//*[@id='lorisworkspace']/div[1]". | ||
"/div[2]/div[1]/div/div/button" |
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.
Line 432-433 /html/body/div[1]/div/div/div/div/div[1]/div[2]/div[1]/div/div/ul/li[1]/a
line 439-440 /html/body/div[1]/div/div/div/div/div[1]/div[2]/div[1]/div/div/ul/li[2]/a
im getting the following error: |
What version of PHP are you using? The minimum required version on the master branch is 7.3 and I'm not getting any syntax errors on that file with |
@driusan i also looked at the code and didn't see anything wrong. im on PHP 7.3.10 |
The PR is working for me and there aren't any issues from |
@zaliqarosli are you sure your web server and command line are using the same version of PHP? It looks like the error is from php <= 7.2 because of a trailing comma in a function call's arguments to me. |
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.
looks good. there are some errors that pop up in my error log when testing but they are not due to this PR and already exist on master branch
Adding |
This updates the dashboard in order to move responsibility for dashboard widgets into the modules themselves. It adds the concept of a "widget" to LORIS as a way to provide loosely coupled cross-module dependencies. Modules may now register "widgets" of different types to be used by other modules. As a proof-of-concept, this architecture can be the basis of the upcoming candidates dashboard.
There are 2 types of widgets defined in this PR: dashboard widgets, which add a panel to the dashboard, and usertasks widgets, which add a task to the "My Tasks" panel on the dashboard.
All existing widgets are moved to the most appropriate module that currently exists. The dashboard only maintains ownership of the "Welcome" widget and the "My Tasks" widget itself.