Merge branch 'dev' of https://gitee.com/keepbx/Jpom into dev

This commit is contained in:
idiotalex@163.com 2021-01-14 13:53:02 +08:00
commit f18a1fd4b5
6 changed files with 152 additions and 46 deletions

View File

@ -35,6 +35,34 @@ export function editDispatch(params) {
})
}
/**
* 编辑分发项目
* @param {
* id: 分发 ID
* name: 分发名称
* reqId: 请求 ID
* type: 类型 add | edit
* afterOpt: 发布后操作
* runMode: 运行方式
* mainClass: 启动类
* javaExtDirsCp: 目录地址
* whitelistDirectory: 白名单地址
* lib: lib
* add_xxx: xxx 表示添加的节点信息
* xxx_token: xxx 节点的 webhook 地址
* xxx_jvm: jvm 参数
* xxx_args: args 参数
* xxx_javaCopyIds: xxx 节点副本 ID 如果有副本还需要加上 xxx_jvm_${副本ID} | xxx_args_${副本ID} 参数
* } params
*/
export function editDispatchProject(params) {
return axios({
url: '/outgiving/save_project',
method: 'post',
data: params
})
}
/**
* 删除分发
* @param {*} id 分发 ID

View File

@ -20,7 +20,8 @@
</template>
<template slot="operation" slot-scope="text, record">
<a-button type="primary" @click="handleDispatch(record)">分发文件</a-button>
<a-button type="primary" @click="handleEdit(record)">编辑</a-button>
<a-button type="primary" v-if="record.outGivingProject" @click="handleEditDispatchProject(record)">编辑</a-button>
<a-button type="primary" v-else @click="handleEditDispatch(record)">编辑</a-button>
<a-button type="danger" @click="handleDelete(record)">删除</a-button>
</template>
<!-- 嵌套表格 -->
@ -36,6 +37,10 @@
<a-tooltip slot="lastOutGivingTime" slot-scope="text" placement="topLeft" :title="text">
<span>{{ text }}</span>
</a-tooltip>
<template slot="child-operation" slot-scope="text, record">
<a-button type="primary" @click="handleFile(record)">文件</a-button>
<a-button type="primary" @click="handleConsole(record)">控制台</a-button>
</template>
</a-table>
</a-table>
<!-- 添加关联项目 -->
@ -105,14 +110,31 @@
<a-select-option :key="3">顺序重启(有重启失败将继续)</a-select-option>
</a-select>
</a-form-model-item>
</a-form-model>
</a-modal>
<!-- 项目文件组件 -->
<a-drawer :title="drawerTitle" placement="right" width="85vw"
:visible="drawerFileVisible" @close="onFileClose">
<file v-if="drawerFileVisible" :nodeId="temp.nodeId" :projectId="temp.projectId" />
</a-drawer>
<!-- 项目控制台组件 -->
<a-drawer :title="drawerTitle" placement="right" width="85vw"
:visible="drawerConsoleVisible" @close="onConsoleClose">
<console v-if="drawerConsoleVisible" :nodeId="temp.nodeId" :projectId="temp.projectId" />
</a-drawer>
</div>
</template>
<script>
import { getDishPatchList, getReqId, editDispatch, getDispatchWhiteList, deleteDisPatch } from '../../api/dispatch';
import File from '../node/node-layout/project/project-file';
import Console from '../node/node-layout/project/project-console';
import { getDishPatchList, getReqId, editDispatch, /*editDispatchProject,*/ getDispatchWhiteList, deleteDisPatch } from '../../api/dispatch';
import { getNodeProjectList } from '../../api/node'
export default {
components: {
File,
Console
},
data() {
return {
loading: false,
@ -134,6 +156,9 @@ export default {
],
linkDispatchVisible: false,
editDispatchVisible: false,
drawerTitle: '',
drawerFileVisible: false,
drawerConsoleVisible: false,
columns: [
{title: '分发 ID', dataIndex: 'id', width: 100, ellipsis: true, scopedSlots: {customRender: 'id'}},
{title: '分发名称', dataIndex: 'name', width: 150, ellipsis: true, scopedSlots: {customRender: 'name'}},
@ -146,7 +171,7 @@ export default {
{title: '项目状态', dataIndex: 'status', width: 150, ellipsis: true, scopedSlots: {customRender: 'status'}},
{title: '分发状态', dataIndex: 'statusMsg', width: 180},
{title: '最后分发时间', dataIndex: 'lastOutGivingTime', width: 180, ellipsis: true, scopedSlots: {customRender: 'lastOutGivingTime'}},
{title: '操作', dataIndex: 'operation', scopedSlots: {customRender: 'operation'}, width: 200, align: 'left'}
{title: '操作', dataIndex: 'child-operation', scopedSlots: {customRender: 'child-operation'}, width: 200, align: 'left'}
],
rules: {
id: [
@ -247,7 +272,7 @@ export default {
this.loadData();
this.loadNodeProjectList();
},
//
//
handleLink() {
this.temp = {
type: 'add'
@ -255,8 +280,8 @@ export default {
this.loadReqId();
this.linkDispatchVisible = true;
},
//
handleEdit(record) {
//
handleEditDispatch(record) {
this.temp = Object.assign({}, record)
this.temp.type = 'edit';
this.targetKeys = [];
@ -270,7 +295,7 @@ export default {
this.loadReqId();
this.linkDispatchVisible = true;
},
//
//
handleAdd() {
this.temp = {
type: 'add'
@ -278,6 +303,14 @@ export default {
this.loadAccesList();
this.editDispatchVisible = true;
},
//
handleEditDispatchProject(record) {
this.temp = Object.assign({}, record)
this.temp.type = 'edit';
this.loadAccesList();
this.loadReqId();
this.editDispatchVisible = true;
},
//
selectProject(value) {
this.targetKeys = [];
@ -367,6 +400,27 @@ export default {
})
}
});
},
//
handleFile(record) {
this.temp = Object.assign(record);
this.drawerTitle = `文件管理(${this.temp.projectId})`
this.drawerFileVisible = true;
},
//
onFileClose() {
this.drawerFileVisible = false;
},
//
handleConsole(record) {
this.temp = Object.assign(record);
this.drawerTitle = `控制台(${this.temp.projectId})`;
this.drawerConsoleVisible = true;
},
//
onConsoleClose() {
this.drawerConsoleVisible = false;
this.handleFilter();
}
}
}

View File

@ -44,15 +44,15 @@
</div>
</template>
<script>
import { getProjectLogSize, downloadProjectLogFile, getLogBackList, downloadProjectLogBackFile, deleteProjectLogBackFile } from '../../../../api/node-project';
import { getProjectById, getProjectLogSize, downloadProjectLogFile, getLogBackList, downloadProjectLogBackFile, deleteProjectLogBackFile } from '../../../../api/node-project';
import { mapGetters } from 'vuex';
export default {
props: {
node: {
type: Object
nodeId: {
type: String
},
project: {
type: Object
projectId: {
type: String
},
replica: {
type: Object
@ -63,6 +63,7 @@ export default {
},
data() {
return {
project: {},
loading: false,
socket: null,
//
@ -83,17 +84,31 @@ export default {
]),
socketUrl() {
const protocol = location.protocol === 'https' ? 'wss://' : 'ws://';
return `${protocol}${location.host}/console?userId=${this.getToken}&projectId=${this.project.id}&nodeId=${this.node.id}&type=console&copyId=${this.copyId}`;
return `${protocol}${location.host}/console?userId=${this.getToken}&projectId=${this.projectId}&nodeId=${this.nodeId}&type=console&copyId=${this.copyId}`;
}
},
mounted() {
this.loadProject();
this.initWebSocket();
this.loadFileSize();
},
beforeDestroy() {
this.socket.close();
},
methods: {
//
loadProject() {
const params = {
id: this.projectId,
nodeId: this.nodeId
}
getProjectById(params).then(res => {
if (res.code === 200) {
this.project = res.data;
//
this.loadFileSize();
}
})
},
//
initWebSocket() {
this.logContext = '';
@ -142,7 +157,7 @@ export default {
sendMsg(op) {
const data = {
op: op,
projectId: this.project.id,
projectId: this.projectId,
copyId: this.copyId
}
this.socket.send(JSON.stringify(data));
@ -150,8 +165,8 @@ export default {
//
loadFileSize() {
const params = {
nodeId: this.node.id,
id: this.project.id,
nodeId: this.nodeId,
id: this.projectId,
copyId: this.copyId
}
getProjectLogSize(params).then(res => {
@ -196,8 +211,8 @@ export default {
});
//
const params = {
nodeId: this.node.id,
id: this.project.id,
nodeId: this.nodeId,
id: this.projectId,
copyId: this.copyId
}
// blob
@ -222,8 +237,8 @@ export default {
this.detailData = [];
this.lobbackVisible = true;
const params = {
nodeId: this.node.id,
id: this.project.id
nodeId: this.nodeId,
id: this.projectId
}
getLogBackList(params).then(res => {
if (res.code === 200) {
@ -240,8 +255,8 @@ export default {
});
//
const params = {
nodeId: this.node.id,
id: this.project.id,
nodeId: this.nodeId,
id: this.projectId,
copyId: this.copyId,
key: record.filename
}
@ -266,8 +281,8 @@ export default {
onOk: () => {
//
const params = {
nodeId: this.node.id,
id: this.project.id,
nodeId: this.nodeId,
id: this.projectId,
copyId: this.copyId,
name: record.filename
}

View File

@ -44,11 +44,11 @@
import { getFileList, downloadProjectFile, deleteProjectFile, uploadProjectFile } from '../../../../api/node-project';
export default {
props: {
node: {
type: Object
nodeId: {
type: String
},
project: {
type: Object
projectId: {
type: String
}
},
data() {
@ -120,8 +120,8 @@ export default {
this.uploadFileList.forEach(file => {
const formData = new FormData();
formData.append('file', file);
formData.append('nodeId', this.node.id);
formData.append('id', this.project.id);
formData.append('nodeId', this.nodeId);
formData.append('id', this.projectId);
formData.append('levelName', this.tempNode.path);
//
uploadProjectFile(formData).then(res => {
@ -148,8 +148,8 @@ export default {
}
//
const params = {
nodeId: this.node.id,
id: this.project.id,
nodeId: this.nodeId,
id: this.projectId,
path: node.dataRef.path
}
this.fileList = [];
@ -194,8 +194,8 @@ export default {
}
//
const params = {
nodeId: this.node.id,
id: this.project.id,
nodeId: this.nodeId,
id: this.projectId,
path: this.tempNode.path
}
this.fileList = [];
@ -226,8 +226,8 @@ export default {
onOk: () => {
//
const params = {
nodeId: this.node.id,
id: this.project.id,
nodeId: this.nodeId,
id: this.projectId,
type: 'clear'
}
//
@ -251,8 +251,8 @@ export default {
});
//
const params = {
nodeId: this.node.id,
id: this.project.id,
nodeId: this.nodeId,
id: this.projectId,
levelName: record.levelName,
filename: record.filename
}
@ -277,8 +277,8 @@ export default {
onOk: () => {
//
const params = {
nodeId: this.node.id,
id: this.project.id,
nodeId: this.nodeId,
id: this.projectId,
levelName: record.levelName,
filename: record.filename
}

View File

@ -119,12 +119,12 @@
<!-- 项目文件组件 -->
<a-drawer :title="drawerTitle" placement="right" width="85vw"
:visible="drawerFileVisible" @close="onFileClose">
<file v-if="drawerFileVisible" :node="node" :project="temp" />
<file v-if="drawerFileVisible" :nodeId="node.id" :projectId="temp.id" />
</a-drawer>
<!-- 项目控制台组件 -->
<a-drawer :title="drawerTitle" placement="right" width="85vw"
:visible="drawerConsoleVisible" @close="onConsoleClose">
<console v-if="drawerConsoleVisible" :node="node" :project="temp" />
<console v-if="drawerConsoleVisible" :nodeId="node.id" :projectId="temp.id" />
</a-drawer>
<!-- 项目监控组件 -->
<a-drawer :title="drawerTitle" placement="right" width="85vw"
@ -292,8 +292,16 @@ export default {
}
getProjectById(params).then(res => {
if (res.code === 200) {
this.temp = res.data;
this.temp.type = 'edit';
this.temp = {
...res.data,
type: 'edit'
};
if (!this.temp.javaCopyItemList) {
this.temp = {
...this.temp,
javaCopyItemList: []
};
}
this.editProjectVisible = true;
}
})
@ -313,6 +321,7 @@ export default {
args: '',
deleteAble: true
})
console.log(this.temp)
},
//
handleDeleteReplica(reeplica) {

View File

@ -15,7 +15,7 @@
<!-- 项目控制台组件 -->
<a-drawer :title="drawerTitle" placement="right" width="85vw"
:visible="drawerConsoleVisible" @close="onConsoleClose">
<console v-if="drawerConsoleVisible" :node="node" :project="project" :replica="temp" :copyId="temp.id" />
<console v-if="drawerConsoleVisible" :nodeId="node.id" :projectId="project.id" :replica="temp" :copyId="temp.id" />
</a-drawer>
<!-- 项目监控组件 -->
<a-drawer :title="drawerTitle" placement="right" width="85vw"