Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

EVG-19950: Add host settings page #2014

Merged
merged 13 commits into from
Sep 8, 2023
Merged

Conversation

sophstad
Copy link
Contributor

@sophstad sophstad commented Aug 31, 2023

EVG-19950

Description

  • Add Legacy SSH fields for Host settings page

Screenshots

image

Testing

  • Add unit and integration tests

Evergreen PR

evergreen-ci/evergreen#6993

@cypress
Copy link

cypress bot commented Aug 31, 2023

Passing run #12560 ↗︎

0 576 7 0 Flakiness 0

Details:

Fix width issues
Project: Spruce Commit: 45c12cfc95
Status: Passed Duration: 17:08 💡
Started: Sep 8, 2023 2:53 PM Ended: Sep 8, 2023 3:10 PM

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings.

@sophstad sophstad requested a review from a team August 31, 2023 16:54
@sophstad sophstad marked this pull request as ready for review August 31, 2023 16:54
Copy link
Contributor

@minnakt minnakt 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, just had a few comments!

Comment on lines 70 to 73
sshKey: {
type: "string" as "string",
title: "SSH Key",
},
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing I'm unsure about is that the Legacy UI and the designs have this value as a dropdown 🤔 But I'm not sure if that's a mistake, or if they actually get the keys from somewhere in the backend

Screenshot 2023-09-01 at 4 21 29 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops thank you! I opened evergreen-ci/evergreen#6993 to expose this field.

