update system information

This commit is contained in:
dongpd 2023-06-29 13:49:03 +07:00
parent e4e080266a
commit c29719d73e
8 changed files with 136 additions and 4 deletions

View File

@ -563,4 +563,29 @@ class ConfigController extends Controller {
}
}
public function actionSystemInfo() {
if (Yii::$app->request->isAjax) {
Yii::$app->response->format = "json";
$options = [
'http' => [
'header' => "Content-Type: application/json",
'method' => "POST"
]
];
@file_get_contents("http://localhost:4004/Reboot", false, stream_context_create($options));
return ["status" => true];
} else {
$this->view->title = Yii::t("app", "THONG_TIN_HE_THONG");
$version = \app\models\SyncUrl::findOne(['key_config' => 'version']);
$info = $version ? $version->data : "Pro 4.27.13 (Jul 19 2021 11:49)";
$temp = explode("(", $info);
$ver = trim($temp[0]);
$build_time = str_replace(")", "", $temp[1]);
return $this->render('system-info', [
"version" => $ver,
"build_time" => $build_time
]);
}
}
}

View File

@ -160,5 +160,8 @@ return [
"XOA_LICH_TRINH" => "Delete schedule",
"BAN_CO_CHAC_CHAN_MUON_XOA_LICH_TRINH_NAY_KHONG" => "Are you sure you want to delete this schedule?",
"SO_SANH_MAT" => "Face comparison",
"BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG" => "Are you sure you want to change the device's IP address?"
"BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG" => "Are you sure you want to change the device's IP address?",
"THONG_TIN_HE_THONG" => "System Information",
"REBOOT" => "Reboot",
"BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG" => "Are you sure you want to reboot?"
];

View File

@ -160,5 +160,8 @@ return [
"XOA_LICH_TRINH" => "スケジュールを削除",
"BAN_CO_CHAC_CHAN_MUON_XOA_LICH_TRINH_NAY_KHONG" => "このスケジュールを削除してもよろしいですか?",
"SO_SANH_MAT" => "顔比較",
"BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG" => "デバイスの IP アドレスを変更してもよろしいですか?"
"BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG" => "デバイスの IP アドレスを変更してもよろしいですか?",
"THONG_TIN_HE_THONG" => "システムインフォメーション",
"REBOOT" => "リブート",
"BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG" => "再起動してもよろしいですか?"
];

View File

@ -160,5 +160,8 @@ return [
"XOA_LICH_TRINH" => "Xóa lịch trình",
"BAN_CO_CHAC_CHAN_MUON_XOA_LICH_TRINH_NAY_KHONG" => "Bạn có chắc chắn muốn xóa lịch trình này không?",
"SO_SANH_MAT" => "So sánh mặt",
"BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG" => "Bạn có chắc chắn muốn thay đổi địa chỉ IP của thiết bị không?"
"BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG" => "Bạn có chắc chắn muốn thay đổi địa chỉ IP của thiết bị không?",
"THONG_TIN_HE_THONG" => "Thông tin hệ thống",
"REBOOT" => "Khởi động lại thiết bị",
"BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG" => "Bạn có chắc chắn muốn khởi động lại thiết bị không?"
];

View File

@ -36,7 +36,7 @@ use yii\widgets\ActiveForm;
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse pull-left" id="navbar-collapse">
<ul class="nav navbar-nav">
<li class="<?php if (Yii::$app->controller->id == "config") echo "active"; ?>">
<li class="<?php if (Yii::$app->controller->id == "config" && Yii::$app->controller->action->id != "system-info") echo "active"; ?>">
<a href="<?php echo yii\helpers\Url::to(['/config/cau-hinh-thiet-bi']); ?>">
<i class="fa fa-cogs"></i> <?php echo Yii::t("app", "CAU_HINH"); ?>
</a>
@ -62,6 +62,11 @@ use yii\widgets\ActiveForm;
<li><a href="<?php echo \yii\helpers\Url::to(['/capture-logs/face-comparison']); ?>"><i class="fa fa-users"></i> <?php echo Yii::t("app", "SO_SANH_MAT"); ?></a></li>
</ul>
</li>
<li class="<?php if (Yii::$app->controller->id == "config" && Yii::$app->controller->action->id == "system-info") echo "active"; ?>">
<a href="<?php echo yii\helpers\Url::to(['/config/system-info']); ?>">
<i class="fa fa-info-circle"></i> <?php echo Yii::t("app", "THONG_TIN_HE_THONG"); ?>
</a>
</li>
<?php } ?>
</ul>
</div>

