add dispatch page for project console feature

This commit is contained in:
Eleven 2021-01-13 22:13:34 +08:00
parent b07ce66b97
commit 8ba0768483
4 changed files with 49 additions and 23 deletions

View File

@ -116,17 +116,22 @@
: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 File from '../node/node-layout/project/project-file';
// import Console from '../node/node-layout/project/project-console';
import Console from '../node/node-layout/project/project-console';
import { getDishPatchList, getReqId, editDispatch, getDispatchWhiteList, deleteDisPatch } from '../../api/dispatch';
import { getNodeProjectList } from '../../api/node'
export default {
components: {
File,
// Console
Console
},
data() {
return {
@ -151,6 +156,7 @@ export default {
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'}},
@ -398,8 +404,13 @@ export default {
//
handleConsole(record) {
this.temp = Object.assign(record);
this.drawerTitle = `控制台(${this.temp.name})`;
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

@ -124,7 +124,7 @@
<!-- 项目控制台组件 -->
<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"

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"