Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(ErrorMessage): Add trace ID link #361

Merged
merged 2 commits into from
Apr 22, 2020
Merged

update(ErrorMessage): Add trace ID link #361

merged 2 commits into from
Apr 22, 2020

Conversation

Tgeo
Copy link
Collaborator

@Tgeo Tgeo commented Apr 22, 2020

to: @milesj @stefhatcher @hayes @alecklandgraf

Description

  • Add traceURL setting
  • Use trace_id property from ErrorMessage for link for more info on that trace ID
  • Update the Button to a Link (no need for it to be a button that I can think of - don't need to generate the URL "on the fly" when the button is clicked, we can use a plain anchor tag)

Motivation and Context

Allow better debugging when a trace_id is present in an Error passed to ErrorMessage component.

Testing

Added tests. Ran sg locally and verified.

Screenshots

image

Checklist

  • My code follows the style guide of this project.
  • I have updated or added documentation accordingly.
  • I have read the CONTRIBUTING document.

openInNewWindow
href={Core.settings.traceURL.replace('{{id}}', traceID)}
>
<T k="lunar.trace.viewDetails" phrase="View trace details" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I need to do anything with this new phrase?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you need to add it internally like our other apps.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -25,11 +25,6 @@ export function getErrorMessage(error: string | ErrorType, includeCode: boolean
return message || '';
}

// istanbul ignore next
function createRedirectURL(id: string, url?: string) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seemed unnecessary to generate the URL on-the-fly on a Button's onClick when we can just set an href

@airbnb-bot
Copy link
Collaborator

airbnb-bot commented Apr 22, 2020

Size Changes

Package Diff ESM Prev ESM CJS Prev CJS
core +0.0% 550.69 KB 550.44 KB 690.4 KB 690.06 KB

Compared to master. File sizes are unminified and ungzipped.

View raw build stats

Previous (master)

{
  "apollo": {
    "esm": 10832,
    "lib": 14147
  },
  "app-shell": {
    "esm": 12906,
    "lib": 19874
  },
  "composer": {
    "esm": 68247,
    "lib": 101805
  },
  "core": {
    "esm": 563646,
    "lib": 706618
  },
  "forms": {
    "esm": 35672,
    "lib": 47577
  },
  "icons": {
    "esm": 156355,
    "lib": 205626
  },
  "layouts": {
    "esm": 15298,
    "lib": 20770
  },
  "metrics": {
    "esm": 5467,
    "lib": 7729
  },
  "test-utils": {
    "esm": 4279,
    "lib": 5937
  }
}

Current

{
  "apollo": {
    "esm": 10832,
    "lib": 14147
  },
  "app-shell": {
    "esm": 12906,
    "lib": 19874
  },
  "composer": {
    "esm": 68247,
    "lib": 101805
  },
  "core": {
    "esm": 563903,
    "lib": 706970
  },
  "forms": {
    "esm": 35672,
    "lib": 47577
  },
  "icons": {
    "esm": 156355,
    "lib": 205626
  },
  "layouts": {
    "esm": 15298,
    "lib": 20770
  },
  "metrics": {
    "esm": 5467,
    "lib": 7729
  },
  "test-utils": {
    "esm": 4279,
    "lib": 5937
  }
}

<T k="lunar.error.viewDetails" phrase="View error details" />
</MutedButton>
</Spacing>
)}

{traceID && (
<Spacing top={1}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buttons shouldn't be stacked. Wrap with ButtonGroup instead.

{traceID && (
<Spacing top={1}>
<MutedButton
inverted
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also make them small.

@Tgeo
Copy link
Collaborator Author

Tgeo commented Apr 22, 2020

@milesj feedback addressed

Copy link
Contributor

@milesj milesj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@Tgeo Tgeo merged commit 29e6fad into master Apr 22, 2020
@Tgeo Tgeo deleted the tgeonetta--trace-id branch April 22, 2020 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants