Skip to content

Commit

Permalink
v0.9.5
Browse files Browse the repository at this point in the history
* fix(app): fix error caused from onClick not being passed to SplitButton
* fix(app): pass user info to error handler
* fix(app): switch start_url in manifest.json ot ./ (in attempt to fix invalid loading of manifest)
  • Loading branch information
prescottprue committed May 30, 2020
1 parent 8ecb470 commit 3bf58bd
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 50 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/app-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,13 @@ jobs:
-y --project $gcloudProject \
"/versionInfo"
- name: Archive Debug Log
uses: actions/upload-artifact@v2
if: failure()
with:
name: firebase-debug
path: firebase-debug.log
- name: Check if version has been updated
if: github.ref == 'refs/heads/prod'
id: check
uses: EndBug/version-check@v1

- name: Create Release In Sentry
if: github.ref == 'refs/heads/prod' && steps.check.outputs.changed == 'true'
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: pruvit
Expand All @@ -142,11 +141,6 @@ jobs:
$(yarn bin)/sentry-cli releases finalize $releaseName
echo Release created successfully
- name: Check if version has been updated
if: github.ref == 'refs/heads/prod'
id: check
uses: EndBug/version-check@v1

- name: Create Release
if: github.ref == 'refs/heads/prod' && steps.check.outputs.changed == 'true'
id: create_release
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "fireadmin",
"version": "0.9.4",
"version": "0.9.5",
"description": "Application for Managing Firebase Applications. Includes support for multiple environments and data migrations.",
"scripts": {
"clean": "rimraf build",
"size": "size-limit",
"build": "react-scripts build && cp public/manifest.json build",
"build": "react-scripts build",
"build:config": "firebase-ci createConfig",
"build:size": "yarn build && size-limit",
"build:size:why": "yarn build && yarn size --why",
Expand Down Expand Up @@ -52,7 +52,8 @@
"react-hook-form": "^5.7.2",
"react-instantsearch": "^4.2.0",
"react-router-dom": "^5.1.2",
"reactfire": "^2.0.3"
"reactfire": "^2.0.3",
"stackdriver-errors-js": "^0.8.0"
},
"devDependencies": {
"@sentry/cli": "^1.53.0",
Expand Down
8 changes: 3 additions & 5 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
-->
<!-- PWA Manifest -->
<link rel="manifest" crossorigin="use-credentials" href="%PUBLIC_URL%/manifest.json">
<!-- Global Styling -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/style.min.css">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand All @@ -26,8 +23,9 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<meta name="description" content="Application for Managing Firebase Applications. Includes support for multiple environments and data migrations.">
<!-- Tracking/Reporting Bundles -->
<script defer src="https://cdn.jsdelivr.net/gh/GoogleCloudPlatform/[email protected]/dist/stackdriver-errors-concat.min.js"></script>
<!-- Global Styling -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/style.min.css">
<script>
// Minified version of isMobile included in the HTML since it's small
(function () {var f=/iPhone/i,j=/iPod/i,p=/iPad/i,g=/\bAndroid(?:.+)Mobile\b/i,i=/Android/i,d=/\bAndroid(?:.+)SD4930UR\b/i,e=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,c=/Windows Phone/i,h=/\bWindows(?:.+)ARM\b/i,k=/BlackBerry/i,l=/BB10/i,m=/Opera Mini/i,n=/\b(CriOS|Chrome)(?:.+)Mobile/i,o=/Mobile(?:.+)Firefox\b/i;function b($,a){return $.test(a)}function a($){var a=($=$||("undefined"!=typeof navigator?navigator.userAgent:"")).split("[FBAN");void 0!==a[1]&&($=a[0]),void 0!==(a=$.split("Twitter"))[1]&&($=a[0]);var r={apple:{phone:b(f,$)&&!b(c,$),ipod:b(j,$),tablet:!b(f,$)&&b(p,$)&&!b(c,$),device:(b(f,$)||b(j,$)||b(p,$))&&!b(c,$)},amazon:{phone:b(d,$),tablet:!b(d,$)&&b(e,$),device:b(d,$)||b(e,$)},android:{phone:!b(c,$)&&b(d,$)||!b(c,$)&&b(g,$),tablet:!b(c,$)&&!b(d,$)&&!b(g,$)&&(b(e,$)||b(i,$)),device:!b(c,$)&&(b(d,$)||b(e,$)||b(g,$)||b(i,$))||b(/\bokhttp\b/i,$)},windows:{phone:b(c,$),tablet:b(h,$),device:b(c,$)||b(h,$)},other:{blackberry:b(k,$),blackberry10:b(l,$),opera:b(m,$),firefox:b(o,$),chrome:b(n,$),device:b(k,$)||b(l,$)||b(m,$)||b(o,$)||b(n,$)},any:!1,phone:!1,tablet:!1};return r.any=r.apple.device||r.android.device||r.windows.device||r.other.device,r.phone=r.apple.phone||r.android.phone||r.windows.phone,r.tablet=r.apple.tablet||r.android.tablet||r.windows.tablet,r}window.isMobile=a();})();
Expand Down
5 changes: 3 additions & 2 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"short_name": "fireadmin",
"name": "fireadmin",
"start_url": "/login/",
"start_url": "./",
"scope": ".",
"background_color": "#ef6c00",
"theme_color": "#ef6c00",
"display": "standalone",
"gcm_sender_id": "103953800507"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useEffect } from 'react'
import { useAnalytics, useUser } from 'reactfire'
import { useLocation } from 'react-router-dom'
import * as config from 'config' // eslint-disable-line import/no-unresolved
import { setErrorUser } from 'utils/errorHandler'

