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

Commit 6bfed62

Browse files
committed
analtics-pagination-and-show-hide-column-wise-view
1 parent 72a34c2 commit 6bfed62

File tree

2 files changed

+60
-9
lines changed

2 files changed

+60
-9
lines changed

client/src/pages/flow/analytics.vue

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@
8686
<!-- Main Table -->
8787
<div v-show="rowview">
8888
<!-- <Table height="690" border :columns="mainColumns()" :data="tableData"></Table> -->
89-
<Table :loading="tableLoading" v-if="schemaId !== null" height="590" border :columns="mainColumns()" :data="tableData"></Table>
89+
<Table :loading="tableLoading" v-if="schemaId !== null" border :columns="mainColumns()" :data="tableData"></Table>
9090
<Row style="margin-top: 4px; float: right">
9191
<Page placement="top" :total="total" :current="cpage" :page-size="limit" show-sizer @on-change="handlePage" @on-page-size-change="handlePagesize"></Page>
9292
</Row>
9393
</div>
9494
<div v-show="columnview">
95-
<Table :loading="tableLoading" :row-class-name="rowClassName" :columns="colviewCols" height="590" :data="colviewData"></Table>
95+
<Table :loading="tableLoading" :row-class-name="rowClassName" :columns="colviewCols" :data="colviewData"></Table>
9696
<Row style="margin-top: 4px; float: right">
9797
<Page placement="top" :total="total" :current="cpage" :page-size="limit" show-sizer @on-change="handlePage" @on-page-size-change="handlePagesize"></Page>
9898
</Row>
@@ -289,7 +289,7 @@ export default {
289289
this.init()
290290
},
291291
rowClassName (row, index) {
292-
return row.className
292+
return ((row.hasOwnProperty('_first')) ? '' : row._uuid + ' notfirst')
293293
},
294294
viewChange (item) {
295295
if (item === 1) {
@@ -531,8 +531,8 @@ export default {
531531
'$sort[_createdAt]': 1
532532
}, heads)
533533
.then(res => {
534-
console.log('res: ', res)
535-
this.total = res.data.total.length
534+
// console.log('res: ', res)
535+
this.total = res.data.total
536536
let tableDataArr = []
537537
for (let item of res.data.data) {
538538
let value = {
@@ -555,12 +555,16 @@ export default {
555555
for (let inst in tableDataArr) {
556556
for (let items in tableDataArr[inst]) {
557557
if (items === 'states') {
558-
for (let item of tableDataArr[inst][items]) {
558+
for (let [inx, item] of tableDataArr[inst][items].entries()) {
559+
if (inx === 0) {
560+
item._first = true
561+
}
559562
this.colviewData.push(item)
560563
}
561564
}
562565
}
563566
}
567+
// console.log('this.colviewData', this.colviewData)
564568
this.tableLoading = false
565569
}).catch(e => {
566570
this.tableLoading = false
@@ -636,7 +640,47 @@ export default {
636640
title: 'ID',
637641
key: '_uuid',
638642
fixed: 'left',
639-
width: 280
643+
width: 280,
644+
render: (h, params) => {
645+
if (params.row._first) {
646+
return h('div', [
647+
h('span', {
648+
attrs: {
649+
title: 'Click to Copy',
650+
class: 'clickToCopy'
651+
},
652+
on: {
653+
click: () => {
654+
let $temp = $('<input>')
655+
$('body').append($temp)
656+
$temp.val(params.row._uuid).select()
657+
document.execCommand('copy')
658+
this.$Message.info('Copied to Clipboard')
659+
$temp.remove()
660+
}
661+
}
662+
}, params.row._uuid),
663+
h('span', {
664+
attrs: {
665+
class: 'btn btn-default btn-sm showHideBtn'
666+
},
667+
on: {
668+
click: () => {
669+
$('.' + params.row._uuid).toggle()
670+
}
671+
}
672+
}, [
673+
h('i', {
674+
attrs: {
675+
class: 'fa fa-angle-down'
676+
}
677+
})
678+
])
679+
])
680+
} else {
681+
return h('span', '')
682+
}
683+
}
640684
// render: (h, params) => {
641685
// if (params.row.hasOwnProperty('first')) {
642686
// if (params.row.first) {
@@ -740,7 +784,14 @@ export default {
740784
{
741785
title: 'Task',
742786
key: '_state',
743-
width: 150
787+
width: 150,
788+
render: (h, params) => {
789+
if (this.flowzData.processList[params.row._state].name && this.flowzData.processList[params.row._state].name !== '') {
790+
return h('span', this.flowzData.processList[params.row._state].name)
791+
} else {
792+
return h('span', params.row._state)
793+
}
794+
}
744795
}
745796
]
746797
this.colviewData = []

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ let beforeFind = function (hook) {
5858
let value = hook.params.query.$group
5959
delete hook.params.query.$group
6060
const query = hook.service.service.createQuery(hook.params.query);
61-
hook.params.rethinkdb = query.group(value)
61+
hook.params.rethinkdb = query.group(value).ungroup()
6262
}
6363
if (query.$search !== undefined) {
6464
hook.service.service.options.name = hook.params.headers.ftablename;

0 commit comments

Comments
 (0)