1. 优化重启按钮,在环境变量CONTAINER_NAME未设置时不显示

This commit is contained in:
ngfchl
2022-08-26 09:30:07 +08:00
parent 903ca92463
commit a820138a31
2 changed files with 10 additions and 3 deletions

View File

@@ -131,6 +131,12 @@ def restart_container(request):
res = scraper.get('https://gitee.com/ngfchl/ptools/raw/master/update.md')
update_notes = markdown.markdown(res.text, extensions=['tables'])
print(update_notes)
restart = 'false'
if os.environ.get('CONTAINER_NAME'):
restart = 'true'
return render(request, 'auto_pt/restart.html',
context={'update_notes': update_notes}
context={
'update_notes': update_notes,
'restart': restart
}
)

View File

@@ -11,7 +11,7 @@
<span>更新日志</span>
<span style="float: right;margin-top: -10px">
<el-button type="success" @click="do_update">更新</el-button>
<el-button type="danger" @click="do_restart">重启</el-button>
<el-button type="danger" @click="do_restart" v-if="restart">重启</el-button>
</span>
</div>
<div class="text item">
@@ -39,7 +39,8 @@
// element: 指定用vue来管理页面中的哪个标签区域
el: '#app',
data: {
update_note: ['请先拉取更新哦']
update_note: ['请先拉取更新哦'],
restart:{{ restart }},
},
methods: {
do_restart() {