diff --git a/client/src/components/SchemaView.vue b/client/src/components/SchemaView.vue index e14d816..37991da 100644 --- a/client/src/components/SchemaView.vue +++ b/client/src/components/SchemaView.vue @@ -914,11 +914,9 @@ export default { // data: obj.data[0] // } let saveObj = obj.data[0] - console.log('Save Object: ', saveObj) delete saveObj['_index'] delete saveObj['_rowKey'] saveObj._state = this.$route.params.stateid - console.log('this.item.currentStatus', this.item.currentStatus) if (this.isMultiple) { saveObj._nextTarget = this.nextTarget.value } @@ -930,7 +928,6 @@ export default { } } // if (fheaders !== null) { - console.log('saveObj', saveObj) dflowzdata.patch(saveObj.id, saveObj, null, fheaders) .then(res => { this.id = null diff --git a/client/src/masterLayout/SideBar.vue b/client/src/masterLayout/SideBar.vue index 69f631b..63f48f6 100644 --- a/client/src/masterLayout/SideBar.vue +++ b/client/src/masterLayout/SideBar.vue @@ -84,15 +84,24 @@ import config from '@/config' import axios from 'axios' const io = require('socket.io-client') const socket = io(config.socketURI) -socket.on('5a6e2e8b_cfeb_4060_b420_6ca95184b884_created', data => { - // console.log('===d8finstance created==', data) -}) -socket.on('5a6e2e8b_cfeb_4060_b420_6ca95184b884_updated', data => { - // console.log('===d6finstance updated==', data) -}) -socket.on('5a6e2e8b_cfeb_4060_b420_6ca95184b884_removed', data => { - // console.log('===d6finstance removed==', data) -}) +// socket.on('5a6e2e8b_cfeb_4060_b420_6ca95184b884_created', data => { +// console.log('===d8finstance created==', data) +// if (data._currentStatus) { +// console.log('data._currentStatus', data._currentStatus, this.flowzList) +// let finx = _.findIndex(this.flowzList, {id: '5a6e2e8b_cfeb_4060_b420_6ca95184b884'.replace(/_/g, '-')}) +// if (finx !== -1) { +// console.log('Index', finx) +// // this.flowzList[finx].count += 1 +// this.flowzList[finx].processList[data._state].count++ +// } +// } +// }) +// socket.on('5a6e2e8b_cfeb_4060_b420_6ca95184b884_updated', data => { +// console.log('===d6finstance updated==', data) +// }) +// socket.on('5a6e2e8b_cfeb_4060_b420_6ca95184b884_removed', data => { +// console.log('===d6finstance removed==', data) +// }) export default { data () { return { @@ -105,6 +114,11 @@ export default { } }, created () { + // console.log('created', socket._callbacks) + }, + beforeDestroy () { + // alert('beforeDestroy') + // console.log(socket, socket.disconnected) }, methods: { getByOrder (array) { @@ -179,6 +193,44 @@ export default { p.count = 0 return p }) + if (socket._callbacks['$' + m.id.replace(/-/g, '_') + '_created'] === undefined) { + socket.on(m.id.replace(/-/g, '_') + '_created', (data) => { + // console.log('===created==', data) + if (data._currentStatus) { + let finx = _.findIndex(this.flowzList, {id: m.id}) + if (finx !== -1) { + this.flowzList[finx].processList[data._state].count++ + this.flowzList[finx].count++ + } + } + }) + } + if (socket._callbacks['$' + m.id.replace(/-/g, '_') + '_patched'] === undefined) { + socket.on(m.id.replace(/-/g, '_') + '_patched', (data) => { + // console.log('===patched==', data) + let finx = _.findIndex(this.flowzList, {id: m.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-- + } + } + }) + } + if (socket._callbacks['$' + m.id.replace(/-/g, '_') + '_removed'] === undefined) { + socket.on(m.id.replace(/-/g, '_') + '_removed', (data) => { + // console.log('===removed==', data) + if (data._currentStatus) { + let finx = _.findIndex(this.flowzList, {id: m.id}) + if (finx !== -1) { + this.flowzList[finx].processList[data._state].count-- + this.flowzList[finx].count-- + } + } + }) + } return m }) this.loading = false @@ -399,37 +451,6 @@ export default { this.init() }, feathers: { - '5a6e2e8b_cfeb_4060_b420_6ca95184b884_created': { - created (data) { - console.log('>>>>>>>>>>', data) - } - }, - 'dflowzdata': { - created (data) { - // console.log('created', data) - // let finx = _.findIndex(this.flowzList, {id: data.fid}) - // if (finx !== -1) { - // // this.flowzList[finx].count += 1 - // this.setCounters(this.flowzList[finx]) - // } - }, - updated (data) { - console.log('updated', data) - // let finx = _.findIndex(this.flowzList, {id: data.fid}) - // if (finx !== -1) { - // // this.flowzList[finx].count += 1 - // this.setCounters(this.flowzList[finx]) - // } - }, - removed (data) { - console.log('removed', data) - // let finx = _.findIndex(this.flowzList, {id: data.fid}) - // if (finx !== -1) { - // // this.flowzList[finx].count += 1 - // this.setCounters(this.flowzList[finx]) - // } - } - }, 'flowz': { created (data) { if (this.$store.state.role === 1) { diff --git a/service/src/middleware/index.js b/service/src/middleware/index.js index be5dad4..913153b 100644 --- a/service/src/middleware/index.js +++ b/service/src/middleware/index.js @@ -17,7 +17,8 @@ module.exports = function () { 'flowzdata': ['update', 'patch'], 'schema': ['create','update', 'patch', 'remove'], 'bpmnplugins': ['create','update', 'patch', 'remove'], - 'emailtemplate': ['create','update', 'patch', 'remove'] + 'emailtemplate': ['create','update', 'patch', 'remove'], + 'dflowzdata': ['create','update', 'patch', 'remove'] }; subscription.moduleResource.registerAppModule = registerAppModule; diff --git a/service/src/services/dflowzdata/dflowzdata.class.js b/service/src/services/dflowzdata/dflowzdata.class.js index c188c40..89d42b4 100644 --- a/service/src/services/dflowzdata/dflowzdata.class.js +++ b/service/src/services/dflowzdata/dflowzdata.class.js @@ -19,7 +19,7 @@ class Service { this.app.io.emit(this.service.options.name+'_updated', data); }); this.on('patched',(data) => { - this.app.io.emit(this.service.options.name+'_updated', data); + this.app.io.emit(this.service.options.name+'_patched', data); }); this.on('removed',(data) => { this.app.io.emit(this.service.options.name+'_removed', data); diff --git a/service/src/services/dflowzdata/dflowzdata.hooks.js b/service/src/services/dflowzdata/dflowzdata.hooks.js index 5db8229..301e87a 100644 --- a/service/src/services/dflowzdata/dflowzdata.hooks.js +++ b/service/src/services/dflowzdata/dflowzdata.hooks.js @@ -64,7 +64,7 @@ let beforeFind = function (hook) { function beforeCreate (hook) { try { - // console.log('before create ================================', hook.data, hook.params) + console.log('before create ================================', hook.params) hook.params.done = true if (hook.params.headers.ftablename !== undefined && hook.data._state !== undefined) { let regex = /_/g