Comment on lines 15 to 16
describe("provider tab", () => {
describe("static provider", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. update test descriptions

}) satisfies GqlToFormFunction<Tab>;

export const formToGql = (({ allocation, setup, sshConfig }, distro) => {
const { bootstrapMethod } = setup;
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason this one is destuctured in particular? :o

Comment on lines 77 to 86
hostAllocatorSettings: {
acceptableHostIdleTime: allocation.acceptableHostIdleTime,
feedbackRule: allocation.feedbackRule,
futureHostFraction: allocation.futureHostFraction,
hostsOverallocatedRule: allocation.hostsOverallocatedRule,
maximumHosts: allocation.maximumHosts,
minimumHosts: allocation.minimumHosts,
roundingRule: allocation.roundingRule,
version: allocation.version,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you could also just write

Suggested change
hostAllocatorSettings: {
acceptableHostIdleTime: allocation.acceptableHostIdleTime,
feedbackRule: allocation.feedbackRule,
futureHostFraction: allocation.futureHostFraction,
hostsOverallocatedRule: allocation.hostsOverallocatedRule,
maximumHosts: allocation.maximumHosts,
minimumHosts: allocation.minimumHosts,
roundingRule: allocation.roundingRule,
version: allocation.version,
},
hostAllocatorSettings: allocation

Comment on lines 37 to 46
allocation: {
version: hostAllocatorSettings.version,
roundingRule: hostAllocatorSettings.roundingRule,
feedbackRule: hostAllocatorSettings.feedbackRule,
hostsOverallocatedRule: hostAllocatorSettings.hostsOverallocatedRule,
minimumHosts: hostAllocatorSettings.minimumHosts,
maximumHosts: hostAllocatorSettings.maximumHosts,
acceptableHostIdleTime: hostAllocatorSettings.acceptableHostIdleTime,
futureHostFraction: hostAllocatorSettings.futureHostFraction,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, but if you prefer to write them out, that's okay with me too 🙂

Comment on lines 160 to 163
sshOptions: {
"ui:addButtonText": "Add SSH option",
"ui:orderable": false,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way to make these full length? not sure if that might be difficult 🥹

it("errors when selecting an incompatible host communication method", () => {
cy.selectLGOption("Host Communication Method", "RPC");
save();
cy.validateToast("error");
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: does it make sense to populate the second parameter for description assertion

const formSchema = useMemo(() => getFormSchema({ provider }), [provider]);

return (
<BaseTab formSchema={formSchema} initialFormState={initialFormState} />
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
<BaseTab formSchema={formSchema} initialFormState={initialFormState} />
<BaseTab formSchema={formSchema} initialFormState={distroData} />

import { TabProps } from "./types";

export const HostTab: React.FC<TabProps> = ({ distroData, provider }) => {
const initialFormState = distroData;
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
const initialFormState = distroData;

Comment on lines 21 to 22
const hasStaticProvider = provider === Provider.Static;
const hasDockerProvider = provider === Provider.Docker;
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
const hasStaticProvider = provider === Provider.Static;
const hasDockerProvider = provider === Provider.Docker;
const hideWidget = provider === Provider.Static || provider === Provider.Docker;

Comment on lines 180 to 199
"ui:data-cy": "minimum-hosts-input",
...((hasStaticProvider || hasDockerProvider) && {
"ui:widget": "hidden",
}),
},
maximumHosts: {
"ui:data-cy": "maximum-hosts-input",
...((hasStaticProvider || hasDockerProvider) && {
"ui:widget": "hidden",
}),
},
acceptableHostIdleTime: {
"ui:data-cy": "idle-time-input",
...((hasStaticProvider || hasDockerProvider) && {
"ui:widget": "hidden",
}),
},
futureHostFraction: {
"ui:data-cy": "future-fraction-input",
...((hasStaticProvider || hasDockerProvider) && {
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
"ui:data-cy": "minimum-hosts-input",
...((hasStaticProvider || hasDockerProvider) && {
"ui:widget": "hidden",
}),
},
maximumHosts: {
"ui:data-cy": "maximum-hosts-input",
...((hasStaticProvider || hasDockerProvider) && {
"ui:widget": "hidden",
}),
},
acceptableHostIdleTime: {
"ui:data-cy": "idle-time-input",
...((hasStaticProvider || hasDockerProvider) && {
"ui:widget": "hidden",
}),
},
futureHostFraction: {
"ui:data-cy": "future-fraction-input",
...((hasStaticProvider || hasDockerProvider) && {
"ui:data-cy": "minimum-hosts-input",
...(hideWidget && {
"ui:widget": "hidden",
}),
},
maximumHosts: {
"ui:data-cy": "maximum-hosts-input",
...(hideWidget && {
"ui:widget": "hidden",
}),
},
acceptableHostIdleTime: {
"ui:data-cy": "idle-time-input",
...(hideWidget && {
"ui:widget": "hidden",
}),
},
futureHostFraction: {
"ui:data-cy": "future-fraction-input",
...(hideWidget && {

Comment on lines 209 to 212
Object.entries(enumObject).map(([value, title]) => ({
type: "string" as "string",
title,
enum: [value],
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this reads a little better without aliasing the object key with "value"

Suggested change
Object.entries(enumObject).map(([value, title]) => ({
type: "string" as "string",
title,
enum: [value],
Object.entries(enumObject).map(([key, title]) => ({
type: "string" as "string",
title,
enum: [key],

...(!hasStaticProvider && { "ui:widget": "hidden" }),
},
sshOptions: {
"ui:addButtonText": "Add SSH option",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any guidance we can give the user for a valid SSH option? I'm not sure what to submit here.

@SupaJoon SupaJoon self-requested a review September 5, 2023 15:56
@sophstad sophstad requested a review from minnakt September 6, 2023 19:39
Copy link
Contributor

@minnakt minnakt left a comment

Choose a reason for hiding this comment

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

host logic itself lgtm, just had some comments about styling

Comment on lines 181 to 188
"ui:fullWidth": true,
"ui:orderable": false,
items: {
"ui:elementWrapperCSS": css`
max-width: unset;
`,
"ui:placeholder": "ConnectTimeout=10",
},
Copy link
Contributor

Choose a reason for hiding this comment

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

oops my bad for not specifying! I think I meant something more like this, like in the designs!

Suggested change
"ui:fullWidth": true,
"ui:orderable": false,
items: {
"ui:elementWrapperCSS": css`
max-width: unset;
`,
"ui:placeholder": "ConnectTimeout=10",
},
"ui:orderable": false,
items: {
"ui:placeholder": "ConnectTimeout=10",
},

@@ -50,4 +50,5 @@ const DefaultFieldContainer = styled.div<{ border?: "top" | "bottom" }>`
${({ border }) =>
border &&
`border-${border}: 1px solid ${gray.light1}; padding-${border}: ${size.s};`}
width: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed this might be causing a slight glitch with the variables input

Screenshot 2023-09-07 at 10 08 05 PM

@sophstad sophstad added this pull request to the merge queue Sep 8, 2023
Merged via the queue into evergreen-ci:main with commit 59629b0 Sep 8, 2023
2 checks passed
@sophstad sophstad deleted the EVG-19950 branch September 8, 2023 15:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants