Feature: add notification for single rename of manage page

This commit is contained in:
萌萌哒赫萝 2023-08-21 01:38:52 -07:00
parent e89b3ca6d1
commit 19f2b18a6a
8 changed files with 13 additions and 11 deletions

View File

@ -842,6 +842,7 @@ MANAGE_BUCKET_DELETE_SUCCESS: Deletion successful
MANAGE_BUCKET_DELETE_FAIL: Deletion failed MANAGE_BUCKET_DELETE_FAIL: Deletion failed
MANAGE_BUCKET_DELETE_CANCEL: Deletion has been cancelled MANAGE_BUCKET_DELETE_CANCEL: Deletion has been cancelled
MANAGE_BUCKET_RENAME_INFO_MSG: The new file name is the same as the original file name, no need to rename MANAGE_BUCKET_RENAME_INFO_MSG: The new file name is the same as the original file name, no need to rename
MANAGE_BUCKET_RENAME_SUCCESS: Rename successful
MANAGE_BUCKET_RENAME_ERROR_MSG: Rename failed MANAGE_BUCKET_RENAME_ERROR_MSG: Rename failed
MANAGE_BUCKET_DOWNLOAD_COLUMN_FILENAME: File name MANAGE_BUCKET_DOWNLOAD_COLUMN_FILENAME: File name
MANAGE_BUCKET_DOWNLOAD_COLUMN_FINISHTIME: Completion time MANAGE_BUCKET_DOWNLOAD_COLUMN_FINISHTIME: Completion time

View File

@ -846,6 +846,7 @@ MANAGE_BUCKET_DELETE_SUCCESS: 删除成功
MANAGE_BUCKET_DELETE_FAIL: 删除失败 MANAGE_BUCKET_DELETE_FAIL: 删除失败
MANAGE_BUCKET_DELETE_CANCEL: 已取消删除 MANAGE_BUCKET_DELETE_CANCEL: 已取消删除
MANAGE_BUCKET_RENAME_INFO_MSG: 新文件名与原文件名相同,无需重命名 MANAGE_BUCKET_RENAME_INFO_MSG: 新文件名与原文件名相同,无需重命名
MANAGE_BUCKET_RENAME_SUCCESS: 重命名成功
MANAGE_BUCKET_RENAME_ERROR_MSG: 重命名失败 MANAGE_BUCKET_RENAME_ERROR_MSG: 重命名失败
MANAGE_BUCKET_DOWNLOAD_COLUMN_FILENAME: 文件名 MANAGE_BUCKET_DOWNLOAD_COLUMN_FILENAME: 文件名
MANAGE_BUCKET_DOWNLOAD_COLUMN_FINISHTIME: 完成时间 MANAGE_BUCKET_DOWNLOAD_COLUMN_FINISHTIME: 完成时间

View File

@ -842,6 +842,7 @@ MANAGE_BUCKET_DELETE_SUCCESS: 刪除成功
MANAGE_BUCKET_DELETE_FAIL: 刪除失敗 MANAGE_BUCKET_DELETE_FAIL: 刪除失敗
MANAGE_BUCKET_DELETE_CANCEL: 已取消删除 MANAGE_BUCKET_DELETE_CANCEL: 已取消删除
MANAGE_BUCKET_RENAME_INFO_MSG: 新文件名和原文件名相同,無需重命名 MANAGE_BUCKET_RENAME_INFO_MSG: 新文件名和原文件名相同,無需重命名
MANAGE_BUCKET_RENAME_SUCCESS: 重命名成功
MANAGE_BUCKET_RENAME_ERROR_MSG: 重命名失敗 MANAGE_BUCKET_RENAME_ERROR_MSG: 重命名失敗
MANAGE_BUCKET_DOWNLOAD_COLUMN_FILENAME: 文件名 MANAGE_BUCKET_DOWNLOAD_COLUMN_FILENAME: 文件名
MANAGE_BUCKET_DOWNLOAD_COLUMN_FINISHTIME: 完成時間 MANAGE_BUCKET_DOWNLOAD_COLUMN_FINISHTIME: 完成時間

View File

