This repository has been archived by the owner on Jul 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
EVG-19950: Add host settings page #2014
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7c362f9
Add host settings page
sophstad 4f0fcb2
Merge branch 'main' of https://github.com/evergreen-ci/spruce into EV…
sophstad 45f67a6
Update transformers and add tests
sophstad ef1e11a
Merge branch 'main' of https://github.com/evergreen-ci/spruce into EV…
sophstad 8975cc3
Add cypress test
sophstad d065bb7
Handle unvalidated dynamic method call
sophstad 44554f0
Merge branch 'main' of https://github.com/evergreen-ci/spruce into EV…
sophstad 22cc671
Address CR comments
sophstad 2130941
Make ssh options full width
sophstad d8e6cf0
Merge branch 'main' of https://github.com/evergreen-ci/spruce into EV…
sophstad 5a6e83e
Fix unit test
sophstad ef07401
Merge branch 'main' of https://github.com/evergreen-ci/spruce into EV…
sophstad 45c12cf
Fix width issues
sophstad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { save } from "./utils"; | ||
|
||
describe("host section", () => { | ||
describe("using legacy ssh", () => { | ||
beforeEach(() => { | ||
cy.visit("/distro/localhost/settings/host"); | ||
}); | ||
|
||
it("shows the correct fields when distro has static provider", () => { | ||
cy.dataCy("authorized-keys-input").should("exist"); | ||
cy.dataCy("minimum-hosts-input").should("not.exist"); | ||
cy.dataCy("maximum-hosts-input").should("not.exist"); | ||
cy.dataCy("idle-time-input").should("not.exist"); | ||
cy.dataCy("future-fraction-input").should("not.exist"); | ||
}); | ||
|
||
it("errors when selecting an incompatible host communication method", () => { | ||
cy.selectLGOption("Host Communication Method", "RPC"); | ||
save(); | ||
cy.validateToast( | ||
"error", | ||
"validating changes for distro 'localhost': 'ERROR: bootstrapping hosts using legacy SSH is incompatible with non-legacy host communication'" | ||
); | ||
cy.selectLGOption("Host Communication Method", "Legacy SSH"); | ||
}); | ||
|
||
it("updates host fields", () => { | ||
cy.selectLGOption("Agent Architecture", "Linux ARM 64-bit"); | ||
cy.getInputByLabel("Working Directory").clear(); | ||
cy.getInputByLabel("Working Directory").type("/usr/local/bin"); | ||
cy.getInputByLabel("SSH User").clear(); | ||
cy.getInputByLabel("SSH User").type("sudo"); | ||
cy.contains("button", "Add SSH option").click(); | ||
cy.getInputByLabel("SSH Option").type("BatchMode=yes"); | ||
cy.selectLGOption("Host Allocator Rounding Rule", "Round down"); | ||
cy.selectLGOption("Host Allocator Feedback Rule", "No feedback"); | ||
cy.selectLGOption( | ||
"Host Overallocation Rule", | ||
"Terminate hosts when overallocated" | ||
); | ||
|
||
save(); | ||
cy.validateToast("success"); | ||
|
||
// Reset fields | ||
cy.selectLGOption("Agent Architecture", "Linux 64-bit"); | ||
cy.getInputByLabel("Working Directory").clear(); | ||
cy.getInputByLabel("Working Directory").type("/home/ubuntu/smoke"); | ||
cy.getInputByLabel("SSH User").clear(); | ||
cy.getInputByLabel("SSH User").type("ubuntu"); | ||
cy.dataCy("delete-item-button").click(); | ||
cy.selectLGOption("Host Allocator Rounding Rule", "Default"); | ||
cy.selectLGOption("Host Allocator Feedback Rule", "Default"); | ||
cy.selectLGOption("Host Overallocation Rule", "Default"); | ||
|
||
save(); | ||
cy.validateToast("success"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
import styled from "@emotion/styled"; | ||
import { STANDARD_FIELD_WIDTH } from "./utils"; | ||
|
||
const ElementWrapper = styled.div` | ||
type ElementWrapperProps = { | ||
limitMaxWidth?: boolean; | ||
}; | ||
|
||
const ElementWrapper = styled.div<ElementWrapperProps>` | ||
margin-bottom: 20px; | ||
|
||
${({ limitMaxWidth }) => | ||
limitMaxWidth && `max-width: ${STANDARD_FIELD_WIDTH}px;`} | ||
`; | ||
|
||
export default ElementWrapper; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,10 @@ query SpruceConfig { | |
jira { | ||
host | ||
} | ||
keys { | ||
location | ||
name | ||
} | ||
providers { | ||
aws { | ||
maxVolumeSizePerUser | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useMemo } from "react"; | ||
import { useSpruceConfig } from "hooks"; | ||
import { BaseTab } from "../BaseTab"; | ||
import { getFormSchema } from "./getFormSchema"; | ||
import { TabProps } from "./types"; | ||
|
||
export const HostTab: React.FC<TabProps> = ({ distroData, provider }) => { | ||
const spruceConfig = useSpruceConfig(); | ||
const sshKeys = spruceConfig?.keys; | ||
|
||
const formSchema = useMemo( | ||
() => getFormSchema({ provider, sshKeys }), | ||
[provider, sshKeys] | ||
); | ||
|
||
return <BaseTab formSchema={formSchema} initialFormState={distroData} />; | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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