diff --git a/src/components/insights/widgets/HumanServiceAgentsTable/index.vue b/src/components/insights/widgets/HumanServiceAgentsTable/index.vue index 0d17fcdf..1ca9a1b5 100644 --- a/src/components/insights/widgets/HumanServiceAgentsTable/index.vue +++ b/src/components/insights/widgets/HumanServiceAgentsTable/index.vue @@ -69,7 +69,7 @@ export default { }, formattedItems() { - if (!this.formattedHeaders.length || !this.items.length) return []; + if (!this.formattedHeaders?.length || !this.items?.length) return []; const formattedItems = this.items.map((item) => ({ ...item, @@ -179,7 +179,7 @@ export default { :hover.unnnic-table-next__body-row { cursor: pointer; background-color: $unnnic-color-neutral-lightest; - text-decoration: underline; + font-weight: $unnnic-font-weight-bold; } span[data-testid='arrow-asc-icon'] { diff --git a/src/components/insights/widgets/TableGroup.vue b/src/components/insights/widgets/TableGroup.vue index efe6af29..bf95b211 100644 --- a/src/components/insights/widgets/TableGroup.vue +++ b/src/components/insights/widgets/TableGroup.vue @@ -20,6 +20,7 @@ > @@ -138,7 +140,7 @@ export default { const content = dynamicHeaders.map((header) => formatRowValue(row[header.value]), ); - return { content }; + return { ...row, link: undefined, url_link: row.link?.url, content }; }); return { @@ -197,6 +199,18 @@ export default { const { offset, limit } = this.paginationConfig; this.$emit('request-data', { offset, limit }); }, + rowClick(row) { + if (row.url_link) { + const [path, query] = row.url_link.split('?'); + window.parent.postMessage( + { + event: 'redirect', + path: path + 'insights?' + query, + }, + '*', + ); + } + }, }, }; @@ -204,5 +218,16 @@ export default { diff --git a/src/components/insights/widgets/__tests__/TableGroup.spec.js b/src/components/insights/widgets/__tests__/TableGroup.spec.js index bcdbf92b..554f2ba9 100644 --- a/src/components/insights/widgets/__tests__/TableGroup.spec.js +++ b/src/components/insights/widgets/__tests__/TableGroup.spec.js @@ -60,7 +60,9 @@ describe('TableGroup', () => { expect(table.props('headers')).toEqual([ { content: 'Field 1', value: 'field1' }, ]); - expect(table.props('rows')).toEqual([{ content: ['Value'] }]); + expect(table.props('rows')).toEqual([ + { field1: 'Value', content: ['Value'] }, + ]); }); it('returns null when no activeTab is found and no default tab is available', () => { @@ -100,7 +102,7 @@ describe('TableGroup', () => { it('computes dynamic rows from the provided data', () => { const rows = wrapper.vm.activeTable.rows; - expect(rows).toEqual([{ content: ['Value'] }]); + expect(rows).toEqual([{ field1: 'Value', content: ['Value'] }]); }); it('formats row values correctly for dates, arrays, and strings', async () => {