OSDN Git Service

2e23b6a3a6aff0ebfadf0a33733b4d0eccf339df
[karesansui/karesansui.git] / karesansui / templates / default / hostby1networkstorage / hostby1networkstorage.part
1 <%doc>Copyright (C) 2010 HDE, Inc.</%doc>
2 <%inherit file="../include/common.part" />
3
4 <script type="text/javascript">
5 <!--
6 function get_activity(id) {
7     activity = false;
8     $(id).children().each(function() {
9         if ($(this).html() == "${_('Connecting')}") {
10             activity = true;
11         }
12     });
13     return activity;
14 };
15
16 $(document).ready(function(){
17     $("#network_storage_list").tablesorter({
18         widgets: ['zebra', 'select']
19     });
20
21     $("#add_network_storage").click(function() {
22         grayout_view("GET",
23             "${ctx.homepath}${ctx.path}?mode=input",
24             "${_('Network_Storage Settings')}",
25             "${ctx.homepath}${ctx.path}");
26     });
27
28     // display detail in detail window
29     $("tr[id*='network_storage_row']").click(function(){
30         var id;
31         var uri;
32
33         id = $(this).attr("id").replace("network_storage_row", "");
34         uri = "${ctx.homepath}${ctx.path}".replace(".part", "");
35         var url = uri + "/" + "default" + '.part?iqn=' + id;
36         ajax_get(
37             "#detail_value",
38             url,
39             null,
40             true
41         );
42     });
43
44         $("tr[id*='network_storage_row']").each(function() {
45             $(this).click(function() {
46                 // edit
47             $("#edit_network_storage").unbind("click");
48                 $("#edit_network_storage").click(function() {
49                     var uri = "${ctx.homepath}${ctx.path}".replace(".part", "");
50                     var target_id = selected_row('network_storage_row');
51
52                     if (target_id == undefined) {
53                         alert_on(".alert", "ERROR", "${_('Please select a target.')}");
54                         tool_reset("#edit_network_storage");
55                     } else {
56                         var url = uri + "/" + "default" + ".part?mode=input&iqn=" + target_id;
57
58                         grayout_view("GET",
59                             url,
60                             "${_('Network_Storage Settings')}",
61                             "${ctx.homepath}${ctx.path}");
62                     }
63                 });
64                 tool_reset("#edit_network_storage");
65
66             // delete
67             if (get_activity(this) == false) {
68                 $("#delete_network_storage").unbind("click");
69                 $("#delete_network_storage").click(function() {
70                     var uri = "${ctx.homepath}${ctx.path}".replace(".part", "");
71                     var target_id = selected_row("network_storage_row");
72
73                     if (target_id == undefined){
74                         alert_on(".alert", "ERROR", "${_('Please select a target.')}");
75                         tool_reset("#delete_network_storage");
76                     } else {
77                         var url = uri + "/" + "default" + ".part?iqn=" + target_id;
78                         var param = null;
79                         delete_dialog("#network_storage_dialog", url, param, "${ctx.homepath}${ctx.path}", "#delete_network_storage");
80                     }
81                 });
82                 tool_reset("#delete_network_storage");
83             } else {
84                 tool_invalid("#delete_network_storage");
85             }
86             // start
87             if (get_activity(this) == false) {
88                 $("#start_network_storage").unbind("click");
89                 $("#start_network_storage").click(function() {
90                     var uri = "${ctx.homepath}${ctx.path}".replace(".part", "");
91                     var target_id = selected_row("network_storage_row");
92
93                     if (target_id == undefined){
94                         alert_on(".alert", "ERROR", "${_('Please select a target.')}");
95                         tool_reset("#start_network_storage");
96                     } else {
97                         var url = uri + "/" + "default" + "/" + "status.part?iqn=" + target_id;
98
99                         ajax_put(url,
100                             {"status" : NETWORK_STORAGE_START},
101                             function(data, status){},
102                             false,
103                             "${ctx.homepath}${ctx.path}"
104                         );
105                     }
106                 });
107                 tool_reset("#start_network_storage");
108             } else {
109                 tool_invalid("#start_network_storage");
110             }
111             // stop
112             if (get_activity(this) == true) {
113                 $("#stop_network_storage").unbind("click");
114                 $("#stop_network_storage").click(function() {
115                     var uri = "${ctx.homepath}${ctx.path}".replace(".part", "");
116                     var target_id = selected_row("network_storage_row");
117
118                     if (target_id == undefined){
119                         alert_on(".alert", "ERROR", "${_('Please select a target.')}");
120                         tool_reset("#stop_network_storage");
121                     } else {
122                         var url = uri + "/" + "default" + "/" + "status.part?iqn=" + target_id;
123
124                         ajax_put(url,
125                             {"status" : NETWORK_STORAGE_STOP},
126                             function(data, status){},
127                             false,
128                             "${ctx.homepath}${ctx.path}"
129                         );
130                     }
131                 });
132                 tool_reset("#stop_network_storage");
133             } else {
134                 tool_invalid("#stop_network_storage");
135             }
136         });
137     });
138
139         // init
140         $("#action>a").hover(
141             function(){tool_over(this);},
142             function(){tool_over(this);}
143         ).mousedown(function(){
144             var id = $(this).attr("id");
145             tool_active(this);
146         });
147
148         tool_invalid("#edit_network_storage");
149         tool_invalid("#delete_network_storage");
150     tool_invalid("#start_network_storage");
151     tool_invalid("#stop_network_storage");
152     renew_main_event("#tool_renew", "${ctx.homepath}${ctx.path}");
153     show_detail_event();
154 });
155 -->
156 </script>
157
158                     <div id="network_storage">
159                         <div id="network_storage_dialog"></div>
160                         <div id="action" >
161                             <div class="left"></div>
162                             <a href="#" name="add_network_storage" id="add_network_storage" class="tool-link">
163                                 <div class="tool-mid">
164                                     <div class="tool-left"></div>
165                                     <div class="tool-img">
166                                         <img src="${ctx.homepath}/static/images/tool-add.png" alt="" />
167                                     </div>
168                                     <div class="tool-right">
169                                         <div class="tool-text" >${_('Add')}</div>
170                                     </div>
171                                 </div>
172                             </a>
173                             <a href="#" name="edit_network_storage" id="edit_network_storage" class="tool-link">
174                                 <div class="tool-mid">
175                                     <div class="tool-left"></div>
176                                     <div class="tool-img">
177                                         <img src="${ctx.homepath}/static/images/tool-edit.png" alt="" />
178                                     </div>
179                                     <div class="tool-right">
180                                         <div class="tool-text" >${_('Edit')}</div>
181                                     </div>
182                                 </div>
183                             </a>
184                             <a href="#" name="delete_network_storage" id="delete_network_storage" class="tool-link">
185                                 <div class="tool-mid">
186                                     <div class="tool-left"></div>
187                                     <div class="tool-img">
188                                         <img src="${ctx.homepath}/static/images/tool-trash.png" alt="" />
189                                     </div>
190                                     <div class="tool-right">
191                                         <div class="tool-text" >${_('Delete')}</div>
192                                     </div>
193                                 </div>
194                             </a>
195                             <a href="#" name="start_network_storage" id="start_network_storage" class="tool-link">
196                                 <div class="tool-mid">
197                                     <div class="tool-left"></div>
198                                     <div class="tool-img">
199                                         <img src="${ctx.homepath}/static/images/tool-start.png" alt="" />
200                                     </div>
201                                     <div class="tool-right">
202                                         <div class="tool-text" >${_('Start')}</div>
203                                     </div>
204                                 </div>
205                             </a>
206                             <a href="#" name="stop_network_storage" id="stop_network_storage" class="tool-link">
207                                 <div class="tool-mid">
208                                     <div class="tool-left"></div>
209                                     <div class="tool-img">
210                                         <img src="${ctx.homepath}/static/images/tool-stop.png" alt="" />
211                                     </div>
212                                     <div class="tool-right">
213                                         <div class="tool-text" >${_('Stop')}</div>
214                                     </div>
215                                 </div>
216                             </a>
217                             <div class="right">
218                                 <a href="#" class="tool-link" >
219                                     <div class="tool-mid">
220                                         <img src="${ctx.homepath}/static/images/reload.gif" alt="renew" id="tool_renew"/>
221                                     </div>
222                                 </a>
223                             </div>
224                         </div>
225                         <br style="clear: both;"/>
226
227                         <div class="space"></div>
228                         <div class="alert"></div>
229
230                         <div id="view">
231                             <div id="list-box">
232                                 <div id="minner">
233                                     <table id="network_storage_list" class="tablesorter">
234                                         <thead>
235                                             <tr>
236                                               <!--
237                                                   TRANSLATORS:
238                                                   上から順に
239                                                   ・ネットワークストレージの種類
240                                                     現在はiSCSIのみ。他にはNFSなどを想定している。
241                                                   ・接続先のホスト名(iSCSIの場合は勝手にIPアドレスになる)
242                                                   ・iSCSIターゲットのIQN
243                                                     iSCSIターゲットを一意に識別するためのユニークキー
244                                                     一つのホストで複数のIQNを持っている場合があります
245                                                   ・現在の状態
246                                                   ・自動起動のONOFF
247                                                 -->
248                                                 <th>${_('Network Storage Type')}</th>
249                                                 <th>${_('Target host name')}</th>
250                                                 <th>${_('Target IQN')}</th>
251                                                 <th>${_('Status')}</th>
252                                                 <th>${_('Autostart')}
253                                             </tr>
254                                         </thead>
255                                         <tbody>
256
257 % for network_storage in network_storages:
258                                             <tr id="network_storage_row${network_storage['iqn']}">
259                                                 <td>${network_storage['type'] |h}</td>
260                                                 <td>${network_storage['hostname']|h}</td>
261                                                 <td>${network_storage['iqn']|h}</td>
262     % if network_storage['activity'] == 1:
263                                                 <td>${_('Connecting')}</td>
264     % else:
265                                                 <td>${_('Disconnect')}</td>
266     % endif
267     % if network_storage['autostart'] == 1:
268                                                 <td>${_('ON')}</td>
269     % else:
270                                                 <td>${_('OFF')}</td>
271     % endif
272                                             </tr>
273 % endfor
274                                         </tbody>
275                                     </table>
276                                     <br style="clear: both;"/>
277                                 </div>
278                             </div>
279                         </div>
280
281                         <br style="clear: both;"/>
282                         <div class="space"></div>
283                         <div id="detail">
284                             <div class="panel">
285                                 <div class="wrap">
286                                     <span class="title"> &nbsp;</span>
287                                     <p class="point"> </p>
288                                     <p>
289
290 <img src="${ctx.homepath}/static/images/tree-open.gif" alt="" id="show_detail_switch" class="tree-toggle-button"/><span class="msg-title">${_('Details')}</span><br />
291 <span id="detail_value">--</span>
292                                         </p>
293                                         <dl><dt>&nbsp;</dt></dl>
294                                     </div>
295                                 </div>
296                             </div>
297                         </div>
298                         <br style="clear: both;"/>
299                     </div>