1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 08:19:15 +08:00

fix: 解决安装应用过程中出现的状态异常问题 (#4156)

This commit is contained in:
zhengkunwang 2024-03-11 20:34:08 +08:00 committed by GitHub
parent f9f68a975c
commit 0b66be7a3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 309 additions and 253 deletions

View File

@ -749,8 +749,10 @@ func syncAppInstallStatus(appInstall *model.AppInstall) error {
switch {
case count == 0:
appInstall.Status = constant.Error
if appInstall.Status != constant.Error {
appInstall.Status = constant.SyncErr
appInstall.Message = buserr.WithName("ErrContainerNotFound", strings.Join(containerNames, ",")).Error()
}
case exitedCount == total:
appInstall.Status = constant.Stopped
case runningCount == total:

View File

@ -13,6 +13,7 @@ const (
Syncing = "Syncing"
SyncSuccess = "SyncSuccess"
Paused = "Paused"
SyncErr = "SyncErr"
ContainerPrefix = "1Panel-"

View File

@ -170,3 +170,5 @@ ErrBanAction: "Setting failed, the current {{ .name }} service is unavailable, p
#waf
ErrScope: "Modification of this configuration is not supported"
ErrStateChange: "State modification failed"
ErrRuleExist: "Rule is Exist"
ErrRuleNotExist: "Rule is not Exist"

View File

@ -171,3 +171,5 @@ ErrBanAction: "設置失敗,當前 {{ .name }} 服務不可用,請檢查後
#waf
ErrScope: "不支援修改此配置"
ErrStateChange: "狀態修改失敗"
ErrRuleExist: "規則名稱已存在"
ErrRuleNotExist: "規則不存在"

View File

@ -170,3 +170,5 @@ ErrBanAction: "设置失败,当前 {{ .name }} 服务不可用,请检查后
#waf
ErrScope: "不支持修改此配置"
ErrStateChange: "状态修改失败"
ErrRuleExist: "规则名称已存在"
ErrRuleNotExist: "规则不存在"

View File

@ -126,6 +126,21 @@ func (f FileOp) SaveFile(dst string, content string, mode fs.FileMode) error {
return nil
}
func (f FileOp) SaveFileWithByte(dst string, content []byte, mode fs.FileMode) error {
if !f.Stat(path.Dir(dst)) {
_ = f.CreateDir(path.Dir(dst), mode.Perm())
}
file, err := f.Fs.OpenFile(dst, os.O_RDWR|os.O_CREATE|os.O_TRUNC, mode)
if err != nil {
return err
}
defer file.Close()
write := bufio.NewWriter(file)
_, _ = write.Write(content)
write.Flush()
return nil
}
func (f FileOp) ChownR(dst string, uid string, gid string, sub bool) error {
cmdStr := fmt.Sprintf(`chown %s:%s "%s"`, uid, gid, dst)
if sub {

View File

@ -18,7 +18,7 @@
"echarts": "^5.3.0",
"echarts-liquidfill": "^3.1.0",
"element-plus": "^2.6.0",
"fit2cloud-ui-plus": "^1.0.9",
"fit2cloud-ui-plus": "^1.1.3",
"js-base64": "^3.7.2",
"js-md5": "^0.7.3",
"md-editor-v3": "^2.7.2",
@ -5282,9 +5282,9 @@
}
},
"node_modules/fit2cloud-ui-plus": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/fit2cloud-ui-plus/-/fit2cloud-ui-plus-1.0.9.tgz",
"integrity": "sha512-hsXJyR21RG07C/ghx1iQPzNoh6OE6uJvICeNY+8p5El4MG2Ji0j//gGKERdJwyH6H6MFkupMiPW7Z8uflnpSxw==",
"version": "1.1.3",
"resolved": "https://registry.npmmirror.com/fit2cloud-ui-plus/-/fit2cloud-ui-plus-1.1.3.tgz",
"integrity": "sha512-Zxp3gyzNxdsfQ6UjX8p1jmO5c++WU4l4A3OnLDseWqbuB1StR2sMfwg/Lh1yrmjBGHE5jLV5EttDcK+P/2LiIQ==",
"dependencies": {
"@element-plus/icons-vue": "^1.1.4",
"element-plus": "^2.3.3",

View File

@ -30,7 +30,7 @@
"echarts": "^5.3.0",
"echarts-liquidfill": "^3.1.0",
"element-plus": "^2.6.0",
"fit2cloud-ui-plus": "^1.0.9",
"fit2cloud-ui-plus": "^1.1.3",
"js-base64": "^3.7.2",
"js-md5": "^0.7.3",
"md-editor-v3": "^2.7.2",

View File

@ -36,7 +36,7 @@ const getType = (status: string) => {
case 'removing':
return 'warning';
default:
return 'info';
return 'primary';
}
};

View File

@ -51,6 +51,7 @@ const message = {
uninstall: 'Uninstall',
fullscreen: 'Fullscreen',
quitFullscreen: 'Quit Fullscreen',
update: 'Edit',
},
search: {
timeStart: 'Time start',
@ -246,6 +247,7 @@ const message = {
ready: 'normal',
applying: 'Applying',
applyerror: 'Failure',
syncerr: 'Error',
},
units: {
second: 'Second',
@ -2144,8 +2146,9 @@ const message = {
statusCode: 'Status code',
manage: 'Management',
},
},
xpack: {
name: 'Professional Edition',
name: 'Professional',
waf: {
name: 'WAF',
blackWhite: 'black and white list',
@ -2212,11 +2215,18 @@ const message = {
ruleType: 'attack type',
ipHelper: 'Please enter IP',
attackLog: 'Attack Log',
rule: 'Rule',
ipArr: 'IPV4 range',
ipStart: 'Start IP',
ipEnd: 'End IP',
ipv4: 'IPV4',
ipv6: 'IPV6',
},
monitor: {
name: 'Website Monitoring',
name: 'Website Monitor',
},
tamper: {
tamper: 'Tamper',
tamperHelper1:
'One-click deployment type of website, it is recommended to enable the application directory anti-tampering function;',
tamperHelper2:
@ -2264,7 +2274,6 @@ const message = {
reset: 'Reset',
},
},
},
};
export default {

View File

@ -51,6 +51,7 @@ const message = {
uninstall: '卸載',
fullscreen: '全屏',
quitFullscreen: '退出全屏',
update: '編輯',
},
search: {
timeStart: '開始時間',
@ -244,6 +245,7 @@ const message = {
ready: '正常',
applying: '申請中',
applyerror: '失敗',
syncerr: '失敗',
},
units: {
second: '秒',
@ -2002,6 +2004,7 @@ const message = {
statusCode: '狀態碼',
manage: '管理',
},
},
xpack: {
name: '專業版',
waf: {
@ -2067,11 +2070,18 @@ const message = {
ruleType: '攻擊類型',
ipHelper: '請輸入 IP',
attackLog: '攻擊日誌',
rule: '規則',
ipArr: 'IPV4 範圍',
ipStart: '起始 IP',
ipEnd: '結束 IP',
ipv4: 'IPV4',
ipv6: 'IPV6',
},
monitor: {
name: '網站監控',
},
tamper: {
tamper: '防篡改',
tamperHelper1: '一鍵部署類型的網站建議啟用應用目錄防篡改功能',
tamperHelper2: '如果在啟用防篡改功能後出現網站無法正常使用或備份恢復失敗的情況請先關閉防篡改功能',
tamperHelper3:
@ -2112,7 +2122,6 @@ const message = {
reset: '重置',
},
},
},
};
export default {
...fit2cloudTwLocale,

View File

@ -51,6 +51,7 @@ const message = {
uninstall: '卸载',
fullscreen: '全屏',
quitFullscreen: '退出全屏',
update: '编辑',
},
search: {
timeStart: '开始时间',
@ -244,6 +245,7 @@ const message = {
ready: '正常',
applying: '申请中',
applyerror: '失败',
syncerr: '失败',
},
units: {
second: '秒',
@ -2068,6 +2070,12 @@ const message = {
ruleType: '攻击类型',
ipHelper: '请输入 IP',
attackLog: '攻击日志',
rule: '规则',
ipArr: 'IPV4 范围',
ipStart: '起始 IP',
ipEnd: '结束 IP',
ipv4: 'IPV4',
ipv6: 'IPV6',
},
monitor: {
name: '网站监控',

View File

@ -418,3 +418,11 @@ html {
.p-w-200 {
width: 200px !important;
}
.p-ml-20 {
margin-left: 20px !important;
}
.p-mt-20 {
margin-top: 20px !important;
}

View File

@ -160,9 +160,6 @@ html {
.el-dialog {
.el-dialog__header {
padding: 15px 20px;
margin: 0;
border-bottom: 1px solid #f0f0f0;
.el-dialog__title {
font-size: 17px;
}

View File

@ -195,7 +195,7 @@
</div>
</template>
</el-table-column>
<el-table-column :label="$t('container.related')" min-width="200">
<el-table-column :label="$t('container.related')" min-width="200" prop="appName">
<template #default="{ row }">
<div>
<el-tooltip
@ -288,6 +288,7 @@
:buttons="buttons"
:label="$t('commons.table.operate')"
:fixed="mobile ? false : 'right'"
prop="operate"
/>
</ComplexTable>
</template>

View File

@ -1,6 +1,6 @@
<template>
<div v-if="recordShow" v-loading="loading">
<div class="app-status" style="margin-top: 20px">
<div class="app-status p-mt-20">
<el-card>
<div>
<el-popover
@ -17,7 +17,7 @@
</el-tag>
</template>
</el-popover>
<el-tag v-if="dialogData.rowData.name.length < 15" style="float: left" effect="dark" type="success">
<el-tag v-if="dialogData.rowData.name.length < 15" class="float-left" effect="dark" type="success">
{{ $t('cronjob.' + dialogData.rowData.type) }} - {{ dialogData.rowData.name }}
</el-tag>
@ -73,7 +73,7 @@
></el-date-picker>
</el-col>
<el-col :span="16">
<el-select @change="search()" v-model="searchInfo.status">
<el-select @change="search()" v-model="searchInfo.status" class="p-w-200">
<template #prefix>{{ $t('commons.table.status') }}</template>
<el-option :label="$t('commons.table.all')" value="" />
<el-option :label="$t('commons.status.success')" value="Success" />

View File

@ -8,24 +8,24 @@
@opened="onOpen"
:top="'5vh'"
>
<el-form :inline="true" :model="config">
<el-form :inline="true" :model="config" class="mt-1.5">
<el-form-item :label="$t('file.theme')">
<el-select v-model="config.theme" @change="changeTheme()">
<el-select v-model="config.theme" @change="changeTheme()" class="p-w-200">
<el-option v-for="item in themes" :key="item.label" :value="item.value" :label="item.label" />
</el-select>
</el-form-item>
<el-form-item :label="$t('file.language')">
<el-select v-model="config.language" @change="changeLanguage()">
<el-select v-model="config.language" @change="changeLanguage()" class="p-w-200">
<el-option v-for="lang in Languages" :key="lang.label" :value="lang.label" :label="lang.label" />
</el-select>
</el-form-item>
<el-form-item :label="$t('file.eol')">
<el-select v-model="config.eol" @change="changeEOL()">
<el-select v-model="config.eol" @change="changeEOL()" class="p-w-200">
<el-option v-for="eol in eols" :key="eol.label" :value="eol.value" :label="eol.label" />
</el-select>
</el-form-item>
<el-form-item :label="$t('file.wordWrap')">
<el-select v-model="config.wordWrap" @change="changeWarp()">
<el-select v-model="config.wordWrap" @change="changeWarp()" class="p-w-200">
<el-option :label="$t('commons.button.enable')" value="on"></el-option>
<el-option :label="$t('commons.button.disable')" value="off"></el-option>
</el-select>

View File

@ -15,7 +15,7 @@
</el-button>
</el-col>
<el-col :xs="24" :sm="8" :md="8" :lg="8" :xl="8">
<div class="flx-align-center">
<div class="flex justify-end">
<TableSetting @search="search()" />
<TableSearch @search="search()" v-model:searchName="searchIP" />
</div>
@ -25,14 +25,14 @@
<template #search>
<div class="flx-align-center">
<el-select v-model="searchStatus" @change="search()" clearable>
<el-select v-model="searchStatus" @change="search()" clearable class="p-w-200">
<template #prefix>{{ $t('commons.table.status') }}</template>
<el-option :label="$t('commons.table.all')" value=""></el-option>
<el-option :label="$t('commons.status.success')" value="Success"></el-option>
<el-option :label="$t('commons.status.failed')" value="Failed"></el-option>
</el-select>
<el-button type="primary" plain @click="onClean()" style="margin-left: 10px">
<el-button type="primary" plain @click="onClean()" class="ml-2.5">
{{ $t('logs.deleteLogs') }}
</el-button>
</div>