[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a
nap
naparuba at gmail.com
Tue Feb 28 22:08:26 UTC 2012
The following commit has been merged in the debian/master branch:
commit 7727d57d4eb3e16fcbc4b2c028c813caa40c04dd
Author: nap <naparuba at gmail.com>
Date: Sun Dec 11 13:50:28 2011 +0100
Add : first mobile login and main page.
diff --git a/shinken/webui/plugins/login/login.py b/shinken/webui/plugins/login/login.py
index 642254d..727c81f 100644
--- a/shinken/webui/plugins/login/login.py
+++ b/shinken/webui/plugins/login/login.py
@@ -62,11 +62,15 @@ def user_auth():
print "Got forms"
login = app.request.forms.get('login', '')
password = app.request.forms.get('password', '')
+ is_mobile = app.request.forms.get('is_mobile', '0')
is_auth = app.check_auth(login, password)
if is_auth:
app.response.set_cookie('user', login, secret=app.auth_secret, path='/')
- redirect("/problems")
+ if is_mobile == '1':
+ redirect("/mobile/main")
+ else:
+ redirect("/problems")
else:
redirect("/user/login?error=Invalid user or Password")
@@ -81,6 +85,18 @@ def get_root():
redirect("/problems")
else:
redirect("/user/login")
+
+
+
+def login_mobile():
+ user = app.get_user_auth()
+ if user:
+ redirect("/mobile/main")
+
+ err = app.request.GET.get('error', None)
+ login_text = app.login_text
+
+ return {'error': err, 'login_text' : login_text}
pages = { user_login : { 'routes' : ['/user/login', '/user/login/'],
@@ -91,5 +107,7 @@ pages = { user_login : { 'routes' : ['/user/login', '/user/login/'],
'method' : 'POST', 'static' : True},
user_logout : { 'routes' : ['/user/logout', '/logout'] , 'static' : True},
get_root : {'routes' : ['/'], 'static' : True},
+ login_mobile : {'routes' : ['/mobile', '/mobile/'],
+ 'view' : 'login_mobile', 'static' : True}
}
diff --git a/shinken/webui/plugins/login/views/login.tpl b/shinken/webui/plugins/login/views/login_mobile.tpl
similarity index 88%
copy from shinken/webui/plugins/login/views/login.tpl
copy to shinken/webui/plugins/login/views/login_mobile.tpl
index 06df389..6182442 100644
--- a/shinken/webui/plugins/login/views/login.tpl
+++ b/shinken/webui/plugins/login/views/login_mobile.tpl
@@ -22,25 +22,25 @@
}
// Add a iphone like password show/hide
- window.addEvent('domready', function(){
+/* window.addEvent('domready', function(){
new PassShark('password',{
interval: 300,
duration: 1500,
replacement: '%u25CF',
debug: false
});
- });
+ });*/
</script>
-<div id="login_container" class="prefix_custom_2">
+<div >
%if login_text:
<p><span id="login-text"> {{login_text}}</span></p>
%end
- <div class="grid_8">
- <img src="/static/images/robot_rouge_alpha.png" alt="Shinken Login">
- </div>
+%# <div class="grid_8">
+%# <img src="/static/images/robot_rouge_alpha.png" alt="Shinken Login">
+%# </div>
<div id="login-form" class="grid_7">
%if error:
@@ -62,6 +62,7 @@
<div class="buttons">
<a tabindex="4" class="button" href="javascript: submitform()">Login</a>
</div>
+ <input type="hidden" value="1" name="is_mobile">
</form>
</div>
</div>
diff --git a/contrib/alternative-installation/shinken-install/tools/__init__.py b/shinken/webui/plugins/mobile/__init__.py
similarity index 100%
copy from contrib/alternative-installation/shinken-install/tools/__init__.py
copy to shinken/webui/plugins/mobile/__init__.py
diff --git a/shinken/webui/plugins/depgraph/depgraph.py b/shinken/webui/plugins/mobile/mobile.py
similarity index 61%
copy from shinken/webui/plugins/depgraph/depgraph.py
copy to shinken/webui/plugins/mobile/mobile.py
index 94a65eb..ef07999 100644
--- a/shinken/webui/plugins/depgraph/depgraph.py
+++ b/shinken/webui/plugins/mobile/mobile.py
@@ -21,33 +21,28 @@
#You should have received a copy of the GNU Affero General Public License
#along with Shinken. If not, see <http://www.gnu.org/licenses/>.
+
+from shinken.webui.bottle import redirect
+
### Will be populated by the UI with it's own value
app = None
-
-def depgraph_host(name):
+def main():
# First we look for the user sid
# so we bail out if it's a false one
user = app.get_user_auth()
if not user:
- return {'app' : app, 'elt' : None, 'valid_user' : False}
+ redirect("/mobile/")
+ return
- h = app.datamgr.get_host(name)
- return {'app' : app, 'elt' : h, 'valid_user' : True}
+ all_imp_impacts = app.datamgr.get_important_elements()
+
+ all_pbs = app.datamgr.get_all_problems()
-def depgraph_srv(hname, desc):
- # First we look for the user sid
- # so we bail out if it's a false one
- user = app.get_user_auth()
+ return {'app' : app, 'user' : user, 'impacts' : all_imp_impacts, 'problems' : all_pbs}
- if not user:
- return {'app' : app, 'elt' : None, 'valid_user' : False}
- s = app.datamgr.get_service(hname, desc)
- return {'app' : app, 'elt' : s, 'valid_user' : True}
+pages = {main : { 'routes' : ['/mobile/main'], 'view' : 'mobile_main', 'static' : True}}
-pages = {depgraph_host : { 'routes' : ['/depgraph/:name'], 'view' : 'depgraph', 'static' : True},
- depgraph_srv : { 'routes' : ['/depgraph/:hname/:desc'], 'view' : 'depgraph', 'static' : True},
- }
diff --git a/shinken/webui/plugins/mobile/views/mobile_main.tpl b/shinken/webui/plugins/mobile/views/mobile_main.tpl
new file mode 100644
index 0000000..4706ad9
--- /dev/null
+++ b/shinken/webui/plugins/mobile/views/mobile_main.tpl
@@ -0,0 +1,26 @@
+
+%rebase layout globals()
+<div> <h1> Shinken </h1> </div>
+
+<h2>End users apps</h2>
+
+%bad_business = [i for i in impacts if i.state_id != 0]
+
+
+%""" All business apps are OK """
+%if len(bad_business) == 0:
+ <img src="/static/images/state_ok.png" >
+ <img src="/static/images/next.png"/>
+ """ Are, some business apps are bad!"""
+%else:
+ <img src="/static/images/state_critical.png" >
+ <img src="/static/images/next.png"/>
+ <ul>
+ %for imp in bad_business:
+ <li class="{{imp.state.lower()}}">{{imp.get_full_name()}} is {{imp.state}}</li>
+ %end
+ </ul>
+%end
+
+
+<h2>Pure IT problems</h2>
\ No newline at end of file
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list