Setup UI: Add remote repositories setup step UI#47572
Conversation
Part of https://github.com/sourcegraph/sourcegraph/issues/47237 Preparation for https://github.com/sourcegraph/sourcegraph/pull/47572 This PR adds a new type of file hook - useControlledField. There are a few cases when we want to store the field's value, not in the form but somewhere else (like in another field store or some external store) useControlledField doesn't bind with useForm it only adds a validation pipeline to the data; that the consumer is supposed to provide. Also, this PR fixes one small visual problem with insight creation UI (I didn't want to open yet another one-line PR for it)
Preparation for https://github.com/sourcegraph/sourcegraph/pull/47572 In the https://github.com/sourcegraph/sourcegraph/pull/47572 PR, we use some form logic and UI component currently placed in the insights directory (since originally, we came up with this logic for the code insights creation UI, it's still placed there). Since in https://github.com/sourcegraph/sourcegraph/pull/47572 we need to import something enterprise (insights) in something OSS (setup wizard), we have import validation error. It's a forbidden practice to have enterprise in OSS. So, this PR just moves insight form validation logic and UI to the wildcard package.
a71b8f8 to
f4d0e27
Compare
Bundle size report 📦
Look at the Statoscope report for a full comparison between the commits a550dcc and 38aa664 or learn more. Open explanation
|
st0nebreaker
left a comment
There was a problem hiding this comment.
Looks really good! The layered routing logic is awesome.
Just a few minor comments below. Also re: UX Flow, more of a design nit, I think the left navigation panel should have an Add more code hosts button, because it wouldn't be clear to the user that canceling edit mode leads them to the add more code hosts view. WDYT?
client/web/src/setup-wizard/components/setup-steps/SetupSteps.module.scss
Show resolved
Hide resolved
...mponents/remote-repositories-step/components/code-hosts/github/GithubConnectView.module.scss
Outdated
Show resolved
Hide resolved
...zard/components/remote-repositories-step/components/code-hosts/common/CodeHostConnection.tsx
Show resolved
Hide resolved
...zard/components/remote-repositories-step/components/code-hosts/common/CodeHostConnection.tsx
Show resolved
Hide resolved
...ote-repositories-step/components/code-hosts/common/radio-group-section/RadioGroupSection.tsx
Show resolved
Hide resolved
...izard/components/remote-repositories-step/components/code-hosts/github/GithubConnectView.tsx
Show resolved
Hide resolved
client/web/src/setup-wizard/components/remote-repositories-step/RemoteRepositoriesStep.tsx
Show resolved
Hide resolved
| <RadioGroupSection | ||
| name="repositories" | ||
| value="repositories" | ||
| checked={isSetRepositories} | ||
| labelId="repos" | ||
| label="Add selected repositories" | ||
| onChange={handleRepositoriesModeChange} | ||
| > | ||
| <GithubRepositoriesPicker repositories={repositories} onChange={handleRepositoriesChange} /> | ||
| </RadioGroupSection> |
There was a problem hiding this comment.
One more thing. I'm noticing values here aren't persisting when the top parent is clicked/unclicked. Will this persist after we connect the suggestions to the new api? (Video below of behavior)
Screen.Recording.2023-02-20.at.1.09.54.PM.mov
There was a problem hiding this comment.
Hmm. I see this is interesting. At the moment in works that, all edits that we're doing edit the json configuration, so unchecked checkbox for repos means that we don't have this field in the JSON configuration, than you check this checkbox, and we add an empty field in the JSON configuration, if pick some repositories we add them in this field in JSON.
When you unchecked checkbox, we remove this field from JSON, that means that we remove all checked repositories, in theory we can add presave them somewhere outside of JSON so when you click check (checked it) we will populate JSON configuration with these saved values. I think it may be a good follow up.
There was a problem hiding this comment.
I see, thanks for the explanation. Yea a different enhancement could even be saving the edit state somewhere & making sure the edit state repos are at least the top suggested repos under the input.
…p/components/code-hosts/github/GithubConnectView.module.scss Co-authored-by: Becca Steinbrecher <beccasteinbrecher@gmail.com>
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff 6ff96b3...a550dcc.
|
|
Codenotify: Notifying subscribers in OWNERS files for diff 6ff96b3...a550dcc.
|
|
Thanks, @st0nebraker, for your review. I addressed UI suggestions and comments; I'm about to merge it now. 😉 |

Part of https://github.com/sourcegraph/sourcegraph/issues/47237
This PR adds a first iteration of UI implementation for the code host connection setup step. It does use some existing API, but it isn't connected yet to the specific API about the setup wizard (it will be addressed in a separate step)
I recorder a quick loom with an overview on the current progress https://www.loom.com/share/19f8179b910d421fa1dc283d2b86b94f
Todo
Further steps
Test plan
App preview:
Check out the client app preview documentation to learn more.