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

socket-to-schemalist #570

Merged
merged 1 commit into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions client/src/components/SchemaView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ import finstanceModal from '@/api/finstance'
// import dataQuerymodel from '@/api/dataquery'
import saveemailTemplate from '@/api/emailtemplate'
import schemalist from '@/pages/user/SchemaList'
import config from '@/config'
const io = require('socket.io-client')
const socket = io(config.socketURI)

export default {
name: 'SchemaView',
Expand Down Expand Up @@ -1198,6 +1201,7 @@ export default {
'_state': this.$route.params.stateid
}, heads)
.then(res => {
console.log('res.data.total', res.data.total)
this.isFlowzLoaded = true
this.dataTotal = res.data.total
if (res.data.data.length > 0) {
Expand Down Expand Up @@ -1285,6 +1289,54 @@ export default {
},
mounted () {
this.init()
if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_created'] === undefined) {
socket.on(this.$route.params.id.replace(/-/g, '_') + '_created', (data) => {
console.log('===created==', data)
if (data._currentStatus && data._state === this.$store.state.stateid) {
if (this.instanceEntries.length < this.entriesTotal) {
this.instanceEntries.push(data)
this.dataData = this.instanceEntries
} else {
console.log('..........')
this.dataTotal++
}
}
})
}
if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_patched'] === undefined) {
socket.on(this.$route.params.id.replace(/-/g, '_') + '_patched', (data) => {
console.log('===patched==', data)
if (!data._currentStatus && data._state === this.$store.state.stateid) {
let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
this.instanceEntries.splice(inx, 1)
this.dataData = this.instanceEntries
}
// let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
// if (finx !== -1 && !data._currentStatus && data._next === null) {
// if (this.flowzList[finx].processList[data._state].count > 0) {
// this.flowzList[finx].processList[data._state].count--
// }
// if (this.flowzList[finx].count > 0) {
// this.flowzList[finx].count--
// }
// }
// let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id })
// this.instanceEntries.splice(inx, 1)
// this.dataData = this.instanceEntries
})
}
// if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_removed'] === undefined) {
// socket.on(this.$route.params.id.replace(/-/g, '_') + '_removed', (data) => {
// console.log('===removed==', data)
// // if (data._currentStatus) {
// // let finx = _.findIndex(this.flowzList, {id: this.$route.params.id})
// // if (finx !== -1) {
// // this.flowzList[finx].processList[data._state].count--
// // this.flowzList[finx].count--
// // }
// // }
// })
// }
},
computed: {
dataCount () {
Expand Down
6 changes: 3 additions & 3 deletions client/src/pages/user/SchemaList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
})
cols.push({
title: 'ID',
key: 'id',
key: '_uuid',
fixed: 'left',
width: 260,
render: (h, params) => {
Expand All @@ -304,13 +304,13 @@
click: () => {
var $temp = $('<input>')
$('body').append($temp)
$temp.val(params.row.id).select()
$temp.val(params.row._uuid).select()
document.execCommand('copy')
this.$Message.info('Copied to Clipboard')
$temp.remove()
}
}
}, params.row.id)
}, params.row._uuid)
}
})
}
Expand Down
4 changes: 4 additions & 0 deletions service/src/services/dflowzdata/dflowzdata.hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ function beforeCreate (hook) {
let tName = hook.params.headers.ftablename.replace(regex, '-')
return hook.app.service('flowz').get(tName).then(res => {
hook.data._currentStatus = true
if (res.processList[hook.data._state].type === 'endevent') {
console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
hook.data._currentStatus = false
}
hook.data._createdAt = new Date().toISOString()
// hook.data._userId = ''
// hook.data._claimUser = ''
Expand Down