export default function AnalyticsPageViewLogger() {
const location = useLocation()
Expand All @@ -12,6 +13,7 @@ export default function AnalyticsPageViewLogger() {
useEffect(() => {
if (user?.uid) {
analytics.setUserId(user.uid)
setErrorUser(user)
}
}, [user?.uid]) // eslint-disable-line react-hooks/exhaustive-deps

Expand Down
4 changes: 2 additions & 2 deletions src/components/SplitButton/SplitButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function SplitButton({
const [selectedIndex, setSelectedIndex] = useState(defaultIndex)
const anchorRef = useRef(null)
const handleClick = () => {
onClick(selectedIndex, options[selectedIndex])
onClick && onClick(selectedIndex, options[selectedIndex])
}

const handleMenuItemClick = (event, index) => {
Expand All @@ -39,9 +39,9 @@ function SplitButton({
if (anchorRef.current?.contains(event.target)) {
return
}

setOpen(false)
}

return (
<>
<ButtonGroup
Expand Down
54 changes: 28 additions & 26 deletions src/utils/errorHandler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as Sentry from '@sentry/browser'
import StackdriverErrorReporter from 'stackdriver-errors-js'
import { firebase, sentryDsn, env as environment } from '../config'
import { version } from '../../package.json'

Expand All @@ -8,39 +9,40 @@ let errorHandler // eslint-disable-line import/no-mutable-exports
* Initialize Stackdriver Error Reporter only if api key exists
*/
function initStackdriverErrorReporter() {
if (typeof window.StackdriverErrorReporter === 'function') {
window.addEventListener('DOMContentLoaded', () => {
const errorHandler = new window.StackdriverErrorReporter()
errorHandler.start({
key: firebase.apiKey,
projectId: firebase.projectId,
service: 'fireadmin-site',
version
})
try {
const errorHandler = new StackdriverErrorReporter()
errorHandler.start({
key: firebase.apiKey,
projectId: firebase.projectId,
service: 'fireadmin-site',
version
})
} catch (err) {
// eslint-disable-next-line no-console
console.error(
'Error setting up stackdriver client side error reporting',
err
)
}
return errorHandler
}

/**
* Initialize Sentry (reports to sentry.io)
*/
function initSentry() {
if (environment !== 'dev' && !window.Cypress) {
Sentry.init({
dsn: sentryDsn,
environment,
release: version
})
}
Sentry.init({
dsn: sentryDsn,
environment,
release: version
})
}

/**
* Initialize client side error reporting. Error handling is only
* initialized if in production environment.
*/
export function init() {
if (environment !== 'dev') {
if (!window.location.origin.includes('localhost') && !window.Cypress) {
initStackdriverErrorReporter()
initSentry()
} else {
Expand All @@ -51,20 +53,20 @@ export function init() {
/**
* Set user's uid within error reporting context (can be one or
* many error handling utilities)
* @param {Object} auth - Authentication data
* @param {String} auth.uid - User's id
* @param {Object} user - Authentication data
* @param {String} user.uid - User's id
*/
export function setErrorUser(auth) {
if (auth && auth.uid && environment !== 'dev') {
export function setErrorUser(user) {
if (user?.uid && !window.location.origin.includes('localhost')) {
// Set user within Stackdriver
if (errorHandler && errorHandler.setUser) {
errorHandler.setUser(auth.uid)
if (errorHandler?.setUser) {
errorHandler.setUser(user.uid)
}
// Set user within Sentry
Sentry.configureScope((scope) => {
scope.setUser({
id: auth.uid,
email: auth.email || 'none'
id: user.uid,
email: user.email || 'none'
})
})
}
Expand Down
51 changes: 50 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4518,7 +4518,7 @@ [email protected], core-js@^3.5.0:
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a"
integrity sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==

core-js@^2.4.0, core-js@^2.5.0:
core-js@^2.4.0, core-js@^2.5.0, core-js@^2.6.9:
version "2.6.11"
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c"
integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==
Expand Down Expand Up @@ -5659,6 +5659,13 @@ error-ex@^1.2.0, error-ex@^1.3.1:
dependencies:
is-arrayish "^0.2.1"

error-stack-parser@^2.0.6:
version "2.0.6"
resolved "https://registry.yarnpkg.com/error-stack-parser/-/error-stack-parser-2.0.6.tgz#5a99a707bd7a4c58a797902d48d82803ede6aad8"
integrity sha512-d51brTeqC+BHlwF0BhPtcYgF5nlzf9ZZ0ZIUQNZpc9ZB9qw5IJ2diTrBY9jlCJkTLITYPjmiX6OWCwH+fuyNgQ==
dependencies:
stackframe "^1.1.1"

es-abstract@^1.17.0, es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.4, es-abstract@^1.17.5:
version "1.17.5"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.5.tgz#d8c9d1d66c8981fb9200e2251d799eee92774ae9"
Expand Down Expand Up @@ -13598,6 +13605,11 @@ source-map-url@^0.4.0:
resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3"
integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=

[email protected]:
version "0.5.6"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"
integrity sha1-dc449SvwczxafwwRjYEzSiu19BI=

[email protected], source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
Expand Down Expand Up @@ -13709,6 +13721,13 @@ stable@^0.1.8:
resolved "https://registry.yarnpkg.com/stable/-/stable-0.1.8.tgz#836eb3c8382fe2936feaf544631017ce7d47a3cf"
integrity sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==

stack-generator@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/stack-generator/-/stack-generator-2.0.5.tgz#fb00e5b4ee97de603e0773ea78ce944d81596c36"
integrity sha512-/t1ebrbHkrLrDuNMdeAcsvynWgoH/i4o8EGGfX7dEYDoTXOYVAkEpFdtshlvabzc6JlJ8Kf9YdFEoz7JkzGN9Q==
dependencies:
stackframe "^1.1.1"

[email protected]:
version "0.0.10"
resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0"
Expand All @@ -13719,6 +13738,36 @@ stack-utils@^1.0.1:
resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-1.0.2.tgz#33eba3897788558bebfc2db059dc158ec36cebb8"
integrity sha512-MTX+MeG5U994cazkjd/9KNAapsHnibjMLnfXodlkXw76JEea0UiNzrqidzo1emMwk7w5Qhc9jd4Bn9TBb1MFwA==

stackdriver-errors-js@^0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/stackdriver-errors-js/-/stackdriver-errors-js-0.8.0.tgz#7aa9964c04b45e9449862472d51e60b12a48608a"
integrity sha512-D8TA0Ty36UmnhMXWiwdGgbAVAka8Bma9xjuipBoAKNu1CmCPtOEIXBlIZ1Q/WjE1GddxPNeSoDs0ufZP8mF1ww==
dependencies:
core-js "^2.6.9"
stacktrace-js "^2.0.0"

stackframe@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.1.1.tgz#ffef0a3318b1b60c3b58564989aca5660729ec71"
integrity sha512-0PlYhdKh6AfFxRyK/v+6/k+/mMfyiEBbTM5L94D0ZytQnJ166wuwoTYLHFWGbs2dpA8Rgq763KGWmN1EQEYHRQ==

stacktrace-gps@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/stacktrace-gps/-/stacktrace-gps-3.0.4.tgz#7688dc2fc09ffb3a13165ebe0dbcaf41bcf0c69a"
integrity sha512-qIr8x41yZVSldqdqe6jciXEaSCKw1U8XTXpjDuy0ki/apyTn/r3w9hDAAQOhZdxvsC93H+WwwEu5cq5VemzYeg==
dependencies:
source-map "0.5.6"
stackframe "^1.1.1"

stacktrace-js@^2.0.0:
version "2.0.2"
resolved "https://registry.yarnpkg.com/stacktrace-js/-/stacktrace-js-2.0.2.tgz#4ca93ea9f494752d55709a081d400fdaebee897b"
integrity sha512-Je5vBeY4S1r/RnLydLl0TBTi3F2qdfWmYsGvtfZgEI+SCprPppaIhQf5nGcal4gI4cGpCV/duLcAzT1np6sQqg==
dependencies:
error-stack-parser "^2.0.6"
stack-generator "^2.0.5"
stacktrace-gps "^3.0.4"

static-extend@^0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6"
Expand Down

0 comments on commit 3bf58bd

Please sign in to comment.