#200 Implement Feed Widget and live update in React
Merged by atelic. Opened by atelic.
atelic/fedora-hubs feature/add-react  into  develop

Download 200.patch

Purpose

After some discussion about JS Frameworks, I have done the work to set up hubs with React. This should make it trivial to add or convert to React components in the future. This also implements the Feed Widget in react and includes live updating via Server Sent Events. This should be able to replace #193. Most of the important stuff is in Feed.jsx and feed.html.

http://paste.opensuse.org/view/raw/81727766

Just quick comment. I think I read up somewhere its not wise to insert the sources for libraries like this and to use a package manager like npm. Does react have an easy way to be installed like that and could we insert that to the setup.py script?

Hmm, I forgot that they are now installed with npm so the source folders shouldn't be needed. I was including them before I figured out how to get webpack to compile.

I've removed them locally with no problem. Hopefully that will make this easier to review too.

3 new commits added

  • Implement feed widget in Reactjs
  • Add tests for feed update and improve speed
  • Front end for live update for feed widget

awesome :) that would be much less daunting to review :P

rebased

rebased

Does this do a system wide install or is there a way to do it only locally (in the home folder or the cwd)?

As I understand it, when run without the -g (--global) flag, npm will only install these modules in the root of the project.

http://stackoverflow.com/a/14032346

Yes, -g does a global installation.

Using pickle because some stronger serialization on the matches list.

For example:

>>> d = { 'aset': set(['thing1', 'thing2']) }
>>> json.dumps(d)

TypeError: set(['thing1', 'thing2']) is not JSON serializable.

The more I think about it, the more that I think this isn't the right way to do it. Sure it got rid of the error messages but we are probably losing some data in there.

I don't think we loose data per say, but I do agree that going via pickle isn't really nice.

If possible I'd rather have us stick with json

What about something like::

class PythonObjectEncoder(json.JSONEncoder):
''' A JSON encoder that handles python data structures in encoding'''
def default(self, obj):
    if isinstance(obj, (list, dict, str, unicode, int, float, bool,
                        type(None))):
        return json.JSONEncoder.default(self, obj)
    if isinstance(obj, set) or isinstance(obj, tuple):
        return list(obj)
    if isinstance(obj, object):
        return obj.__dict__
    else:
        raise TypeError

rebased

rebased

rebased

1 new commit added

  • Fix JS that was causing errors

rebased

Yes, fixed now

rebased

Looks fine to me but I'm clearly not the most knowledgeable person on react :)

rebased

:thumbsup:

Looks good to me. :thumbsup:

Good to merge?

@atelic @sayanchowdhury gave his :thumbsup:, so let's do it! :)

Woo! :ship: :tada:

Pull-Request has been merged by atelic

Metadata