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

feat(server): add compare different url #457

Merged
merged 4 commits into from Oct 12, 2020

Conversation

pndllxzzy
Copy link
Contributor

No description provided.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@pndllxzzy
Copy link
Contributor Author

@googlebot I signed it!

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@patrickhulce
Copy link
Collaborator

thanks for the PR @pndllxzzy! It gets a little crowded by sticking it up there though and the click target moves when you hover because of "Open Report" :/
image

Other ideas:

  • hide the base and compare URL selectors behind the menu where you select the build/hash
  • have both dropdowns in the original location of the compare URL dropdown (add more labels to differentiate)

@pndllxzzy
Copy link
Contributor Author

pndllxzzy commented Sep 25, 2020

@patrickhulce Thanks for your ideas.Do you mean like this?
image

@patrickhulce
Copy link
Collaborator

patrickhulce commented Sep 25, 2020

Yeah, that seems to get the job done even if it's not the prettiest (not referring to your implementation being not pretty, I know it was my suggestion 😄 ). WDYT?

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@pndllxzzy
Copy link
Contributor Author

@patrickhulce I agree with you. I'm not good at beautiful layout. If you have any ideas, please tell me.🤝🏻

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

thanks @pndllxzzy this is great! I think you might need to update some snapshot tests as well?

@@ -113,13 +113,14 @@ export function computeAuditGroups(lhr, baseLhr, options) {
return auditGroups;
}

/** @param {{hookElements: LHCI.HookElements<'dropdowns'>, selectedAuditId?: string | null, lhr?: LH.Result, baseLhr?: LH.Result, percentAbsoluteDeltaThreshold: number, setPercentAbsoluteDeltaThreshold: (x: number) => void}} props */
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can leave this just as dropdowns it was already set to be plural for more than one.

use a fragment when it's used instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean like this?

<LhrComparison
  ...
  hookElements={{
    ...
    dropdowns: (
      <Fragment>
        <Dropdown
          label="Base Url"
          className="dropdown--url dropdown--base-url"
          value={baseUrl}
          setValue={url => {
            const to = new URL(window.location.href);
            to.searchParams.set('baseUrl', url);
            to.searchParams.set('compareUrl', compareUrl);
            route(`${to.pathname}${to.search}`);
          }}
          options={availableUrlOptions}
        />
        <Dropdown
          label="Compare Url"
          className="dropdown--url dropdown--compare-url"
          value={compareUrl}
          setValue={url => {
            const to = new URL(window.location.href);
            to.searchParams.set('baseUrl', baseUrl);
            to.searchParams.set('compareUrl', url);
            route(`${to.pathname}${to.search}`);
          }}
          options={availableUrlOptions}
        />
      </Fragment>
    ),
  }}
/>

@@ -126,7 +130,7 @@ const BuildView_ = props => {
lhr={lhr}
isDimmed={openBuildHash === 'base'}
isOpen={openBuildHash === 'compare'}
setLhrLinkHover={setLhrLinkHover}
setLhrLinkHover={setLhrCompareLinkHover}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice split 👍

dropdowns: (
dropdownsBase: (
<Dropdown
label="BaseUrl"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
label="BaseUrl"
label="Base URL"

label="URL"
className="dropdown--url"
value={selectedUrl}
label="CompareUrl"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
label="CompareUrl"
label="Compare URL"

@pndllxzzy
Copy link
Contributor Author

@patrickhulce How to update snapshot?
Use this command?
jest --updateSnapshot

@patrickhulce
Copy link
Collaborator

Yep! I tend to use -u but that works too :)

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

just these two leftover from previous review but other than that looks good with test fixes! :) thanks for doing this @pndllxzzy

packages/server/src/ui/routes/build-view/build-view.jsx Outdated Show resolved Hide resolved
packages/server/src/ui/routes/build-view/build-view.jsx Outdated Show resolved Hide resolved
pndllxzzy and others added 2 commits October 11, 2020 20:06
Co-authored-by: Patrick Hulce <patrick.hulce@gmail.com>
Co-authored-by: Patrick Hulce <patrick.hulce@gmail.com>
@pndllxzzy
Copy link
Contributor Author

@patrickhulce Should I rebase all commits to one?

@patrickhulce
Copy link
Collaborator

Should I rebase all commits to one?

Don't worry about it we'll squash when we merge :) I'll take a closer look here tomorrow 👍

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

thanks for sticking with this @pndllxzzy! 🎉

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.

None yet

3 participants