fix: 获取镜像导入相应结果

This commit is contained in:
ssongliu 2023-03-10 18:05:02 +08:00 committed by ssongliu
parent 23bb379afe
commit 4992281e36
6 changed files with 20 additions and 9 deletions

View file

@ -1,7 +1,6 @@
package dto
type DaemonJsonUpdateByFile struct {
Path string `json:"path" validate:"required"`
File string `json:"file"`
}

View file

@ -163,7 +163,7 @@ func (u *DockerService) UpdateConf(req dto.DaemonJsonConf) error {
}
func (u *DockerService) UpdateConfByFile(req dto.DaemonJsonUpdateByFile) error {
file, err := os.OpenFile(req.Path, os.O_WRONLY|os.O_TRUNC, 0640)
file, err := os.OpenFile(constant.DaemonJsonPath, os.O_WRONLY|os.O_TRUNC, 0640)
if err != nil {
return err
}

View file

@ -5,8 +5,10 @@ import (
"context"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"strings"
@ -249,9 +251,17 @@ func (u *ImageService) ImageLoad(req dto.ImageLoad) error {
if err != nil {
return err
}
if _, err := client.ImageLoad(context.TODO(), file, true); err != nil {
res, err := client.ImageLoad(context.TODO(), file, true)
if err != nil {
return err
}
content, err := ioutil.ReadAll(res.Body)
if err != nil {
return err
}
if strings.Contains(string(content), "Error") {
return errors.New(string(content))
}
return nil
}

View file

@ -13,7 +13,7 @@
<div style="float: left">
<el-input type="number" v-model.number="variables.long_query_time" />
</div>
<el-button style="float: left; margin-left: 10px" @click="openSlowLogs" type="primary">
<el-button style="float: left; margin-left: 10px" @click="openSlowLogs">
{{ $t('commons.button.save') }}
</el-button>
<div style="float: left; margin-left: 20px">
@ -152,6 +152,9 @@ const onSave = async () => {
.then(() => {
emit('loading', false);
isOnEdit.value = false;
if (variables.slow_query_log !== 'ON') {
detailShow.value = false;
}
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
})
.catch(() => {

View file

@ -139,7 +139,7 @@ import Status from '@/views/database/redis/setting/status/index.vue';
import Persistence from '@/views/database/redis/setting/persistence/index.vue';
import { loadRedisConf, updateRedisConf, updateRedisConfByFile } from '@/api/modules/database';
import i18n from '@/lang';
import { Rules } from '@/global/form-rules';
import { checkNumberRange, Rules } from '@/global/form-rules';
import { ChangePort, GetAppDefaultConfig } from '@/api/modules/app';
import { loadBaseDir } from '@/api/modules/setting';
import { MsgSuccess } from '@/utils/message';
@ -162,9 +162,9 @@ const form = reactive({
});
const rules = reactive({
port: [Rules.port],
timeout: [Rules.number],
maxclients: [Rules.number],
maxmemory: [Rules.number],
timeout: [Rules.number, checkNumberRange(0, 9999999)],
maxclients: [Rules.number, checkNumberRange(1, 999999)],
maxmemory: [Rules.number, checkNumberRange(0, 999999)],
});
const activeName = ref('conf');

View file

@ -294,7 +294,6 @@ const onSave = async (formEl: FormInstance | undefined, type: string) => {
};
const loadform = async () => {
console.log('adqwdqw');
form.saves = [];
const res = await redisPersistenceConf();
form.appendonly = res.data?.appendonly;