initialAcrName: orDefault()

in webview-ui/src/Draft/DraftDeployment/DraftDeployment.tsx [215:292]


            initialAcrName: orDefault(state.selectedAcr, null),
            initialAcrRepository: isValid(state.selectedAcrRepository) ? state.selectedAcrRepository.value.value : null,
            initialClusterResourceGroup: state.selectedClusterResourceGroup,
            initialClusterName: state.selectedCluster,
            initialClusterNamespace: isValid(state.selectedClusterNamespace)
                ? state.selectedClusterNamespace.value.value
                : null,
            initialDeploymentSpecType: state.selectedDeploymentSpecType,
            deploymentLocation: state.selectedLocation.value,
        });
    }

    const existingFiles = getExistingPaths(state.selectedDeploymentSpecType, state.existingFiles);

    const acrImageTooltipMessage =
        "If you choose to use Draft's GitHub Action workflow for your deployment, it will automatically create and deploy the new resources through the workflow. The workflow can build new images and deploy to new namespaces.";

    const clusterResourceGroupTooltipMessage =
        "You can select a resource group and cluster here if you wish to select an existing Kubernetes namespace to deploy to.\n\nLeave this field blank to specify a namespace that does not exist yet.";

    const clusterNamespaceTooltipMessage =
        "If you choose to use Draft's GitHub Action workflow for your deployment, it will create this namespace when it runs.";

    const targetPortTooltipMessage =
        "The port on which your application listens in the deployment.\n\nThis will typically match the port exposed in the Dockerfile.";

    const servicePortTooltipMessage = "The port on which the service will listen for incoming traffic.";

    return (
        <>
            <form className={styles.wrapper} onSubmit={handleFormSubmit}>
                <h2>Automated Deployments: Draft a deployment</h2>
                <p>
                    Enter the appropriate values in the fields below to enable Draft to automatically create Kubernetes
                    manifests, Helm charts, or Kustomize files for your application. Once created, you will be able to
                    deploy your application to your AKS (Azure Kubernetes Service) cluster.
                </p>

                <fieldset className={styles.inputContainer} disabled={state.status !== "Editing"}>
                    <h3 className={styles.fullWidth}>Azure resource details</h3>
                    <p className={styles.fullWidth}>
                        Select the Azure Container Registry (ACR) which will contain the image to use for your
                        deployment. You may also select an AKS cluster to choose a Kubernetes namespace to deploy to.
                    </p>
                    <label htmlFor="subscription-input" className={styles.label}>
                        Subscription *
                    </label>
                    <ResourceSelector<Subscription>
                        id="subscription-input"
                        className={styles.control}
                        resources={lazySubscriptions}
                        selectedItem={toNullable(state.selectedSubscription)}
                        valueGetter={(l) => l.id}
                        labelGetter={(l) => l.name}
                        onSelect={handleSubscriptionSelect}
                    />
                    {hasMessage(state.selectedSubscription) && (
                        <span className={styles.validationMessage}>
                            <FontAwesomeIcon className={styles.errorIndicator} icon={faTimesCircle} />
                            {state.selectedSubscription.message}
                        </span>
                    )}

                    {isValid(state.selectedSubscription) && (
                        <>
                            <label htmlFor="acr-rg-input" className={styles.label}>
                                ACR Resource Group *
                            </label>
                            <ResourceSelector<string>
                                id="acr-rg-input"
                                className={styles.control}
                                resources={lazyAcrResourceGroups}
                                selectedItem={toNullable(state.selectedAcrResourceGroup)}
                                valueGetter={(g) => g}
                                labelGetter={(g) => g}
                                onSelect={handleAcrResourceGroupSelect}
                            />
                            {hasMessage(state.selectedAcrResourceGroup) && (