mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 00:09:16 +08:00
fix: 修复 Redis 数据库快速命令部分问题 (#5206)
This commit is contained in:
parent
a4a66e1e18
commit
c62232e648
@ -30,21 +30,21 @@ func (b *BaseApi) CreateCommand(c *gin.Context) {
|
||||
}
|
||||
|
||||
// @Tags Redis Command
|
||||
// @Summary Create redis command
|
||||
// @Description 创建 Redis 快速命令
|
||||
// @Summary Save redis command
|
||||
// @Description 保存 Redis 快速命令
|
||||
// @Accept json
|
||||
// @Param request body dto.RedisCommand true "request"
|
||||
// @Success 200
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /hosts/command/redis [post]
|
||||
// @x-panel-log {"bodyKeys":["name","command"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"创建 redis 快捷命令 [name][command]","formatEN":"create quick command for redis [name][command]"}
|
||||
func (b *BaseApi) CreateRedisCommand(c *gin.Context) {
|
||||
// @x-panel-log {"bodyKeys":["name","command"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"保存 redis 快捷命令 [name][command]","formatEN":"save quick command for redis [name][command]"}
|
||||
func (b *BaseApi) SaveRedisCommand(c *gin.Context) {
|
||||
var req dto.RedisCommand
|
||||
if err := helper.CheckBindAndValidate(&req, c); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if err := commandService.CreateRedisCommand(req); err != nil {
|
||||
if err := commandService.SaveRedisCommand(req); err != nil {
|
||||
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
|
||||
return
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ type ICommandRepo interface {
|
||||
PageRedis(limit, offset int, opts ...DBOption) (int64, []model.RedisCommand, error)
|
||||
GetRedis(opts ...DBOption) (model.RedisCommand, error)
|
||||
GetRedisList(opts ...DBOption) ([]model.RedisCommand, error)
|
||||
CreateRedis(command *model.RedisCommand) error
|
||||
SaveRedis(command *model.RedisCommand) error
|
||||
DeleteRedis(opts ...DBOption) error
|
||||
}
|
||||
|
||||
@ -107,8 +107,8 @@ func (u *CommandRepo) Create(command *model.Command) error {
|
||||
return global.DB.Create(command).Error
|
||||
}
|
||||
|
||||
func (u *CommandRepo) CreateRedis(command *model.RedisCommand) error {
|
||||
return global.DB.Create(command).Error
|
||||
func (u *CommandRepo) SaveRedis(command *model.RedisCommand) error {
|
||||
return global.DB.Save(command).Error
|
||||
}
|
||||
|
||||
func (u *CommandRepo) Update(id uint, vars map[string]interface{}) error {
|
||||
|
@ -2,6 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"github.com/1Panel-dev/1Panel/backend/app/dto"
|
||||
"github.com/1Panel-dev/1Panel/backend/app/model"
|
||||
"github.com/1Panel-dev/1Panel/backend/constant"
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/pkg/errors"
|
||||
@ -19,7 +20,7 @@ type ICommandService interface {
|
||||
|
||||
SearchRedisCommandWithPage(search dto.SearchWithPage) (int64, interface{}, error)
|
||||
ListRedisCommand() ([]dto.RedisCommand, error)
|
||||
CreateRedisCommand(commandDto dto.RedisCommand) error
|
||||
SaveRedisCommand(commandDto dto.RedisCommand) error
|
||||
DeleteRedisCommand(ids []uint) error
|
||||
}
|
||||
|
||||
@ -153,15 +154,12 @@ func (u *CommandService) ListRedisCommand() ([]dto.RedisCommand, error) {
|
||||
return dtoCommands, err
|
||||
}
|
||||
|
||||
func (u *CommandService) CreateRedisCommand(commandDto dto.RedisCommand) error {
|
||||
command, _ := commandRepo.GetRedis(commonRepo.WithByName(commandDto.Name))
|
||||
if command.ID != 0 {
|
||||
return constant.ErrRecordExist
|
||||
}
|
||||
func (u *CommandService) SaveRedisCommand(commandDto dto.RedisCommand) error {
|
||||
var command model.RedisCommand
|
||||
if err := copier.Copy(&command, &commandDto); err != nil {
|
||||
return errors.WithMessage(constant.ErrStructTransform, err.Error())
|
||||
}
|
||||
if err := commandRepo.CreateRedis(&command); err != nil {
|
||||
if err := commandRepo.SaveRedis(&command); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
@ -275,6 +275,14 @@ func (u *DatabaseService) Update(req dto.DatabaseUpdate) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
case constant.AppRedis:
|
||||
if _, err := redis_client.NewRedisClient(redis_client.DBInfo{
|
||||
Address: req.Address,
|
||||
Port: req.Port,
|
||||
Password: req.Password,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
case "mysql", "mariadb":
|
||||
if _, err := mysql.NewMysqlClient(client.DBInfo{
|
||||
From: "remote",
|
||||
|
@ -57,7 +57,7 @@ func (s *HostRouter) InitRouter(Router *gin.RouterGroup) {
|
||||
hostRouter.POST("/command/update", baseApi.UpdateCommand)
|
||||
|
||||
hostRouter.GET("/command/redis", baseApi.ListRedisCommand)
|
||||
hostRouter.POST("/command/redis", baseApi.CreateRedisCommand)
|
||||
hostRouter.POST("/command/redis", baseApi.SaveRedisCommand)
|
||||
hostRouter.POST("/command/redis/search", baseApi.SearchRedisCommand)
|
||||
hostRouter.POST("/command/redis/del", baseApi.DeleteRedisCommand)
|
||||
|
||||
|
@ -7674,14 +7674,14 @@ const docTemplate = `{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "创建 Redis 快速命令",
|
||||
"description": "保存 Redis 快速命令",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Redis Command"
|
||||
],
|
||||
"summary": "Create redis command",
|
||||
"summary": "Save redis command",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
@ -7704,8 +7704,8 @@ const docTemplate = `{
|
||||
"name",
|
||||
"command"
|
||||
],
|
||||
"formatEN": "create quick command for redis [name][command]",
|
||||
"formatZH": "创建 redis 快捷命令 [name][command]",
|
||||
"formatEN": "save quick command for redis [name][command]",
|
||||
"formatZH": "保存 redis 快捷命令 [name][command]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
|
@ -7667,14 +7667,14 @@
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "创建 Redis 快速命令",
|
||||
"description": "保存 Redis 快速命令",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Redis Command"
|
||||
],
|
||||
"summary": "Create redis command",
|
||||
"summary": "Save redis command",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "request",
|
||||
@ -7697,8 +7697,8 @@
|
||||
"name",
|
||||
"command"
|
||||
],
|
||||
"formatEN": "create quick command for redis [name][command]",
|
||||
"formatZH": "创建 redis 快捷命令 [name][command]",
|
||||
"formatEN": "save quick command for redis [name][command]",
|
||||
"formatZH": "保存 redis 快捷命令 [name][command]",
|
||||
"paramKeys": []
|
||||
}
|
||||
}
|
||||
|
@ -10069,7 +10069,7 @@ paths:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 创建 Redis 快速命令
|
||||
description: 保存 Redis 快速命令
|
||||
parameters:
|
||||
- description: request
|
||||
in: body
|
||||
@ -10082,7 +10082,7 @@ paths:
|
||||
description: OK
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Create redis command
|
||||
summary: Save redis command
|
||||
tags:
|
||||
- Redis Command
|
||||
x-panel-log:
|
||||
@ -10090,8 +10090,8 @@ paths:
|
||||
bodyKeys:
|
||||
- name
|
||||
- command
|
||||
formatEN: create quick command for redis [name][command]
|
||||
formatZH: 创建 redis 快捷命令 [name][command]
|
||||
formatEN: save quick command for redis [name][command]
|
||||
formatZH: 保存 redis 快捷命令 [name][command]
|
||||
paramKeys: []
|
||||
/hosts/command/redis/del:
|
||||
post:
|
||||
|
@ -78,7 +78,7 @@ export const getRedisCommandList = () => {
|
||||
export const getRedisCommandPage = (params: SearchWithPage) => {
|
||||
return http.post<ResPage<Command.RedisCommand>>(`/hosts/command/redis/search`, params);
|
||||
};
|
||||
export const addRedisCommand = (params: Command.RedisCommand) => {
|
||||
export const saveRedisCommand = (params: Command.RedisCommand) => {
|
||||
return http.post(`/hosts/command/redis`, params);
|
||||
};
|
||||
export const deleteRedisCommand = (params: { ids: number[] }) => {
|
||||
|
@ -185,7 +185,7 @@ const checkSimplePassword = (rule: any, value: any, callback: any) => {
|
||||
if (value === '' || typeof value === 'undefined' || value == null) {
|
||||
callback(new Error(i18n.global.t('commons.rule.simplePassword')));
|
||||
} else {
|
||||
const reg = /^[a-zA-Z0-9]{1}[a-zA-Z0-9_]{5,29}$/;
|
||||
const reg = /^[a-zA-Z0-9]{1}[a-zA-Z0-9_]{0,29}$/;
|
||||
if (!reg.test(value) && value !== '') {
|
||||
callback(new Error(i18n.global.t('commons.rule.simplePassword')));
|
||||
} else {
|
||||
|
@ -171,7 +171,7 @@ const message = {
|
||||
'Supports non-special characters starting with English, Chinese, numbers, .- and _, length 1-128',
|
||||
userName: 'Support English, Chinese, numbers and _ length 3-30',
|
||||
simpleName: 'Supports non-underscore starting, English, numbers, _, length 3-30',
|
||||
simplePassword: 'Supports non-underscore starting, English, numbers, _, length 6-30',
|
||||
simplePassword: 'Supports non-underscore starting, English, numbers, _, length 1-30',
|
||||
dbName: 'Supports non-special character starting, including English, Chinese, numbers, .-_, with a length of 1-64',
|
||||
imageName: 'Support English, numbers, :/.-_, length 1-150',
|
||||
volumeName: 'Support English, numbers, .-_, length 2-30',
|
||||
|
@ -171,7 +171,7 @@ const message = {
|
||||
commonName: '支持非特殊字元開頭,英文、中文、數字、.-和_,長度1-128',
|
||||
userName: '支持英文、中文、數字和_,長度3-30',
|
||||
simpleName: '支持非底線開頭,英文、數字、_,長度3-30',
|
||||
simplePassword: '支持非底線開頭,英文、數字、_,長度6-30',
|
||||
simplePassword: '支持非底線開頭,英文、數字、_,長度1-30',
|
||||
dbName: '支持非特殊字符開頭,英文、中文、數字、.-_,長度1-64',
|
||||
imageName: '支持英文、數字、:/.-_,長度1-150',
|
||||
volumeName: '支持英文、數字、.-和_,長度2-30',
|
||||
@ -1205,7 +1205,7 @@ const message = {
|
||||
sessionTimeoutError: '最小超時時間為 300 秒',
|
||||
sessionTimeoutHelper: '如果用戶超過 {0} 秒未操作面板,面板將自動退出登錄',
|
||||
systemIP: '伺服器地址',
|
||||
proxy: '伺服器代理',
|
||||
proxy: '代理伺服器',
|
||||
proxyHelper: '設置代理伺服器後,將在以下場景中生效:',
|
||||
proxyHelper1: '應用商店的安裝包下載和同步',
|
||||
proxyHelper2: '系統版本升級及獲取更新說明',
|
||||
|
@ -171,7 +171,7 @@ const message = {
|
||||
commonName: '支持非特殊字符开头,英文、中文、数字、.-和_,长度1-128',
|
||||
userName: '支持英文、中文、数字和_,长度3-30',
|
||||
simpleName: '支持非下划线开头,英文、数字、_,长度3-30',
|
||||
simplePassword: '支持非下划线开头,英文、数字、_,长度6-30',
|
||||
simplePassword: '支持非下划线开头,英文、数字、_,长度1-30',
|
||||
dbName: '支持非特殊字符开头,英文、中文、数字、.-_,长度1-64',
|
||||
imageName: '支持英文、数字、:/.-_,长度1-150',
|
||||
volumeName: '支持英文、数字、.-和_,长度2-30',
|
||||
@ -1206,7 +1206,7 @@ const message = {
|
||||
sessionTimeoutError: '最小超时时间为 300 秒',
|
||||
sessionTimeoutHelper: '如果用户超过 {0} 秒未操作面板,面板将自动退出登录',
|
||||
systemIP: '服务器地址',
|
||||
proxy: '服务器代理',
|
||||
proxy: '代理服务器',
|
||||
proxyHelper: '设置代理服务器后,将在以下场景中生效:',
|
||||
proxyHelper1: '应用商店的安装包下载和同步',
|
||||
proxyHelper2: '系统版本升级及获取更新说明',
|
||||
|
@ -92,6 +92,13 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
|
||||
form.fromRepo = true;
|
||||
form.imageName = '';
|
||||
repos.value = params.repos;
|
||||
form.repoID = 1;
|
||||
for (const item of repos.value) {
|
||||
if (item.name === 'Docker Hub' && item.downloadUrl === 'docker.io') {
|
||||
form.repoID = item.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
buttonDisabled.value = false;
|
||||
logInfo.value = '';
|
||||
showLog.value = false;
|
||||
|
@ -21,22 +21,46 @@
|
||||
<el-table-column type="selection" fix />
|
||||
<el-table-column :label="$t('commons.table.name')" min-width="50">
|
||||
<template #default="{ row }">
|
||||
<el-input v-if="row.isOn" v-model="row.name" />
|
||||
<el-input v-if="row.lineStatus === 'create' || row.lineStatus === 'edit'" v-model="row.name" />
|
||||
<span v-else>{{ row.name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('terminal.quickCommand')" min-width="120">
|
||||
<template #default="{ row }">
|
||||
<el-input v-if="row.isOn" v-model="row.command" />
|
||||
<span v-else>{{ row.name }}</span>
|
||||
<el-input
|
||||
v-if="row.lineStatus === 'create' || row.lineStatus === 'edit'"
|
||||
v-model="row.command"
|
||||
/>
|
||||
<span v-else>{{ row.command }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column min-width="40">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="handleCmdCreate(scope.row)">
|
||||
<el-button
|
||||
v-if="scope.row.lineStatus === 'create'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleCmdSave(scope.row)"
|
||||
>
|
||||
{{ $t('commons.button.save') }}
|
||||
</el-button>
|
||||
<el-button link type="primary" @click="handleCmdDelete(scope.$index)">
|
||||
<el-button
|
||||
v-if="!scope.row.lineStatus || scope.row.lineStatus === 'saved'"
|
||||
link
|
||||
type="primary"
|
||||
@click="scope.row.lineStatus = 'create'"
|
||||
>
|
||||
{{ $t('commons.button.edit') }}
|
||||
</el-button>
|
||||
<el-button v-if="scope.row.lineStatus === 'create'" link type="primary" @click="search()">
|
||||
{{ $t('commons.button.cancel') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.lineStatus !== 'create'"
|
||||
link
|
||||
type="primary"
|
||||
@click="handleCmdDelete(scope.$index)"
|
||||
>
|
||||
{{ $t('commons.button.delete') }}
|
||||
</el-button>
|
||||
</template>
|
||||
@ -55,7 +79,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Command } from '@/api/interface/command';
|
||||
import { addRedisCommand, deleteRedisCommand, getRedisCommandPage } from '@/api/modules/host';
|
||||
import { saveRedisCommand, deleteRedisCommand, getRedisCommandPage } from '@/api/modules/host';
|
||||
import { reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||
@ -87,21 +111,20 @@ const handleCmdAdd = () => {
|
||||
let item = {
|
||||
name: '',
|
||||
command: '',
|
||||
isOn: true,
|
||||
lineStatus: 'create',
|
||||
};
|
||||
data.value.push(item);
|
||||
};
|
||||
const handleCmdDelete = (index: number) => {
|
||||
batchDelete(data.value[index]);
|
||||
data.value.splice(index, 1);
|
||||
};
|
||||
|
||||
const handleCmdCreate = async (row: any) => {
|
||||
const handleCmdSave = async (row: any) => {
|
||||
loading.value = true;
|
||||
await addRedisCommand(row)
|
||||
await saveRedisCommand(row)
|
||||
.then(() => {
|
||||
loading.value = false;
|
||||
row.isOn = false;
|
||||
row.lineStatus = 'saved';
|
||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||
search();
|
||||
})
|
||||
|
@ -51,20 +51,19 @@
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
</template>
|
||||
<template #toolbar v-if="!isOnSetting && redisIsExist">
|
||||
<div :class="{ mask: redisStatus != 'Running' }">
|
||||
<template #toolbar v-if="!isOnSetting && currentDB">
|
||||
<div :class="{ mask: redisStatus != 'Running' && currentDB.from === 'local' }">
|
||||
<el-button type="primary" plain @click="onChangePassword">
|
||||
{{ $t('database.databaseConnInfo') }}
|
||||
</el-button>
|
||||
<el-button @click="goRemoteDB" type="primary" plain>
|
||||
{{ $t('database.remoteDB') }}
|
||||
</el-button>
|
||||
<el-button type="primary" plain @click="goDashboard" icon="Position">Redis-Commander</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</LayoutContent>
|
||||
|
||||
<div v-if="redisIsExist && !isOnSetting" class="mt-5">
|
||||
<div v-if="currentDB && !isOnSetting" class="mt-5">
|
||||
<Terminal
|
||||
:style="{ height: `calc(100vh - ${loadHeight()})` }"
|
||||
:key="isRefresh"
|
||||
@ -75,7 +74,7 @@
|
||||
v-if="redisStatus !== 'Running' || (currentDB.from === 'remote' && !redisCliExist)"
|
||||
:style="{ height: `calc(100vh - ${loadHeight()})`, 'background-color': '#000' }"
|
||||
:description="
|
||||
currentDB.from !== 'remote'
|
||||
currentDB.from === 'remote'
|
||||
? $t('commons.service.serviceNotStarted', ['Redis'])
|
||||
: $t('database.redisCliHelper')
|
||||
"
|
||||
@ -116,7 +115,6 @@
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<PortJumpDialog ref="dialogPortJumpRef" />
|
||||
<QuickCmd ref="dialogQuickCmdRef" @reload="loadQuickCmd" />
|
||||
</div>
|
||||
</template>
|
||||
@ -126,10 +124,9 @@ import Setting from '@/views/database/redis/setting/index.vue';
|
||||
import Password from '@/views/database/redis/password/index.vue';
|
||||
import Terminal from '@/components/terminal/index.vue';
|
||||
import AppStatus from '@/components/app-status/index.vue';
|
||||
import PortJumpDialog from '@/components/port-jump/index.vue';
|
||||
import QuickCmd from '@/views/database/redis/command/index.vue';
|
||||
import { nextTick, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { CheckAppInstalled, GetAppPort } from '@/api/modules/app';
|
||||
import { CheckAppInstalled } from '@/api/modules/app';
|
||||
import router from '@/routers';
|
||||
import { GlobalStore } from '@/store';
|
||||
import { listDatabases, checkRedisCli, installRedisCli } from '@/api/modules/database';
|
||||
@ -149,7 +146,6 @@ const redisIsExist = ref(false);
|
||||
const redisStatus = ref();
|
||||
const terminalShow = ref(false);
|
||||
|
||||
const redisCommandPort = ref();
|
||||
const commandVisible = ref(false);
|
||||
|
||||
const redisCliExist = ref();
|
||||
@ -165,8 +161,6 @@ const quickCmd = ref();
|
||||
const quickCmdList = ref([]);
|
||||
const dialogQuickCmdRef = ref();
|
||||
|
||||
const dialogPortJumpRef = ref();
|
||||
|
||||
const isRefresh = ref();
|
||||
|
||||
const onSetting = async () => {
|
||||
@ -180,13 +174,6 @@ const loadHeight = () => {
|
||||
return globalStore.openMenuTabs ? '470px' : '380px';
|
||||
};
|
||||
|
||||
const goDashboard = async () => {
|
||||
if (redisCommandPort.value === 0) {
|
||||
commandVisible.value = true;
|
||||
return;
|
||||
}
|
||||
dialogPortJumpRef.value.acceptParams({ port: redisCommandPort.value });
|
||||
};
|
||||
const getAppDetail = (key: string) => {
|
||||
router.push({ name: 'AppAll', query: { install: key } });
|
||||
};
|
||||
@ -197,11 +184,6 @@ const goRemoteDB = async () => {
|
||||
router.push({ name: 'Redis-Remote' });
|
||||
};
|
||||
|
||||
const loadDashboardPort = async () => {
|
||||
const res = await GetAppPort('redis-commander', '');
|
||||
redisCommandPort.value = res.data;
|
||||
};
|
||||
|
||||
const passwordRef = ref();
|
||||
const onChangePassword = async () => {
|
||||
passwordRef.value!.acceptParams({ database: currentDBName.value });
|
||||
@ -331,8 +313,14 @@ const closeTerminal = async (isKeepShow: boolean) => {
|
||||
};
|
||||
|
||||
const checkCliValid = async () => {
|
||||
const res = await checkRedisCli();
|
||||
redisCliExist.value = res.data;
|
||||
await checkRedisCli()
|
||||
.then((res) => {
|
||||
redisCliExist.value = res.data;
|
||||
loadDBOptions();
|
||||
})
|
||||
.catch(() => {
|
||||
loadDBOptions();
|
||||
});
|
||||
};
|
||||
const installCli = async () => {
|
||||
loading.value = true;
|
||||
@ -341,6 +329,7 @@ const installCli = async () => {
|
||||
loading.value = false;
|
||||
redisCliExist.value = true;
|
||||
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||
reOpenTerminal();
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
@ -363,9 +352,7 @@ const onSetQuickCmd = () => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
loadDBOptions();
|
||||
loadQuickCmd();
|
||||
loadDashboardPort();
|
||||
checkCliValid();
|
||||
});
|
||||
const onBefore = () => {
|
||||
|
@ -95,7 +95,7 @@ const acceptParams = (params: DialogProps): void => {
|
||||
dialogData.value.rowData.version = '6.x';
|
||||
}
|
||||
if (dialogData.value.rowData.version.startsWith('7.')) {
|
||||
dialogData.value.rowData.version = '7,x';
|
||||
dialogData.value.rowData.version = '7.x';
|
||||
}
|
||||
title.value = i18n.global.t('database.' + dialogData.value.title + 'RemoteDB');
|
||||
drawerVisible.value = true;
|
||||
|
@ -128,13 +128,6 @@
|
||||
prop="description"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
:label="$t('commons.table.createdAt')"
|
||||
show-overflow-tooltip
|
||||
:formatter="dateFormat"
|
||||
:min-width="80"
|
||||
prop="createdAt"
|
||||
/>
|
||||
<fu-table-operations
|
||||
width="200px"
|
||||
:buttons="buttons"
|
||||
@ -174,7 +167,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { dateFormat } from '@/utils/util';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { deleteFtp, searchFtp, updateFtp, syncFtp, operateFtp, getFtpBase } from '@/api/modules/toolbox';
|
||||
import OperateDialog from '@/views/toolbox/ftp/operate/index.vue';
|
||||
@ -363,9 +355,6 @@ const buttons = [
|
||||
},
|
||||
{
|
||||
label: i18n.global.t('commons.button.delete'),
|
||||
disabled: (row: Toolbox.FtpInfo) => {
|
||||
return row.status === 'deleted';
|
||||
},
|
||||
click: (row: Toolbox.FtpInfo) => {
|
||||
onDelete(row);
|
||||
},
|
||||
|
@ -10,7 +10,7 @@
|
||||
<DrawerHeader header="FTP" :resource="paginationConfig.user" :back="handleClose" />
|
||||
</template>
|
||||
<el-select @change="search" class="p-w-200" clearable v-model="paginationConfig.operation">
|
||||
<template #prefix>{{ $t('container.lines') }}</template>
|
||||
<template #prefix>{{ $t('commons.table.operate') }}</template>
|
||||
<el-option value="PUT" :label="$t('file.upload')" />
|
||||
<el-option value="GET" :label="$t('file.download')" />
|
||||
</el-select>
|
||||
|
@ -111,8 +111,8 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) return;
|
||||
loading.value = true;
|
||||
if (dialogData.value.title === 'edit') {
|
||||
loading.value = true;
|
||||
await updateFtp(dialogData.value.rowData)
|
||||
.then(() => {
|
||||
loading.value = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user