View File

@ -0,0 +1,58 @@
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
{use class="yii\helpers\Url"}
{use class="app\assets\ConfigAsset"}
{ConfigAsset::register($this)|void}
{block name='content'}
<style>
.input-group-addon{
width: 120px;
font-weight: bold;
}
.input-group{
width: 100%;
}
.table-striped > tbody > tr:nth-of-type(odd) {
background-color: #d1d1d1;
}
</style>
<div class="container-fluid">
<br>
<div class="row">
<div class="col-md-3 col-md-push-1">
<table class="table table-bordered table-striped" style="background: #fff;">
<thead>
<tr style="background-color: #3c8dbc;color:#fff;">
<th colspan="2">{Yii::t("app", "THONG_TIN_HE_THONG")|upper}</th>
</tr>
</thead>
<tbody>
<tr>
<th>CPU</th>
<td>ARM Mali-450 penta-core</td>
</tr>
<tr>
<th>MemTotal</th>
<td>2.0 GiB</td>
</tr>
<tr>
<th>DiskTotal</th>
<td>16.0 GiB</td>
</tr>
<tr>
<th>Software version number</th>
<td>{$version}</td>
</tr>
<tr>
<th>Build time</th>
<td>{$build_time}</td>
</tr>
</tbody>
</table>
<button class="btn btn-danger" onclick="reboot(this);" data-href="{Url::to(['system-info'])}">
<i class="fa fa-refresh"></i> {Yii::t("app","REBOOT")}
</button>
</div>
</div>
</div>
</div>
{/block}

View File

@ -33,6 +33,8 @@
<input type="hidden" name="HAY_CHON_DOI_TUONG_DE_GAN_LICH_TRINH" value="{Yii::t("app", "HAY_CHON_DOI_TUONG_DE_GAN_LICH_TRINH")}">
<input type="hidden" name="BAN_CO_CHAC_CHAN_MUON_XOA_LICH_TRINH_NAY_KHONG" value="{Yii::t("app", "BAN_CO_CHAC_CHAN_MUON_XOA_LICH_TRINH_NAY_KHONG")}">
<input type="hidden" name="BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG" value="{Yii::t("app", "BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG")}">
<input type="hidden" name="BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG" value="{Yii::t("app", "BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG")}">
<div id="blocking" class="fade modal" role="dialog" tabindex="-1">
<div class="modal-dialog" style="top: 50%;margin-top: -45px;">
@ -47,6 +49,19 @@
</div>
</div>
</div>
<div id="reboot-blocking" class="fade modal" role="dialog" tabindex="-1">
<div class="modal-dialog" style="top: 50%;margin-top: -45px;">
<div class="modal-content" style="background-color: transparent;box-shadow: none;">
<div class="modal-body">
<div id='modelContent' class="text-center">
<i class="fa fa-spinner fa-pulse fa-5x fa-fw" style="color: #fff;"></i>
<br>
<b style="color: #fff;font-size: 25px;">Đang khởi động lại thiết bị, vui lòng chờ trong vài phút và tải lại trang!</b>
</div>
</div>
</div>
</div>
</div>
<div id="uploadBlock" class="fade modal" role="dialog" tabindex="-1">
<div class="modal-dialog" style="top: 50%;margin-top: -45px;">
<div class="modal-content" style="background-color: transparent;box-shadow: none;">

View File

@ -177,4 +177,24 @@ function changeIP(e) {
}
});
}
}
function reboot(e) {
if (confirm($("input[name='BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG']").val())) {
$("#reboot-blocking").modal({
keyboard: false,
backdrop: false
});
$.ajax({
url: $(e).attr("data-href"),
type: 'POST',
success: function (data) {
},
error: function (jqXHR, textStatus, errorThrown) {
// $("#reboot-blocking").modal("hide");
// common.ajaxError();
}
});
}
}