@ -214,7 +214,6 @@ const handlePluginUpdate = async (fullName: string | string[]) => {
const handleUpdateAllPlugin = () => { const handleUpdateAllPlugin = () => {
ipcMain.on('updateAllPlugin', async (event: IpcMainEvent, list: string[]) => { ipcMain.on('updateAllPlugin', async (event: IpcMainEvent, list: string[]) => {
console.log(list)
handlePluginUpdate(list) handlePluginUpdate(list)
}) })
} }

View File

@ -262,10 +262,9 @@ class SftpApi {
this.ctx.close() this.ctx.close()
if (this.isRequestSuccess(res.code)) { if (this.isRequestSuccess(res.code)) {
const formatedLSRes = this.formatLSResult(res.stdout, prefix) const formatedLSRes = this.formatLSResult(res.stdout, prefix)
console.log(formatedLSRes)
if (formatedLSRes.length) { if (formatedLSRes.length) {
formatedLSRes.forEach((item: listDirResult) => { formatedLSRes.forEach((item: listDirResult) => {
const relativePath = path.relative(baseDir, item.key) const relativePath = path.relative(baseDir, item.key.startsWith('/') ? item.key : `/${item.key}`)
const relative = webPath && urlPrefix + `/${path.join(webPath, relativePath)}`.replace(/\\/g, '/').replace(/\/+/g, '/') const relative = webPath && urlPrefix + `/${path.join(webPath, relativePath)}`.replace(/\\/g, '/').replace(/\/+/g, '/')
if (item.isDir) { if (item.isDir) {
result.fullList.push(this.formatFolder(item, webPath ? relative : urlPrefix, !!webPath)) result.fullList.push(this.formatFolder(item, webPath ? relative : urlPrefix, !!webPath))
@ -298,7 +297,7 @@ class SftpApi {
let result = false let result = false
try { try {
await this.connectClient() await this.connectClient()
const res = await this.ctx.execCommand(`mv -f ${oldKey} ${newKey}`) const res = await this.ctx.execCommand(`mv -f "/${oldKey.replace(/^\/+/, '')}" "/${newKey.replace(/^\/+/, '')}"`)
this.ctx.close() this.ctx.close()
result = this.isRequestSuccess(res.code) result = this.isRequestSuccess(res.code)
} catch (error) { } catch (error) {
@ -312,7 +311,7 @@ class SftpApi {
let result = false let result = false
try { try {
await this.connectClient() await this.connectClient()
const res = await this.ctx.execCommand(`rm -f ${key}`) const res = await this.ctx.execCommand(`rm -f "/${key.replace(/^\/+/, '')}"`)
this.ctx.close() this.ctx.close()
result = this.isRequestSuccess(res.code) result = this.isRequestSuccess(res.code)
} catch (error) { } catch (error) {
@ -326,7 +325,7 @@ class SftpApi {
let result = false let result = false
try { try {
await this.connectClient() await this.connectClient()
const res = await this.ctx.execCommand(`rm -rf ${key}`) const res = await this.ctx.execCommand(`rm -rf "/${key.replace(/^\/+/, '')}"`)
this.ctx.close() this.ctx.close()
result = this.isRequestSuccess(res.code) result = this.isRequestSuccess(res.code)
} catch (error) { } catch (error) {
@ -370,7 +369,7 @@ class SftpApi {
let result = false let result = false
try { try {
await this.connectClient() await this.connectClient()
const res = await this.ctx.execCommand(`mkdir -p ${key}`) const res = await this.ctx.execCommand(`mkdir -p "/${key.replace(/^\/+/, '')}"`)
this.ctx.close() this.ctx.close()
result = this.isRequestSuccess(res.code) result = this.isRequestSuccess(res.code)
} catch (error) { } catch (error) {

View File

@ -43,7 +43,7 @@ class SSHClient {
} }
try { try {
remote = this.changeWinStylePathToUnix(remote) remote = this.changeWinStylePathToUnix(remote)
const script = `rm -f ${remote}` const script = `rm -f "${remote}"`
return await this.exec(script) return await this.exec(script)
} catch (err: any) { } catch (err: any) {
return false return false

View File

@ -1616,7 +1616,7 @@ const isIgnoreCase = computed(() => manageStore.config.settings.isIgnoreCase ??
// //
const isShowCreateNewFolder = computed(() => ['aliyun', 'github', 'local', 'qiniu', 'tcyun', 's3plist', 'upyun', 'webdavplist', 'sftp'].includes(currentPicBedName.value)) const isShowCreateNewFolder = computed(() => ['aliyun', 'github', 'local', 'qiniu', 'tcyun', 's3plist', 'upyun', 'webdavplist', 'sftp'].includes(currentPicBedName.value))
const isShowPresignedUrl = computed(() => ['aliyun', 'github', 'qiniu', 's3plist', 'tcyun', 'webdavplist', 'sftp'].includes(currentPicBedName.value)) const isShowPresignedUrl = computed(() => ['aliyun', 'github', 'qiniu', 's3plist', 'tcyun', 'webdavplist'].includes(currentPicBedName.value))
// //
@ -3047,11 +3047,11 @@ function singleRename () {
}) })
}) })
} }
ElMessage.success($T('MANAGE_BUCKET_RENAME_SUCCESS'))
} else { } else {
ElMessage.error($T('MANAGE_BUCKET_RENAME_ERROR_MSG')) ElMessage.error($T('MANAGE_BUCKET_RENAME_ERROR_MSG'))
} }
} })
)
} }
async function getPreSignedUrl (item: any) { async function getPreSignedUrl (item: any) {

View File

@ -800,6 +800,7 @@ interface ILocales {
MANAGE_BUCKET_DELETE_FAIL: string MANAGE_BUCKET_DELETE_FAIL: string
MANAGE_BUCKET_DELETE_CANCEL: string MANAGE_BUCKET_DELETE_CANCEL: string
MANAGE_BUCKET_RENAME_INFO_MSG: string MANAGE_BUCKET_RENAME_INFO_MSG: string
MANAGE_BUCKET_RENAME_SUCCESS: string
MANAGE_BUCKET_RENAME_ERROR_MSG: string MANAGE_BUCKET_RENAME_ERROR_MSG: string
MANAGE_BUCKET_DOWNLOAD_COLUMN_FILENAME: string MANAGE_BUCKET_DOWNLOAD_COLUMN_FILENAME: string
MANAGE_BUCKET_DOWNLOAD_COLUMN_FINISHTIME: string MANAGE_BUCKET_DOWNLOAD_COLUMN_FINISHTIME: string