mirror of
https://github.com/ngfchl/ptools
synced 2023-07-10 13:41:22 +08:00
1. 更新页面添加容器启动时间,以提示是否重启成功!
This commit is contained in:
@@ -168,7 +168,11 @@ def restart_container(request):
|
||||
client = docker.from_env()
|
||||
# 从内部获取容器id
|
||||
cid = socket.gethostname()
|
||||
started_at = client.api.inspect_container(cid).get('State').get('StartedAt')
|
||||
started_at = client.api.inspect_container(cid).get('State').get('StartedAt')[:19]
|
||||
UTC_FORMAT = "%Y-%m-%dT%H:%M:%S"
|
||||
utc_time = datetime.strptime(started_at, UTC_FORMAT)
|
||||
delta = datetime.now() - utc_time
|
||||
|
||||
if get_update_logs():
|
||||
update = 'false'
|
||||
update_tips = '目前您使用的是最新版本!'
|
||||
@@ -177,7 +181,7 @@ def restart_container(request):
|
||||
update_tips = '已有新版本,请根据需要升级!'
|
||||
return render(request, 'auto_pt/restart.html',
|
||||
context={
|
||||
'started_at': started_at,
|
||||
'delta': delta.total_seconds(),
|
||||
'local_logs': get_git_logs(),
|
||||
'update_notes': get_git_logs(master='origin/master'),
|
||||
'update': update,
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
width="200"
|
||||
trigger="hover"
|
||||
content="如果遇到无法更新的情况,您可以选择重建容器或者进入容器命令行到项目根目录执行`git pull`命令!">
|
||||
<el-link slot="reference" type="success">{{ update_tips }} + <span>启动时间:{{ started_at }}</span></el-link>
|
||||
<el-link slot="reference" type="success">{{ update_tips }} + <span>启动时间:{{ delta }}</span></el-link>
|
||||
</el-popover>
|
||||
</span>
|
||||
<span style="float: right;margin-top: -10px">
|
||||
|
||||
Reference in New Issue
Block a user