From 6bfed62be976ac44480c277f26adefd2db239ba0 Mon Sep 17 00:00:00 2001 From: nikitam Date: Mon, 1 Oct 2018 17:32:48 +0530 Subject: [PATCH 1/2] analtics-pagination-and-show-hide-column-wise-view --- client/src/pages/flow/analytics.vue | 67 ++++++++++++++++--- .../services/dflowzdata/dflowzdata.hooks.js | 2 +- 2 files changed, 60 insertions(+), 9 deletions(-) diff --git a/client/src/pages/flow/analytics.vue b/client/src/pages/flow/analytics.vue index 7d0d8fa..f445856 100644 --- a/client/src/pages/flow/analytics.vue +++ b/client/src/pages/flow/analytics.vue @@ -86,13 +86,13 @@
-
+
-
+
@@ -289,7 +289,7 @@ export default { this.init() }, rowClassName (row, index) { - return row.className + return ((row.hasOwnProperty('_first')) ? '' : row._uuid + ' notfirst') }, viewChange (item) { if (item === 1) { @@ -531,8 +531,8 @@ export default { '$sort[_createdAt]': 1 }, heads) .then(res => { - console.log('res: ', res) - this.total = res.data.total.length + // console.log('res: ', res) + this.total = res.data.total let tableDataArr = [] for (let item of res.data.data) { let value = { @@ -555,12 +555,16 @@ export default { for (let inst in tableDataArr) { for (let items in tableDataArr[inst]) { if (items === 'states') { - for (let item of tableDataArr[inst][items]) { + for (let [inx, item] of tableDataArr[inst][items].entries()) { + if (inx === 0) { + item._first = true + } this.colviewData.push(item) } } } } + // console.log('this.colviewData', this.colviewData) this.tableLoading = false }).catch(e => { this.tableLoading = false @@ -636,7 +640,47 @@ export default { title: 'ID', key: '_uuid', fixed: 'left', - width: 280 + width: 280, + render: (h, params) => { + if (params.row._first) { + return h('div', [ + h('span', { + attrs: { + title: 'Click to Copy', + class: 'clickToCopy' + }, + on: { + click: () => { + let $temp = $('') + $('body').append($temp) + $temp.val(params.row._uuid).select() + document.execCommand('copy') + this.$Message.info('Copied to Clipboard') + $temp.remove() + } + } + }, params.row._uuid), + h('span', { + attrs: { + class: 'btn btn-default btn-sm showHideBtn' + }, + on: { + click: () => { + $('.' + params.row._uuid).toggle() + } + } + }, [ + h('i', { + attrs: { + class: 'fa fa-angle-down' + } + }) + ]) + ]) + } else { + return h('span', '') + } + } // render: (h, params) => { // if (params.row.hasOwnProperty('first')) { // if (params.row.first) { @@ -740,7 +784,14 @@ export default { { title: 'Task', key: '_state', - width: 150 + width: 150, + render: (h, params) => { + if (this.flowzData.processList[params.row._state].name && this.flowzData.processList[params.row._state].name !== '') { + return h('span', this.flowzData.processList[params.row._state].name) + } else { + return h('span', params.row._state) + } + } } ] this.colviewData = [] diff --git a/service/src/services/dflowzdata/dflowzdata.hooks.js b/service/src/services/dflowzdata/dflowzdata.hooks.js index 4e39007..3972054 100644 --- a/service/src/services/dflowzdata/dflowzdata.hooks.js +++ b/service/src/services/dflowzdata/dflowzdata.hooks.js @@ -58,7 +58,7 @@ let beforeFind = function (hook) { let value = hook.params.query.$group delete hook.params.query.$group const query = hook.service.service.createQuery(hook.params.query); - hook.params.rethinkdb = query.group(value) + hook.params.rethinkdb = query.group(value).ungroup() } if (query.$search !== undefined) { hook.service.service.options.name = hook.params.headers.ftablename; From 7512ac1e94b4455d768645cbd5c33061c723ff6c Mon Sep 17 00:00:00 2001 From: nikitam Date: Mon, 1 Oct 2018 19:39:25 +0530 Subject: [PATCH 2/2] new-flow-table-generated-and-socket-changes --- client/src/components/SchemaView.vue | 233 ++++++++++++++-------- client/src/masterLayout/SideBar.vue | 168 ++++++++-------- service/src/services/flowz/flowz.hooks.js | 20 +- 3 files changed, 254 insertions(+), 167 deletions(-) diff --git a/client/src/components/SchemaView.vue b/client/src/components/SchemaView.vue index 009f7be..d8a1385 100644 --- a/client/src/components/SchemaView.vue +++ b/client/src/components/SchemaView.vue @@ -225,9 +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) +// import config from '@/config' +// const io = require('socket.io-client') +// const socket = io(config.socketURI) export default { name: 'SchemaView', @@ -1373,85 +1373,77 @@ export default { this.jumperLinks = objectArr } }, - beforeDestroy () { - for (let item of socket.subs) { - item.destroy() - } - }, mounted () { - for (let item of socket.subs) { - item.destroy() - } 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(data._currentStatus && data._state, this.$route.params.stateid) - if (data._currentStatus && data._state === this.$route.params.stateid) { - if (this.instanceEntries.length < this.entriesTotal) { - this.instanceEntries.push(data) - this.dataData = this.instanceEntries - } else { - console.log('..........') - this.dataTotal++ - } - } else { - let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data._previous }) - this.instanceEntries.splice(inx, 1) - } - }) - } - if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_patched'] === undefined) { - socket.on(this.$route.params.id.replace(/-/g, '_') + '_patched', (data) => { - if (this.$store.state.role === 1) { - if (data._currentStatus && data._state === this.$route.params.stateid) { - let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id }) - this.instanceEntries.splice(inx, 1) - this.instanceEntries.push(data) - this.dataData = this.instanceEntries - } - } - console.log(this.$store.state.role === 2, data) - if (this.$store.state.role === 2 && data !== undefined) { - console.log('dataClaim', this.dataClaim) - console.log('dataClaim', data) - console.log('dataUnclaim', this.dataUnclaim) - if (data._claimUser === '') { - let inx = _.findIndex(this.dataUnclaim, (o) => { return o.id === data.id }) - this.dataUnclaim.splice(inx, 1) - this.dataClaim.push(data) - console.log(inx) - } else { - let inx = _.findIndex(this.dataClaim, (o) => { return o.id === data.id }) - this.dataClaim.splice(inx, 1) - this.dataUnclaim.push(data) - console.log(inx) - } - } - 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) => { - 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-- - } - } - }) - } + // if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_created'] === undefined) { + // socket.on(this.$route.params.id.replace(/-/g, '_') + '_created', (data) => { + // console.log(data._currentStatus && data._state, this.$route.params.stateid) + // if (data._currentStatus && data._state === this.$route.params.stateid) { + // if (this.instanceEntries.length < this.entriesTotal) { + // this.instanceEntries.push(data) + // this.dataData = this.instanceEntries + // } else { + // console.log('..........') + // this.dataTotal++ + // } + // } else { + // let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data._previous }) + // this.instanceEntries.splice(inx, 1) + // } + // }) + // } + // if (socket._callbacks['$' + this.$route.params.id.replace(/-/g, '_') + '_patched'] === undefined) { + // socket.on(this.$route.params.id.replace(/-/g, '_') + '_patched', (data) => { + // if (this.$store.state.role === 1) { + // if (data._currentStatus && data._state === this.$route.params.stateid) { + // let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data.id }) + // this.instanceEntries.splice(inx, 1) + // this.instanceEntries.push(data) + // this.dataData = this.instanceEntries + // } + // } + // console.log(this.$store.state.role === 2, data) + // if (this.$store.state.role === 2 && data !== undefined) { + // console.log('dataClaim', this.dataClaim) + // console.log('dataClaim', data) + // console.log('dataUnclaim', this.dataUnclaim) + // if (data._claimUser === '') { + // let inx = _.findIndex(this.dataUnclaim, (o) => { return o.id === data.id }) + // this.dataUnclaim.splice(inx, 1) + // this.dataClaim.push(data) + // console.log(inx) + // } else { + // let inx = _.findIndex(this.dataClaim, (o) => { return o.id === data.id }) + // this.dataClaim.splice(inx, 1) + // this.dataUnclaim.push(data) + // console.log(inx) + // } + // } + // 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) => { + // 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 () { @@ -1541,6 +1533,87 @@ export default { }, removed (data) { } + }, + 'dflowzdata': { + _created (data) { + // console.log('================created==============', data) + let keys = Object.keys(data) + for (let tName of keys) { + if (tName === this.$route.params.id.replace(/-/g, '_')) { + if (data[tName]._currentStatus && data[tName]._state === this.$route.params.stateid) { + if (this.instanceEntries.length < this.entriesTotal) { + this.instanceEntries.push(data[tName]) + this.dataData = this.instanceEntries + } else { + this.dataTotal++ + } + } else { + let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data[tName]._previous }) + this.instanceEntries.splice(inx, 1) + } + } + } + }, + _updated (data) { + }, + _patched (data) { + // console.log('==============patched============', data) + let keys = Object.keys(data) + for (let tName of keys) { + if (data[tName]._currentStatus) { + if (this.$store.state.role === 1) { + if (data[tName]._currentStatus && data[tName]._state === this.$route.params.stateid) { + let inx = _.findIndex(this.instanceEntries, (o) => { return o.id === data[tName].id }) + this.instanceEntries.splice(inx, 1) + this.instanceEntries.push(data[tName]) + this.dataData = this.instanceEntries + } + } + // console.log(this.$store.state.role === 2, data) + if (this.$store.state.role === 2 && data[tName] !== undefined) { + // console.log('dataClaim', this.dataClaim) + // console.log('dataClaim', data[tName]) + // console.log('dataUnclaim', this.dataUnclaim) + if (data[tName]._claimUser === '') { + let inx = _.findIndex(this.dataUnclaim, (o) => { return o.id === data[tName].id }) + this.dataUnclaim.splice(inx, 1) + this.dataClaim.push(data[tName]) + // console.log(inx) + } else { + let inx = _.findIndex(this.dataClaim, (o) => { return o.id === data[tName].id }) + this.dataClaim.splice(inx, 1) + this.dataUnclaim.push(data[tName]) + // console.log(inx) + } + } + let finx = _.findIndex(this.flowzList, {id: this.$route.params.id}) + if (finx !== -1 && !data[tName]._currentStatus && data[tName]._next === null) { + if (this.flowzList[finx].processList[data[tName]._state].count > 0) { + this.flowzList[finx].processList[data[tName]._state].count-- + } + if (this.flowzList[finx].count > 0) { + this.flowzList[finx].count-- + } + } + } + } + }, + _removed (data) { + // let keys = Object.keys(data) + // for (let tName of keys) { + // if (data[tName]._currentStatus) { + // let finx = _.findIndex(this.flowzList, {id: tName.replace(/_/g, '-')}) + // if (finx !== -1) { + // if (this.flowzList[finx].processList[data[tName]._state].count > 0) { + // this.flowzList[finx].processList[data[tName]._state].count-- + // } + // if (this.flowzList[finx].count > 0) { + // this.flowzList[finx].count-- + // } + // } + // } + // } + } } } } diff --git a/client/src/masterLayout/SideBar.vue b/client/src/masterLayout/SideBar.vue index 46522f3..c82f35b 100644 --- a/client/src/masterLayout/SideBar.vue +++ b/client/src/masterLayout/SideBar.vue @@ -77,31 +77,11 @@