From 4bd96b110f752481c6357c6f06617578b83fa7f9 Mon Sep 17 00:00:00 2001 From: Vitor Capretz Date: Sat, 12 Jun 2021 13:42:40 +0200 Subject: [PATCH 1/2] Replace timeago.js in favor of luxon in Sentry plugin Signed-off-by: Vitor Capretz --- plugins/sentry/package.json | 5 +++-- .../SentryIssuesTable/SentryIssuesTable.tsx | 7 ++++--- yarn.lock | 15 ++++++++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/plugins/sentry/package.json b/plugins/sentry/package.json index efaac81188..72404009e2 100644 --- a/plugins/sentry/package.json +++ b/plugins/sentry/package.json @@ -38,12 +38,12 @@ "@material-ui/core": "^4.11.0", "@material-ui/icons": "^4.9.1", "@material-ui/lab": "4.0.0-alpha.45", + "luxon": "^1.27.0", "react": "^16.13.1", "react-dom": "^16.13.1", "react-router": "6.0.0-beta.0", "react-sparklines": "^1.7.0", - "react-use": "^17.2.4", - "timeago.js": "^4.0.2" + "react-use": "^17.2.4" }, "devDependencies": { "@backstage/cli": "^0.7.0", @@ -53,6 +53,7 @@ "@testing-library/react": "^11.2.5", "@testing-library/user-event": "^13.1.8", "@types/jest": "^26.0.7", + "@types/luxon": "^1.27.0", "@types/node": "^14.14.32", "@types/react": "^16.9", "cross-fetch": "^3.0.6", diff --git a/plugins/sentry/src/components/SentryIssuesTable/SentryIssuesTable.tsx b/plugins/sentry/src/components/SentryIssuesTable/SentryIssuesTable.tsx index 72081bf2da..ea040f4130 100644 --- a/plugins/sentry/src/components/SentryIssuesTable/SentryIssuesTable.tsx +++ b/plugins/sentry/src/components/SentryIssuesTable/SentryIssuesTable.tsx @@ -17,7 +17,7 @@ import React from 'react'; import { Table, TableColumn } from '@backstage/core'; import { SentryIssue } from '../../api'; -import { format } from 'timeago.js'; +import { DateTime } from 'luxon'; import { ErrorCell } from '../ErrorCell/ErrorCell'; import { ErrorGraph } from '../ErrorGraph/ErrorGraph'; @@ -35,7 +35,8 @@ const columns: TableColumn[] = [ field: 'firstSeen', render: data => { const { firstSeen } = data as SentryIssue; - return format(firstSeen); + + return DateTime.fromISO(firstSeen).toRelative({ locale: 'en' }); }, }, { @@ -43,7 +44,7 @@ const columns: TableColumn[] = [ field: 'lastSeen', render: data => { const { lastSeen } = data as SentryIssue; - return format(lastSeen); + return DateTime.fromISO(lastSeen).toRelative({ locale: 'en' }); }, }, { diff --git a/yarn.lock b/yarn.lock index af81214be9..d7be55db7d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6039,6 +6039,11 @@ resolved "https://registry.npmjs.org/@types/luxon/-/luxon-1.26.5.tgz#843fb705e16e4d2a90847a351b799ea9d879859e" integrity sha512-XeQxxRMyJi1znfzHw4CGDLyup/raj84SnjjkI2fDootZPGlB0yqtvlvEIAmzHDa5wiEI5JJevZOWxpcofsaV+A== +"@types/luxon@^1.27.0": + version "1.27.0" + resolved "https://registry.npmjs.org/@types/luxon/-/luxon-1.27.0.tgz#1e3b5a7f8ca6944349c43498b4442b742c71ab0b" + integrity sha512-rr2lNXsErnA/ARtgFn46NtQjUa66cuwZYeo/2K7oqqxhJErhXgHBPyNKCo+pfOC3L7HFwtao8ebViiU9h4iAxA== + "@types/markdown-to-jsx@^6.11.0": version "6.11.2" resolved "https://registry.npmjs.org/@types/markdown-to-jsx/-/markdown-to-jsx-6.11.2.tgz#05d1aaffbf15be7be12c70535fa4fed65cc7c64f" @@ -17952,6 +17957,11 @@ luxon@^1.26.0: resolved "https://registry.npmjs.org/luxon/-/luxon-1.26.0.tgz#d3692361fda51473948252061d0f8561df02b578" integrity sha512-+V5QIQ5f6CDXQpWNICELwjwuHdqeJM1UenlZWx5ujcRMc9venvluCjFb4t5NYLhb6IhkbMVOxzVuOqkgMxee2A== +luxon@^1.27.0: + version "1.27.0" + resolved "https://registry.npmjs.org/luxon/-/luxon-1.27.0.tgz#ae10c69113d85dab8f15f5e8390d0cbeddf4f00f" + integrity sha512-VKsFsPggTA0DvnxtJdiExAucKdAnwbCCNlMM5ENvHlxubqWd0xhZcdb4XgZ7QFNhaRhilXCFxHuoObP5BNA4PA== + lz-string@^1.4.4: version "1.4.4" resolved "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26" @@ -25186,11 +25196,6 @@ tildify@2.0.0: resolved "https://registry.npmjs.org/tildify/-/tildify-2.0.0.tgz#f205f3674d677ce698b7067a99e949ce03b4754a" integrity sha512-Cc+OraorugtXNfs50hU9KS369rFXCfgGLpfCfvlc+Ud5u6VWmUQsOAa9HbTvheQdYnrdJqqv1e5oIqXppMYnSw== -timeago.js@^4.0.2: - version "4.0.2" - resolved "https://registry.npmjs.org/timeago.js/-/timeago.js-4.0.2.tgz#724e8c8833e3490676c7bb0a75f5daf20e558028" - integrity sha512-a7wPxPdVlQL7lqvitHGGRsofhdwtkoSXPGATFuSOA2i1ZNQEPLrGnj68vOp2sOJTCFAQVXPeNMX/GctBaO9L2w== - timers-browserify@^2.0.4: version "2.0.11" resolved "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.11.tgz#800b1f3eee272e5bc53ee465a04d0e804c31211f" From 6c12f0ec68a003ea39288d4fb6503091a3b1091f Mon Sep 17 00:00:00 2001 From: Vitor Capretz Date: Sat, 12 Jun 2021 13:44:34 +0200 Subject: [PATCH 2/2] Create changeset Signed-off-by: Vitor Capretz --- .changeset/ninety-horses-rescue.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/ninety-horses-rescue.md diff --git a/.changeset/ninety-horses-rescue.md b/.changeset/ninety-horses-rescue.md new file mode 100644 index 0000000000..b3e0decdde --- /dev/null +++ b/.changeset/ninety-horses-rescue.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-sentry': patch +--- + +Migrated the package from `timeago.js` to `luxon`. See #4278