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

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
minnakt committed Sep 15, 2023
1 parent 9383586 commit 405ce37
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
14 changes: 14 additions & 0 deletions cypress/integration/distroSettings/provider_section.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ describe("provider section", () => {
cy.visit("/distro/ubuntu1604-container-test/settings/provider");
});

it("shows pool mapping information based on container pool id", () => {
cy.getInputByLabel("Container Pool ID").should(
"contain.text",
"test-pool-1"
);
cy.getInputByLabel("Pool Mapping Information")
.should("have.attr", "placeholder")
.and("match", /test-pool-1/);
cy.selectLGOption("Container Pool ID", "test-pool-2");
cy.getInputByLabel("Pool Mapping Information")
.should("have.attr", "placeholder")
.and("match", /test-pool-2/);
});

it("successfully updates docker provider fields", () => {
cy.dataCy("provider-select").contains("Docker");

Expand Down
6 changes: 1 addition & 5 deletions src/pages/distroSettings/tabs/ProviderTab/ProviderTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { getFormSchema } from "./getFormSchema";
import { TabProps, ProviderFormState } from "./types";

export const ProviderTab: React.FC<TabProps> = ({ distroData }) => {
const initialFormState = distroData;

const { getTab } = useDistroSettingsContext();
// @ts-expect-error - see TabState for details.
const { formData }: { formData: ProviderFormState } = getTab(
Expand All @@ -30,7 +28,5 @@ export const ProviderTab: React.FC<TabProps> = ({ distroData }) => {
[pools, poolMappingInfo]
);

return (
<BaseTab formSchema={formSchema} initialFormState={initialFormState} />
);
return <BaseTab formSchema={formSchema} initialFormState={distroData} />;
};
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ describe("provider tab", () => {
registryUsername: "",
registryPassword: "",
containerPoolId: "",
poolMappingInfo: "",
userData: "",
mergeUserData: false,
securityGroups: ["1"],
Expand Down Expand Up @@ -93,6 +94,7 @@ describe("provider tab", () => {
registryUsername: "testuser",
registryPassword: "abc-123",
containerPoolId: "pool-1",
poolMappingInfo: "",
userData: "",
mergeUserData: false,
securityGroups: ["1"],
Expand Down
1 change: 1 addition & 0 deletions src/pages/distroSettings/tabs/ProviderTab/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const gqlToForm = ((data) => {
dockerProviderSettings: {
...dockerProviderSettings(providerSettingsList[0]).form,
containerPoolId: containerPool,
poolMappingInfo: "",
},
};
}) satisfies GqlToFormFunction<Tab>;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/distroSettings/tabs/ProviderTab/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export enum BuildType {
Pull = "pull",
}

// TODO: Append type with additional provider options, e.g. type ProviderFormState = StaticProviderFormState | DockerProviderFormState
export type ProviderFormState = {
provider: {
providerName: Provider;
Expand All @@ -21,6 +20,7 @@ export type ProviderFormState = {
registryUsername: string;
registryPassword: string;
containerPoolId: string;
poolMappingInfo: string;
userData: string;
mergeUserData: boolean;
securityGroups: string[];
Expand Down

0 comments on commit 405ce37

Please sign in to comment.