Files
orico-official-website-old/app/admin/view/dbmanager/databaklist.html
2024-10-29 14:04:59 +08:00

125 lines
6.0 KiB
HTML
Executable File

<div class="content-wrapper" id="pjax-container">
<section class="content-header">
<h1>
数据备份
<small>已备份数据</small>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-md-12">
<div class="box box-primary">
<div class="box-header">
<button type="button" class="btn btn-primary btn-sm" data-cod="refresh"> 刷新</button>
</div>
<!-- /.box-header -->
<div class="box-body table-responsive no-padding lists-table">
<table class="table table-hover">
<tr>
<th class="text-center">时间</th>
<th class="text-center"></th>
<th class="text-center">占用空间</th>
<th class="text-center">压缩</th>
<th class="text-center">操作</th>
</tr>
<?php foreach($databaklist as $k=>$bak):?>
<tr>
<td class="text-center"><?php echo $k;?></td>
<td class="text-center"><?php echo $bak['part'];?></td>
<td class="text-center"><?php echo format_bytes($bak['size'], '', 2);?></td>
<td class="text-center"><?php echo $bak['compress'];?></td>
<td class="text-center">
<a href="<?php echo url('/admin/dbmanager/download',['tablename'=>$bak['time']]);?>" target="_blank" class="btn btn-success btn-sm">下载</a>
<button type="button" class="btn btn-info btn-sm btn-restore" data-table="<?php echo $bak['time'];?>">恢复</button>
<button type="button" class="btn btn-info btn-sm btn-delete" data-table="<?php echo $bak['time'];?>">删除</button>
</td>
</tr>
<?php endforeach;?>
</table>
</div>
<div class="box-footer clearfix">
</div>
<!-- /.box-body -->
</div>
</div>
</div>
</section>
<style>
.table thead > tr > td, .table tbody > tr > td {
vertical-align: middle;
}
</style>
<script type="text/javascript">
$(function() {
//Enable check and uncheck all functionality
$(".checkbox-toggle").click(function() {
var clicks = $(this).data('clicks');
//Uncheck all checkboxes
//Check all checkboxes
$.each($(".lists-table input[name='ids[]']"), function() {
//$(this).attr("checked", flag);
$(this).prop("checked", !clicks);
});
if (clicks) {
//$(".lists-table input[name='ids[]']").iCheck("uncheck");
$(".fa", this).removeClass("fa-check-square-o").addClass('fa-square-o');
} else {
//$(".lists-table input[name='ids[]']").iCheck("check");
$(".fa", this).removeClass("fa-square-o").addClass('fa-check-square-o');
}
$(this).data("clicks", !clicks);
});
$(".btn-restore").bind("click", function(event) {
var that = this;
var tablename = $(this).data('table');
$(this).tooltip({trigger: 'manual', placement: 'top', html: 'true', title: '<i class="fa fa-spinner fa-spin"></i> 提示!正在处理中...'});
$(this).tooltip('show');
$.ajax({
type: "POST",
url: "<?php echo url('/admin/dbmanager/restore');?>",
data: {'tablename': tablename, 'flag': 0},
dataType: 'json',
success: function(data, status, xhr) {
if (data.code) {
//$(that).parent().parent().remove();
alert(data.msg);
} else {
alert(data.msg);
}
},
complete: function(xhr, status) {
setTimeout(function() {
$(that).tooltip('hide');
}, 1000);
}
});
});
$(".btn-delete").bind("click", function(event) {
var that = this;
var tablename = $(this).data('table');
$(this).tooltip({trigger: 'manual', placement: 'top', html: 'true', title: '<i class="fa fa-spinner fa-spin"></i> 提示!正在处理中...'});
$(this).tooltip('show');
$.ajax({
type: "POST",
url: "<?php echo url('/admin/dbmanager/delete');?>",
data: {'tablename': tablename, 'flag': 0},
dataType: 'json',
success: function(data, status, xhr) {
if (data.code) {
$(that).parent().parent().remove();
alert(data.msg);
} else {
alert(data.msg);
}
},
complete: function(xhr, status) {
setTimeout(function() {
$(that).tooltip('hide');
}, 1000);
}
});
});
});
</script>
</div>