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
Open widget framework integration #1450
Conversation
@@ -13,6 +13,8 @@ | |||
{% if js_settings_json %} | |||
<script type="text/javascript"> | |||
var SETTINGS = {{ js_settings_json|safe }}; | |||
var csrfToken = '{{ csrf_token }}'; |
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's this for / is it necessary?
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.
That is for making requests to the django backend. It's a django generated token that the backend reads and verifies that it's not a cross-site request forgery. If your project has a different way of handling this, we can change it.
@@ -292,6 +294,9 @@ class App extends React.Component<AppProps> { | |||
path={`${match.url}privacy-statement`} | |||
component={PrivacyPolicyPage} | |||
/> | |||
<Route path={match.url} render={() => { | |||
return (<WidgetList widgetListId={SETTINGS.widgetListId} />) | |||
}}/> |
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.
by putting this here, the widgets will appear on all pages, right?
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.
Correct.
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.
Some notes from a code review:
- Needs a rebase on master
- Travis is failing on both python and javascript tests. The python failures so far are just formatting, which you can fix by running
docker-compose run web black .
- The version changes to the engine definitions need to get reverted.
- There are a lot of version bumps in
requirements.txt
. I think you can fix this by reverting that fix and then runningpip-compile -P open-widget-framework
to only affect that one depedency -
open-widget-framework
should be pinned inrequirements.in
to a specific version so our builds don't upgrade automatically - WidgetWrappers.js appears to reference some functions that don't exist or aren't imported
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.
just a question I had looking through - are the various WidgetWrapper
components used for anything currently?
} | ||
} | ||
|
||
class mitodlWidgetWrapper extends Component { |
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.
are the components written in this file used anywhere?
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 are stubs but haven't been fully implemented yet. They also will probably be nicer if / when we implement redux in the package and then we won't need to pass through so many widget props.
@jklingen92 this is a really helpful start for us. @rhysyngsun is going to take this PR from here to do some of the more idiosyncratic stuff. |
Replaced by a newer PR #1534 |
Pre-Flight checklist
app.json
What are the relevant tickets?
#1441
What's this PR do?
Initial integration of the open-widget-framework
How should this be manually tested?
No testing yet
Where should the reviewer start?
See if you can locally view, edit, add, and delete widgets
Any background context you want to provide?
There's still a lot to change and adjust. If the input is invalid (URLs especially) it won't add the widget
Screenshots (if appropriate)
(Optional)
What GIF best describes this PR or how it makes you feel?
(Optional)