mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-11-30 10:58:14 +08:00
优化新增文件、删除文件目录加载两次问题 #I5DMKG
项目文件管理新增重命名文件功能
This commit is contained in:
parent
91d3891dd6
commit
8c0ebb070c
@ -5,7 +5,8 @@
|
||||
### 🐣 新增功能
|
||||
|
||||
1. 【agent】插件端白名单新增 nginx 安装路径,解决 nginx reload 问题(感谢[@all-around-badass](https://gitee.com/all-around-badass) [Gitee issues I5CJR7](https://gitee.com/dromara/Jpom/issues/I5CJR7) )
|
||||
4. 【server】通过私人令牌导入仓库支持自建 GitLab
|
||||
2. 【server】通过私人令牌导入仓库支持自建 GitLab
|
||||
3. 【agent】项目文件管理新增重命名文件功能
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
@ -14,6 +15,7 @@
|
||||
3. 【agent】文件备份对比流程异步处理,避免大文件对比耗时阻塞(感谢@ʟᴊx💎💎)
|
||||
4. 【server】修复通过私人令牌导入仓库表格主键指定错误
|
||||
5. 【server】修复 GitLab 通过私人令牌导入仓库接口分页错误
|
||||
6. 【agent】优化新增文件、删除文件目录加载两次问题(感谢[@all-around-badass](https://gitee.com/all-around-badass) [Gitee issues I5DMKG](https://gitee.com/dromara/Jpom/issues/I5DMKG) )
|
||||
|
||||
------
|
||||
|
||||
|
@ -471,7 +471,7 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
* @param unFolder true/1 为文件夹,false/0 为文件
|
||||
* @return json
|
||||
*/
|
||||
@RequestMapping(value = "new_file_folder.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@PostMapping(value = "new_file_folder.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public String newFileFolder(String id, String levelName, @ValidatorItem String filename, String unFolder) {
|
||||
NodeProjectInfoModel projectInfoModel = projectInfoService.getItem(id);
|
||||
Assert.notNull(projectInfoModel, "没有对应到项目");
|
||||
@ -486,4 +486,27 @@ public class ProjectFileControl extends BaseAgentController {
|
||||
return JsonMessage.getString(200, "操作成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文件夹/文件
|
||||
*
|
||||
* @param id 项目ID
|
||||
* @param levelName 二级文件夹名
|
||||
* @param filename 文件名
|
||||
* @param newname 新文件名
|
||||
* @return json
|
||||
*/
|
||||
@PostMapping(value = "rename.json", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public String rename(String id, String levelName, @ValidatorItem String filename, String newname) {
|
||||
NodeProjectInfoModel projectInfoModel = getProjectInfoModel();
|
||||
File file = FileUtil.file(projectInfoModel.allLib(), StrUtil.emptyToDefault(levelName, FileUtil.FILE_SEPARATOR), filename);
|
||||
File newFile = FileUtil.file(projectInfoModel.allLib(), StrUtil.emptyToDefault(levelName, FileUtil.FILE_SEPARATOR), newname);
|
||||
|
||||
Assert.state(FileUtil.exist(file), "文件不存在");
|
||||
Assert.state(!FileUtil.exist(newFile), "文件名已经存在拉");
|
||||
|
||||
FileUtil.rename(file, newname, false);
|
||||
|
||||
return JsonMessage.getString(200, "操作成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -124,6 +124,7 @@ public enum NodeUrl {
|
||||
|
||||
Manage_File_Remote_Download("/manage/file/remote_download"),
|
||||
MANAGE_FILE_NEW_FILE_FOLDER("/manage/file/new_file_folder.json"),
|
||||
MANAGE_FILE_RENAME_FILE_FOLDER("/manage/file/rename.json"),
|
||||
|
||||
Manage_File_Download("/manage/file/download"),
|
||||
|
||||
|
@ -132,4 +132,16 @@ public class ProjectFileControl extends BaseServerController {
|
||||
return NodeForward.request(getNode(), getRequest(), NodeUrl.MANAGE_FILE_NEW_FILE_FOLDER).toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改文件名
|
||||
*
|
||||
* @return json
|
||||
*/
|
||||
@GetMapping(value = "rename_file_folder", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(cls = ClassFeature.PROJECT_FILE, method = MethodFeature.EDIT)
|
||||
public String renameFileFolder() {
|
||||
return NodeForward.request(getNode(), getRequest(), NodeUrl.MANAGE_FILE_RENAME_FILE_FOLDER).toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -578,6 +578,19 @@ export function newFileFolder(params) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改目录或文件名称
|
||||
* @param params
|
||||
* @returns {id, levelName, filename,newname} params x
|
||||
*/
|
||||
export function renameFileFolder(params) {
|
||||
return axios({
|
||||
url: "/node/manage/file/rename_file_folder",
|
||||
method: "get",
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 所有的运行模式
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
<!-- 侧边栏 节点管理菜单 -->
|
||||
<a-layout-sider theme="light" :class="`node-sider jpom-node-sider ${this.fullScreenFlag ? 'sider-scroll' : 'sider-full-screen'}`">
|
||||
<a-menu theme="light" mode="inline" @openChange="openChange" :default-selected-keys="selectedKeys" :openKeys="openKey">
|
||||
<template v-for="menu in nodeMenuList">
|
||||
<template v-for="(menu, index) in nodeMenuList">
|
||||
<a-sub-menu v-if="menu.childs" :key="menu.id" :class="menu.id">
|
||||
<span slot="title">
|
||||
<a-icon :type="menu.icon_v3" />
|
||||
@ -13,7 +13,7 @@
|
||||
<span>{{ subMenu.title }}</span>
|
||||
</a-menu-item>
|
||||
</a-sub-menu>
|
||||
<a-menu-item v-else :key="menu.id" @click="handleMenuClick(menu.id)">
|
||||
<a-menu-item v-else :key="menu.id + index" @click="handleMenuClick(menu.id)">
|
||||
<a-icon :type="menu.icon_v3" />
|
||||
<span>{{ menu.title }}</span>
|
||||
</a-menu-item>
|
||||
@ -41,7 +41,7 @@
|
||||
</a-layout>
|
||||
</template>
|
||||
<script>
|
||||
import { getNodeMenu } from "@/api/menu";
|
||||
import {getNodeMenu} from "@/api/menu";
|
||||
import Welcome from "@/pages/node/node-layout/welcome";
|
||||
import ProjectList from "@/pages/node/node-layout/project/project-list";
|
||||
import JdkList from "@/pages/node/node-layout/project/jdk-list";
|
||||
@ -56,7 +56,8 @@ import Cache from "@/pages/node/node-layout/system/cache";
|
||||
import Log from "@/pages/node/node-layout/system/log.vue";
|
||||
import Upgrade from "@/pages/node/node-layout/system/upgrade.vue";
|
||||
import ConfigFile from "@/pages/node/node-layout/system/config-file.vue";
|
||||
import { mapGetters } from "vuex";
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Welcome,
|
||||
@ -191,7 +192,7 @@ export default {
|
||||
min-height: calc(100vh - 85px)
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
|
||||
.sider-full-screen {
|
||||
height: calc(100vh - 75px);
|
||||
overflow-y: scroll;
|
||||
|
@ -34,13 +34,13 @@
|
||||
<a-dropdown :disabled="!Object.keys(this.tempNode).length">
|
||||
<a-button size="small" type="primary" @click="(e) => e.preventDefault()">新建</a-button>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item @click="handleAddFolder">
|
||||
<a-menu-item @click="handleAddFile(1)">
|
||||
<a-space>
|
||||
<a-icon type="folder-add" />
|
||||
<a-space>新建目录</a-space>
|
||||
</a-space>
|
||||
</a-menu-item>
|
||||
<a-menu-item @click="handleAddFile">
|
||||
<a-menu-item @click="handleAddFile(2)">
|
||||
<a-space>
|
||||
<a-icon type="file-add" />
|
||||
<a-space>新建空白文件</a-space>
|
||||
@ -64,11 +64,14 @@
|
||||
</template>
|
||||
<a-tooltip slot="filename" slot-scope="text, record" placement="topLeft" :title="text">
|
||||
<a-dropdown :trigger="['contextmenu']">
|
||||
<span>{{ text }}</span>
|
||||
<div>{{ text }}</div>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item key="1">
|
||||
<a-button icon="bars" @click="goReadFile(record)" :disabled="!record.textFileEdit" type="link"> 阅读文件 </a-button>
|
||||
</a-menu-item>
|
||||
<a-menu-item key="2">
|
||||
<a-button icon="highlight" @click="handleRenameFile(record)" type="link"> 重命名 </a-button>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</a-tooltip>
|
||||
@ -174,6 +177,16 @@
|
||||
</a-row>
|
||||
</a-space>
|
||||
</a-modal>
|
||||
<!-- 从命名文件/文件夹 -->
|
||||
<a-modal v-model="renameFileFolderVisible" width="300px" :title="`重命名`" :footer="null" :maskClosable="true">
|
||||
<a-space direction="vertical" style="width: 100%">
|
||||
<a-input v-model="fileFolderName" placeholder="输入新名称" />
|
||||
|
||||
<a-row type="flex" justify="center">
|
||||
<a-button type="primary" :disabled="fileFolderName.length === 0" @click="renameFileFolder">确认</a-button>
|
||||
</a-row>
|
||||
</a-space>
|
||||
</a-modal>
|
||||
</a-layout-content>
|
||||
</a-layout>
|
||||
<!-- 查看备份列表 -->
|
||||
@ -195,8 +208,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getFileList, downloadProjectFile, noFileModes, deleteProjectFile, uploadProjectFile, readFile, updateFile, remoteDownload, newFileFolder } from "@/api/node-project";
|
||||
import { ZIP_ACCEPT } from "@/utils/const";
|
||||
import {deleteProjectFile, downloadProjectFile, getFileList, newFileFolder, noFileModes, readFile, remoteDownload, renameFileFolder, updateFile, uploadProjectFile} from "@/api/node-project";
|
||||
import {ZIP_ACCEPT} from "@/utils/const";
|
||||
import codeEditor from "@/components/codeEditor";
|
||||
import projectFileBackup from "./project-file-backup.vue";
|
||||
|
||||
@ -252,7 +265,7 @@ export default {
|
||||
uploading: false,
|
||||
percentage: 0,
|
||||
checkBox: false,
|
||||
tableHeight: "80vh",
|
||||
// tableHeight: "80vh",
|
||||
defaultProps: {
|
||||
children: "children",
|
||||
label: "filename",
|
||||
@ -276,6 +289,8 @@ export default {
|
||||
// 目录1 文件2 标识
|
||||
addFileOrFolderType: 1,
|
||||
fileFolderName: "",
|
||||
oldFileFolderName: "",
|
||||
renameFileFolderVisible: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -695,7 +710,7 @@ export default {
|
||||
message: res.msg,
|
||||
});
|
||||
this.loadData();
|
||||
this.loadFileList();
|
||||
// this.loadFileList();
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -708,14 +723,9 @@ export default {
|
||||
// const filePath = this.uploadPath + record.filename;
|
||||
this.$emit("goReadFile", this.uploadPath, record.filename);
|
||||
},
|
||||
handleAddFolder() {
|
||||
handleAddFile(type) {
|
||||
this.addFileFolderVisible = true;
|
||||
this.addFileOrFolderType = 1;
|
||||
this.fileFolderName = "";
|
||||
},
|
||||
handleAddFile() {
|
||||
this.addFileFolderVisible = true;
|
||||
this.addFileOrFolderType = 2;
|
||||
this.addFileOrFolderType = type;
|
||||
this.fileFolderName = "";
|
||||
},
|
||||
// 确认新增文件 目录
|
||||
@ -734,6 +744,30 @@ export default {
|
||||
});
|
||||
this.addFileFolderVisible = false;
|
||||
this.loadData();
|
||||
// this.loadFileList();
|
||||
}
|
||||
});
|
||||
},
|
||||
handleRenameFile(record) {
|
||||
this.renameFileFolderVisible = true;
|
||||
this.fileFolderName = record.filename;
|
||||
this.oldFileFolderName = record.filename;
|
||||
},
|
||||
// 确认修改文件 目录名称
|
||||
renameFileFolder() {
|
||||
const params = {
|
||||
nodeId: this.nodeId,
|
||||
id: this.projectId,
|
||||
levelName: this.uploadPath,
|
||||
newname: this.fileFolderName,
|
||||
filename: this.oldFileFolderName,
|
||||
};
|
||||
renameFileFolder(params).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.$notification.success({
|
||||
message: res.msg,
|
||||
});
|
||||
this.renameFileFolderVisible = false;
|
||||
this.loadFileList();
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user