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

Staging Sites: Add Staging Sites UI in Hosting Configuration #73709

Merged
merged 12 commits into from
Feb 27, 2023

Conversation

wojtekn
Copy link
Contributor

@wojtekn wojtekn commented Feb 23, 2023

Related to 1696-gh-Automattic/dotcom-forge

Proposed Changes

In this PR, I propose to add an initial UI that allows adding a staging site.

Testing Instructions

  1. Open the Atomic site
  2. Navigate to Hosting Configuration
  3. Confirm that the "Staging site" card is displayed
  4. Click "Create staging site" to add a new staging site
  5. Confirm that when the site is created, the UI changes and allows navigating to staging site

Screenshot 2023-02-23 at 14 35 33

Screenshot 2023-02-23 at 14 34 41

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-ajp-p2)?

@wojtekn wojtekn self-assigned this Feb 23, 2023
@github-actions
Copy link

github-actions bot commented Feb 23, 2023

@wojtekn wojtekn changed the title Add Staging Sites UI in Hosting Configuration Staging Sites: Add Staging Sites UI in Hosting Configuration Feb 23, 2023
@wojtekn wojtekn requested a review from a team February 23, 2023 13:38
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 23, 2023
@wojtekn wojtekn marked this pull request as ready for review February 23, 2023 13:39
Copy link
Contributor Author

@wojtekn wojtekn left a comment

Choose a reason for hiding this comment

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

@Automattic/yolo please review the PR.

I would also appreciate looking at rendering, as I think that component still renders too often when I unfocus/focus the browser. I suspect I'm still missing something there. Or maybe I'm trying to do premature optimization?

let transferInterval: NodeJS.Timeout;

if ( ! isFetchingTransferStatus ) {
transferInterval = setInterval(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initially, I tried to do it using waitFor like it's done in another component:

waitFor( 2 ).then( () => dispatch( fetchAutomatedTransferStatus( siteId ) ) );

Unfortunately, it was sending tens of requests to the server. Do you have any thoughts on what could cause it? Does waitFor also need a way to cancel the effect?

Copy link
Member

Choose a reason for hiding this comment

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

Screenshot 2023-02-23 at 20 58 13

During my testint, the setInterval worked great. It waited 5-6 seconds between each request, and it only made 3 requests.

Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

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

It works great, I was able to create my staging site without errors. Love it! Great work! 🥳
I had to sandbox the API D102075-code

Some suggestions for future follow-ups/discussions related to the UI:

  • We could set a minimum height to the staging-site-card so the card linking won't break the scrolling.
  • Both buttons Create staging site and Manage staging site are too similar, which can confuse the user. We could change the text, or use the secondary button style for manage the site, or add some icons.
  • Currently there is no easy way to "remove/refresh" the staging site.

Screenshot 2023-02-23 at 21 17 45


return (
<Card className="staging-site-card">
<MaterialIcon icon="build" size={ 24 } />
Copy link
Member

Choose a reason for hiding this comment

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

This icon is conflicting with Web server settings

Screenshot 2023-02-23 at 21 27 26

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! I tried to re-use an icon we already have in the codebase and missed that we use this one on this page. Would you have any thoughts on a good fit?

Screenshot 2023-02-24 at 10 33 52 Screenshot 2023-02-24 at 10 33 39 Screenshot 2023-02-24 at 10 33 33 Screenshot 2023-02-24 at 10 33 25

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@sejas sejas Feb 27, 2023

Choose a reason for hiding this comment

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

We could also use Gutenberg icons: https://wordpress.github.io/gutenberg/?path=/story/icons-icon--library

Some suggestions:
Screenshot 2023-02-27 at 11 06 18

Screenshot 2023-02-27 at 11 07 04

Screenshot 2023-02-27 at 11 09 04

Screenshot 2023-02-27 at 11 10 58

Screenshot 2023-02-27 at 11 08 32

We also have the Gridicons: https://automattic.github.io/gridicons/

Copy link
Contributor

Choose a reason for hiding this comment

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

Going with the Share icon for now:

image

I created a follow up issue to explore further https://github.com/Automattic/dotcom-forge/issues/1856

config/stage.json Outdated Show resolved Hide resolved
@wojtekn
Copy link
Contributor Author

wojtekn commented Feb 24, 2023

Some suggestions for future follow-ups/discussions related to the UI:

  • We could set a minimum height to the staging-site-card so the card linking won't break the scrolling.
  • Both buttons Create staging site and Manage staging site are too similar, which can confuse the user. We could change the text, or use the secondary button style for manage the site, or add some icons.
  • Currently there is no easy way to "remove/refresh" the staging site.

Thanks @sejas , those are good suggestions. I've already added a ticket for the last one: 1757-gh-Automattic/dotcom-forge and added another one for card height 1840-gh-Automattic/dotcom-forge

@wojtekn
Copy link
Contributor Author

wojtekn commented Feb 24, 2023

Both buttons Create staging site and Manage staging site are too similar, which can confuse the user. We could change the text, or use the secondary button style for manage the site, or add some icons.

@javierarce any thoughts on this? Note that the "Manage staging site" button will be accompanied by "Delete staging site" button

Copy link
Contributor

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

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

This is pretty great, @wojtekn. Nice work!

client/my-sites/hosting/main.js Outdated Show resolved Hide resolved
},
onSuccess: () => {
dispatch( recordTracksEvent( 'calypso_hosting_configuration_staging_site_add_success' ) );
dispatch( successNotice( __( 'Staging site was added.' ), noticeOptions ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
dispatch( successNotice( __( 'Staging site was added.' ), noticeOptions ) );
dispatch( successNotice( __( 'Staging site added.' ), noticeOptions ) );

This notice disappeared really quickly for me (much quicker than 3 seconds). Maybe we should make it always present?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, now I see we don't need this notice. We display it when the simple site is added, but we still need to wait and poll for the transfer status. What if we remove it completely and solve it under 1767-gh-Automattic/dotcom-forge ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@wojtekn I think a notice would be nice. Can we have it displayed after the staging site is fully created?

Copy link
Contributor

Choose a reason for hiding this comment

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

Moved with 6ef8d1e

config/stage.json Outdated Show resolved Hide resolved
@matticbot
Copy link
Contributor

matticbot commented Feb 27, 2023

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

Sections (~693 bytes added 📈 [gzipped])

name     parsed_size           gzip_size
hosting      +3103 B  (+0.5%)     +693 B  (+0.4%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

Copy link
Contributor

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

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

Nice work on this, @wojtekn !

@danielbachhuber danielbachhuber merged commit 440704b into trunk Feb 27, 2023
@danielbachhuber danielbachhuber deleted the add/staging-sites-hosting-configuration branch February 27, 2023 15:53
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 27, 2023
@a8ci18n
Copy link

a8ci18n commented Feb 27, 2023

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7833935

Thank you @wojtekn for including a screenshot in the description! This is really helpful for our translators.

@a8ci18n
Copy link

a8ci18n commented Mar 9, 2023

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7833935

Thank you @wojtekn for including a screenshot in the description! This is really helpful for our translators.

@a8ci18n
Copy link

a8ci18n commented Mar 30, 2023

Translation for this Pull Request has now been finished.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants