Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit c5bbc14

Browse files
authored
Merge pull request #570 from FlowzPlatform/issue-504-n5
socket-to-schemalist
2 parents 3021769 + f4a390b commit c5bbc14

File tree

3 files changed

+59
-3
lines changed

3 files changed

+59
-3
lines changed

client/src/components/SchemaView.vue

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ import finstanceModal from '@/api/finstance'
225225
// import dataQuerymodel from '@/api/dataquery'
226226
import saveemailTemplate from '@/api/emailtemplate'
227227
import schemalist from '@/pages/user/SchemaList'
228+
import config from '@/config'
229+
const io = require('socket.io-client')
230+
const socket = io(config.socketURI)
228231
229232
export default {
230233
name: 'SchemaView',
@@ -1198,6 +1201,7 @@ export default {
11981201
'_state': this.$route.params.stateid
11991202
}, heads)
12001203
.then(res => {
1204+
console.log('res.data.total', res.data.total)
12011205
this.isFlowzLoaded = true
12021206
this.dataTotal = res.data.total
12031207
if (res.data.data.length > 0) {
@@ -1285,6 +1289,54 @@ export default {
12851289
},
12861290
mounted () {
12871291
this.init()
1292+
if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_created'] === undefined) {
1293+
socket.on(this.$route.params.id.replace(/-/g, '_') + '_created', (data) => {
1294+
console.log('===created==', data)
1295+
if (data._currentStatus && data._state === this.$store.state.stateid) {
1296+
if (this.instanceEntries.length < this.entriesTotal) {
1297+
this.instanceEntries.push(data)
1298+
this.dataData = this.instanceEntries
1299+
} else {
1300+
console.log('..........')
1301+
this.dataTotal++
1302+
}
1303+
}
1304+
})
1305+
}
1306+
if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_patched'] === undefined) {
1307+
socket.on(this.$route.params.id.replace(/-/g, '_') + '_patched', (data) => {
1308+
console.log('===patched==', data)
1309+
if (!data._currentStatus && data._state === this.$store.state.stateid) {
1310+
let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
1311+
this.instanceEntries.splice(inx, 1)
1312+
this.dataData = this.instanceEntries
1313+
}
1314+
// let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
1315+
// if (finx !== -1 && !data._currentStatus && data._next === null) {
1316+
// if (this.flowzList[finx].processList[data._state].count > 0) {
1317+
// this.flowzList[finx].processList[data._state].count--
1318+
// }
1319+
// if (this.flowzList[finx].count > 0) {
1320+
// this.flowzList[finx].count--
1321+
// }
1322+
// }
1323+
// let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
1324+
// this.instanceEntries.splice(inx, 1)
1325+
// this.dataData = this.instanceEntries
1326+
})
1327+
}
1328+
// if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_removed'] === undefined) {
1329+
// socket.on(this.$route.params.id.replace(/-/g, '_') + '_removed', (data) => {
1330+
// console.log('===removed==', data)
1331+
// // if (data._currentStatus) {
1332+
// // let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
1333+
// // if (finx !== -1) {
1334+
// // this.flowzList[finx].processList[data._state].count--
1335+
// // this.flowzList[finx].count--
1336+
// // }
1337+
// // }
1338+
// })
1339+
// }
12881340
},
12891341
computed: {
12901342
dataCount () {

client/src/pages/user/SchemaList.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@
291291
})
292292
cols.push({
293293
title: 'ID',
294-
key: 'id',
294+
key: '_uuid',
295295
fixed: 'left',
296296
width: 260,
297297
render: (h, params) => {
@@ -304,13 +304,13 @@
304304
click: () => {
305305
var $temp = $('<input>')
306306
$('body').append($temp)
307-
$temp.val(params.row.id).select()
307+
$temp.val(params.row._uuid).select()
308308
document.execCommand('copy')
309309
this.$Message.info('Copied to Clipboard')
310310
$temp.remove()
311311
}
312312
}
313-
}, params.row.id)
313+
}, params.row._uuid)
314314
}
315315
})
316316
}

service/src/services/dflowzdata/dflowzdata.hooks.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ function beforeCreate (hook) {
8383
let tName = hook.params.headers.ftablename.replace(regex, '-')
8484
return hook.app.service('flowz').get(tName).then(res => {
8585
hook.data._currentStatus = true
86+
if (res.processList[hook.data._state].type === 'endevent') {
87+
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
88+
hook.data._currentStatus = false
89+
}
8690
hook.data._createdAt = new Date().toISOString()
8791
// hook.data._userId = ''
8892
// hook.data._claimUser = ''

0 commit comments

Comments
 (0)