WIP: upgrade button

This commit is contained in:
olevole
2023-04-12 09:23:46 +03:00
parent 60083e90ed
commit 9d509b9150
4 changed files with 34 additions and 10 deletions

1
.gitignore vendored
View File

@@ -8,3 +8,4 @@ public/media/*.img
public/media/*.size
composer.lock
php/sentry.php
php/vendor

View File

@@ -2168,7 +2168,7 @@ class ClonOS {
}
}
function ccmd_settingsUpdateCheck()
function ccmd_settingsGetList()
{
$res=CBSD::run(
'cix_upgrade mode=listjson',
@@ -2181,6 +2181,21 @@ class ClonOS {
$arr['error']=false;
$arr['update_list']=json_decode($res['message']);
}
}
function ccmd_settingsUpdateCheck()
{
$res=CBSD::run(
'cix_upgrade mode=check_upgrade', //listjson
array()
);
if($res['error']){
$arr['error']=true;
$arr['error_message']=$res['error_message'];
}else{
$arr['error']=false;
$arr['update_list']=json_decode($res['message']);
}
return $arr;
}

View File

@@ -312,6 +312,13 @@ var clonos={
}
$(dlg).find('input[type=text],textarea').filter(':visible:first').focus();
},
isDialogOpened:function(id)
{
var dlg=$('dialog#'+id);
if(dlg.length==0) return false;
if(dlg.css('display')=='block') return true;
return false;
},
dialogSetPosition:function(dialog)
{
var wd=$(dialog).width();
@@ -897,16 +904,14 @@ var clonos={
onSettingsUpdateCheck:function(data)
{
var msg='<p>'+this.translate('No updates&hellip;')+'</p>';
if(this.updates_exists)
if(typeof data.update_list != "undefined" && typeof data.update_list.latest != "undefined")
{
msg='<p>'+this.translate('Updates available:')+'</p>';
for(n in this.updates)
{
msg+='<p>'+n+', version: '+this.updates[n]+'</p>';
}
this.updates_exists=true;
this.checkLatestUpdates(data.update_list.latest);
}
this.setButtonUpdate();
$('dialog#settings-update .window-content').html(msg);
//this.checkLatestUpdates(data.latest)
//this.setButtonUpdate();
//$('dialog#settings-update .window-content').html(msg);
},
setButtonUpdate:function()
{
@@ -3020,6 +3025,9 @@ var clonos={
{
if(data.id=='update')
{
var dlgId='settings-getupdate';
if(!this.isDialogOpened(dlgId))
this.dialogShow1(dlgId);
var msg=data.data.message;
//console.log(msg);
$('dialog#settings-getupdate .window-content').append('<p>'+this.translate(msg)+'</p>');

View File

@@ -2,7 +2,7 @@
$clonos->useDialogs(['settings-getupdate']);
?>
<h1>Настройки</h1>
<h1>Settings</h1>
<p><span class="top-button icon-plus id:settings-update">Check for updates</span>
<span class="top-button icon-upload id:settings-getupdate hidden" id="but-getupdate">Upgrade</span></p>