From b55145e58047a2cc976e3b2ed10dede6d1b383b8 Mon Sep 17 00:00:00 2001 From: sylenien Date: Thu, 23 Jun 2022 12:49:39 +0200 Subject: [PATCH] fix(ui): minor ui fixes --- .../MissingResources/MissingResources.tsx | 23 +++++++++++-------- .../ResourceLoadedVsResponseEnd.tsx | 4 ++-- .../SlowestResources/SlowestResources.tsx | 21 ++++++++++------- .../ResourceLoadedVsResponseEnd.js | 2 +- .../Dashboard/Widgets/common/Table.js | 2 +- .../components/WidgetName/WidgetName.tsx | 4 +++- .../components/WidgetView/WidgetView.tsx | 1 + frontend/app/constants/filterOptions.js | 6 ++--- frontend/scripts/constants.js | 2 +- 9 files changed, 39 insertions(+), 26 deletions(-) diff --git a/frontend/app/components/Dashboard/Widgets/PredefinedWidgets/MissingResources/MissingResources.tsx b/frontend/app/components/Dashboard/Widgets/PredefinedWidgets/MissingResources/MissingResources.tsx index 69517328c..ae2f1d27e 100644 --- a/frontend/app/components/Dashboard/Widgets/PredefinedWidgets/MissingResources/MissingResources.tsx +++ b/frontend/app/components/Dashboard/Widgets/PredefinedWidgets/MissingResources/MissingResources.tsx @@ -7,7 +7,7 @@ import Chart from './Chart'; import ResourceInfo from './ResourceInfo'; import CopyPath from './CopyPath'; -const cols = [ +const cols: Array = [ { key: 'resource', title: 'Resource', @@ -17,7 +17,7 @@ const cols = [ { key: 'sessions', title: 'Sessions', - toText: count => `${ count > 1000 ? Math.trunc(count / 1000) : count }${ count > 1000 ? 'k' : '' }`, + toText: (count: number) => `${ count > 1000 ? Math.trunc(count / 1000) : count }${ count > 1000 ? 'k' : '' }`, width: '20%', }, { @@ -25,16 +25,17 @@ const cols = [ title: 'Trend', Component: Chart, width: '20%', - }, - { - key: 'copy-path', - title: '', - Component: CopyPath, - cellClass: 'invisible group-hover:visible text-right', - width: '20%', } ]; +const copyPathCol = { + key: 'copy-path', + title: '', + Component: CopyPath, + cellClass: 'invisible group-hover:visible text-right', + width: '20%', +} + interface Props { data: any metric?: any @@ -43,6 +44,10 @@ interface Props { function MissingResources(props: Props) { const { data, metric, isTemplate } = props; + if (!isTemplate) { + cols.push(copyPathCol); + } + return ( - + = [ { key: 'type', title: 'Type', @@ -43,16 +43,17 @@ const cols = [ title: 'Trend', Component: Chart, width: '15%', - }, - { - key: 'copy-path', - title: '', - Component: CopyPath, - cellClass: 'invisible group-hover:visible text-right', - width: '15%', } ]; +const copyPathCol = { + key: 'copy-path', + title: '', + Component: CopyPath, + cellClass: 'invisible group-hover:visible text-right', + width: '15%', +} + interface Props { data: any metric?: any @@ -61,6 +62,10 @@ interface Props { function SlowestResources(props: Props) { const { data, metric, isTemplate } = props; + if (!isTemplate) { + cols.push(copyPathCol); + } + return ( - + { !isTemplate && rows.size > (small ? 3 : 5) && !showAll && -
+
diff --git a/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx b/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx index 527dbe32b..48b78d415 100644 --- a/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx +++ b/frontend/app/components/Dashboard/components/WidgetView/WidgetView.tsx @@ -11,6 +11,7 @@ import { withSiteId } from 'App/routes'; import FunnelIssues from '../Funnels/FunnelIssues/FunnelIssues'; import Breadcrumb from 'Shared/Breadcrumb'; import { FilterKey } from 'Types/filter/filterType'; + interface Props { history: any; match: any diff --git a/frontend/app/constants/filterOptions.js b/frontend/app/constants/filterOptions.js index 4e27d6b44..224a32ae6 100644 --- a/frontend/app/constants/filterOptions.js +++ b/frontend/app/constants/filterOptions.js @@ -70,7 +70,7 @@ export const metricTypes = [ export const tableColumnName = { [FilterKey.USERID]: 'Users', [FilterKey.ISSUE]: 'Issues', - [FilterKey.USER_BROWSER]: 'Browsers', + [FilterKey.USER_BROWSER]: 'Browser', [FilterKey.USER_DEVICE]: 'Devices', [FilterKey.USER_COUNTRY]: 'Countries', [FilterKey.LOCATION]: 'URLs', @@ -82,7 +82,7 @@ export const metricOf = [ { label: 'Sessions', value: FilterKey.SESSIONS, type: 'table' }, { label: 'JS Errors', value: FilterKey.ERRORS, type: 'table' }, { label: 'Issues', value: FilterKey.ISSUE, type: 'table' }, - { label: 'Browsers', value: FilterKey.USER_BROWSER, type: 'table' }, + { label: 'Browser', value: FilterKey.USER_BROWSER, type: 'table' }, { label: 'Devices', value: FilterKey.USER_DEVICE, type: 'table' }, { label: 'Countries', value: FilterKey.USER_COUNTRY, type: 'table' }, { label: 'URLs', value: FilterKey.LOCATION, type: 'table' }, @@ -128,4 +128,4 @@ export default { metricOf, issueOptions, methodOptions, -} \ No newline at end of file +} diff --git a/frontend/scripts/constants.js b/frontend/scripts/constants.js index eb2d3e6d9..32b4de9a6 100644 --- a/frontend/scripts/constants.js +++ b/frontend/scripts/constants.js @@ -27,7 +27,7 @@ fs.writeFileSync('app/constants.js', "/* eslint-disable */" + toExport('countries', countries) + toExport('os', os) + - toExport('browsers', browsers) + toExport('browser', browsers) ); function toStyles(prefix, data) {