Commit 01983670 authored by Cédric's avatar Cédric

adding network view settings

parent ae92075b
......@@ -40,5 +40,10 @@ $wb["vm_confirm_reset"] = 'Réinitialiser de la machine virtuelle ?';
$wb["vm_confirm_kill"] = 'Stopper la machine virtuelle ?';
$wb["vm_confirm_shutdown"] = 'Arreter la machine virtuelle ?';
$wb["vm_select_timeframe_txt"] = 'Merci de choisir une période' ;
$wb["vm_interface_txt"] = 'Interface';
$wb["vm_bridge_txt"] = 'Mode';
$wb["vm_rate_txt"] = 'Limitation (Mb/s)';
$wb["vm_tag_txt"] = 'Vlan';
$wb["vm_link_txt"] = 'Désactivé';
?>
......@@ -40,5 +40,9 @@ $wb["vm_confirm_reset"] = 'Reset the virtual machine ?';
$wb["vm_confirm_kill"] = 'Kill the virtual machine ?';
$wb["vm_confirm_shutdown"] = 'Shutdown the virtual machine ?';
$wb["vm_select_timeframe_txt"] = 'Choose a timeframe please' ;
$wb["vm_interface_txt"] = 'Interface';
$wb["vm_bridge_txt"] = 'Mode';
$wb["vm_rate_txt"] = 'Rate (Mb/s)';
$wb["vm_tag_txt"] = 'Vlan';
$wb["vm_link_txt"] = 'Disable';
?>
......@@ -40,5 +40,10 @@ $wb["vm_confirm_reset"] = 'Réinitialiser de la machine virtuelle ?';
$wb["vm_confirm_kill"] = 'Stopper la machine virtuelle ?';
$wb["vm_confirm_shutdown"] = 'Arreter la machine virtuelle ?';
$wb["vm_select_timeframe_txt"] = 'Merci de choisir une période' ;
$wb["vm_interface_txt"] = 'Interface';
$wb["vm_bridge_txt"] = 'Mode';
$wb["vm_rate_txt"] = 'Limitation (Mb/s)';
$wb["vm_tag_txt"] = 'Vlan';
$wb["vm_link_txt"] = 'Désactivé';
?>
......@@ -31,7 +31,7 @@ class page_action extends tform_actions {
function onShowEnd() {
global $app, $conf;
$vm_info['vm_id'] = $app->functions->intval($this->dataRecord['vm_id']);
//$vm_info['vm_id'] = $app->functions->intval($this->dataRecord['vm_id']);
$pve2 = new PVE2_API($conf["pve_link"], $conf["pve_username"], $conf["pve_realm"], $conf["pve_password"]);
......@@ -46,7 +46,7 @@ class page_action extends tform_actions {
$key = array_search($vm_id, array_column( $vm_temp , 'vmid'));
$vm_pvesvr = $vm_temp[$key]['node'];
$app->tpl->setVar("vm_id", $vm_info['vm_id']);
$app->tpl->setVar("vm_id", $vm_id);
$app->tpl->setVar("vm_pvesvr", $vm_pvesvr);
......@@ -57,7 +57,34 @@ class page_action extends tform_actions {
break;
case 'networks':
//DO SOMETHING HERE
$vm_config = $pve2->get("/nodes/{$vm_pvesvr}/{$vm_containers}/{$vm_id}/config");
$keys = array_keys($vm_config);
$net_temp = preg_grep('/^net[0-9]+/',$keys);
echo '<pre>';
$arr_net = array();
foreach($net_temp as $net)
{
$settings_temp = explode(',', $vm_config[$net]);
$arr_net[$net]['interface'] = $net;
foreach($settings_temp as $settings )
{
list($k, $v) = explode('=', $settings);
$arr_net[$net]['checked'] = ($k == 'link_down' && $v == 1 ? 'checked' : '');
$arr_net[$net][$k] = $v;
}
}
$app->tpl->setloop('networks', $arr_net);
print_r($arr_net);
echo '</pre>';
break;
case 'informations':
......
......@@ -11,6 +11,33 @@
Here Network configuration
<table class="table">
<thead class="dark form-group-sm">
<tr>
<th><tmpl_var name="vm_interface_txt"></th>
<th><tmpl_var name="vm_bridge_txt"></th>
<th><tmpl_var name="vm_rate_txt"></th>
<th><tmpl_var name="vm_tag_txt"></th>
<th><tmpl_var name="vm_link_txt"></th>
</tr>
</thead>
<tbody>
<tmpl_loop name="networks">
<tr>
<td>{tmpl_var name="interface"}</td>
<td>{tmpl_var name="bridge"}</td>
<td>{tmpl_var name="rate"}</td>
<td>{tmpl_var name="tag"}</td>
<!-- <td>{tmpl_var name="link_down"}</td>-->
<td><input class="form-control" type="checkbox" id="link_down" value="{tmpl_var name='link_down'}" name="link_down" {tmpl_var name='checked'}/></td>
</tr>
</tmpl_loop>
</tbody>
</table>
</div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment