mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 02:45:49 +02:00
feat(upgrade): add in_docker flag to RuntimeInfo and adjust upgrade interval based on Docker environment
This commit is contained in:
parent
174f8baf18
commit
406d9113e7
3 changed files with 17 additions and 9 deletions
|
@ -8,6 +8,7 @@ export interface RuntimeInfo {
|
||||||
body: string
|
body: string
|
||||||
published_at: string
|
published_at: string
|
||||||
cur_version: Info
|
cur_version: Info
|
||||||
|
in_docker: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Info {
|
interface Info {
|
||||||
|
|
|
@ -123,16 +123,18 @@ async function performUpgrade() {
|
||||||
return
|
return
|
||||||
|
|
||||||
const t = setInterval(() => {
|
const t = setInterval(() => {
|
||||||
|
const interval = data.value.in_docker ? 10000 : 1000
|
||||||
upgrade.current_version().then(() => {
|
upgrade.current_version().then(() => {
|
||||||
clearInterval(t)
|
clearInterval(t)
|
||||||
|
setTimeout(() => {
|
||||||
progressStatus.value = 'success'
|
progressStatus.value = 'success'
|
||||||
progressPercent.value = 100
|
progressPercent.value = 100
|
||||||
modalClosable.value = true
|
modalClosable.value = true
|
||||||
log('Upgraded successfully')
|
log('Upgraded successfully')
|
||||||
|
setTimeout(() => {
|
||||||
setInterval(() => {
|
|
||||||
location.reload()
|
location.reload()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
}, interval)
|
||||||
})
|
})
|
||||||
}, 2000)
|
}, 2000)
|
||||||
}
|
}
|
||||||
|
@ -171,7 +173,10 @@ const performUpgradeBtnText = computed(() => {
|
||||||
</AModal>
|
</AModal>
|
||||||
<div class="upgrade-container">
|
<div class="upgrade-container">
|
||||||
<p>{{ $gettext('You can check Nginx UI upgrade at this page.') }}</p>
|
<p>{{ $gettext('You can check Nginx UI upgrade at this page.') }}</p>
|
||||||
<h3>{{ $gettext('Current Version') }}: v{{ version.version }} <span class="short-hash">({{ data?.cur_version?.short_hash }})</span></h3>
|
<h3>
|
||||||
|
{{ $gettext('Current Version') }}: v{{ version.version }}
|
||||||
|
<span v-if="data?.cur_version?.short_hash" class="short-hash">({{ data?.cur_version?.short_hash }})</span>
|
||||||
|
</h3>
|
||||||
<template v-if="getReleaseError">
|
<template v-if="getReleaseError">
|
||||||
<AAlert
|
<AAlert
|
||||||
type="error"
|
type="error"
|
||||||
|
|
|
@ -13,6 +13,7 @@ type RuntimeInfo struct {
|
||||||
Arch string `json:"arch"`
|
Arch string `json:"arch"`
|
||||||
ExPath string `json:"ex_path"`
|
ExPath string `json:"ex_path"`
|
||||||
CurVersion *Info `json:"cur_version"`
|
CurVersion *Info `json:"cur_version"`
|
||||||
|
InDocker bool `json:"in_docker"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetRuntimeInfo() (r RuntimeInfo, err error) {
|
func GetRuntimeInfo() (r RuntimeInfo, err error) {
|
||||||
|
@ -32,6 +33,7 @@ func GetRuntimeInfo() (r RuntimeInfo, err error) {
|
||||||
Arch: runtime.GOARCH,
|
Arch: runtime.GOARCH,
|
||||||
ExPath: realPath,
|
ExPath: realPath,
|
||||||
CurVersion: GetVersionInfo(),
|
CurVersion: GetVersionInfo(),
|
||||||
|
InDocker: os.Getenv("NGINX_UI_IN_DOCKER") == "true",
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue