Skip to content

Commit

Permalink
DEVPROD-843 Add warnings section to distro settings (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
khelif96 authored Apr 26, 2024
1 parent ff42e6a commit 25afe96
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { save } from "./utils";

// TODO: https://jira.mongodb.org/browse/DEVPROD-6656 - Uncomment the Warnings assertions when the backend supports it
describe("general section", () => {
beforeEach(() => {
cy.visit("/distro/localhost/settings/general");
Expand All @@ -16,6 +17,7 @@ describe("general section", () => {
cy.contains("button", "Add alias").click();
cy.getInputByLabel("Alias").type("localhost-alias");
cy.getInputByLabel("Notes").type("this is a note");
// cy.getInputByLabel("Warnings").type("this is a warning");
cy.getInputByLabel("Disable shallow clone for this distro").check({
force: true,
});
Expand All @@ -27,6 +29,7 @@ describe("general section", () => {
cy.reload();
cy.getInputByLabel("Alias").should("have.value", "localhost-alias");
cy.getInputByLabel("Notes").should("have.value", "this is a note");
// cy.getInputByLabel("Warnings").should("have.value", "this is a warning");
cy.getInputByLabel("Disable shallow clone for this distro").should(
"be.checked",
);
Expand All @@ -35,6 +38,7 @@ describe("general section", () => {
// Undo changes.
cy.dataCy("delete-item-button").click();
cy.getInputByLabel("Notes").clear();
// cy.getInputByLabel("Warnings").clear();
cy.getInputByLabel("Disable shallow clone for this distro").uncheck({
force: true,
});
Expand Down
1 change: 1 addition & 0 deletions apps/spruce/src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5830,6 +5830,7 @@ export type DistroQuery = {
user: string;
userSpawnAllowed: boolean;
validProjects: Array<string | null>;
warningNote: string;
workDir: string;
bootstrapSettings: {
__typename?: "BootstrapSettings";
Expand Down
1 change: 1 addition & 0 deletions apps/spruce/src/gql/queries/distro.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ query Distro($distroId: String!) {
user
userSpawnAllowed
validProjects
warningNote
workDir
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ export const getFormSchema = (
title: "Notes",
default: "",
},
warningNote: {
type: "string" as "string",
title: "Warnings",
default: "",
},
},
},
},
Expand Down Expand Up @@ -111,6 +116,13 @@ export const getFormSchema = (
"ui:rows": 7,
"ui:widget": "textarea",
},
warningNote: {
"ui:rows": 2,
// TODO: https://jira.mongodb.org/browse/DEVPROD-6656 - Swap this to textarea when the backend supports it
"ui:widget": "hidden",
"ui:description":
"This will be displayed to users when selecting this distro as part of evergreen yml validation.",
},
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const generalForm: GeneralFormState = {
disableShallowClone: true,
disabled: false,
note: "distro note",
warningNote: "distro warnings",
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const gqlToForm = ((data) => {
isCluster,
name,
note,
warningNote,
} = data;

return {
Expand All @@ -29,6 +30,7 @@ export const gqlToForm = ((data) => {
disableShallowClone,
disabled,
note,
warningNote,
},
};
}) satisfies GqlToFormFunction<Tab>;
Expand All @@ -42,6 +44,7 @@ export const formToGql = ((
adminOnly: distroOptions.adminOnly,
aliases: distroAliases.aliases,
note: distroOptions.note,
warningNote: distroOptions.warningNote,
isCluster: distroOptions.isCluster,
disableShallowClone: distroOptions.disableShallowClone,
disabled: distroOptions.disabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface GeneralFormState {
disableShallowClone: boolean;
disabled: boolean;
note: string;
warningNote: string;
};
}

Expand Down
1 change: 1 addition & 0 deletions apps/spruce/src/pages/distroSettings/tabs/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ const distroData: DistroQuery["distro"] = {
isVirtualWorkStation: false,
name: "rhel71-power8-large",
note: "distro note",
warningNote: "distro warnings",
plannerSettings: {
commitQueueFactor: 0,
expectedRuntimeFactor: 0,
Expand Down

0 comments on commit 25afe96

Please sign in to comment.