demo D225
A support desk
Tickets by week, the busiest agent per queue, the commonest tags, and SLA breaches, from one filtered source
bucket · limitPer · unnest · where
Loading a live grid…
The configuration
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/lattice-grid.min.css">
<style>
#desk > div { height: 320px; }
#week, #perQueue { margin-top: 16px; }
</style>
<div id="app"></div>
<script type="module">
import * as Vue from 'https://esm.sh/vue@3';
import { createGrid } from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/lattice-grid.esm.min.js';
import createLatticeGrid from 'https://cdn.jsdelivr.net/npm/@toclocoinc/lattice-grid@1.28.0/modules/vue.esm.min.js';
const LatticeGrid = createLatticeGrid({ vue: Vue, createGrid });
Vue.createApp({
components: { LatticeGrid },
data() {
return {
desk: {
rowKey: 'id',
toolPanel: { side: 'left', panels: ['filters', 'columns'] },
columns: [
{ field: 'queue', title: 'Queue', filter: { type: 'set' } },
{ field: 'agent', title: 'Agent', filter: { type: 'set' } },
{ field: 'opened', title: 'Opened', type: 'dateString' },
{ field: 'hours', title: 'Time to resolve', type: 'hours' },
],
rows, // each ticket carries a tags: [{ tag, area }] array
},
// The derived shapes read the desk's live instance, so they wait for mounted().
week: null,
perQueue: null,
};
},
mounted() {
const desk = this.$refs.desk.grid();
// bucket rounds each date down to its ISO Monday and groups on that: a series.
this.week = {
autoHeight: true,
source: { mode: 'derived', from: desk, follow: 'filtered', refresh: 'live',
groupBy: 'opened', bucket: { of: 'opened', by: 'week' },
select: { tickets: { fn: 'count' }, median: { of: 'hours', fn: 'median' }, worst: { of: 'hours', fn: 'p95' } },
sort: [{ col: 'opened', dir: 'asc' }] },
columns: [{ field: 'opened', title: 'Week' }, { field: 'tickets', title: 'Tickets', type: 'number' },
{ field: 'median', title: 'Median', type: 'hours' }, { field: 'worst', title: 'p95', type: 'hours' }],
};
// limit with limitPer: the busiest agent in EACH queue, not the busiest three
// overall. A global limit of one would return a single agent.
this.perQueue = {
autoHeight: true,
source: { mode: 'derived', from: desk, follow: 'filtered', refresh: 'live', groupBy: ['queue', 'agent'],
select: { tickets: { fn: 'count' } }, sort: [{ col: 'tickets', dir: 'desc' }], limit: 1, limitPer: 'queue' },
columns: [{ field: 'queue', title: 'Queue' }, { field: 'agent', title: 'Agent' }, { field: 'tickets', title: 'Tickets', type: 'number' }],
};
},
template: `
<div>
<div id="desk"><lattice-grid ref="desk" v-bind="desk" /></div>
<div id="week"><lattice-grid v-if="week" v-bind="week" /></div>
<div id="perQueue"><lattice-grid v-if="perQueue" v-bind="perQueue" /></div>
</div>
`,
}).mount('#app');
</script>