mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-10-29 09:02:21 +00:00
fix link; improve bhyve vm create form
This commit is contained in:
@@ -17,7 +17,7 @@ ClonOS is a free open-source FreeBSD-based platform for virtual environments cre
|
|||||||
+ https://man.freebsd.org/vale/4 :: vale(4) as Virtual Ethernet Switch
|
+ https://man.freebsd.org/vale/4 :: vale(4) as Virtual Ethernet Switch
|
||||||
+ http://man.freebsd.org/jail/8 :: jail(8) as container engine
|
+ http://man.freebsd.org/jail/8 :: jail(8) as container engine
|
||||||
|
|
||||||
- https://www.bsdstore.ru/en/ :: CBSD Project as management tools
|
- https://github.com/cbsd/cbsd :: CBSD Project as management tools
|
||||||
|
|
||||||
- https://puppet.com/ :: Puppet as configuration management
|
- https://puppet.com/ :: Puppet as configuration management
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ class ClonOS {
|
|||||||
$this->config=new Config();
|
$this->config=new Config();
|
||||||
|
|
||||||
$this->_locale = new Localization($this->realpath_public);
|
$this->_locale = new Localization($this->realpath_public);
|
||||||
|
$this->_translate = new Translate($this->_locale,$this->realpath_page);
|
||||||
|
|
||||||
$this->_client_ip=$_SERVER['REMOTE_ADDR'];
|
$this->_client_ip=$_SERVER['REMOTE_ADDR'];
|
||||||
|
|
||||||
@@ -103,12 +104,23 @@ class ClonOS {
|
|||||||
$this->json_name=$this->realpath_page.'a.json.php';
|
$this->json_name=$this->realpath_page.'a.json.php';
|
||||||
//echo $this->realpath_page;
|
//echo $this->realpath_page;
|
||||||
}else if($_SERVER['REQUEST_URI']){
|
}else if($_SERVER['REQUEST_URI']){
|
||||||
|
|
||||||
|
if($this->uri_chunks[0]=='overview1')
|
||||||
|
{
|
||||||
|
$this->uri_chunks[0]='overview';
|
||||||
|
$this->realpath_page=$this->realpath_public.'pages/'.$this->uri_chunks[0].'/';
|
||||||
|
$this->_translate->translate($this->realpath_page,'index.php');
|
||||||
|
//break 1;
|
||||||
|
}
|
||||||
|
|
||||||
//$this->realpath_page=$this->realpath_public.'pages/'.trim($_SERVER['REQUEST_URI'],'/').'/';
|
//$this->realpath_page=$this->realpath_public.'pages/'.trim($_SERVER['REQUEST_URI'],'/').'/';
|
||||||
if(isset($this->uri_chunks[0])){
|
if(isset($this->uri_chunks[0])){
|
||||||
$this->realpath_page=$this->realpath_public.'pages/'.$this->uri_chunks[0].'/';
|
$this->realpath_page=$this->realpath_public.'pages/'.$this->uri_chunks[0].'/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(isset($this->_vars['hash'])) $this->url_hash=preg_replace('/^#/','',$this->_vars['hash']);
|
if(isset($this->_vars['hash'])) $this->url_hash=preg_replace('/^#/','',$this->_vars['hash']);
|
||||||
|
|
||||||
// $this->json_name=$this->realpath_php.'pages'
|
// $this->json_name=$this->realpath_php.'pages'
|
||||||
@@ -1614,7 +1626,7 @@ class ClonOS {
|
|||||||
$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']=='-') // если медиа отвязана, то про<EFBFBD>
|
//if($res['jname']=='-') // если медиа отвязана, то про
|
||||||
|
|
||||||
$res=CBSD::run(
|
$res=CBSD::run(
|
||||||
'media mode=remove name="%s" path="%s" jname="%s" type="%s"', //.$res['name']
|
'media mode=remove name="%s" path="%s" jname="%s" type="%s"', //.$res['name']
|
||||||
@@ -2353,30 +2365,32 @@ class ClonOS {
|
|||||||
$html=str_replace('#sel#',' selected="selected"',$html);
|
$html=str_replace('#sel#',' selected="selected"',$html);
|
||||||
}
|
}
|
||||||
|
|
||||||
$form_items=$this->getBhyve_formItems();
|
$form_items=$this->getBhyveFormItems();
|
||||||
|
|
||||||
return array('iso_list'=>$html,'form_items'=>$form_items);
|
return array('iso_list'=>$html,'form_items'=>$form_items);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBhyve_formItems($os_name='')
|
|
||||||
|
function ccmd_vmOsInfo() //getVMOSListInfo
|
||||||
{
|
{
|
||||||
|
return array('form_items'=>$this->getBhyveFormItems($this->form['vmOsProfile'],$this->form['obtain']));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBhyveFormItems($os_name='',$obtain='')
|
||||||
|
{
|
||||||
|
$jname='undefined';
|
||||||
if($os_name!='')
|
if($os_name!='')
|
||||||
{
|
{
|
||||||
$res=array();
|
$arr=$this->config->os_types_getOne($os_name,$obtain);
|
||||||
}else{
|
}else{
|
||||||
$arr=$this->config->os_types_getOne('first');
|
$arr=$this->config->os_types_getOne('first',$obtain);
|
||||||
//return $res;exit;
|
}
|
||||||
$jname='undefined';
|
|
||||||
$jres=$this->ccmd_getFreeJname(false,$arr['default_jname']);
|
$jres=$this->ccmd_getFreeJname(false,$arr['default_jname']);
|
||||||
if(!$jres['error'])
|
if(!$jres['error'])
|
||||||
{
|
{
|
||||||
$jname=$jres['freejname'];
|
$jname=$jres['freejname'];
|
||||||
}
|
}
|
||||||
//print_r($jres);exit;
|
|
||||||
//$res['jname']=$jname;
|
|
||||||
//var_dump($res);exit;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$res=array(
|
$res=array(
|
||||||
'jname'=>$jname, //$arr['jname'],
|
'jname'=>$jname, //$arr['jname'],
|
||||||
@@ -2395,11 +2409,22 @@ class ClonOS {
|
|||||||
'max'=>intval($arr['vm_ram_max']),
|
'max'=>intval($arr['vm_ram_max']),
|
||||||
'cur'=>intval($arr['vm_ram'])
|
'cur'=>intval($arr['vm_ram'])
|
||||||
),
|
),
|
||||||
|
'obtain'=>$obtain,
|
||||||
);
|
);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ccmd_getObtainFormItems($os_name='')
|
||||||
|
{
|
||||||
|
$res=array('form_items'=>$this->getBhyveFormItems($os_name,'obtain'));
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function get_interfaces_html(){
|
function get_interfaces_html(){
|
||||||
$if=$this->config->os_interfaces;
|
$if=$this->config->os_interfaces;
|
||||||
$html='';
|
$html='';
|
||||||
@@ -2501,7 +2526,7 @@ class ClonOS {
|
|||||||
if($db->isConnected()) {
|
if($db->isConnected()) {
|
||||||
$res=$db->selectOne("SELECT username FROM auth_user WHERE username=?", array([$user_info['username']]));
|
$res=$db->selectOne("SELECT username FROM auth_user WHERE username=?", array([$user_info['username']]));
|
||||||
if(!empty($res)){
|
if(!empty($res)){
|
||||||
$res['user_exsts']=true;
|
$res['user_exists']=true; // было user_exsts, похоже была опечатка
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -320,17 +320,32 @@ class Config
|
|||||||
}
|
}
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
function os_types_getOne($name='first')
|
function os_types_getOne($name='first',$obtain='')
|
||||||
{
|
{
|
||||||
$res=array();
|
$res=array();
|
||||||
|
if($obtain=='obtain')
|
||||||
|
{
|
||||||
|
$info=$this->os_types_obtain;
|
||||||
|
}else{
|
||||||
$info=$this->os_types;
|
$info=$this->os_types;
|
||||||
if($name='first')
|
}
|
||||||
|
|
||||||
|
if($name=='first')
|
||||||
{
|
{
|
||||||
$res=current($info)['items'][0];
|
$res=current($info)['items'][0];
|
||||||
}else{
|
}else{
|
||||||
|
foreach($info as $type)
|
||||||
|
{
|
||||||
|
foreach($type['items'] as $arr)
|
||||||
|
{
|
||||||
|
if($arr['name']==$name)
|
||||||
|
{
|
||||||
|
$res=$arr;
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,3 +23,140 @@ class Localization
|
|||||||
return (isset($this->translate_arr[$phrase])) ? $this->translate_arr[$phrase] : $phrase;
|
return (isset($this->translate_arr[$phrase])) ? $this->translate_arr[$phrase] : $phrase;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Translate
|
||||||
|
{
|
||||||
|
private $locale='';
|
||||||
|
private $language='';
|
||||||
|
private $realpath='';
|
||||||
|
|
||||||
|
function __construct($locale,$realpath)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->locale=$locale;
|
||||||
|
$this->language=$this->locale->get_lang();
|
||||||
|
$this->realpath=$realpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function translate($path,$file_name)
|
||||||
|
{
|
||||||
|
$file=$path.$file_name;
|
||||||
|
$db=new Db('clonos');
|
||||||
|
if(!$db->isConnected()) return array('error'=>true,'error_message'=>'db connection lost!');
|
||||||
|
//$status=(new Db('base','cbsdtaskd'))->selectOne("SELECT status,logfile,errcode
|
||||||
|
// FROM taskd WHERE id=?", array([$task_id]);
|
||||||
|
|
||||||
|
if(file_exists($file))
|
||||||
|
{
|
||||||
|
$is_changed=false;
|
||||||
|
$txt=file_get_contents($file);
|
||||||
|
preg_match_all('#<translate([^>]*)>(.*)</translate>#',$txt,$res,PREG_SET_ORDER);
|
||||||
|
// var_dump($res);exit;
|
||||||
|
|
||||||
|
foreach($res as $item)
|
||||||
|
{
|
||||||
|
$id=-1;
|
||||||
|
//$text='';
|
||||||
|
$update=false;
|
||||||
|
$params=[];
|
||||||
|
$tag=$item[0];
|
||||||
|
$attrs=$item[1];
|
||||||
|
$text=$item[2];
|
||||||
|
|
||||||
|
if($attrs!='')
|
||||||
|
{
|
||||||
|
//$txt=$item[2];
|
||||||
|
//echo '<pre>'.$txt;
|
||||||
|
preg_match_all('#((id)="?([\d]+)"?|update)#',$attrs,$params,PREG_SET_ORDER);
|
||||||
|
if(is_array($params) && $this->language!='en')
|
||||||
|
{
|
||||||
|
// если у пользователя язык интерфейса не английский, то переводим
|
||||||
|
foreach($params as $p)
|
||||||
|
{
|
||||||
|
if(isset($p[2]) && $p[2]=='id')
|
||||||
|
{
|
||||||
|
if(is_numeric($p[3]))
|
||||||
|
{
|
||||||
|
$id=$p[3];
|
||||||
|
$dbres=$db->selectOne("select text from lang_en where id=?",[[$id,PDO::PARAM_INT]]);
|
||||||
|
if(!empty($dbres))
|
||||||
|
{
|
||||||
|
var_dump($dbres);exit;
|
||||||
|
}else{
|
||||||
|
echo 'no data';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($p[0]=='update' && $id>0)
|
||||||
|
{
|
||||||
|
echo "\tupdate id: ",$id,"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//echo "\tupdate: ",var_dump($update),"\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
//print_r($params);
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
delete FROM "lang_en";
|
||||||
|
VACUUM;
|
||||||
|
UPDATE SQLITE_SEQUENCE SET seq = 0 WHERE name = 'lang_en'
|
||||||
|
*/
|
||||||
|
|
||||||
|
$dbres=$db->selectOne("select id from lang_en where text=?",[[$text, PDO::PARAM_STR]]); //,[[$text, PDO::PARAM_STR]]);
|
||||||
|
if(isset($dbres['error']) && $dbres['error'])
|
||||||
|
{
|
||||||
|
echo 'error db: ',$dbres['info'];
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if(is_numeric($dbres['id']))
|
||||||
|
{
|
||||||
|
// если фраза есть в базе, то вписываем её ID в тэг
|
||||||
|
$new_text='<translate id="'.$dbres['id'].'">'.$text."</translate>";
|
||||||
|
$txt=str_replace($tag,$new_text,$txt);
|
||||||
|
$is_changed=true;
|
||||||
|
}else{
|
||||||
|
if($dbres===false)
|
||||||
|
{
|
||||||
|
// если фразы нет в базе, то добавляем её туда и вписываем новый ID в тэг
|
||||||
|
$dbres=$db->insert("insert into lang_en (text) values (?)",[[$text, PDO::PARAM_STR]]);
|
||||||
|
|
||||||
|
if($dbres['error'])
|
||||||
|
return array('error'=>true,'error_message'=>$dbres['info']);
|
||||||
|
|
||||||
|
$new_text='<translate id="'.$dbres['lastID'].'">'.$text."</translate>";
|
||||||
|
$txt=str_replace($tag,$new_text,$txt);
|
||||||
|
$is_changed=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($is_changed)
|
||||||
|
{
|
||||||
|
rename($path.$file_name,$path.'orig.'.$file_name);
|
||||||
|
file_put_contents($path.$file_name,$txt);
|
||||||
|
}
|
||||||
|
echo $txt;
|
||||||
|
exit;
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
<translate([^>]*)>(.*)</translate>
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -920,6 +920,15 @@ dialog.fullscreen #vnc-iframe {
|
|||||||
.window-box .mrow.installed small {
|
.window-box .mrow.installed small {
|
||||||
color:silver;
|
color:silver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form.loading {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
form.loading input,
|
||||||
|
form.loading select {
|
||||||
|
color:#AAA;
|
||||||
|
background:#F5F5F5;
|
||||||
|
}
|
||||||
form.win .field-name {
|
form.win .field-name {
|
||||||
display:block;
|
display:block;
|
||||||
text-transform:uppercase;
|
text-transform:uppercase;
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ err_messages.add({
|
|||||||
<span class="range">
|
<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="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" 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>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p class="new">
|
<p class="new">
|
||||||
@@ -56,7 +55,6 @@ err_messages.add({
|
|||||||
<span class="range">
|
<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="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" 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>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<div class="window-content">
|
<div class="window-content">
|
||||||
<p>
|
<p>
|
||||||
<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('obtain'); ?>
|
<?php echo $this->config->os_types_create('obtain'); ?>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
@@ -29,11 +29,20 @@
|
|||||||
</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]+(g|gb|mb|m)$" placeholder="1g" required="required" />
|
<!-- <input type="text" name="vm_ram" value="" pattern="^[0-9]+(g|gb|mb|m)$" 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="rngRam1" oninput="rngRamShow1.value=rngRam1.value+'g'" />
|
||||||
|
<input type="text" disabled="disabled" id="rngRamShow1" value="1" name="vm_ram_show" />
|
||||||
|
</span>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<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|mb|m|t|tb)$" placeholder="10g" required="required" />
|
<!-- <input type="text" name="vm_size" value="" pattern="^[0-9]+(g|gb|mb|m|t|tb)$" placeholder="10g" required="required" /> -->
|
||||||
|
<span class="range">
|
||||||
|
<input type="range" name="vm_size" class="vHorizon" min="20" max="866" value="20" style="margin:6px 0;" id="rngImgsize1" oninput="rngImgsizeShow1.value=rngImgsize1.value+'g'" />
|
||||||
|
<input type="text" disabled="disabled" id="rngImgsizeShow1" value="1" name="vm_imgsize_show" />
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<span class="field-name"><?php echo $this->translate('IP address');?>:</span>
|
<span class="field-name"><?php echo $this->translate('IP address');?>:</span>
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ echo $menu->html;
|
|||||||
<header>
|
<header>
|
||||||
<div class="top-right">
|
<div class="top-right">
|
||||||
<span class="txt">
|
<span class="txt">
|
||||||
<a href="https://www.bsdstore.ru/ru/donate.html" target="_blank"><?php echo $locale->translate('DONATE'); ?></a>
|
<a href="https://www.patreon.com/clonos" target="_blank"><?php echo $locale->translate('DONATE'); ?></a>
|
||||||
<span class="space"></span>
|
<span class="space"></span>
|
||||||
<?php echo $locale->translate('VERSION'),': ',file_get_contents($clonos->realpath.'version'); ?>
|
<?php echo $locale->translate('VERSION'),': ',file_get_contents($clonos->realpath.'version'); ?>
|
||||||
<span class="space"></span>
|
<span class="space"></span>
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ var clonos={
|
|||||||
}
|
}
|
||||||
if(id=='bhyve-obtain')
|
if(id=='bhyve-obtain')
|
||||||
{
|
{
|
||||||
|
this.getObtainFormItems(); // Берём с сервера свободное имя виртуалки и min/max ram/cpus
|
||||||
if(typeof this.vm_packages_obtain_min_id!='undefined')
|
if(typeof this.vm_packages_obtain_min_id!='undefined')
|
||||||
$('#bhyveObtSettings select[name="vm_packages"]').val(this.vm_packages_obtain_min_id).change();
|
$('#bhyveObtSettings select[name="vm_packages"]').val(this.vm_packages_obtain_min_id).change();
|
||||||
}
|
}
|
||||||
@@ -869,6 +870,7 @@ var clonos={
|
|||||||
},
|
},
|
||||||
updateBhyveISO:function()
|
updateBhyveISO:function()
|
||||||
{
|
{
|
||||||
|
this.formDisable($('form#bhyveSettings'));
|
||||||
this.loadData('updateBhyveISO',$.proxy(this.onUpdateBhyveISO,this));
|
this.loadData('updateBhyveISO',$.proxy(this.onUpdateBhyveISO,this));
|
||||||
},
|
},
|
||||||
onUpdateBhyveISO:function(data)
|
onUpdateBhyveISO:function(data)
|
||||||
@@ -892,14 +894,15 @@ var clonos={
|
|||||||
'min':fi.vm_ram.min,
|
'min':fi.vm_ram.min,
|
||||||
'max':fi.vm_ram.max
|
'max':fi.vm_ram.max
|
||||||
}).val(fi.vm_ram.cur);
|
}).val(fi.vm_ram.cur);
|
||||||
$('#bhyveSettings input[name="vm_ram_show"]').val(fi.vm_ram.cur);
|
$('#bhyveSettings input[name="vm_ram_show"]').val(fi.vm_ram.cur+'g');
|
||||||
|
|
||||||
$('#bhyveSettings input[name="vm_imgsize"]').prop({
|
$('#bhyveSettings input[name="vm_imgsize"]').prop({
|
||||||
'min':fi.imgsize.min,
|
'min':fi.imgsize.min,
|
||||||
'max':fi.imgsize.max
|
'max':fi.imgsize.max
|
||||||
}).val(fi.imgsize.cur);
|
}).val(fi.imgsize.cur);
|
||||||
$('#bhyveSettings input[name="vm_imgsize_show"]').val(fi.imgsize.cur);
|
$('#bhyveSettings input[name="vm_imgsize_show"]').val(fi.imgsize.cur+'g');
|
||||||
}
|
}
|
||||||
|
this.formEnable($('form#bhyveSettings'));
|
||||||
},
|
},
|
||||||
getFreeJname:function()
|
getFreeJname:function()
|
||||||
{
|
{
|
||||||
@@ -991,6 +994,39 @@ var clonos={
|
|||||||
this.wssReload();
|
this.wssReload();
|
||||||
this.dataReload();
|
this.dataReload();
|
||||||
},
|
},
|
||||||
|
getObtainFormItems:function()
|
||||||
|
{
|
||||||
|
this.formDisable($('form#bhyveObtSettings'));
|
||||||
|
this.loadData('getObtainFormItems',$.proxy(this.onGetObtainFormItems,this));
|
||||||
|
},
|
||||||
|
onGetObtainFormItems:function(data)
|
||||||
|
{
|
||||||
|
//#bhyveObtSettings
|
||||||
|
if(typeof data.form_items!='undefined')
|
||||||
|
{
|
||||||
|
var fi=data.form_items;
|
||||||
|
$('#bhyveObtSettings input[name="vm_name"]').val(fi.jname);
|
||||||
|
|
||||||
|
$('#bhyveObtSettings input[name="vm_cpus"]').prop({
|
||||||
|
'min':fi.vm_cpus.min,
|
||||||
|
'max':fi.vm_cpus.max
|
||||||
|
}).val(fi.vm_cpus.cur);
|
||||||
|
$('#bhyveObtSettings input[name="vm_cpus_show"]').val(fi.vm_cpus.cur);
|
||||||
|
|
||||||
|
$('#bhyveObtSettings input[name="vm_ram"]').prop({
|
||||||
|
'min':fi.vm_ram.min,
|
||||||
|
'max':fi.vm_ram.max
|
||||||
|
}).val(fi.vm_ram.cur);
|
||||||
|
$('#bhyveObtSettings input[name="vm_ram_show"]').val(fi.vm_ram.cur+'g');
|
||||||
|
|
||||||
|
$('#bhyveObtSettings input[name="vm_size"]').prop({
|
||||||
|
'min':fi.imgsize.min,
|
||||||
|
'max':fi.imgsize.max
|
||||||
|
}).val(fi.imgsize.cur);
|
||||||
|
$('#bhyveObtSettings input[name="vm_imgsize_show"]').val(fi.imgsize.cur+'g');
|
||||||
|
}
|
||||||
|
this.formEnable($('form#bhyveObtSettings'));
|
||||||
|
},
|
||||||
|
|
||||||
loadData:function(mode,return_func,arr,spinner)
|
loadData:function(mode,return_func,arr,spinner)
|
||||||
{
|
{
|
||||||
@@ -2184,9 +2220,39 @@ var clonos={
|
|||||||
},
|
},
|
||||||
onChangeOsProfile:function(obj,event)
|
onChangeOsProfile:function(obj,event)
|
||||||
{
|
{
|
||||||
var a=event.target;
|
var frm=$(obj).closest('form');
|
||||||
var i=a.selectedIndex;
|
this.formDisable(frm);
|
||||||
debugger;
|
var val=$(obj).val();
|
||||||
|
var txt=$("option:selected",obj).text();
|
||||||
|
|
||||||
|
var obtain='';
|
||||||
|
if($(frm).attr('id')=='bhyveObtSettings') obtain='obtain';
|
||||||
|
var posts=[{'name':'vmOsProfile','value':txt},{'name':'obtain','value':obtain}];
|
||||||
|
this.loadData('vmOsInfo',$.proxy(this.onVmOsInfoLoad,this),posts);
|
||||||
|
},
|
||||||
|
onVmOsInfoLoad:function(data)
|
||||||
|
{
|
||||||
|
var fi=data.form_items;
|
||||||
|
if(fi.obtain=='obtain') return this.onGetObtainFormItems(data);
|
||||||
|
var obj=$('form#bhyveSettings');
|
||||||
|
$('input[name="vm_name"]',obj).val(fi.jname);
|
||||||
|
|
||||||
|
$('input[name="vm_cpus"]',obj)
|
||||||
|
.attr('min',fi.vm_cpus.min)
|
||||||
|
.attr('max',fi.vm_cpus.max)
|
||||||
|
.val(fi.vm_cpus.cur);
|
||||||
|
$('input[name="vm_cpus_show"]',obj).val(fi.vm_cpus.cur);
|
||||||
|
$('input[name="vm_ram"]',obj)
|
||||||
|
.attr('min',fi.vm_ram.min)
|
||||||
|
.attr('max',fi.vm_ram.max)
|
||||||
|
.val(parseInt(fi.vm_ram.cur));
|
||||||
|
$('input[name="vm_ram_show"]',obj).val(fi.vm_ram.cur+'g');
|
||||||
|
$('input[name="vm_imgsize"]',obj)
|
||||||
|
.attr('min',fi.imgsize.min)
|
||||||
|
.attr('max',fi.imgsize.max)
|
||||||
|
.val(parseInt(fi.imgsize.cur));
|
||||||
|
$('input[name="vm_imgsize_show"]',obj).val(fi.imgsize.cur+'g');
|
||||||
|
this.formEnable($('form#bhyveSettings'));
|
||||||
},
|
},
|
||||||
|
|
||||||
loginAction:function(event)
|
loginAction:function(event)
|
||||||
@@ -2503,6 +2569,15 @@ var clonos={
|
|||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
formEnable(form)
|
||||||
|
{
|
||||||
|
$(form).removeClass('loading');
|
||||||
|
},
|
||||||
|
formDisable(form)
|
||||||
|
{
|
||||||
|
$(form).addClass('loading');
|
||||||
|
},
|
||||||
|
|
||||||
userEdit:function(user_id,tblid)
|
userEdit:function(user_id,tblid)
|
||||||
{
|
{
|
||||||
var mode='userEditInfo';
|
var mode='userEditInfo';
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
<p>It is an open source and free product which powered by other project (major importance list):</p>
|
<p>It is an open source and free product which powered by other project (major importance list):</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://www.bsdstore.ru/" target="_blank">CBSD Project</a> — — FreeBSD OS virtual environment management framework</li>
|
<li><a href="https://github.com/cbsd/cbsd" target="_blank">CBSD Project</a> — — FreeBSD OS virtual environment management framework</li>
|
||||||
<li><a href="https://www.freebsd.org/" target="_blank">FreeBSD Project</a> — FreeBSD is a free and open source Unix-like operating system descended from Research Unix created in <a href="https://en.wikipedia.org/wiki/Berkeley_Software_Distribution">University of California, Berkeley, U.S.</li>
|
<li><a href="https://www.freebsd.org/" target="_blank">FreeBSD Project</a> — FreeBSD is a free and open source Unix-like operating system descended from Research Unix created in <a href="https://en.wikipedia.org/wiki/Berkeley_Software_Distribution">University of California, Berkeley, U.S.</li>
|
||||||
<li><a href="https://puppet.com/" target="_blank">Puppet</a> — Puppet is an open-source configuration management tool.</li>
|
<li><a href="https://puppet.com/" target="_blank">Puppet</a> — Puppet is an open-source configuration management tool.</li>
|
||||||
<li>and many other..</li>
|
<li>and many other..</li>
|
||||||
|
|||||||
46
public/pages/overview/index.php
Normal file
46
public/pages/overview/index.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<div class="row2col">
|
||||||
|
<div class="column">
|
||||||
|
<h1><translate id="1">Summary statistics for cloud:</translate></h1>
|
||||||
|
<table class="tfill" style="width:98%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td width="200"><translate id="2">Param</translate></td><td width="200"><translate>Values<translate></td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><translate id="3">Num of nodes:</translate></td><td id="num-nodes"></td></tr>
|
||||||
|
<tr><td><translate id="4">Online nodes:</translate></td><td id="online-nodes"></td></tr>
|
||||||
|
<tr><td><translate id="5">Offline nodes:</translate></td><td id="offline-nodes"></td></tr>
|
||||||
|
<tr><td><translate id="6">Num of jails:</translate></td><td id="num-jails"></td></tr>
|
||||||
|
<tr><td><translate id="7">Num of cores:</translate></td><td id="num-cores"></td></tr>
|
||||||
|
<tr><td><translate id="8">Average freq. Mhz:</translate></td><td id="average"></td></tr>
|
||||||
|
<tr><td><translate id="9">Summary RAM:</translate></td><td id="sum-ram"></td></tr>
|
||||||
|
<tr><td><translate id="10">Summary storage size:</translate></td><td id="sum-storage"></td></tr>
|
||||||
|
</tbody>
|
||||||
|
<tbody class="error" style="display:none;">
|
||||||
|
<tr><td colspan="2" class="error_message"><translate id="11">Unable to fetch net info!</translate></td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<h1><translate id="12">Current node CPU usage:</translate></h1>
|
||||||
|
<div class="graph g-local-pcpu v-black l-cpu" style="height:100px;width:100%"></div>
|
||||||
|
|
||||||
|
<h1><translate id="13">Current node RAM usage:</translate></h1>
|
||||||
|
<div class="graph g-local-pmem v-black l-mem" style="height:100px;width:100%"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p><translate id="14">It is an open source and free product which powered by other project (major importance list):</translate></p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/cbsd/cbsd" target="_blank">CBSD Project</a> — <translate id="15">FreeBSD OS virtual environment management framework</translate></li>
|
||||||
|
<li><a href="https://www.freebsd.org/" target="_blank">FreeBSD Project</a> — <translate id="16">FreeBSD is a free and open source Unix-like operating system descended from Research Unix created in <a href="https://en.wikipedia.org/wiki/Berkeley_Software_Distribution">University of California, Berkeley, U.S.</translate></li>
|
||||||
|
<li><a href="https://puppet.com/" target="_blank">Puppet</a> — <translate id="17">Puppet is an open-source configuration management tool.</translate></li>
|
||||||
|
<li><translate id="18">and many other..</translate></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
CHAT:
|
||||||
|
<input type="text" id="wsinp" />
|
||||||
|
<input type="button" onclick="clonos.wssend($('#wsinp').val());$('#wsinp').val('');" value="Send" />
|
||||||
|
-->
|
||||||
46
public/pages/overview/orig.index.php
Normal file
46
public/pages/overview/orig.index.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<div class="row2col">
|
||||||
|
<div class="column">
|
||||||
|
<h1><translate>Summary statistics for cloud:</translate></h1>
|
||||||
|
<table class="tfill" style="width:98%;">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td width="200"><translate>Param</translate></td><td width="200"><translate>Values<translate></td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td><translate>Num of nodes:</translate></td><td id="num-nodes"></td></tr>
|
||||||
|
<tr><td><translate>Online nodes:</translate></td><td id="online-nodes"></td></tr>
|
||||||
|
<tr><td><translate>Offline nodes:</translate></td><td id="offline-nodes"></td></tr>
|
||||||
|
<tr><td><translate>Num of jails:</translate></td><td id="num-jails"></td></tr>
|
||||||
|
<tr><td><translate>Num of cores:</translate></td><td id="num-cores"></td></tr>
|
||||||
|
<tr><td><translate>Average freq. Mhz:</translate></td><td id="average"></td></tr>
|
||||||
|
<tr><td><translate>Summary RAM:</translate></td><td id="sum-ram"></td></tr>
|
||||||
|
<tr><td><translate>Summary storage size:</translate></td><td id="sum-storage"></td></tr>
|
||||||
|
</tbody>
|
||||||
|
<tbody class="error" style="display:none;">
|
||||||
|
<tr><td colspan="2" class="error_message"><translate>Unable to fetch net info!</translate></td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<h1><translate>Current node CPU usage:</translate></h1>
|
||||||
|
<div class="graph g-local-pcpu v-black l-cpu" style="height:100px;width:100%"></div>
|
||||||
|
|
||||||
|
<h1><translate>Current node RAM usage:</translate></h1>
|
||||||
|
<div class="graph g-local-pmem v-black l-mem" style="height:100px;width:100%"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p><translate>It is an open source and free product which powered by other project (major importance list):</translate></p>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://github.com/cbsd/cbsd" target="_blank">CBSD Project</a> — <translate>FreeBSD OS virtual environment management framework</translate></li>
|
||||||
|
<li><a href="https://www.freebsd.org/" target="_blank">FreeBSD Project</a> — <translate>FreeBSD is a free and open source Unix-like operating system descended from Research Unix created in <a href="https://en.wikipedia.org/wiki/Berkeley_Software_Distribution">University of California, Berkeley, U.S.</translate></li>
|
||||||
|
<li><a href="https://puppet.com/" target="_blank">Puppet</a> — <translate>Puppet is an open-source configuration management tool.</translate></li>
|
||||||
|
<li><translate>and many other..</translate></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
CHAT:
|
||||||
|
<input type="text" id="wsinp" />
|
||||||
|
<input type="button" onclick="clonos.wssend($('#wsinp').val());$('#wsinp').val('');" value="Send" />
|
||||||
|
-->
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
<p>Это открытый и свободный проект, использующий в своей работе такие проекты, как (наиболее значимые):</p>
|
<p>Это открытый и свободный проект, использующий в своей работе такие проекты, как (наиболее значимые):</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://www.bsdstore.ru/" target="_blank">CBSD Project</a> — Фреймворк для управления виртуальными окружениями FreeBSD ОС</li>
|
<li><a href="https://github.com/cbsd/cbsd" target="_blank">CBSD Project</a> — Фреймворк для управления виртуальными окружениями FreeBSD ОС</li>
|
||||||
<li><a href="https://www.freebsd.org/" target="_blank">FreeBSD Project</a> — свободная Unix-подобная операционная система, потомок AT&T Unix по линии BSD, созданной в <a href="https://en.wikipedia.org/wiki/Berkeley_Software_Distribution">Калифорнийском университете Беркли, США</a></li>
|
<li><a href="https://www.freebsd.org/" target="_blank">FreeBSD Project</a> — свободная Unix-подобная операционная система, потомок AT&T Unix по линии BSD, созданной в <a href="https://en.wikipedia.org/wiki/Berkeley_Software_Distribution">Калифорнийском университете Беркли, США</a></li>
|
||||||
<li><a href="https://puppet.com/" target="_blank">Puppet</a> — Система управления конфигурациями</li>
|
<li><a href="https://puppet.com/" target="_blank">Puppet</a> — Система управления конфигурациями</li>
|
||||||
<li>и много остального..</li>
|
<li>и много остального..</li>
|
||||||
|
|||||||
1
public/pages/overview/translate.cache/!dont.touch.files
Normal file
1
public/pages/overview/translate.cache/!dont.touch.files
Normal file
@@ -0,0 +1 @@
|
|||||||
|
This files is cache of translated pages, do not translate it!
|
||||||
85
public/phpliteadmin.config.php
Normal file
85
public/phpliteadmin.config.php
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
//
|
||||||
|
// This is sample configuration file
|
||||||
|
//
|
||||||
|
// You can configure phpliteadmin in one of 2 ways:
|
||||||
|
// 1. Rename phpliteadmin.config.sample.php to phpliteadmin.config.php and change parameters in there.
|
||||||
|
// You can set only your custom settings in phpliteadmin.config.php. All other settings will be set to defaults.
|
||||||
|
// 2. Change parameters directly in main phpliteadmin.php file
|
||||||
|
//
|
||||||
|
// Please see https://bitbucket.org/phpliteadmin/public/wiki/Configuration for more details
|
||||||
|
|
||||||
|
//password to gain access (set an empty password to disable authentication completely)
|
||||||
|
//$password = 'admin';
|
||||||
|
|
||||||
|
//directory relative to this file to search for databases (if false, manually list databases in the $databases variable)
|
||||||
|
//$directory = '.';
|
||||||
|
$directory = false;
|
||||||
|
|
||||||
|
//whether or not to scan the subdirectories of the above directory infinitely deep
|
||||||
|
$subdirectories = false;
|
||||||
|
|
||||||
|
//if the above $directory variable is set to false, you must specify the databases manually in an array as the next variable
|
||||||
|
//if any of the databases do not exist as they are referenced by their path, they will be created automatically
|
||||||
|
$databases = array(
|
||||||
|
array(
|
||||||
|
'path'=> '/var/db/clonos/clonos.sqlite',
|
||||||
|
'name'=> 'ClonOS DB'
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'path'=> '/usr/jails/var/db/local.sqlite',
|
||||||
|
'name'=> 'CBSD Global DB'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
/* ---- Interface settings ---- */
|
||||||
|
|
||||||
|
// Theme! If you want to change theme, save the CSS file in same folder of phpliteadmin or in folder "themes"
|
||||||
|
$theme = 'phpliteadmin.css';
|
||||||
|
|
||||||
|
// the default language! If you want to change it, save the language file in same folder of phpliteadmin or in folder "languages"
|
||||||
|
// More about localizations (downloads, how to translate etc.): https://bitbucket.org/phpliteadmin/public/wiki/Localization
|
||||||
|
$language = 'en';
|
||||||
|
|
||||||
|
// set default number of rows. You need to relog after changing the number
|
||||||
|
$rowsNum = 30;
|
||||||
|
|
||||||
|
// reduce string characters by a number bigger than 10
|
||||||
|
$charsNum = 300;
|
||||||
|
|
||||||
|
// maximum number of SQL queries to save in the history
|
||||||
|
$maxSavedQueries = 10;
|
||||||
|
|
||||||
|
/* ---- Custom functions ---- */
|
||||||
|
|
||||||
|
//a list of custom functions that can be applied to columns in the databases
|
||||||
|
//make sure to define every function below if it is not a core PHP function
|
||||||
|
$custom_functions = array(
|
||||||
|
'md5', 'sha1', 'strtotime',
|
||||||
|
// add the names of your custom functions to this array
|
||||||
|
/* 'leet_text', */
|
||||||
|
);
|
||||||
|
|
||||||
|
// define your custom functions here
|
||||||
|
/*
|
||||||
|
function leet_text($value)
|
||||||
|
{
|
||||||
|
return strtr($value, 'eaAsSOl', '344zZ01');
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* ---- Advanced options ---- */
|
||||||
|
|
||||||
|
//changing the following variable allows multiple phpLiteAdmin installs to work under the same domain.
|
||||||
|
$cookie_name = 'pla3412';
|
||||||
|
|
||||||
|
//whether or not to put the app in debug mode where errors are outputted
|
||||||
|
$debug = false;
|
||||||
|
|
||||||
|
// the user is allowed to create databases with only these extensions
|
||||||
|
$allowed_extensions = array('db','db3','sqlite','sqlite3');
|
||||||
|
|
||||||
|
// BLOBs are displayed and edited as hex string
|
||||||
|
$hexblobs = false;
|
||||||
6264
public/phpliteadmin.php
Normal file
6264
public/phpliteadmin.php
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user