#447 Integrate the contact info in the rules widget for team hubs
Merged by abompard. Opened by abompard.
abompard/fedora-hubs feature/contact  into  develop

Download 447.patch

Fixes #442

There's also a rework of the Contact widget which did not work since the switch to React. The difference is that jQuery auto-executes the <script> tags when filling a element with AJAX data, while React does not. As a consequence simple widgets can't use Javascript, they need to be written in React for that.

The Contact widget uses javascript to display the user's local time and refresh it every second.

Just tried this on a fresh vagrant install, and the contact widget on a user page shows the following error:

JSON.parse: unexpected character at line 1 column 1 of the JSON data

Do you have an error in the webserver's output?

rebased onto ecaec879cfc21e6d88e278b36583a0c0c61c6964

@abompard weirdly, no. Let me check again :)

Yup, there is a traceback... here it is:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib/python2.7/site-packages/flask/views.py", line 84, in view
    return self.dispatch_request(*args, **kwargs)
  File "/srv/hubs/fedora-hubs/hubs/widgets/view.py", line 123, in dispatch_request
    context = self.get_context(instance, *args, **kwargs)
  File "/srv/hubs/fedora-hubs/hubs/widgets/contact/__init__.py", line 59, in get_context
    fas_info = get_fas_info()
  File "/srv/hubs/fedora-hubs/hubs/widgets/caching.py", line 76, in get_data
    key, self.execute, should_cache_fn=self._should_cache)
  File "/usr/lib/python2.7/site-packages/dogpile/cache/region.py", line 825, in get_or_create
    async_creator) as value:
  File "/usr/lib/python2.7/site-packages/dogpile/lock.py", line 154, in __enter__
    return self._enter()
  File "/usr/lib/python2.7/site-packages/dogpile/lock.py", line 94, in _enter
    generated = self._enter_create(createdtime)
  File "/usr/lib/python2.7/site-packages/dogpile/lock.py", line 145, in _enter_create
    created = self.creator()
  File "/usr/lib/python2.7/site-packages/dogpile/cache/region.py", line 792, in gen_value
    created_value = creator()
  File "/srv/hubs/fedora-hubs/hubs/widgets/contact/__init__.py", line 73, in execute
    person = fas_client.person_by_username(self.instance.hub.name)
  File "/usr/lib/python2.7/site-packages/fedora/client/fas2.py", line 429, in person_by_username
    req_params=params)
  File "/usr/lib/python2.7/site-packages/fedora/client/baseclient.py", line 354, in send_request
    'Auth was requested but no way to'
AuthError: Auth was requested but no way to perform auth was given.  Please set username and password or session_id before calling this function with auth=True

Right! You need to set a login and password to be able to access FAS. I'll make an explicit error message.

1 new commit added

  • Add an error message if no FAS credentials are available

rebased onto a1b80713066f3595de26561022e5903ed8c15bce

:thumbsup: on this one from me.

One thing i did find distracting a bit was the seconds counter on the time. IMHO, having it down to the minute would be sufficient.

5 new commits added

  • Don't display the seconds in the contact widget
  • Set the allowed hub types for the rules and contact widgets
  • Add a Communication section to the Rules widget
  • Rewrite the contact widget with React to use Javascript
  • Allow manual invalidation of multiple widgets

Pull-Request has been merged by abompard

Metadata