mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-10-29 17:12:20 +00:00
fix SQLite3 DQS, improve VM create wizard
This commit is contained in:
@@ -408,7 +408,7 @@ class ClonOS {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
function getProjectsListOnStart(){
|
function getProjectsListOnStart(){
|
||||||
$query='SELECT * FROM projects';
|
$query="SELECT * FROM projects";
|
||||||
$res=$this->_db->select($query, array());
|
$res=$this->_db->select($query, array());
|
||||||
echo ' var projects=',json_encode($res),PHP_EOL;
|
echo ' var projects=',json_encode($res),PHP_EOL;
|
||||||
}
|
}
|
||||||
@@ -1248,14 +1248,14 @@ class ClonOS {
|
|||||||
$db=new Db('base','storage_media');
|
$db=new Db('base','storage_media');
|
||||||
if(!$db->isConnected()) return(false); // TODO: Fix return
|
if(!$db->isConnected()) return(false); // TODO: Fix return
|
||||||
|
|
||||||
$res=$db->selectOne('SELECT * FROM media WHERE jname=? AND type=\'iso\'', array([$jname]));
|
$res=$db->selectOne("SELECT * FROM media WHERE jname=? AND type='iso'", array([$jname]));
|
||||||
if($res!==false && !empty($res)){
|
if($res!==false && !empty($res)){
|
||||||
CBSD::run(
|
CBSD::run(
|
||||||
'cbsd media mode=unregister name="%s" path="%s" jname=%s type=%s',
|
'cbsd media mode=unregister name="%s" path="%s" jname=%s type=%s',
|
||||||
array($res['name'], $res['path'], $jname, $res['type'])
|
array($res['name'], $res['path'], $jname, $res['type'])
|
||||||
);
|
);
|
||||||
$res=$db->selectOne(
|
$res=$db->selectOne(
|
||||||
'SELECT * FROM media WHERE idx=?',
|
"SELECT * FROM media WHERE idx=?",
|
||||||
array([(int)$form['vm_iso_image']])
|
array([(int)$form['vm_iso_image']])
|
||||||
);
|
);
|
||||||
if($res!==false && !empty($res) && $form['vm_iso_image']!=-2){
|
if($res!==false && !empty($res) && $form['vm_iso_image']!=-2){
|
||||||
@@ -1318,7 +1318,7 @@ class ClonOS {
|
|||||||
if($iso_id>0){
|
if($iso_id>0){
|
||||||
$db=new Db('base','storage_media');
|
$db=new Db('base','storage_media');
|
||||||
if(!$db->isConnected()) return(false); // TODO: return error
|
if(!$db->isConnected()) return(false); // TODO: return error
|
||||||
$res=$db->selectOne('SELECT name,path FROM media WHERE idx= ?', array([$iso_id])); // OK, $iso_id is casted as int above.
|
$res=$db->selectOne("SELECT name,path FROM media WHERE idx= ?", array([$iso_id])); // OK, $iso_id is casted as int above.
|
||||||
if($res===false || empty($res)) $iso=false;
|
if($res===false || empty($res)) $iso=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1421,8 +1421,8 @@ class ClonOS {
|
|||||||
$db=new Db('base','authkey');
|
$db=new Db('base','authkey');
|
||||||
if(!$db->isConnected()) return array('error'=>true,'errorMessage'=>'Database error!');
|
if(!$db->isConnected()) return array('error'=>true,'errorMessage'=>'Database error!');
|
||||||
if($nres['name']!==false) $key_name=$nres['name'];
|
if($nres['name']!==false) $key_name=$nres['name'];
|
||||||
Utils::clonos_syslog("clonos.php:". 'SELECT authkey FROM authkey WHERE idx=?'. array([$key_id, PDO::PARAM_INT]));
|
Utils::clonos_syslog("clonos.php:". "SELECT authkey FROM authkey WHERE idx=?". array([$key_id, PDO::PARAM_INT]));
|
||||||
$nres=$db->selectOne('SELECT authkey FROM authkey WHERE idx=?', array([$key_id, PDO::PARAM_INT]));
|
$nres=$db->selectOne("SELECT authkey FROM authkey WHERE idx=?", array([$key_id, PDO::PARAM_INT]));
|
||||||
//var_dump($nres);exit;
|
//var_dump($nres);exit;
|
||||||
|
|
||||||
// [22-Jul-2022 13:15:19 UTC] PHP Warning: Trying to access array offset on value of type bool in /usr/local/www/clonos/php/clonos.php on line 1416
|
// [22-Jul-2022 13:15:19 UTC] PHP Warning: Trying to access array offset on value of type bool in /usr/local/www/clonos/php/clonos.php on line 1416
|
||||||
@@ -1611,7 +1611,7 @@ class ClonOS {
|
|||||||
if(!$db->isConnected()) return array('error'=>true,'res'=>'Database error');
|
if(!$db->isConnected()) return array('error'=>true,'res'=>'Database error');
|
||||||
|
|
||||||
//$res=$db->update('DELETE FROM media WHERE idx=?', array([$this->form['media_id']]));
|
//$res=$db->update('DELETE FROM media WHERE idx=?', array([$this->form['media_id']]));
|
||||||
$res=$db->selectOne('SELECT * FROM media WHERE idx=?', array([(int)$this->form['media_id'], PDO::PARAM_INT]));
|
$res=$db->selectOne("SELECT * FROM media WHERE idx=?", array([(int)$this->form['media_id'], PDO::PARAM_INT]));
|
||||||
if($res===false || empty($res)) return array('error'=>true,'res'=>print_r($res,true));
|
if($res===false || empty($res)) return array('error'=>true,'res'=>print_r($res,true));
|
||||||
|
|
||||||
//if($res['jname']=='-') // если медиа отвязана, то про<D180>
|
//if($res['jname']=='-') // если медиа отвязана, то про<D180>
|
||||||
@@ -2315,7 +2315,7 @@ class ClonOS {
|
|||||||
function media_iso_list_html(){
|
function media_iso_list_html(){
|
||||||
// $form=$this->form;
|
// $form=$this->form;
|
||||||
$db=new Db('base','storage_media');
|
$db=new Db('base','storage_media');
|
||||||
$res=$db->select('select * from media where type=\'iso\'', array());
|
$res=$db->select("select * from media where type='iso'", array());
|
||||||
|
|
||||||
//var_dump($res);exit;
|
//var_dump($res);exit;
|
||||||
if($res===false || empty($res)) return;
|
if($res===false || empty($res)) return;
|
||||||
@@ -2330,8 +2330,10 @@ class ClonOS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ccmd_updateBhyveISO($iso=''){
|
function ccmd_updateBhyveISO($iso=''){
|
||||||
|
//echo $this->config->os_types_getOne('first');exit;
|
||||||
$db=new Db('base','storage_media');
|
$db=new Db('base','storage_media');
|
||||||
$res=$db->select('SELECT * FROM media WHERE type=\'iso\'', array());
|
$res=$db->select("SELECT * FROM media WHERE type='iso'", array());
|
||||||
|
|
||||||
if($res===false || empty($res)) return array(); //array('error'=>true,'error_message'=>'Profile ISO is not find!');
|
if($res===false || empty($res)) return array(); //array('error'=>true,'error_message'=>'Profile ISO is not find!');
|
||||||
|
|
||||||
$sel='';
|
$sel='';
|
||||||
@@ -2350,8 +2352,52 @@ class ClonOS {
|
|||||||
$html=str_replace('#sel1#','',$html);
|
$html=str_replace('#sel1#','',$html);
|
||||||
$html=str_replace('#sel#',' selected="selected"',$html);
|
$html=str_replace('#sel#',' selected="selected"',$html);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$form_items=$this->getBhyve_formItems();
|
||||||
|
|
||||||
return $html;
|
return array('iso_list'=>$html,'form_items'=>$form_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBhyve_formItems($os_name='')
|
||||||
|
{
|
||||||
|
if($os_name!='')
|
||||||
|
{
|
||||||
|
$res=array();
|
||||||
|
}else{
|
||||||
|
$arr=$this->config->os_types_getOne('first');
|
||||||
|
//return $res;exit;
|
||||||
|
$jname='undefined';
|
||||||
|
$jres=$this->ccmd_getFreeJname(false,$arr['default_jname']);
|
||||||
|
if(!$jres['error'])
|
||||||
|
{
|
||||||
|
$jname=$jres['freejname'];
|
||||||
|
}
|
||||||
|
//print_r($jres);exit;
|
||||||
|
//$res['jname']=$jname;
|
||||||
|
//var_dump($res);exit;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$res=array(
|
||||||
|
'jname'=>$jname, //$arr['jname'],
|
||||||
|
'imgsize'=>array(
|
||||||
|
'min'=>intval($arr['imgsize_min']),
|
||||||
|
'max'=>intval($arr['imgsize_max']),
|
||||||
|
'cur'=>intval($arr['imgsize'])
|
||||||
|
),
|
||||||
|
'vm_cpus'=>array(
|
||||||
|
'min'=>intval($arr['vm_cpus_min']),
|
||||||
|
'max'=>intval($arr['vm_cpus_max']),
|
||||||
|
'cur'=>intval($arr['vm_cpus'])
|
||||||
|
),
|
||||||
|
'vm_ram'=>array(
|
||||||
|
'min'=>intval($arr['vm_ram_min']),
|
||||||
|
'max'=>intval($arr['vm_ram_max']),
|
||||||
|
'cur'=>intval($arr['vm_ram'])
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_interfaces_html(){
|
function get_interfaces_html(){
|
||||||
|
|||||||
@@ -231,13 +231,14 @@ class Config
|
|||||||
// vm profile (ISO)
|
// vm profile (ISO)
|
||||||
if ($vm_profile_list_file_size > 0 ) {
|
if ($vm_profile_list_file_size > 0 ) {
|
||||||
Utils::clonos_syslog("config.php: (cached) found vm_profile cache file/size: $vm_profile_list_file exist/$vm_profile_list_file_size");
|
Utils::clonos_syslog("config.php: (cached) found vm_profile cache file/size: $vm_profile_list_file exist/$vm_profile_list_file_size");
|
||||||
$res['message']=file_get_contents($vm_profile_list_file);
|
$res['message']=file_get_contents($vm_profile_list_file);
|
||||||
|
//echo $res['message'];exit;
|
||||||
$this->os_types=$this->create_bhyve_profiles($res);
|
$this->os_types=$this->create_bhyve_profiles($res);
|
||||||
} else {
|
} else {
|
||||||
Utils::clonos_syslog("config.php: vm_profile cache file not found: $vm_profile_list_file");
|
Utils::clonos_syslog("config.php: vm_profile cache file not found: $vm_profile_list_file");
|
||||||
$res=CBSD::run('get_bhyve_profiles src=vm clonos=1', array());
|
$res=CBSD::run('get_bhyve_profiles src=vm clonos=1', array());
|
||||||
if($res['retval']==0){
|
if($res['retval']==0){
|
||||||
$this->os_types=$this->create_bhyve_profiles($res);
|
$this->os_types=$this->create_bhyve_profiles($res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,6 +293,7 @@ class Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
function os_types_create($obtain='new'){
|
function os_types_create($obtain='new'){
|
||||||
|
//print_r($this->os_types);exit;
|
||||||
$obtain=($obtain=='obtain');
|
$obtain=($obtain=='obtain');
|
||||||
if($obtain)
|
if($obtain)
|
||||||
$info=$this->os_types_obtain;
|
$info=$this->os_types_obtain;
|
||||||
@@ -318,6 +320,19 @@ class Config
|
|||||||
}
|
}
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
function os_types_getOne($name='first')
|
||||||
|
{
|
||||||
|
$res=array();
|
||||||
|
$info=$this->os_types;
|
||||||
|
if($name='first')
|
||||||
|
{
|
||||||
|
$res=current($info)['items'][0];
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
function authkeys_list(){
|
function authkeys_list(){
|
||||||
$db=new Db('base','authkey');
|
$db=new Db('base','authkey');
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ dialog .panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.window-box {
|
.window-box {
|
||||||
border:1px solid #6f7579;
|
/*border:1px solid #6f7579;*/
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
.window-box .close-but {
|
.window-box .close-but {
|
||||||
@@ -249,7 +249,7 @@ td.error {
|
|||||||
|
|
||||||
#config-menu ul
|
#config-menu ul
|
||||||
{
|
{
|
||||||
border:1px solid gray;
|
/*border:1px solid gray;*/
|
||||||
background-color:black;
|
background-color:black;
|
||||||
}
|
}
|
||||||
#config-menu li:hover {
|
#config-menu li:hover {
|
||||||
@@ -258,7 +258,7 @@ td.error {
|
|||||||
background:#073642;
|
background:#073642;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
#config-menu .menu-cog {
|
#config-menu .menu-cog {
|
||||||
color:#337ab7;
|
color:#337ab7;
|
||||||
/*border:1px solid gray;*/
|
/*border:1px solid gray;*/
|
||||||
background-color:black;
|
background-color:black;
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ dialog .panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.window-box {
|
.window-box {
|
||||||
border:1px solid #337ab7;
|
/*border:1px solid #337ab7;*/
|
||||||
}
|
}
|
||||||
.window-box .close-but {
|
.window-box .close-but {
|
||||||
background-color:#f3f3f3;
|
background-color:#f3f3f3;
|
||||||
@@ -198,10 +198,17 @@ form.win input[type="password"]:valid {
|
|||||||
|
|
||||||
form.win input[type="email"]:invalid,
|
form.win input[type="email"]:invalid,
|
||||||
form.win input[type="password"]:invalid {
|
form.win input[type="password"]:invalid {
|
||||||
background-color:#fef7f7;
|
background-color:#ffd5d5;
|
||||||
border:1px solid #d7a0a0;
|
border:1px solid #d7a0a0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form.win input:invalid:focus {
|
||||||
|
outline-color:red;
|
||||||
|
}
|
||||||
|
form.win input:valid:focus {
|
||||||
|
outline-color:green;
|
||||||
|
}
|
||||||
|
|
||||||
input[type=checkbox]:checked + label,
|
input[type=checkbox]:checked + label,
|
||||||
input[type=radio]:checked + label {
|
input[type=radio]:checked + label {
|
||||||
color:#337ab7;
|
color:#337ab7;
|
||||||
@@ -244,7 +251,7 @@ td.error {
|
|||||||
|
|
||||||
#config-menu ul
|
#config-menu ul
|
||||||
{
|
{
|
||||||
border:1px solid gray;
|
/*border:1px solid gray;*/
|
||||||
background-color:white;
|
background-color:white;
|
||||||
}
|
}
|
||||||
#config-menu li:hover {
|
#config-menu li:hover {
|
||||||
@@ -252,7 +259,8 @@ td.error {
|
|||||||
}
|
}
|
||||||
#config-menu .menu-cog {
|
#config-menu .menu-cog {
|
||||||
color:#337ab7;
|
color:#337ab7;
|
||||||
border:1px solid gray;
|
/*border:1px solid gray;*/
|
||||||
|
border-bottom-width: 0px;
|
||||||
background-color:white;
|
background-color:white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ err_messages.add({
|
|||||||
'vm_size':'You need type «g» char after numbers',
|
'vm_size':'You need type «g» char after numbers',
|
||||||
'vm_ram':'You need type «g» char after numbers',
|
'vm_ram':'You need type «g» char after numbers',
|
||||||
});
|
});
|
||||||
|
<?php
|
||||||
|
//print_r($this->config->os_types);exit;
|
||||||
|
?>
|
||||||
</script>
|
</script>
|
||||||
<dialog id="bhyve-new" class="window-box">
|
<dialog id="bhyve-new" class="window-box">
|
||||||
<h1>
|
<h1>
|
||||||
@@ -15,8 +18,8 @@ err_messages.add({
|
|||||||
<div class="window-content">
|
<div class="window-content">
|
||||||
<p class="new">
|
<p class="new">
|
||||||
<span class="field-name"><?php echo $this->translate('VM OS profile');?>:</span>
|
<span class="field-name"><?php echo $this->translate('VM OS profile');?>:</span>
|
||||||
<select name="vm_os_profile">
|
<select name="vm_os_profile" onchange="clonos.onChangeOsProfile(this,event);">
|
||||||
<?php echo $this->config->os_types_create(); ?>
|
<?php echo $this->config->os_types_create(); ?>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
@@ -26,7 +29,7 @@ err_messages.add({
|
|||||||
<p class="new">
|
<p class="new">
|
||||||
<span class="field-name"><?php echo $this->translate('VM template (cpu, ram, hdd)');?>:</span>
|
<span class="field-name"><?php echo $this->translate('VM template (cpu, ram, hdd)');?>:</span>
|
||||||
<select name="vm_packages" onchange="clonos.onChangePkgTemplate(this,event);">
|
<select name="vm_packages" onchange="clonos.onChangePkgTemplate(this,event);">
|
||||||
<?php $vm_res=$this->config->vm_packages_list(); echo $vm_res['html']; ?>
|
<?php $vm_res=$this->config->vm_packages_list(); echo $vm_res['html']; ?>
|
||||||
</select>
|
</select>
|
||||||
<script type="text/javascript">clonos.vm_packages_new_min_id=<?php echo $vm_res['min_id']; ?>;</script>
|
<script type="text/javascript">clonos.vm_packages_new_min_id=<?php echo $vm_res['min_id']; ?>;</script>
|
||||||
</p>
|
</p>
|
||||||
@@ -40,18 +43,28 @@ err_messages.add({
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="field-name"><?php echo $this->translate('VM RAM');?>:</span>
|
<span class="field-name"><?php echo $this->translate('VM RAM');?>:</span>
|
||||||
<input type="text" name="vm_ram" value="" pattern="^[0-9]+\s*(g|gb|mb|m|t|tb)$" placeholder="1g" required="required" />
|
<!-- <input type="text" name="vm_ram" value="" pattern="^[0-9]+\s*(g|gb|mb|m|t|tb)$" placeholder="1g" required="required" /> -->
|
||||||
|
<span class="range">
|
||||||
|
<input type="range" name="vm_ram" class="vHorizon" min="1" max="64" value="1" style="margin:6px 0;" id="rngRam" oninput="rngRamShow.value=rngRam.value+'g'" />
|
||||||
|
<input type="text" disabled="disabled" id="rngRamShow" value="1" name="vm_ram_show" />
|
||||||
|
<!-- input type="text" name="vm_cpus" value="" pattern="[0-9]+" placeholder="1" required="required" / -->
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="new">
|
<p class="new">
|
||||||
<span class="field-name"><?php echo $this->translate('VM Image size');?>:</span>
|
<span class="field-name"><?php echo $this->translate('VM Image size');?>:</span>
|
||||||
<input type="text" name="vm_size" value="" pattern="^[0-9]+(g|gb|t|tb)$" placeholder="10g" required="required" class="edit-disable" />
|
<!-- <input type="text" name="vm_size" value="" pattern="^[0-9]+(g|gb|t|tb)$" placeholder="10g" required="required" class="edit-disable" /> -->
|
||||||
|
<span class="range">
|
||||||
|
<input type="range" name="vm_imgsize" class="vHorizon" min="20" max="866" value="20" style="margin:6px 0;" id="rngImgsize" oninput="rngImgsizeShow.value=rngImgsize.value+'g'" />
|
||||||
|
<input type="text" disabled="disabled" id="rngImgsizeShow" value="1" name="vm_imgsize_show" />
|
||||||
|
<!-- input type="text" name="vm_cpus" value="" pattern="[0-9]+" placeholder="1" required="required" / -->
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="field-name"><?php echo $this->translate('Attached boot ISO image');?>:</span>
|
<span class="field-name"><?php echo $this->translate('Attached boot ISO image');?>:</span>
|
||||||
<select name="vm_iso_image">
|
<select name="vm_iso_image">
|
||||||
<option value="-2"></option>
|
<option value="-2"></option>
|
||||||
<option value="-1" selected>Profile default ISO</option>
|
<option value="-1" selected>Profile default ISO</option>
|
||||||
<?php echo $this->media_iso_list_html(); ?>
|
<?php echo $this->media_iso_list_html(); ?>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -877,6 +877,29 @@ var clonos={
|
|||||||
{
|
{
|
||||||
$('dialog #bhyveSettings select[name="vm_iso_image"]').html(data.iso_list);
|
$('dialog #bhyveSettings select[name="vm_iso_image"]').html(data.iso_list);
|
||||||
}
|
}
|
||||||
|
if(typeof data.form_items!='undefined')
|
||||||
|
{
|
||||||
|
var fi=data.form_items;
|
||||||
|
$('#bhyveSettings input[name="vm_name"]').val(fi.jname);
|
||||||
|
|
||||||
|
$('#bhyveSettings input[name="vm_cpus"]').prop({
|
||||||
|
'min':fi.vm_cpus.min,
|
||||||
|
'max':fi.vm_cpus.max
|
||||||
|
}).val(fi.vm_cpus.cur);
|
||||||
|
$('#bhyveSettings input[name="vm_cpus_show"]').val(fi.vm_cpus.cur);
|
||||||
|
|
||||||
|
$('#bhyveSettings input[name="vm_ram"]').prop({
|
||||||
|
'min':fi.vm_ram.min,
|
||||||
|
'max':fi.vm_ram.max
|
||||||
|
}).val(fi.vm_ram.cur);
|
||||||
|
$('#bhyveSettings input[name="vm_ram_show"]').val(fi.vm_ram.cur);
|
||||||
|
|
||||||
|
$('#bhyveSettings input[name="vm_imgsize"]').prop({
|
||||||
|
'min':fi.imgsize.min,
|
||||||
|
'max':fi.imgsize.max
|
||||||
|
}).val(fi.imgsize.cur);
|
||||||
|
$('#bhyveSettings input[name="vm_imgsize_show"]').val(fi.imgsize.cur);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getFreeJname:function()
|
getFreeJname:function()
|
||||||
{
|
{
|
||||||
@@ -2152,11 +2175,19 @@ var clonos={
|
|||||||
{
|
{
|
||||||
var par=$(obj).closest('form');
|
var par=$(obj).closest('form');
|
||||||
$('input[name="vm_cpus"]',par).val(res[1]);
|
$('input[name="vm_cpus"]',par).val(res[1]);
|
||||||
$('input[name="vm_cpus_show"]',par).val(res[1]);
|
$('input[name="vm_cpus_show"]',par).val(res[1]);
|
||||||
$('input[name="vm_ram"]',par).val(res[2]);
|
$('input[name="vm_ram"]',par).val(parseInt(res[2]));
|
||||||
$('input[name="vm_size"]',par).val(res[3]);
|
$('input[name="vm_ram_show"]',par).val(res[2]);
|
||||||
|
$('input[name="vm_imgsize"]',par).val(parseInt(res[3]));
|
||||||
|
$('input[name="vm_imgsize_show"]',par).val(res[3]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onChangeOsProfile:function(obj,event)
|
||||||
|
{
|
||||||
|
var a=event.target;
|
||||||
|
var i=a.selectedIndex;
|
||||||
|
debugger;
|
||||||
|
},
|
||||||
|
|
||||||
loginAction:function(event)
|
loginAction:function(event)
|
||||||
{
|
{
|
||||||
@@ -2301,9 +2332,10 @@ var clonos={
|
|||||||
var tpad=parseInt($(td).css('padding-top'),10);
|
var tpad=parseInt($(td).css('padding-top'),10);
|
||||||
if(menu.length>0)
|
if(menu.length>0)
|
||||||
{
|
{
|
||||||
|
/* # пересмотреть расчёт верхнего левого угла меню */
|
||||||
$(menu).css({
|
$(menu).css({
|
||||||
'left':coords.left+lpad/2-3,
|
'left':coords.left+lpad/2-3,
|
||||||
'top':coords.top+$('div#content').scrollTop()+tpad/2,
|
'top':coords.top+$('div#content').scrollTop()+tpad+$('.tsimple').position().top,
|
||||||
'display':'block',
|
'display':'block',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$db = new Db('base','authkey');
|
$db = new Db('base','authkey');
|
||||||
$res = $db->select('SELECT idx,name,authkey FROM authkey;', []);
|
$res = $db->select("SELECT idx,name,authkey FROM authkey;", []);
|
||||||
$html = '';
|
$html = '';
|
||||||
$html_tpl = '';
|
$html_tpl = '';
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$db = new Db('base','nodes');
|
$db = new Db('base','nodes');
|
||||||
$nodes = $db->select('select nodename,ip from nodelist order by nodename desc', []);
|
$nodes = $db->select("select nodename,ip from nodelist order by nodename desc", []);
|
||||||
$nodes[] = ['nodename' => 'local'];
|
$nodes[] = ['nodename' => 'local'];
|
||||||
$nodes = array_reverse($nodes);
|
$nodes = array_reverse($nodes);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
//if($hres!==false) $thead=$hres[1];
|
//if($hres!==false) $thead=$hres[1];
|
||||||
|
|
||||||
$db = new Db('base','nodes');
|
$db = new Db('base','nodes');
|
||||||
$res = $db->select('select nodename from nodelist', []);
|
$res = $db->select("select nodename from nodelist", []);
|
||||||
$nodes = ['local'];
|
$nodes = ['local'];
|
||||||
foreach($res as $val){
|
foreach($res as $val){
|
||||||
$nodes[] = $val['nodename'];
|
$nodes[] = $val['nodename'];
|
||||||
|
|||||||
36
public/pages/jailscontainers/index.php
Normal file
36
public/pages/jailscontainers/index.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
if(isset($clonos->uri_chunks[1])){
|
||||||
|
include('helpers.php');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$clonos->useDialogs([
|
||||||
|
'vnc',
|
||||||
|
'jail-settings',
|
||||||
|
'jail-settings-config-menu',
|
||||||
|
'jail-import',
|
||||||
|
'jail-clone',
|
||||||
|
'jail-rename',
|
||||||
|
]);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<h1>{translate:[Jail containers:]}</h1>
|
||||||
|
|
||||||
|
<p><span class="top-button icon-plus id:jail-settings">{translate:[Create jail]}</span>
|
||||||
|
<span class="top-button icon-upload id:jail-import">{translate:[Import]}</span></p>
|
||||||
|
|
||||||
|
<table class="tsimple" id="jailslist" width="100%">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="elastic">{translate:[Node name]}</th>
|
||||||
|
<th class="txtleft">{translate:[Jail]}</th>
|
||||||
|
<th class="wdt-120">{translate:[Usage]}</th>
|
||||||
|
<th class="txtleft">{translate:[IP address]}</th>
|
||||||
|
<th class="txtcenter wdt-120">{translate:[Status]}</th>
|
||||||
|
<th colspan="4" class="txtcenter wdt-100">{translate:[Action]}</th>
|
||||||
|
<th class="wdt-30">{translate:[VNC]}</th>
|
||||||
|
<th class="txtcenter wdt-50" title="VNC port">{translate:[Port]}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody></tbody>
|
||||||
|
</table>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
This files is cache of translated pages, do not translate it!
|
||||||
|
|
||||||
|
translate template:
|
||||||
|
{translate:[Last One]}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$db = new Db('base', 'storage_media');
|
$db = new Db('base', 'storage_media');
|
||||||
$res = $db->select('SELECT idx,name,path,jname FROM media where type=\'iso\'', []);
|
$res = $db->select("SELECT idx,name,path,jname FROM media where type='iso'", []);
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
if($res !== false){
|
if($res !== false){
|
||||||
@@ -34,4 +34,4 @@ if($res !== false){
|
|||||||
'func' => 'fillTable',
|
'func' => 'fillTable',
|
||||||
'id' => 'mediaslist'
|
'id' => 'mediaslist'
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ $res_array = [
|
|||||||
|
|
||||||
$nodenames = ['local'];
|
$nodenames = ['local'];
|
||||||
$db = new Db('base','nodes');
|
$db = new Db('base','nodes');
|
||||||
$nodes = $db->select('select nodename,ip from nodelist', []);
|
$nodes = $db->select("select nodename,ip from nodelist", []);
|
||||||
foreach($nodes as $node){
|
foreach($nodes as $node){
|
||||||
$idle = $this->check_locktime($node['ip']);
|
$idle = $this->check_locktime($node['ip']);
|
||||||
if($idle == 0){
|
if($idle == 0){
|
||||||
@@ -37,10 +37,10 @@ foreach($nodenames as $name){
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$jcounts = $ndb->selectOne('SELECT COUNT(*) as count FROM jails;', []);
|
$jcounts = $ndb->selectOne("SELECT COUNT(*) as count FROM jails;", []);
|
||||||
$res_array['num-jails'] += $jcounts['count'];
|
$res_array['num-jails'] += $jcounts['count'];
|
||||||
|
|
||||||
$counts = $ndb->select('SELECT ncpu,physmem,cpufreq FROM local;', []);
|
$counts = $ndb->select("SELECT ncpu,physmem,cpufreq FROM local;", []);
|
||||||
foreach($counts as $cel){
|
foreach($counts as $cel){
|
||||||
$res_array['num-cores'] += $cel['ncpu'];
|
$res_array['num-cores'] += $cel['ncpu'];
|
||||||
$res_array['sum-ram'] += $cel['physmem'];
|
$res_array['sum-ram'] += $cel['physmem'];
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$db = new Db('base','nodes');
|
$db = new Db('base','nodes');
|
||||||
$nodes = $db->select('select nodename,ip from nodelist order by nodename desc', []);
|
$nodes = $db->select("select nodename,ip from nodelist order by nodename desc", []);
|
||||||
$nodes[] = ['nodename'=>'local'];
|
$nodes[] = ['nodename'=>'local'];
|
||||||
$nodes = array_reverse($nodes);
|
$nodes = array_reverse($nodes);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$db = new Db('base','vpnet');
|
$db = new Db('base','vpnet');
|
||||||
$res = $db->select('SELECT idx,name,vpnet FROM vpnet', []);
|
$res = $db->select("SELECT idx,name,vpnet FROM vpnet", []);
|
||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
if(!$db->error){
|
if(!$db->error){
|
||||||
|
|||||||
Reference in New Issue
Block a user