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

batches: display rollout windows configuration in user settings #50479

Merged

Conversation

BolajiOlajide
Copy link
Contributor

@BolajiOlajide BolajiOlajide commented Apr 7, 2023

When rollout windows are configured on a Sourcegraph instance, there's no way for non-site admins to know the window that has been configured. We are displaying this window (if configured), in the Batch Changes section of the UserSettings area.

Test plan

Test 1

  • Navigate to the Batch Changes User Settings page /users/<username>/settings/batch-changes on a Sourcegraph instance without rollout windows configured.
  • A section for rollout windows will be shown, with a link to configure rollout windows for Batch Changes.

CleanShot 2023-05-04 at 15 31 24@2x

Test 2

  • Navigate to the Batch Changes User Settings page /users/<username>/settings/batch-changes on a Sourcegraph instance with rollout windows configured.
  • You should see a section containing the configuration of the rollout windows.

CleanShot 2023-05-04 at 15 30 58@2x

App preview:

Check out the client app preview documentation to learn more.

@BolajiOlajide BolajiOlajide added the batch-changes Issues related to Batch Changes label Apr 7, 2023
@BolajiOlajide BolajiOlajide requested a review from a team April 7, 2023 17:04
@BolajiOlajide BolajiOlajide self-assigned this Apr 7, 2023
@cla-bot cla-bot bot added the cla-signed label Apr 7, 2023
@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Apr 7, 2023

Codenotify: Notifying subscribers in CODENOTIFY files for diff 5072054...60071fa.

Notify File(s)
@courier-new client/web/src/enterprise/batches/backend.ts
client/web/src/enterprise/batches/settings/BatchChangesSettingsArea.module.scss
client/web/src/enterprise/batches/settings/BatchChangesSettingsArea.story.tsx
client/web/src/enterprise/batches/settings/BatchChangesSettingsArea.tsx
client/web/src/enterprise/batches/settings/RolloutWindowsConfiguration.module.scss
client/web/src/enterprise/batches/settings/RolloutWindowsConfiguration.story.tsx
client/web/src/enterprise/batches/settings/RolloutWindowsConfiguration.tsx
client/web/src/enterprise/batches/settings/format.test.ts
client/web/src/enterprise/batches/settings/format.ts
client/web/src/enterprise/batches/settings/mocks.ts
@eseliger client/web/src/enterprise/batches/backend.ts
client/web/src/enterprise/batches/settings/BatchChangesSettingsArea.module.scss
client/web/src/enterprise/batches/settings/BatchChangesSettingsArea.story.tsx
client/web/src/enterprise/batches/settings/BatchChangesSettingsArea.tsx
client/web/src/enterprise/batches/settings/RolloutWindowsConfiguration.module.scss
client/web/src/enterprise/batches/settings/RolloutWindowsConfiguration.story.tsx
client/web/src/enterprise/batches/settings/RolloutWindowsConfiguration.tsx
client/web/src/enterprise/batches/settings/format.test.ts
client/web/src/enterprise/batches/settings/format.ts
client/web/src/enterprise/batches/settings/mocks.ts

@sg-e2e-regression-test-bob
Copy link

sg-e2e-regression-test-bob commented Apr 7, 2023

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (+0.13 kb) 0.05% (+7.10 kb) 0.06% (+6.96 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits 60071fa and 5072054 or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@BolajiOlajide BolajiOlajide force-pushed the bo/display-rollout-windows-batch-changes-user-settings branch from ec3ee2c to 7173dd9 Compare April 12, 2023 10:11
Copy link
Contributor

@courier-new courier-new left a comment

Choose a reason for hiding this comment

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

I love the design you came up with for this! 😄 Left several comments but they're all pretty minor so here's a ✅ to go along with them.

@BolajiOlajide BolajiOlajide force-pushed the bo/display-rollout-windows-batch-changes-user-settings branch 2 times, most recently from c8222f8 to 0585d61 Compare May 5, 2023 02:09
@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented May 5, 2023

📖 Storybook live preview

Copy link
Contributor

@courier-new courier-new left a comment

Choose a reason for hiding this comment

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

This looks great; the refactor to use the site query makes a lot of sense to me, too. Left a couple nits, but really great work here! 🙌

Once this is merged, can we safely revert https://github.com/sourcegraph/sourcegraph/pull/50471, too?

<UserCodeHostConnections
headerLine={<Text>Add access tokens to enable Batch Changes changeset creation on your code hosts.</Text>}
userID={props.user.id}
/>
</div>
)

// Displays the rollout window configuration.
export const RolloutWindowsConfiguration: React.FunctionComponent = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Could we give this its own file, like we do with UserCodeHostConnections?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing.

* Formats the days of the week for a rollout window for display.
*
* If days are provided, joins them with commas and capitalizes each day name.
* Otherwise returns 'every other day' as the default.
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry if this is glaringly obvious, but why is "every other day" the default?

Copy link
Contributor Author

@BolajiOlajide BolajiOlajide May 9, 2023

Choose a reason for hiding this comment

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

Oh no, it's okay; the statement is technically wrong. I'll reword it.

 * If days are provided, join them with commas and capitalize each day's name.
 * Otherwise, returns 'every other day'.

/**
* Formats the rollout window rate for display.
*
* According to the schema, if the rate is a number then it can only be zero.
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 tell, do we actually validate if you provide a number other than 0? I don't remember if I've tried. I wonder if it's worth actually assuming that we haven't validated that here (so only returning "None" if it's actually rate: 0), and showing "invalid configuration" with the little warning indicator if we get a bad rate like rate: 7 or rate: 200/24 hours.

This doesn't need to happen in this PR; we could log that as an enhancement. Just something that came to mind that could also be useful here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CleanShot 2023-05-09 at 15 45 08
CleanShot 2023-05-09 at 15 45 05
CleanShot 2023-05-09 at 15 46 34

We do have a validation of the rate field when it's added. I've added screenshots above.

CHANGELOG.md Outdated Show resolved Hide resolved
@BolajiOlajide
Copy link
Contributor Author

This looks great; the refactor to use the site query makes a lot of sense to me, too. Left a couple nits, but really great work here! 🙌

Once this is merged, can we safely revert #50471, too?

Not yet. I have one more PR to remove the JSContext field for rollout configuration in the Bulk Actions dropdown view.

@BolajiOlajide BolajiOlajide force-pushed the bo/display-rollout-windows-batch-changes-user-settings branch from 5200636 to 52d727b Compare May 10, 2023 12:46
BolajiOlajide and others added 16 commits May 10, 2023 19:45
Co-authored-by: Kelli Rockwell <kelli@sourcegraph.com>
…sArea.tsx

Co-authored-by: Kelli Rockwell <kelli@sourcegraph.com>
…#51560)

Make the web application bundle independent from the
`//client/web/src/integration` and `//client/shared/src/testing`. It
significantly slows down the Percy changes I iterate on locally.

Previously they were connected via multiple mock files and the shared
`isHotReloadEnabled` variable. The variable is redundant now, and the
mock files are correctly moved to the `web_tests` target out of
`web_lib`.
@BolajiOlajide BolajiOlajide force-pushed the bo/display-rollout-windows-batch-changes-user-settings branch from 713faa7 to 60071fa Compare May 10, 2023 17:46
@BolajiOlajide BolajiOlajide merged commit 5bd03cd into main May 10, 2023
@BolajiOlajide BolajiOlajide deleted the bo/display-rollout-windows-batch-changes-user-settings branch May 10, 2023 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
batch-changes Issues related to Batch Changes cla-signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants