[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, debian/master, updated. 810edbdd3feedbfe37f4a65bee50b57b2f60fa2a

Naparuba naparuba at gmail.com
Tue Feb 28 22:13:28 UTC 2012


The following commit has been merged in the debian/master branch:
commit 5f6904515fc9aee75c762750912aeb5961ee3f29
Author: Naparuba <naparuba at gmail.com>
Date:   Fri Jan 13 10:35:15 2012 +0100

    Add : first pages for the discovery page in SkonfUI.

diff --git a/contrib/alternative-installation/shinken-install/tools/__init__.py b/shinken/webui/plugins_skonf/newhosts/__init__.py
similarity index 100%
copy from contrib/alternative-installation/shinken-install/tools/__init__.py
copy to shinken/webui/plugins_skonf/newhosts/__init__.py
diff --git a/shinken/webui/plugins_skonf/main/main.py b/shinken/webui/plugins_skonf/newhosts/newhosts.py
similarity index 71%
copy from shinken/webui/plugins_skonf/main/main.py
copy to shinken/webui/plugins_skonf/newhosts/newhosts.py
index 41929b5..3361c03 100644
--- a/shinken/webui/plugins_skonf/main/main.py
+++ b/shinken/webui/plugins_skonf/newhosts/newhosts.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-#Copyright (C) 2009-2012 :
+#Copyright (C) 2009-2011 :
 #    Gabes Jean, naparuba at gmail.com
 #    Gerhard Lausser, Gerhard.Lausser at consol.de
 #    Gregory Starck, g.starck at gmail.com
@@ -23,13 +23,14 @@
 
 
 from shinken.webui.bottle import redirect
+from shinken.utils import to_bool
 
 ### Will be populated by the UI with it's own value
 app = None
 
 # Our page. If the useer call /dummy/TOTO arg1 will be TOTO.
 # if it's /dummy/, it will be 'nothing'
-def get_page():
+def get_newhosts():
     # First we look for the user sid
     # so we bail out if it's a false one
     user = app.get_user_auth()
@@ -44,6 +45,27 @@ def get_page():
     return {'app' : app, 'user' : user}
 
 
+
+def get_launch():
+    print "Got forms in /newhosts/launch page"
+    names = app.request.forms.get('names', '')
+    use_nmap = to_bool(app.request.forms.get('use_nmap', '0'))
+    use_vmware = to_bool(app.request.forms.get('use_vmware', '0'))
+    
+    print "Got in request form"
+    print names
+    print 'nmap?', use_nmap
+    print 'vmware?', use_vmware
+
+    return {'app' : app}
+
+
+
+def get_scans():
+    print "Got scans"
+    return {'app' : app}
+
+
 # This is the dict teh webui will try to "load".
 #  *here we register one page with both adresses /dummy/:arg1 and /dummy/, both addresses
 #   will call the function get_page.
@@ -52,5 +74,8 @@ def get_page():
 #    the dummy/htdocs/ directory. Bewere : it will take the plugin name to match.
 #  * optional : you can add 'method' : 'POST' so this adress will be only available for
 #    POST calls. By default it's GET. Look at the lookup module for sample about this.
-pages = {get_page : { 'routes' : ['/main/', '/main'], 'view' : 'main', 'static' : True}}
+pages = {get_newhosts : { 'routes' : ['/newhosts'], 'view' : 'newhosts', 'static' : True},
+         get_launch : { 'routes' : ['/newhosts/launch'], 'view' : 'newhosts_launch', 'static' : True, 'method' : 'POST'},
+         get_scans : { 'routes' : ['/newhosts/scans'], 'view' : 'newhosts_scans', 'static' : True},
+         }
 
diff --git a/shinken/webui/plugins_skonf/newhosts/views/newhosts.tpl b/shinken/webui/plugins_skonf/newhosts/views/newhosts.tpl
new file mode 100644
index 0000000..decb2b8
--- /dev/null
+++ b/shinken/webui/plugins_skonf/newhosts/views/newhosts.tpl
@@ -0,0 +1,33 @@
+
+%rebase layout_skonf globals()
+<div> <h1> Discover your new hosts </h1> </div>
+
+
+<script type="text/javascript">
+  function submitform() {
+  document.forms["launchform"].submit();
+  }
+</script>
+
+
+
+<div id="login-form" class="grid_7">
+  <form method="post" id="launchform" action="/newhosts/launch">
+    <div class="textarea-field">
+      <label for="names">Ips/Names:</label>
+      <textarea name="names" type="textarea" tabindex="1" size="30">
+      </textarea>
+    </div>
+    <input type="hidden" value="1" name="use_nmap">
+    <div class="check-field">
+      <input type="checkbox" id="use_nmap" tabindex="1" value="1" name="use_nmap"> <label for="use_nmap">Use Nmap discovery</label>
+    </div>
+    <input type="hidden" value="1" name="use_vmware">
+    <div class="check-field">
+      <input type="checkbox" id="use_vmware" tabindex="2" value="1" name="use_vmware"> <label for="use_vmware">Use VMware discovery</label>
+    </div>
+    <div class="buttons">
+      <a tabindex="4" class="button" href="javascript: submitform()">Scan!</a>
+    </div>
+  </form>
+</div>
diff --git a/shinken/webui/plugins_skonf/newhosts/views/newhosts_launch.tpl b/shinken/webui/plugins_skonf/newhosts/views/newhosts_launch.tpl
new file mode 100644
index 0000000..1d150eb
--- /dev/null
+++ b/shinken/webui/plugins_skonf/newhosts/views/newhosts_launch.tpl
@@ -0,0 +1,7 @@
+
+%rebase layout_skonf globals()
+<div> <h1> Discover your new hosts </h1> </div>
+
+Discovery launched. Redirecting in progress.
+
+<p><a href='/newhosts/results'>Scan results</a></p>
diff --git a/shinken/webui/plugins_skonf/newhosts/views/newhosts_scans.tpl b/shinken/webui/plugins_skonf/newhosts/views/newhosts_scans.tpl
new file mode 100644
index 0000000..489dbac
--- /dev/null
+++ b/shinken/webui/plugins_skonf/newhosts/views/newhosts_scans.tpl
@@ -0,0 +1,5 @@
+
+%rebase layout_skonf globals()
+<div> <h1> Discover your new hosts </h1> </div>
+
+Here are the results :

-- 
UNNAMED PROJECT



More information about the Pkg-nagios-changes mailing list