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

Add Remotes section to setup webview #3901

Merged
merged 10 commits into from
May 17, 2023
Merged

Add Remotes section to setup webview #3901

merged 10 commits into from
May 17, 2023

Conversation

mattseddon
Copy link
Member

@mattseddon mattseddon commented May 16, 2023

2/3 main <- #3908 <- this <- #3912

First basic step for #3867.

Demo

Screen.Recording.2023-05-17.at.6.15.07.pm.mov

See storybook for how workspaces with multiple projects are handled.

@mattseddon mattseddon added the product PR that affects product label May 16, 2023
@mattseddon mattseddon self-assigned this May 16, 2023
@mattseddon mattseddon force-pushed the add-remotes-section branch from 592bcec to cf29462 Compare May 17, 2023 00:13
@mattseddon mattseddon changed the base branch from main to add-default-test-data May 17, 2023 00:14
@mattseddon mattseddon changed the base branch from add-default-test-data to main May 17, 2023 00:34
@mattseddon mattseddon force-pushed the add-remotes-section branch from f3b9910 to 288b3dc Compare May 17, 2023 04:00
@mattseddon mattseddon changed the base branch from main to add-default-test-data May 17, 2023 04:01
@mattseddon mattseddon marked this pull request as ready for review May 17, 2023 08:16
@mattseddon mattseddon requested review from sroy3 and julieg18 as code owners May 17, 2023 08:16
@mattseddon mattseddon requested a review from shcheklein May 17, 2023 08:16
@mattseddon mattseddon changed the title Add Remote section to setup webview Add Remotes section to setup webview May 17, 2023
state,
action: PayloadAction<
| { [dvcRoot: string]: { [alias: string]: string } | undefined }
| undefined
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use RemoteList here?

Object.entries(remotes).map(([alias, remote], i) => (
<tr key={[alias, remote].join('-')}>
{i === 0 ? <td className={styles.alias}>{dvcRoot}</td> : <td />}
<td className={styles.alias}>{alias}</td>
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a th?

Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to this pr, but we also should be using th in the dvc env details table. I'll open a quick pr later correcting that :)

<tbody>
{Object.entries(remotes).map(([alias, remote]) => (
<tr key={[alias, remote].join('-')}>
<td className={styles.alias}>{alias}</td>
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here about using a th instead of a td

Copy link
Contributor

@julieg18 julieg18 left a comment

Choose a reason for hiding this comment

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

Great work!

expect(setupDVCButton).toBeVisible()
})

it('should show the list of remotes there is only one project in the workspace', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be:

Suggested change
it('should show the list of remotes there is only one project in the workspace', () => {
it('should show the list of remotes if there is only one project in the workspace', () => {

Object.entries(remotes).map(([alias, remote], i) => (
<tr key={[alias, remote].join('-')}>
{i === 0 ? <td className={styles.alias}>{dvcRoot}</td> : <td />}
<td className={styles.alias}>{alias}</td>
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to this pr, but we also should be using th in the dvc env details table. I'll open a quick pr later correcting that :)

remoteList: NonNullable<RemoteList>
}> = ({ remoteList }) => (
<table data-testid="remote-details" className={styles.remoteDetails}>
<tbody>
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor, but we technically don't need this tbody in the table since a tbody is only needed if table has thead, tfoot or multiple tbodys. We also have an unneeded tbody in dvc env table... I'll change that :)

import { SetupSection } from 'dvc/src/setup/webview/contract'
import { updateSectionCollapsed } from '../../state/webviewSlice'

const getAllSections = (collaspsed: boolean) => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean collapsed?

Copy link
Contributor

Choose a reason for hiding this comment

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

Great work on the shared functions and components!

Base automatically changed from add-default-test-data to main May 17, 2023 22:02
@mattseddon mattseddon force-pushed the add-remotes-section branch from 288b3dc to 4093a8d Compare May 17, 2023 22:03
@mattseddon mattseddon enabled auto-merge (squash) May 17, 2023 22:14
@codeclimate
Copy link

codeclimate bot commented May 17, 2023

Code Climate has analyzed commit ace9c69 and detected 4 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 4

The test coverage on the diff in this pull request is 99.1% (85% is the threshold).

This pull request will bring the total coverage in the repository to 95.0% (0.0% change).

View more on Code Climate.

@mattseddon mattseddon merged commit d06c0e3 into main May 17, 2023
@mattseddon mattseddon deleted the add-remotes-section branch May 17, 2023 23:04
@mattseddon mattseddon mentioned this pull request May 18, 2023
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product PR that affects product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants