import { Box, Button, Checkbox, ColumnLayout, Container, Form, FormField, Header, Link, Select, SelectProps, Spinner } from "@awsui/components-react"; import React, { useCallback, useEffect, useMemo, useState } from "react"; import { Controller, useForm } from "react-hook-form"; import { useDispatch } from "react-redux"; import { useHistory } from "react-router"; import { externalUrls } from "../../constants/externalUrls"; import { init, setProfileSet } from "../../store/actions/backend"; import { getSupportedVersion } from "../../utils/getSupportedVersions"; import { InfoLink } from "../InfoLink"; import styles from "./ProfileSelection.module.scss"; interface Props { title: string; buttonText: string; next?: () => void; } type FormData = { profileSelection: string; targetFrameworkSelection: SelectProps.Option; share: boolean; email: string; useDefaultCreds: boolean; removeProfile: boolean; }; const ProfileSelectionInternal: React.FC = ({ title, next, buttonText }) => { const { control, errors, handleSubmit, setError, formState } = useForm(); const history = useHistory(); const { isSubmitting } = formState; const dispatch = useDispatch(); const currentProfile = window.electron.getState("profile"); const cachedUseDefaultCreds = window.electron.getState("useDefaultCreds"); const cachedTargetFramework = window.electron.getState("targetFramework"); const [defaultTargetFramework, setDefaultFramework] = useState({label: "", value: ""} as SelectProps.Option); const [targetFramework, setTargetFramework] = useState(defaultTargetFramework); const [targetFrameworkOptions, setFrameworkOptions] = useState(new Array()); useEffect(() => { (async () => { var result = await getSupportedVersion(); if (result[1] == null || result[1].trim() === "") { setFrameworkOptions(result[0]); // Need to convert from existing user selection to latest options if name changes. var lookupOption = result[0].find((item) => { return item.value === cachedTargetFramework.id; }); var currentOption = {label: lookupOption?.label, value: lookupOption?.value} as SelectProps.Option; setTargetFramework(currentOption); setDefaultFramework(currentOption); } else { setError("targetFrameworkSelection", "required", result[1]); } })(); }, []); const actionButton = useMemo( () => (
{isSubmitting && }
), [buttonText, history, isSubmitting] ); const onSelectTargetFramework = useCallback(([e]) => { setTargetFramework(e.detail.selectedOption); return e.detail.selectedOption; }, []); const onCheckbox = useCallback(([e]) => { return e.detail.checked; }, []); const onRemoveProfile = useCallback(([e]) => { return e.detail.checked; }, []); return (
{ if (targetFramework.value == null || targetFramework.value.trim() == "" || targetFramework.label == null || targetFramework.label.trim() == "") { setError("targetFrameworkSelection", "required", "Target Framework is required."); return; } window.electron.saveState("lastConfirmVersion", "1.3.0"); if (data.removeProfile) { window.electron.saveState("profile", ""); window.electron.saveState("share", false); } else { window.electron.saveState("share", data.share ?? false); } window.electron.saveState("targetFramework", { id: targetFramework.value, label: targetFramework.label }); dispatch(init(true)); dispatch(setProfileSet(true)); // set pending message and go back to settings dashboard next && next(); })} > When you start the assessment tool for the first time, you are prompted to enter your AWS CLI profile information so that Porting Assistant for .NET can collect metrics to improve your experience. These metrics also help flag issues with the software for AWS to quickly address. If you have not set up your AWS CLI profile, see Configuring the AWS CLI below.

) : ( "" ) } learnMoreLinks={ currentProfile ? [ { text: "Configuring the AWS CLI", externalUrl: "https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#cli-quick-configuration" } ] : [] } /> } > {title} } actions={actionButton} > Porting Assistant for .NET settings}>
Target framework Select a target framework to allow Porting Assistant for .NET to assess your solution for .NET Core compatibility. { event.preventDefault(); event.stopPropagation(); window.electron.openExternalUrl(externalUrls.dotnetSupportPolicy); }}>Learn more
{cachedUseDefaultCreds || currentProfile ? (
Porting Assistant for .NET data usage sharing {/* #7f7f7f */} When you share your usage data, Porting Assistant for .NET will collect information only about the public NuGet packages, APIs, build errors and stack traces. This information is used to make the Porting Assistant for .NET product better, for example, to improve the package and API replacement recommendations. Porting Assistant for .NET does not collect any identifying information about you.{" "} { event.preventDefault(); event.stopPropagation(); window.electron.openExternalUrl(externalUrls.howItWorks); }} > Learn more


Current Profile: {currentProfile}
) : null}
); }; const shareCheckbox = ( I agree to share my usage data with Porting Assistant for .NET - optional You can change this setting at any time on the Porting Assistant for .NET Settings page. ); const removeProfileCheckbox = ( You no longer need to provide your named profile information to use Porting Assistant for .NET. Check the box to remove your profile information from Porting Assistant ); export const ProfileSelection = React.memo(ProfileSelectionInternal);