mirror of
https://github.com/optim-enterprises-bv/control-pane.git
synced 2025-10-29 00:52:30 +00:00
WIP: upgrade button
This commit is contained in:
@@ -2184,6 +2184,23 @@ class ClonOS {
|
||||
return $arr;
|
||||
}
|
||||
|
||||
function ccmd_settingsUpdateComponents()
|
||||
{
|
||||
$res=CBSD::run(
|
||||
'cix_upgrade mode=upgrade',
|
||||
array()
|
||||
);
|
||||
if($res['error']){
|
||||
$arr['error']=true;
|
||||
$arr['error_message']=$err['error_message'];
|
||||
}else{
|
||||
$arr['error']=false;
|
||||
$arr['response']=$res['msg'];
|
||||
//$arr['update_list']=json_decode($res['message']);
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -870,7 +870,8 @@ dialog.fullscreen #vnc-iframe {
|
||||
background-color:coral;
|
||||
text-shadow:1px 1px 2px black;
|
||||
}
|
||||
.buttons .button.hidden {
|
||||
.buttons .button.hidden,
|
||||
.top-button.hidden {
|
||||
display:none;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<dialog id="settings-update" class="window-box tasklog">
|
||||
<dialog id="settings-getupdate" class="window-box tasklog">
|
||||
<h1><?php echo $this->translate('Settings update');?></h1>
|
||||
<div class="window-content">
|
||||
Check for updates…
|
||||
@@ -237,6 +237,12 @@ var clonos={
|
||||
if(id=='settings-update')
|
||||
{
|
||||
this.settingsUpdateCheck();
|
||||
return;
|
||||
}
|
||||
if(id=='settings-getupdate')
|
||||
{
|
||||
$('dialog#settings-getupdate .window-content').html('');
|
||||
this.settingsUpdateComponents();
|
||||
}
|
||||
this.dialogShow1(id);
|
||||
}
|
||||
@@ -253,6 +259,12 @@ var clonos={
|
||||
dialogShow1:function(id,mode)
|
||||
{
|
||||
var dlg=$('dialog#'+id);
|
||||
if(dlg.length==0)
|
||||
{
|
||||
//console.log('Not found dialog: '+id);
|
||||
this.notify('Not found dialog: '+id,'error');
|
||||
return;
|
||||
}
|
||||
|
||||
if(mode=='edit')
|
||||
{
|
||||
@@ -892,13 +904,29 @@ var clonos={
|
||||
{
|
||||
msg+='<p>'+n+', version: '+this.updates[n]+'</p>';
|
||||
}
|
||||
$('#settings-update .button.ok-but').removeClass('hidden');
|
||||
}else{
|
||||
$('#settings-update .button.ok-but').addClass('hidden');
|
||||
}
|
||||
this.setButtonUpdate();
|
||||
$('dialog#settings-update .window-content').html(msg);
|
||||
},
|
||||
|
||||
setButtonUpdate:function()
|
||||
{
|
||||
if(this.updates_exists)
|
||||
{
|
||||
$('#but-getupdate').removeClass('hidden');
|
||||
}else{
|
||||
$('#but-getupdate').addClass('hidden');
|
||||
}
|
||||
},
|
||||
settingsUpdateComponents:function()
|
||||
{
|
||||
this.loadData('settingsUpdateComponents',$.proxy(this.onSettingsUpdateComponents,this));
|
||||
},
|
||||
onSettingsUpdateComponents:function(data)
|
||||
{
|
||||
var msg='getData';
|
||||
$('dialog#settings-update .window-content').html(msg);
|
||||
},
|
||||
|
||||
onUsersAdd:function(data)
|
||||
{
|
||||
if(typeof data.error!='undefined')
|
||||
@@ -2252,6 +2280,7 @@ var clonos={
|
||||
this.updates_exists=true;
|
||||
}
|
||||
if(this.updates_exists) this.updates=data;
|
||||
this.setButtonUpdate();
|
||||
},
|
||||
|
||||
|
||||
@@ -2989,6 +3018,17 @@ var clonos={
|
||||
case 'update':
|
||||
if(isset(data.data))
|
||||
{
|
||||
if(data.id=='update')
|
||||
{
|
||||
var msg=data.data.message;
|
||||
//console.log(msg);
|
||||
$('dialog#settings-getupdate .window-content').append('<p>'+this.translate(msg)+'</p>');
|
||||
if(msg=='complete')
|
||||
this.settingsUpdateCheck();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for(n in data.data)
|
||||
{
|
||||
if(n=='impsize') data.data[n]=this.formatBytes(data.data[n],0);
|
||||
|
||||
@@ -66,4 +66,11 @@ clonos.lang={
|
||||
"description":"описание",
|
||||
"properties":"параметры",
|
||||
|
||||
"starting...":"Запуск обновления...",
|
||||
"update phase 1/5..":"Фаза обновления: 1/5..",
|
||||
"update phase 2/5..":"Фаза обновления: 2/5..",
|
||||
"update phase 3/5..":"Фаза обновления: 3/5..",
|
||||
"update phase 4/5..":"Фаза обновления: 4/5..",
|
||||
"update phase 5/5..":"Фаза обновления: 5/5..",
|
||||
"complete":"Обновление завершено",
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
<?php
|
||||
$clonos->useDialogs(['settings-update']);
|
||||
$clonos->useDialogs(['settings-getupdate']);
|
||||
?>
|
||||
|
||||
<h1>Настройки</h1>
|
||||
<p><span class="top-button icon-plus id:settings-update">Проверить обновления</span></p>
|
||||
<p><span class="top-button icon-plus id:settings-update">Проверить обновления</span>
|
||||
<span class="top-button icon-upload id:settings-getupdate hidden" id="but-getupdate">Обновить</span></p>
|
||||
|
||||
|
||||
<table class="tsimple" id="update_files" width="100%">
|
||||
|
||||
Reference in New Issue
Block a user