Skip to content

Commit

Permalink
Merge pull request #479 from mohierf/develop
Browse files Browse the repository at this point in the history
Version 2.3.2
  • Loading branch information
mohierf committed Apr 17, 2016
2 parents 3f65d99 + 9f405c8 commit 151b3b5
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 44 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,39 @@
## Description
Shinken Web User Interface

Current version is 2.3.1, available on [`shinken.io`](http://shinken.io/package/webui2).
Current version is 2.3.2, available on [`shinken.io`](http://shinken.io/package/webui2).

## Release notes

### Version 2.3.2
- Features:
- Update (huge) dashboard currently view
- Improve problems widgets (synthesis, commands bar)
- Problems page metrics improvements (thanks @medismail)
- New dashboard widget to enable/disable global notifications

- Enhancements:
- Clean dashboard widgets management (addition, options, removal, ...)
- Update JS/CSS/Fonts libraries (jQuery, Font Awesome)
- Update login process and user management
- Refactoring in the data manager
- Allows authenticating a user with Alignak backend

- Bugs and fixes:
- #471: downtime page error
- #469: currently 404
- #468: CSS bug
- #466: use display_name when available
- ... and some others :)

### Version 2.3.1
Only for internal testings and not published on shinken.io
- Features:
- Update (huge) dashboard currently view
- Improve problems widgets (synthesis, commands bar)
- Problems page metrics improvements (thanks @medismail)

- Enhancements:
- Enhancements:
- Clean dashboard widgets management (addition, options, removal, ...)
- Update JS/CSS/Fonts libraries (jQuery, Font Awesome)
- Update login process and user management
Expand Down
32 changes: 22 additions & 10 deletions etc/modules/webui2.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,33 @@ define module {
# You may remove the modules 'auth-cfg-password' and 'auth-htpasswd' from your
# configuration because the WebUI embeds those authentication methods.
#
# - auth-alignak (internal) : Use alignak backend to authenticate users.
# This new authentication feature is used to authenticate a user near Alignak backend.
#
# You may use these external modules:
# - auth-ws-glpi : Use the Glpi Web Services for user authentication
# - auth-active-directory : Use AD for auth backend (and retrieve photos).

# htpasswd (apache like) file containing username/passwords
# Use an Apache htpasswd file or build your own (http://www.htaccesstools.com/htpasswd-generator/)
#Default file
#htpasswd_file /etc/shinken/htpasswd.users
#htpasswd_file /etc/shinken/htpasswd.users

# Alignak backend endpoint
# Configure this value to activate the Alignak backend authentication module
#alignak_backend_endpoint http://127.0.0.1:5020

# Use Alignak backend objects instead of Shinken objects
# NOTE : this feature is still experimental and should never be used in a production environment!
# *******************************
#alignak_backend_objects 1
# *******************************


## Modules for WebUI
## Graphs:
# You may use these external modules:
# - ui-pnp : Use PNP graphs in the UI.
# - ui-graphite : Use graphs from Graphite time series database.
# - ui-graphite2 : Use graphs from Graphite time series database.


## Modules for WebUI
Expand Down Expand Up @@ -84,13 +96,13 @@ define module {
#port 7767


# By default, a random secret for session cookies will be auto-generated
# and stored in file described by auth_secret_file. Alternatively, secret
# can be explicitly set using parameter auth_secret, for example if there
# are multiple instances providing webui behind a load balancer.
#
#auth_secret CHANGEME
#auth_secret_file /var/lib/shinken/auth_secret
# Authentication secret for session cookie
# 1/ Define here a secret string used to sign session cookie
# auth_secret CHANGEME
; CHANGE THIS or someone could forge cookies
# 2/ Define here a file that will store an auto-generated secret (more secure)
# This configuration is more secure than the previous one ...
auth_secret_file /var/lib/shinken/auth_secret

# Session cookie name
cookie_name user_session
Expand Down
27 changes: 14 additions & 13 deletions module/datamanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def __init__(self, rg=None, frontend=None, alignak=False):
def _is_related_to(item, user):
"""
"""
if not user:
# if no user or user is an admin, always consider there is a relation
if not user or user.is_administrator():
return item

return user._is_related_to(item)
Expand All @@ -146,7 +147,8 @@ def _only_related_to(items, user):
:returns: List of elements related to the user
"""
if not user:
# if no user or user is an admin, always consider there is a relation
if not user or user.is_administrator():
return items

try:
Expand Down Expand Up @@ -415,7 +417,7 @@ def search_hosts_and_services(self, search, user, get_impacts=True, sorter=None)
)
)

logger.info("[WebUI - datamanager] search_hosts_and_services, search for %s", search)
logger.debug("[WebUI - datamanager] search_hosts_and_services, search for %s in %d items", search, len(items))

search = [s for s in search.split(' ')]

Expand Down Expand Up @@ -677,7 +679,6 @@ def get_timeperiod(self, name):
name = name.decode('utf8', 'ignore')
except UnicodeEncodeError:
pass
logger.info("[WebUI - datamanager] get_timeperiod, name: %s", name)

return self.get_timeperiods(name=name)

Expand Down Expand Up @@ -788,7 +789,7 @@ def get_contactgroups(self, user=None, name=None, parent=None, members=False):
:param name: only this element
:returns: List of elements related to the user
"""
logger.info("[WebUI - datamanager] get_contactgroups, name: %s, members: %s", name, members)
logger.debug("[WebUI - datamanager] get_contactgroups, name: %s, members: %s", name, members)
items = []
if parent:
group = self.get_contactgroups(user=user, name=parent)
Expand All @@ -801,7 +802,7 @@ def get_contactgroups(self, user=None, name=None, parent=None, members=False):
items = self.fe.contactgroups
else:
items = self.rg.contactgroups
logger.info("[WebUI - datamanager] got %d contactgroups", len(items))
logger.debug("[WebUI - datamanager] got %d contactgroups", len(items))

if name:
return items.find_by_name(name)
Expand All @@ -819,7 +820,7 @@ def get_contactgroup(self, name, user=None, members=False):
name = name.decode('utf8', 'ignore')
except UnicodeEncodeError:
pass
logger.info("[WebUI - datamanager] get_contactgroup, name: %s", name)
logger.debug("[WebUI - datamanager] get_contactgroup, name: %s", name)

return self._is_related_to(self.get_contactgroups(user=user, name=name, members=members), user)

Expand Down Expand Up @@ -870,7 +871,7 @@ def get_hostgroups(self, user=None, name=None, parent=None, members=False):
:param name: only this element
:returns: List of elements related to the user
"""
logger.info("[WebUI - datamanager] get_hostgroups, name: %s", name)
logger.debug("[WebUI - datamanager] get_hostgroups, name: %s", name)
items = []
if parent:
group = self.get_hostgroups(user=user, name=parent)
Expand All @@ -883,7 +884,7 @@ def get_hostgroups(self, user=None, name=None, parent=None, members=False):
items = self.fe.hostgroups
else:
items = self.rg.hostgroups
logger.info("[WebUI - datamanager] got %d hostgroups", len(items))
logger.debug("[WebUI - datamanager] got %d hostgroups", len(items))

if name:
return items.find_by_name(name)
Expand Down Expand Up @@ -944,7 +945,7 @@ def get_servicegroups(self, user=None, name=None, parent=None, members=False):
:param name: only this element
:returns: List of elements related to the user
"""
logger.info("[WebUI - datamanager] get_servicegroups, name: %s", user)
logger.debug("[WebUI - datamanager] get_servicegroups, name: %s", user)
items = []
if parent:
group = self.get_servicegroups(user=user, name=parent)
Expand All @@ -957,7 +958,7 @@ def get_servicegroups(self, user=None, name=None, parent=None, members=False):
items = self.fe.servicegroups
else:
items = self.rg.servicegroups
logger.info("[WebUI - datamanager] got %d servicegroups", len(items))
logger.debug("[WebUI - datamanager] got %d servicegroups", len(items))

if name:
return items.find_by_name(name)
Expand Down Expand Up @@ -1008,7 +1009,7 @@ def get_host_tags(self):
for name in names:
items.append((name, self.rg.tags[name]))

logger.warning("[WebUI - datamanager] got %d hosts tags", len(items))
logger.debug("[WebUI - datamanager] got %d hosts tags", len(items))
return items

def get_hosts_tagged_with(self, tag, user):
Expand All @@ -1030,7 +1031,7 @@ def get_service_tags(self):
for name in names:
items.append((name, self.rg.tags[name]))

logger.warning("[WebUI - datamanager] got %d services tags", len(items))
logger.debug("[WebUI - datamanager] got %d services tags", len(items))
return items

def get_services_tagged_with(self, tag, user):
Expand Down
9 changes: 5 additions & 4 deletions module/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@
# along with Shinken. If not, see <http://www.gnu.org/licenses/>.


WEBUI_VERSION = "2.4.0"
WEBUI_VERSION = "2.3.2"
WEBUI_COPYRIGHT = "(c) 2009-2016 - License GNU AGPL as published by the FSF, minimum version 3 of the License."
WEBUI_RELEASENOTES = """
Stand-alone mode
Use Alignak backend
Dashboard currently view
Global notifications enable/disable widget
Use Alignak backend (experimental)
"""


"""
This Class is a plugin for the Shinken Broker. It is in charge
to get brok and recreate real objects, and propose a Web interface :)
to get broks and recreate real objects, and propose a Web User Interface :)
"""

import traceback
Expand Down
3 changes: 1 addition & 2 deletions module/plugins/contacts/contacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def show_contacts():
user = app.request.environ['USER']
user.is_administrator() or app.redirect403()

return {'contacts': sorted(app.datamgr.get_contacts(user=user),
key=lambda c: c.contact_name)}
return {'contacts': sorted(app.datamgr.get_contacts(user=user), key=lambda c: c.contact_name)}

pages = {
show_contact: {
Expand Down
14 changes: 5 additions & 9 deletions module/plugins/contacts/views/contact.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@
%# If got no element, bailout
%if not contact:
%rebase("layout", title='Invalid contact name')

%else:
%end

%helper = app.helper

%username = 'anonymous'
%if user is not None:
%if hasattr(contact, 'alias'):
%if hasattr(contact, 'alias') and contact.alias != 'none':
%username = contact.alias
%else:
%username = contact.get_name()
%end
%username = contact.contact_name
%end

%rebase("layout", title='Contact ' + username, breadcrumb=[ ['All contacts', '/contacts'], [username, '/contact/'+username] ])
Expand Down Expand Up @@ -71,7 +68,7 @@
</p>
%if app.manage_acl:
<p class="usercategory">
<small>{{'Administrator' if contact.is_administrator() else 'User'}}</small>
<small>{{'Administrator' if contact.is_admin else 'User'}}</small>
</p>
%end
</div>
Expand Down Expand Up @@ -457,7 +454,7 @@
<td>
%i=1
%for item in my_contactgroups:
{{', ' if i!=1 else ''}}{{item.alias if item.alias!='' else item.get_name()}}
{{', ' if i!=1 else ''}}<a href="/all?search=cg:{{item.get_name()}}">{{item.alias if item.alias!='' else item.get_name()}}</a>
%i+=1
%if i > 20:
<span> ... </span>
Expand All @@ -474,4 +471,3 @@
</div>
</div>
</div>
%end
2 changes: 1 addition & 1 deletion module/plugins/contacts/views/contacts.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<td><strong>{{contact.contact_name}}</strong></td>
<td><strong>{{"%s (%s)" % (contact.alias, contact.contact_name) if contact.alias != 'none' else contact.contact_name}}</strong></td>
<td><a href="mailto:{{contact.email}}?subject=Sent from Shinken WebUI">{{contact.email}}</a></td>
<td><a href="/contact/{{contact.get_name()}}" class="firstbtn">Detail</a></td>
<td><a href="/contact/{{contact.contact_name}}" >Detail</a></td>
</tr>
%end
</tbody>
Expand Down
10 changes: 9 additions & 1 deletion module/plugins/problems/views/problems.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,15 @@
</td>
<td>
%if i == 0:
<a href="/host/{{pb.host_name}}">{{pb.get_name() if pb.display_name == '' else pb.display_name}}</a>
%if pb.__class__.my_type == 'service':
%if pb.host:
<a href="/host/{{pb.host_name}}">{{pb.host.get_name() if pb.host.display_name == '' else pb.host.display_name}}</a>
%else:
<a href="/host/{{pb.host_name}}">{{pb.host_name}}</a>
%end
%else:
<a href="/host/{{pb.host_name}}">{{pb.get_name() if pb.display_name == '' else pb.display_name}}</a>
%end
%end
</td>
<td>
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "webui2",
"types": ["module"],
"version": "2.2.1",
"version": "2.3.2",
"homepage": "https://github.com/shinken-monitoring/mod-webui/wiki",
"author": "Frédéric MOHIER",
"description": "Web User Interface for Shinken, version 2.2.0",
"description": "Web User Interface for Shinken, version 2.3.2",
"contributors": [
{
"name": "Frederic Mohier",
Expand Down

0 comments on commit 151b3b5

Please sign in to comment.