mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-10 12:26:10 +08:00
fix(cronjob): fix issue with run cut website log failed (#8144)
This commit is contained in:
parent
2ed3aaa99b
commit
c2dc38f02f
16 changed files with 31 additions and 22 deletions
|
|
@ -147,7 +147,7 @@ func (u *CronjobRepo) StartRecords(cronjobID uint, targetPath, cronjobType strin
|
||||||
var record model.JobRecords
|
var record model.JobRecords
|
||||||
record.StartTime = time.Now()
|
record.StartTime = time.Now()
|
||||||
record.CronjobID = cronjobID
|
record.CronjobID = cronjobID
|
||||||
if cronjobType != "directory" && cronjobType != "log" {
|
if cronjobType != "directory" && cronjobType != "log" && cronjobType != "cutWebsiteLog" {
|
||||||
record.TaskID = uuid.New().String()
|
record.TaskID = uuid.New().String()
|
||||||
}
|
}
|
||||||
record.Status = constant.StatusWaiting
|
record.Status = constant.StatusWaiting
|
||||||
|
|
|
||||||
|
|
@ -981,15 +981,13 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) {
|
||||||
t.LogStart(i18n.GetMsgByKey("SyncAppDetail"))
|
t.LogStart(i18n.GetMsgByKey("SyncAppDetail"))
|
||||||
for _, l := range list.Apps {
|
for _, l := range list.Apps {
|
||||||
app := appsMap[l.AppProperty.Key]
|
app := appsMap[l.AppProperty.Key]
|
||||||
_, iconRes, err := req_helper.HandleRequest(l.Icon, http.MethodGet, constant.TimeOut20s)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
iconStr := ""
|
iconStr := ""
|
||||||
if !strings.Contains(string(iconRes), "<xml>") {
|
_, iconRes, err := req_helper.HandleRequest(l.Icon, http.MethodGet, constant.TimeOut20s)
|
||||||
iconStr = base64.StdEncoding.EncodeToString(iconRes)
|
if err == nil {
|
||||||
|
if !strings.Contains(string(iconRes), "<xml>") {
|
||||||
|
iconStr = base64.StdEncoding.EncodeToString(iconRes)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
app.Icon = iconStr
|
app.Icon = iconStr
|
||||||
app.TagsKey = l.AppProperty.Tags
|
app.TagsKey = l.AppProperty.Tags
|
||||||
if l.AppProperty.Recommend > 0 {
|
if l.AppProperty.Recommend > 0 {
|
||||||
|
|
@ -1171,7 +1169,6 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) {
|
||||||
|
|
||||||
_ = settingService.Update("AppStoreSyncStatus", constant.StatusSyncSuccess)
|
_ = settingService.Update("AppStoreSyncStatus", constant.StatusSyncSuccess)
|
||||||
_ = settingService.Update("AppStoreLastModified", strconv.Itoa(list.LastModified))
|
_ = settingService.Update("AppStoreLastModified", strconv.Itoa(list.LastModified))
|
||||||
t.Log(i18n.GetMsgByKey("AppStoreSyncSuccess"))
|
|
||||||
return nil
|
return nil
|
||||||
}, nil)
|
}, nil)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -224,9 +224,6 @@ func (t *Task) Execute() error {
|
||||||
}
|
}
|
||||||
if t.Task.Status == constant.StatusExecuting {
|
if t.Task.Status == constant.StatusExecuting {
|
||||||
t.Task.Status = constant.StatusSuccess
|
t.Task.Status = constant.StatusSuccess
|
||||||
t.Log(i18n.GetWithName("TaskSuccess", t.Name))
|
|
||||||
} else {
|
|
||||||
t.Log(i18n.GetWithName("TaskFailed", t.Name))
|
|
||||||
}
|
}
|
||||||
t.Log("[TASK-END]")
|
t.Log("[TASK-END]")
|
||||||
t.Task.EndAt = time.Now()
|
t.Task.EndAt = time.Now()
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.log-container {
|
.log-container {
|
||||||
height: calc(100vh - 320px);
|
height: calc(100vh - 350px);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ const refreshRate = ref<number>(0);
|
||||||
const emit = defineEmits(['search']);
|
const emit = defineEmits(['search']);
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
title: String,
|
title: String,
|
||||||
|
rate: Number,
|
||||||
});
|
});
|
||||||
|
|
||||||
let timer: NodeJS.Timer | null = null;
|
let timer: NodeJS.Timer | null = null;
|
||||||
|
|
@ -57,10 +58,15 @@ onUnmounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (props.title) {
|
if (props.title && localStorage.getItem(props.title) != null) {
|
||||||
let rate = Number(localStorage.getItem(props.title));
|
let rate = Number(localStorage.getItem(props.title));
|
||||||
refreshRate.value = rate ? Number(rate) : 0;
|
refreshRate.value = rate ? Number(rate) : 0;
|
||||||
changeRefresh();
|
changeRefresh();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (props.rate) {
|
||||||
|
refreshRate.value = props.rate;
|
||||||
|
changeRefresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<el-option :label="$t('logs.taskRunning')" value="Executing"></el-option>
|
<el-option :label="$t('logs.taskRunning')" value="Executing"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
<TableRefresh @search="search()" />
|
<TableRefresh @search="search()" />
|
||||||
<TableSetting title="task-log-refresh" @search="search()" />
|
<TableSetting @search="search()" :rate="5" />
|
||||||
</template>
|
</template>
|
||||||
<template #main>
|
<template #main>
|
||||||
<ComplexTable :pagination-config="paginationConfig" :data="data" @search="search" :heightDiff="320">
|
<ComplexTable :pagination-config="paginationConfig" :data="data" @search="search" :heightDiff="320">
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,7 @@ const message = {
|
||||||
applyerror: 'Apply failed',
|
applyerror: 'Apply failed',
|
||||||
systemrestart: 'Interrupted',
|
systemrestart: 'Interrupted',
|
||||||
starterr: 'Startup failed',
|
starterr: 'Startup failed',
|
||||||
|
uperr: 'Startup failed',
|
||||||
},
|
},
|
||||||
units: {
|
units: {
|
||||||
second: 'Second',
|
second: 'Second',
|
||||||
|
|
@ -2916,7 +2917,7 @@ const message = {
|
||||||
defaultIpBlackHelper: 'Some malicious IPs collected from the Internet to prevent access',
|
defaultIpBlackHelper: 'Some malicious IPs collected from the Internet to prevent access',
|
||||||
notFoundCount: '404 Frequency Limit',
|
notFoundCount: '404 Frequency Limit',
|
||||||
matchValue: 'Match value',
|
matchValue: 'Match value',
|
||||||
headerName: 'Supports English, numbers, -, length 3-30',
|
headerName: 'Supports non-special characters starting with English, numbers, -, length 3-30',
|
||||||
cdnHelper: 'Websites using CDN can open here to obtain the correct source IP',
|
cdnHelper: 'Websites using CDN can open here to obtain the correct source IP',
|
||||||
clearLogWarn: 'Clearing the log will not be possible, do you want to continue?',
|
clearLogWarn: 'Clearing the log will not be possible, do you want to continue?',
|
||||||
commonRuleHelper: 'Rule is fuzzy matching',
|
commonRuleHelper: 'Rule is fuzzy matching',
|
||||||
|
|
|
||||||
|
|
@ -304,6 +304,7 @@ const message = {
|
||||||
applyerror: '適用に失敗しました',
|
applyerror: '適用に失敗しました',
|
||||||
systemrestart: '中断',
|
systemrestart: '中断',
|
||||||
starterr: '起動に失敗しました',
|
starterr: '起動に失敗しました',
|
||||||
|
uperr: '起動に失敗しました',
|
||||||
},
|
},
|
||||||
units: {
|
units: {
|
||||||
second: '2番目|2番目|秒',
|
second: '2番目|2番目|秒',
|
||||||
|
|
@ -2734,7 +2735,7 @@ const message = {
|
||||||
defaultIpBlackHelper: 'インターネットから収集された悪意のあるIPをアクセス防止のために使用',
|
defaultIpBlackHelper: 'インターネットから収集された悪意のあるIPをアクセス防止のために使用',
|
||||||
notFoundCount: '404頻度制限',
|
notFoundCount: '404頻度制限',
|
||||||
matchValue: '一致する値',
|
matchValue: '一致する値',
|
||||||
headerName: '英数字、-をサポート、長さは3-30',
|
headerName: 'このフィールドは、特別なキャラクターではなく、英語、数字、-をサポート、長さは3-30',
|
||||||
cdnHelper: 'CDNを使用しているウェブサイトは、ここで正しいソースIPを取得できます',
|
cdnHelper: 'CDNを使用しているウェブサイトは、ここで正しいソースIPを取得できます',
|
||||||
clearLogWarn: 'ログをクリアすると元に戻せません。続けますか?',
|
clearLogWarn: 'ログをクリアすると元に戻せません。続けますか?',
|
||||||
commonRuleHelper: 'ルールは部分一致です',
|
commonRuleHelper: 'ルールは部分一致です',
|
||||||
|
|
|
||||||
|
|
@ -306,6 +306,7 @@ const message = {
|
||||||
applyerror: '적용 실패',
|
applyerror: '적용 실패',
|
||||||
systemrestart: '중단됨',
|
systemrestart: '중단됨',
|
||||||
starterr: '시작 실패',
|
starterr: '시작 실패',
|
||||||
|
uperr: '실행 실패',
|
||||||
},
|
},
|
||||||
units: {
|
units: {
|
||||||
second: '초 | 초 | 초',
|
second: '초 | 초 | 초',
|
||||||
|
|
@ -2691,7 +2692,7 @@ const message = {
|
||||||
defaultIpBlackHelper: '인터넷에서 수집된 일부 악성 IP로 접근을 차단합니다.',
|
defaultIpBlackHelper: '인터넷에서 수집된 일부 악성 IP로 접근을 차단합니다.',
|
||||||
notFoundCount: '404 빈도 제한',
|
notFoundCount: '404 빈도 제한',
|
||||||
matchValue: '매칭 값',
|
matchValue: '매칭 값',
|
||||||
headerName: '영어, 숫자, -, 길이 3-30 지원',
|
headerName: '이 필드는 특수 문자로 시작할 수 없으며,영어, 숫자, -, 길이 3-30 지원',
|
||||||
cdnHelper: 'CDN 을 사용하는 웹사이트는 여기서 원본 IP를 확인할 수 있습니다.',
|
cdnHelper: 'CDN 을 사용하는 웹사이트는 여기서 원본 IP를 확인할 수 있습니다.',
|
||||||
clearLogWarn: '로그를 삭제하면 복구할 수 없습니다. 계속하시겠습니까?',
|
clearLogWarn: '로그를 삭제하면 복구할 수 없습니다. 계속하시겠습니까?',
|
||||||
commonRuleHelper: '규칙은 유사 매칭 방식입니다.',
|
commonRuleHelper: '규칙은 유사 매칭 방식입니다.',
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,7 @@ const message = {
|
||||||
applyerror: 'Permohonan gagal',
|
applyerror: 'Permohonan gagal',
|
||||||
systemrestart: 'Dihentikan',
|
systemrestart: 'Dihentikan',
|
||||||
starterr: 'Permulaan gagal',
|
starterr: 'Permulaan gagal',
|
||||||
|
uperr: 'Permulaan gagal',
|
||||||
},
|
},
|
||||||
units: {
|
units: {
|
||||||
second: 'saat | saat | saat',
|
second: 'saat | saat | saat',
|
||||||
|
|
|
||||||
|
|
@ -310,6 +310,7 @@ const message = {
|
||||||
applyerror: 'Falha na aplicação',
|
applyerror: 'Falha na aplicação',
|
||||||
systemrestart: 'Interrompido',
|
systemrestart: 'Interrompido',
|
||||||
starterr: 'Falha na inicialização',
|
starterr: 'Falha na inicialização',
|
||||||
|
uperr: 'Falha na inicialização',
|
||||||
},
|
},
|
||||||
units: {
|
units: {
|
||||||
second: 'segundo | segundos | segundos',
|
second: 'segundo | segundos | segundos',
|
||||||
|
|
|
||||||
|
|
@ -307,6 +307,7 @@ const message = {
|
||||||
applyerror: 'Ошибка применения',
|
applyerror: 'Ошибка применения',
|
||||||
systemrestart: 'Прервано',
|
systemrestart: 'Прервано',
|
||||||
starterr: 'Ошибка запуска',
|
starterr: 'Ошибка запуска',
|
||||||
|
uperr: 'Ошибка запуска',
|
||||||
},
|
},
|
||||||
units: {
|
units: {
|
||||||
second: ' секунда | секунда | секунд',
|
second: ' секунда | секунда | секунд',
|
||||||
|
|
|
||||||
|
|
@ -305,6 +305,7 @@ const message = {
|
||||||
applyerror: '申請失敗',
|
applyerror: '申請失敗',
|
||||||
systemrestart: '中斷',
|
systemrestart: '中斷',
|
||||||
starterr: '啟動失敗',
|
starterr: '啟動失敗',
|
||||||
|
uperr: '啟動失敗',
|
||||||
},
|
},
|
||||||
units: {
|
units: {
|
||||||
second: '秒',
|
second: '秒',
|
||||||
|
|
@ -2703,7 +2704,7 @@ const message = {
|
||||||
defaultIpBlackHelper: '從網路收集的一些惡意 IP,阻止其存取',
|
defaultIpBlackHelper: '從網路收集的一些惡意 IP,阻止其存取',
|
||||||
notFoundCount: '404 頻率限制',
|
notFoundCount: '404 頻率限制',
|
||||||
matchValue: '匹配值',
|
matchValue: '匹配值',
|
||||||
headerName: '支援英文、數字、-,長度3-30',
|
headerName: '支持非特殊字元開頭、英文、數字、-,長度3-30',
|
||||||
cdnHelper: '使用 CDN 的網站可以打開此處來取得正確來源 IP',
|
cdnHelper: '使用 CDN 的網站可以打開此處來取得正確來源 IP',
|
||||||
clearLogWarn: '清空日誌將無法復原,是否繼續?',
|
clearLogWarn: '清空日誌將無法復原,是否繼續?',
|
||||||
commonRuleHelper: '規則為模糊匹配',
|
commonRuleHelper: '規則為模糊匹配',
|
||||||
|
|
|
||||||
|
|
@ -303,6 +303,7 @@ const message = {
|
||||||
applyerror: '申请失败',
|
applyerror: '申请失败',
|
||||||
systemrestart: '中断',
|
systemrestart: '中断',
|
||||||
starterr: '启动失败',
|
starterr: '启动失败',
|
||||||
|
uperr: '启动失败',
|
||||||
},
|
},
|
||||||
units: {
|
units: {
|
||||||
second: '秒',
|
second: '秒',
|
||||||
|
|
@ -2691,7 +2692,7 @@ const message = {
|
||||||
defaultIpBlackHelper: '从互联网收集的一些恶意 IP,阻止其访问',
|
defaultIpBlackHelper: '从互联网收集的一些恶意 IP,阻止其访问',
|
||||||
notFoundCount: '404 频率限制',
|
notFoundCount: '404 频率限制',
|
||||||
matchValue: '匹配值',
|
matchValue: '匹配值',
|
||||||
headerName: '支持英文、数字、-,长度3-30',
|
headerName: '支持非特殊字符开头,英文、数字、-,长度3-30',
|
||||||
cdnHelper: '使用 CDN 的网站可以打开此处来获取正确来源 IP',
|
cdnHelper: '使用 CDN 的网站可以打开此处来获取正确来源 IP',
|
||||||
clearLogWarn: '清空日志将无法恢复,是否继续?',
|
clearLogWarn: '清空日志将无法恢复,是否继续?',
|
||||||
commonRuleHelper: '规则为模糊匹配',
|
commonRuleHelper: '规则为模糊匹配',
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@
|
||||||
></highlightjs>
|
></highlightjs>
|
||||||
</div>
|
</div>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row v-if="currentRecord?.taskID">
|
<el-row v-if="currentRecord?.taskID && currentRecord?.taskID != ''">
|
||||||
<LogFile
|
<LogFile
|
||||||
:defaultButton="false"
|
:defaultButton="false"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
|
|
@ -378,6 +378,7 @@ const search = async () => {
|
||||||
if (currentRecord.value?.records) {
|
if (currentRecord.value?.records) {
|
||||||
loadRecord(currentRecord.value);
|
loadRecord(currentRecord.value);
|
||||||
}
|
}
|
||||||
|
console.log(currentRecord.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const forDetail = async (row: Cronjob.Record) => {
|
const forDetail = async (row: Cronjob.Record) => {
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<ContainerLog v-if="activeName === 'log'" :container="containerID" />
|
<ContainerLog v-if="activeName === 'log'" :container="baseInfo.containerID" />
|
||||||
<SlowLog
|
<SlowLog
|
||||||
@loading="changeLoading"
|
@loading="changeLoading"
|
||||||
@refresh="loadBaseInfo"
|
@refresh="loadBaseInfo"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue