source: adagios/templates/configurator/addhost.html @ d92ba08

Revision d92ba08, 5.3 KB checked in by Tomas Edwardsson <tommi@…>, 2 years ago (diff)

Massed the addhost

  • Property mode set to 100644
Line 
1
2{% extends "configurator/base.html" %}
3
4{% block title %}Adagios - Add Host{% endblock %}
5
6{% block sidebar %}arg {% endblock %}
7
8{% block javascript %}
9                $(document).ready(function() {
10                        $('#hostname').focus();
11                        $.getJSON("/adagios/api/get_templates.json", function(json) {
12                                deferred = [];
13                                $.each(json.templates, function(key, object) {
14                                        if (object.parents.length == 0) {
15                                               
16                                                $('#os').append($('<option></option>').val(key).text(object.name));
17                                                $('#subtemplates').append("<fieldset class='subtemplate' id='subtemplate_" + key + "'><legend>Templates</legend></fieldset>");
18                                        } else {
19                                                deferred.push(key);
20                                        }
21                                                        /* <p><input type="checkbox" class="left" /> <label>Microsoft Exchange</p>
22                                                        <p style="clear: both"><input type="checkbox" class="left" /> <label>Microsoft SQL Server</p>
23                                        <fieldset class="subtemplates" id="subtemplates">
24                                                    <legend>Templates</legend>
25                                                  </fieldset> */
26                                });
27                                $.each(deferred, function(key, template) {
28                                        $.each(json.templates[template].parents, function(i, parent) {
29                                                $('#subtemplate_' + parent).append('<p style="clear: both"><input type="checkbox" name="' + template + ' class="left" /> <label>' + json.templates[template].name + '</p>');
30                                        });
31                                });
32                        });
33                });
34
35{% endblock %}
36
37{% block head %}
38
39
40        <!-- tab styling -->
41        <link rel="stylesheet" type="text/css" href="/static/css/tabs-flowplayer-v2.css"/>
42
43        <style>
44       
45
46        /* override the root element to enable scrolling */
47        #flowpanes {
48                position:relative;
49                overflow:hidden;
50                clear:both;
51        }
52
53        /* override single pane */
54        #flowpanes div {
55                float:left;
56                display:block;
57                width:670px;
58                font-size:14px;
59        }
60
61        /* our additional wrapper element for the items */
62        #flowpanes .items {
63                width:20000em;
64                position:absolute;
65                clear:both;
66                margin:0;
67                padding:0;
68        }
69
70        #flowpanes .less, #flowpanes .less a {
71                color:#999 !important;
72                font-size:11px;
73        }
74        </style>
75{% endblock %}
76
77
78{% block content %}
79
80
81<!-- tabs work as navigator for scrollable -->
82<ul id="flowtabs" class="navi">
83        <li><a id="t1" href="#host">Host</a></li>
84        <li><a id="t2" href="#templates">Templates</a></li>
85        <li><a id="t3" href="#review">Review</a></li>
86        <li><a id="t4" href="#complete">Complete</a></li>
87
88</ul>
89
90<form action="#" method="POST">
91<!-- panes -->
92<div id="flowpanes">
93
94
95        <!-- wrapper for scrollable items -->
96        <div class="items">
97
98                <div>
99                       
100                          <fieldset id="hostinfo">
101                                <legend>Host Information</legend>
102
103                                       
104                                                <p>
105                                                        <label for="hostname">Hostname <em>*</em></label>
106                                                        <input id="hostname" type="text" name="hostname" />
107                                                        <span id="warn_hostname"></span>
108                                                </p>
109                                                <p>
110                                                        <label for="description">Description</label>
111                                                        <input id="description" type="text" name="description" />
112                                                        <span id="warn_description"></span>
113                                                </p>
114                                                <p>
115                                                        <label for="ipaddress">IP Address <em>*</em></label>
116                                                        <input id="ipaddress" type="text" name="ipaddress" />
117                                                        <span id="warn_hostname"></span>
118                                                </p>
119                                       
120                                </fieldset>
121                       
122                </div> 
123               
124                <div>
125
126                        <fieldset id="templateinfo">
127                          <legend>Select Relevant Templates</legend>
128                                               
129                                                <p>
130                                                    <select id="os">
131                                                      <option value="none">-- select --</option>
132                                                    </select>
133                                                </p>
134                                                <p id="subtemplates">
135                                                 
136                                                </p>
137                        </fieldset>
138                </div>
139
140                <div>
141                                <h2>Review</h2>
142                </div>
143                <div>
144                                <h2>Complete</h2>
145                </div>
146
147        </div>
148
149</div>
150</form>         
151<p style="text-align:center;width:500px">
152        <button class="custom prev">&laquo; Previous</button>
153        <button class="custom next">Next &raquo;</button>
154</p>
155
156<!-- activate tabs with JavaScript -->
157<script>
158
159
160// wait until document is fully scriptable
161$(function() {
162
163        // select #flowplanes and make it scrollable. use circular and navigator plugins
164        $("#flowpanes").scrollable({ circular: true, mousewheel: true }).navigator({
165
166                // select #flowtabs to be used as navigator
167                navi: "#flowtabs",
168
169                // select A tags inside the navigator to work as items (not direct children)
170                naviItem: 'a',
171
172                // assign "current" class name for the active A tag inside navigator
173                activeClass: 'current',
174
175                // make browser's back button work
176                history: true
177
178        });
179});
180</script>
181                <script type="text/javascript">
182                                $('#hostname').keypress(function() {
183                                        if ($('#warn_hostname').html() != "") {
184                                                $('#warn_hostname').html("");
185                                        }
186                                });
187                               
188                               
189                                $('#os').change(function() {
190                                        $('.subtemplate').hide();                                       
191                                        $('#subtemplate_' + $('#os').val()).show();
192                                });
193                               
194                                $('#hostname').blur(function(e) {
195                                        if ($(this).val() == "") {
196                                                return false;
197                                        }
198                                        $.getJSON("/adagios/api/host/" + $(this).val() + ".json", function(json) {
199                                                if (json.host.host_name != "null") {           
200                                                        $('#warn_hostname').html('<img src="/static/attention.png" title="Hostname already exists" />');
201                                                        $("#warn_hostname img[title]").tooltip({
202                                                       
203        // place tooltip on the right edge
204        position: "center right",
205
206        // a little tweaking of the position
207        offset: [-2, 10],
208
209        // use the built-in fadeIn/fadeOut effect
210        effect: "fade",
211
212        // custom opacity setting
213        opacity: 0.7 });
214                                                        $('#hostname').select();
215                                                        e.stopImmediatePropagation();
216                                                }
217                                        });
218                                        $.getJSON("/adagios/api/gethostbyname/" + $('#hostname').val(), function(json) {
219                                                                $('#ipaddress').val(json.host);
220                                        });
221                                });
222
223                </script>
224{% endblock %}
Note: See TracBrowser for help on using the repository browser.