fix: 样式调整

This commit is contained in:
ssongliu 2022-10-06 15:31:07 +08:00
parent cc68c82644
commit 01662cec66
3 changed files with 31 additions and 34 deletions

View file

@ -18,11 +18,6 @@ import (
"github.com/robfig/cron/v3"
)
const (
errRecord = "errRecord"
errHandle = "errHandle"
)
type CronjobService struct{}
type ICronjobService interface {

View file

@ -49,20 +49,17 @@ func (u *CronjobService) HandleJob(cronjob *model.Cronjob) {
request, _ := http.NewRequest("GET", cronjob.URL, nil)
response, err := client.Do(request)
if err != nil {
record.Records = errHandle
cronjobRepo.EndRecords(record, constant.StatusFailed, err.Error(), errHandle)
cronjobRepo.EndRecords(record, constant.StatusFailed, err.Error(), string(message))
}
defer response.Body.Close()
message, _ = ioutil.ReadAll(response.Body)
}
if err != nil {
record.Records = errHandle
cronjobRepo.EndRecords(record, constant.StatusFailed, err.Error(), errHandle)
cronjobRepo.EndRecords(record, constant.StatusFailed, err.Error(), string(message))
return
}
record.Records, err = mkdirAndWriteFile(cronjob, record.StartTime, message)
if err != nil {
record.Records = errRecord
global.LOG.Errorf("save file %s failed, err: %v", record.Records, err)
}
cronjobRepo.EndRecords(record, constant.StatusSuccess, "", record.Records)

View file

@ -152,9 +152,12 @@
v-if="dialogData.rowData!.type === 'website' || dialogData.rowData!.type === 'directory'"
>
<el-form-item :label="$t('cronjob.exclusionRules')">
<div v-for="item in dialogData.rowData!.exclusionRules.split(';')" :key="item">
<el-tag>{{ item }}</el-tag>
<div v-if="dialogData.rowData!.exclusionRules">
<div v-for="item in dialogData.rowData!.exclusionRules.split(';')" :key="item">
<el-tag>{{ item }}</el-tag>
</div>
</div>
<span v-else>-</span>
</el-form-item>
</el-col>
</el-row>
@ -191,30 +194,32 @@
<el-row>
<el-col :span="24">
<el-form-item :label="$t('commons.table.records')">
<span
style="color: red"
v-if="currentRecord?.records! === 'errRecord' || currentRecord?.records! === 'errHandle'|| currentRecord?.records! === 'noRecord'"
>
<span style="color: red" v-if="currentRecord?.status! === 'Failed'">
{{ currentRecord?.message }}
</span>
<el-popover
v-else
placement="right"
:width="600"
trigger="click"
style="white-space: pre-wrap"
>
<div style="margin-left: 20px; max-height: 400px; overflow: auto">
<span style="white-space: pre-wrap">
{{ currentRecordDetail }}
</span>
</div>
<template #reference>
<el-button type="primary" link @click="loadRecord(currentRecord?.records!)">
{{ $t('commons.button.expand') }}
</el-button>
</template>
</el-popover>
<div v-else>
<el-popover
placement="right"
:width="600"
trigger="click"
style="white-space: pre-wrap"
>
<div style="margin-left: 20px; max-height: 400px; overflow: auto">
<span style="white-space: pre-wrap">
{{ currentRecordDetail }}
</span>
</div>
<template #reference>
<el-button
type="primary"
link
@click="loadRecord(currentRecord?.records!)"
>
{{ $t('commons.button.expand') }}
</el-button>
</template>
</el-popover>
</div>
</el-form-item>
</el-col>
</el-row>