Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

jklingen92
Copy link

Pre-Flight checklist

  • Screenshots and design review for any changes that affect layout or styling
    • Desktop screenshots
    • Mobile width screenshots
    • tag @Ferdi or @pdpinch for review
  • Migrations
    • Migration is backwards-compatible with current production code
  • Testing
    • Code is tested
    • Changes have been manually tested
  • Settings
    • New settings are documented and present in app.json
    • New settings have reasonable development defaults, if applicable

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)

@@ -13,6 +13,8 @@
{% if js_settings_json %}
<script type="text/javascript">
var SETTINGS = {{ js_settings_json|safe }};
var csrfToken = '{{ csrf_token }}';
Copy link
Member

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?

Copy link
Author

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} />)
}}/>
Copy link
Member

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

Copy link
Contributor

@rhysyngsun rhysyngsun left a 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 running pip-compile -P open-widget-framework to only affect that one depedency
  • open-widget-framework should be pinned in requirements.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

Copy link
Contributor

@alicewriteswrongs alicewriteswrongs left a 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 {
Copy link
Contributor

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?

Copy link
Author

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.

@pdpinch
Copy link
Member

pdpinch commented Nov 6, 2018

@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.

@rhysyngsun
Copy link
Contributor

Replaced by a newer PR #1534

@rhysyngsun rhysyngsun closed this Nov 27, 2018
@rhysyngsun rhysyngsun deleted the open-widget-framework-integration branch November 27, 2018 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants