mirror of https://github.com/1Panel-dev/1Panel
fix: 获取镜像导入相应结果
parent
23bb379afe
commit
4992281e36
|
@ -1,7 +1,6 @@
|
||||||
package dto
|
package dto
|
||||||
|
|
||||||
type DaemonJsonUpdateByFile struct {
|
type DaemonJsonUpdateByFile struct {
|
||||||
Path string `json:"path" validate:"required"`
|
|
||||||
File string `json:"file"`
|
File string `json:"file"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ func (u *DockerService) UpdateConf(req dto.DaemonJsonConf) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *DockerService) UpdateConfByFile(req dto.DaemonJsonUpdateByFile) 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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,10 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -249,9 +251,17 @@ func (u *ImageService) ImageLoad(req dto.ImageLoad) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<div style="float: left">
|
<div style="float: left">
|
||||||
<el-input type="number" v-model.number="variables.long_query_time" />
|
<el-input type="number" v-model.number="variables.long_query_time" />
|
||||||
</div>
|
</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') }}
|
{{ $t('commons.button.save') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<div style="float: left; margin-left: 20px">
|
<div style="float: left; margin-left: 20px">
|
||||||
|
@ -152,6 +152,9 @@ const onSave = async () => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
emit('loading', false);
|
emit('loading', false);
|
||||||
isOnEdit.value = false;
|
isOnEdit.value = false;
|
||||||
|
if (variables.slow_query_log !== 'ON') {
|
||||||
|
detailShow.value = false;
|
||||||
|
}
|
||||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|
|
@ -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 Persistence from '@/views/database/redis/setting/persistence/index.vue';
|
||||||
import { loadRedisConf, updateRedisConf, updateRedisConfByFile } from '@/api/modules/database';
|
import { loadRedisConf, updateRedisConf, updateRedisConfByFile } from '@/api/modules/database';
|
||||||
import i18n from '@/lang';
|
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 { ChangePort, GetAppDefaultConfig } from '@/api/modules/app';
|
||||||
import { loadBaseDir } from '@/api/modules/setting';
|
import { loadBaseDir } from '@/api/modules/setting';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
|
@ -162,9 +162,9 @@ const form = reactive({
|
||||||
});
|
});
|
||||||
const rules = reactive({
|
const rules = reactive({
|
||||||
port: [Rules.port],
|
port: [Rules.port],
|
||||||
timeout: [Rules.number],
|
timeout: [Rules.number, checkNumberRange(0, 9999999)],
|
||||||
maxclients: [Rules.number],
|
maxclients: [Rules.number, checkNumberRange(1, 999999)],
|
||||||
maxmemory: [Rules.number],
|
maxmemory: [Rules.number, checkNumberRange(0, 999999)],
|
||||||
});
|
});
|
||||||
|
|
||||||
const activeName = ref('conf');
|
const activeName = ref('conf');
|
||||||
|
|
|
@ -294,7 +294,6 @@ const onSave = async (formEl: FormInstance | undefined, type: string) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadform = async () => {
|
const loadform = async () => {
|
||||||
console.log('adqwdqw');
|
|
||||||
form.saves = [];
|
form.saves = [];
|
||||||
const res = await redisPersistenceConf();
|
const res = await redisPersistenceConf();
|
||||||
form.appendonly = res.data?.appendonly;
|
form.appendonly = res.data?.appendonly;
|
||||||
|
|
Loading…
Reference in New Issue