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 Git Integrations #3582

Merged
merged 1 commit into from
Mar 26, 2021
Merged

Add Git Integrations #3582

merged 1 commit into from
Mar 26, 2021

Conversation

AlexTugarev
Copy link
Member

@AlexTugarev AlexTugarev commented Mar 25, 2021

Second part of #3401

Closes #3574

Git Integrations

Screen Shot 2021-03-25 at 13 34 27

Screen Shot 2021-03-25 at 13 37 36

Screen Shot 2021-03-25 at 12 05 09

Git Providers

Bugfixes

Screen Shot 2021-03-25 at 13 35 17

Screen Shot 2021-03-25 at 13 35 21

Screen Shot 2021-03-25 at 13 36 10

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

Superb @AlexTugarev! Thanks for pushing this through the finish line. Left some minor style issues. Feel free to merge once these have been resolved.

components/dashboard/src/settings/Integrations.tsx Outdated Show resolved Hide resolved
</Modal>
)}

<h3 className="flex-grow self-center">Git Integration</h3>
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Minor typo.

Suggested change
<h3 className="flex-grow self-center">Git Integration</h3>
<h3 className="flex-grow self-center">Git Integrations</h3>

Copy link
Contributor

Choose a reason for hiding this comment

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

question: This minor typo is still missing. Do you think it looks better without this suggestion?

components/dashboard/src/settings/Integrations.tsx Outdated Show resolved Hide resolved
components/dashboard/src/settings/Integrations.tsx Outdated Show resolved Hide resolved
components/dashboard/src/settings/Integrations.tsx Outdated Show resolved Hide resolved
components/dashboard/src/settings/Integrations.tsx Outdated Show resolved Hide resolved
components/dashboard/src/settings/Integrations.tsx Outdated Show resolved Hide resolved
components/dashboard/src/settings/Integrations.tsx Outdated Show resolved Hide resolved
components/dashboard/src/settings/Integrations.tsx Outdated Show resolved Hide resolved
@svenefftinge
Copy link
Member

svenefftinge commented Mar 26, 2021

/werft run

👍 started the job as gitpod-build-at-git-init2.8

Copy link
Member

@svenefftinge svenefftinge left a comment

Choose a reason for hiding this comment

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

Looks pretty good! The state management still seems a bit "by accident" as discussed yesterday.

components/dashboard/src/provider-utils.tsx Outdated Show resolved Hide resolved
components/dashboard/src/settings/Integrations.tsx Outdated Show resolved Hide resolved
setClientSecret(props.provider.oauth.clientSecret);
setRedirectURL(props.provider.oauth.callBackUrl);
}
}, []);
Copy link
Member

Choose a reason for hiding this comment

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

As to our discussion yesterday the commonly used pattern here is this facebook/react#15523 (comment)

const [type, setType] = useState<string>(props.provider.type);
...

userEffect(() => {
   setType(props.provider.type);
   ...
}, [props.provider]);

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks for sharing!
in this case, the GitIntegrationModal component can be used in two modes, with and without a prop.provider to allow creating and editing.

const [errorMessage, setErrorMessage] = useState<string | undefined>();
const [validationError, setValidationError] = useState<string | undefined>();

const firstRender = useRef(true);
Copy link
Member

Choose a reason for hiding this comment

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

Tracking how often it is rendered looks like you tried to fix something weird.
What's the purpose of firstRender? If you think this is the right solution, please at least explain in a comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

why so?
the first render thingy seems to be a common case, https://stackoverflow.com/questions/53253940/make-react-useeffect-hook-not-run-on-initial-render

the effect here is, that I don't want the validation on [clientId, clientSecret] being triggered right away, but only on user changes.

components/dashboard/src/settings/Integrations.tsx Outdated Show resolved Hide resolved
@AlexTugarev AlexTugarev force-pushed the at/git-init2 branch 4 times, most recently from 2545734 to 4254d4a Compare March 26, 2021 11:14
@AlexTugarev
Copy link
Member Author

AlexTugarev commented Mar 26, 2021

Done with review comments so far 🤞🏻 and squashed and rebased.

const validate = () => {
const errors: string[] = [];
if (clientId.trim().length === 0) {
errors.push("Client ID is missing.");
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: What do you think of hiding the error message when you are trying to add a new integration and showing this only after clicking Activate Integration?

Copy link
Member Author

Choose a reason for hiding this comment

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

But you can no longer click that button, as both values are missing.

Copy link
Contributor

@gtsiolis gtsiolis Mar 26, 2021

Choose a reason for hiding this comment

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

Yes, but there's no need to also show the error alert component, right? We could use an info alert component here if you think this is still helpful. Feel free to leave this as is for this iteration.

Copy link
Contributor

@gtsiolis gtsiolis left a comment

Choose a reason for hiding this comment

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

Looks great @AlexTugarev! Left two minor comments in #3582 (comment) and #3582 (comment). Feel free to open a follow up issue for this if needed.

@@ -15,7 +15,7 @@ export interface Props {
}

export function SettingsPage(p: Props) {
return <div className="max-w-6xl">
return <div className="w-full">
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: This also affected other settings pages that don't need to span across the right side, see /account. Could we bring back this padding for pages like /account? Happy to discuss this in a follow up issue. /cc @AlexTugarev

Copy link
Member Author

Choose a reason for hiding this comment

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

All right. I'll revert.

Copy link
Contributor

Choose a reason for hiding this comment

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

note: Integrations page should use the full width as is. Only accounts and other pages without much information should be limited to the middle. /cc @AlexTugarev

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.

Align integrations page with the design specs
3 participants