diff --git a/helper/src/components/addonsTab.js b/helper/src/components/addonsTab.js index 9c2e12729..af3580f58 100644 --- a/helper/src/components/addonsTab.js +++ b/helper/src/components/addonsTab.js @@ -2,10 +2,8 @@ import React from 'react'; import { TextField,Link, Separator, Dropdown, Slider, Stack, Text, Label, ChoiceGroup, Checkbox, MessageBar, MessageBarType, SpinButton } from '@fluentui/react'; import { adv_stackstyle, hasError, getError } from './common' -import { PreviewDialog } from './previewDialog' - -export default function ({ tabValues, updateFn, featureFlag, invalidArray }) { +export default function ({ tabValues, updateFn, featureFlag, invalidArray,showPreviewModal }) { const { cluster, addons, net } = tabValues const osmFeatureFlag = featureFlag.includes('osm') const wiFeatureFlag = featureFlag.includes('workloadId') @@ -63,13 +61,12 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) { updateFn("acrUntaggedRetentionPolicyEnabled", v)} + onChange={(ev, v) => {updateFn("acrUntaggedRetentionPolicyEnabled", v); showPreviewModal(ev,"https://learn.microsoft.com/en-us/azure/container-registry/container-registry-retention-policy"); }} label={Create untagged image retention policy (docs) } /> Deleting untagged images will remove them from your ACR after a defined period (docs) (*preview) {addons.acrUntaggedRetentionPolicyEnabled && (
- updateFn("acrUntaggedRetentionPolicy", v)} @@ -110,16 +107,12 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) { { key: 'nginx', text: 'Nginx ingress controller' }, { key: 'traefik', text: 'Traefik ingress controller' } ]} - onChange={(ev, { key }) => updateFn("ingress", key)} + onChange={(ev, { key }) => {updateFn("ingress", key); key === "warNginx" && showPreviewModal(ev,"https://docs.microsoft.com/en-us/azure/aks/web-app-routing"); }} /> {hasError(invalidArray, 'ingress') && {getError(invalidArray, 'ingress')} } - { addons.ingress === "warNginx" && - ( - - )} {addons.ingress === "nginx" && false && @@ -292,16 +285,12 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) { decrementButtonAriaLabel="Decrease value by 1" styles={{ root: { marginTop: '15px'}}} /> - setContainerLogsV2(v)} label={Enable the ContainerLogV2 schema (docs)} /> + + setContainerLogsV2(v)} label={Enable the ContainerLogV2 schema (docs) (*preview)} /> Enable the ContainerLogV2 (successor for ContainerLog) schema for additional data capture and friendlier schema. Disabling this feature will also disable features that are dependent on it (e.g. Basic Logs). - setContainerLogV2BasicLogs(v)} - label={Set Basic Logs for ContainerLogV2 (docs)} - /> + setContainerLogV2BasicLogs(v)} label={Set Basic Logs for ContainerLogV2 (docs)} /> Enable the Basic log data plan to cost optimise on log ingestion at the cost of a lower retention period, some log query operations that are no longer available and no alerts. Enabling Basic Logs for ContainerLogsV2 has a dependency on the ContainerLogsV2 schema and thus enabling this capability will automatically enable ContainerLogsV2. In addition, the ContainerLogsV2 table's retention is fixed at eight days. More information available via the provided docs link. updateFn("createAksMetricAlerts", v)} label={Create recommended metric alerts, enable you to monitor your system resource when it's running on peak capacity or hitting failure rates (docs) } /> @@ -520,13 +509,7 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) { KEDA : Enable Kubernetes Event-driven Autoscaling (KEDA) on the AKS Cluster (*preview) (docs) - updateFn("kedaAddon", v, 'https://learn.microsoft.com/azure/aks/keda-deploy-add-on-arm#prerequisites')} label="Install the KEDA AddOn" /> - { - addons.kedaAddon && - ( - - ) - } + {updateFn("kedaAddon", v, 'https://learn.microsoft.com/azure/aks/keda-deploy-add-on-arm#prerequisites'); showPreviewModal(ev,"https://learn.microsoft.com/azure/aks/keda-deploy-add-on-arm#prerequisites")}} label="Install the KEDA AddOn" /> @@ -540,12 +523,8 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) { styles={{ root: { marginLeft: '50px' } }} inputProps={{ "data-testid": "addons-asm-Checkbox"}} checked={addons.serviceMeshProfile} - onChange={(ev, v) => updateFn("serviceMeshProfile", v ? "Istio" : "")} + onChange={(ev, v) => { updateFn("serviceMeshProfile", v ? "Istio" : ""); showPreviewModal(ev, "https://learn.microsoft.com/en-us/azure/aks/istio-deploy-addon");}} label="Install the Istio Service Mesh AddOn (Preview)" /> - { - addons.serviceMeshProfile && - ( ) - } @@ -556,11 +535,8 @@ export default function ({ tabValues, updateFn, featureFlag, invalidArray }) { (*preview) (project) - updateFn("workloadIdentity", v)} label="Install Workload Identity" /> - { - addons.workloadIdentity && - ( ) - } + {updateFn("workloadIdentity", v);showPreviewModal(ev,"https://learn.microsoft.com/en-us/azure/aks/workload-identity-deploy-cluster")}} label="Install Workload Identity" /> + diff --git a/helper/src/components/portalnav.js b/helper/src/components/portalnav.js index dfd3db693..1d09408e4 100644 --- a/helper/src/components/portalnav.js +++ b/helper/src/components/portalnav.js @@ -14,6 +14,7 @@ import AppsTab from './appsTab' import { appInsights } from '../index.js' import { initializeIcons } from '@fluentui/react/lib/Icons'; +import { PreviewDialog } from './previewDialog'; initializeIcons(); @@ -118,6 +119,14 @@ export default function PortalNav({ config }) { const [tabValues, setTabValues] = useState(initTabValues(selected, defaults, true)) // Field Selections - Used to keep track of the last FieldSelections monitored by App Insights to prevent logging the same entry continuously const [lastAIUpdated, setLastAIUpdated] = useState ({tab: null, field: null}) + const [show, setShow] = useState(false) + const [previewLink, setPreviewLink] = useState("") + + const showPreviewModal = (e,previewLink) => { + if (!e.currentTarget.checked) return; + setShow(true); + setPreviewLink(previewLink) + }; function initSelected (currentPreset) { return { @@ -435,6 +444,7 @@ export default function PortalNav({ config }) { return (
+ setShow(false)} show={show} previewLink={previewLink}>
@@ -451,7 +461,7 @@ export default function PortalNav({ config }) { mergeState("cluster", field, value)} invalidArray={invalidArray['cluster']} /> _customRenderer('addons', a, b)} > - mergeState("addons", field, value, previewLink)} invalidArray={invalidArray['addons']} /> + mergeState("addons", field, value)} invalidArray={invalidArray['addons']} showPreviewModal={showPreviewModal} /> _customRenderer('net', a, b)}> mergeState("net", field, value)} invalidArray={invalidArray['net']} /> diff --git a/helper/src/components/previewDialog.js b/helper/src/components/previewDialog.js index a16354542..37ba6a890 100644 --- a/helper/src/components/previewDialog.js +++ b/helper/src/components/previewDialog.js @@ -1,34 +1,28 @@ import React from "react"; -import { useBoolean } from "@fluentui/react-hooks"; -import { Dialog, DialogType, DialogFooter } from '@fluentui/react/lib/Dialog'; -import { PrimaryButton,DefaultButton } from '@fluentui/react/lib/Button'; +import { Dialog, DialogType, DialogFooter } from "@fluentui/react/lib/Dialog"; +import { PrimaryButton} from "@fluentui/react/lib/Button"; -export function PreviewDialog({previewLink}) { - - const [hideDialog, { toggle: toggleHideDialog }] = useBoolean(false); +export function PreviewDialog({ previewLink, onClose, show}) { const dialogContentProps = { type: DialogType.normal, - title: 'Preview Feature', - closeButtonAriaLabel: 'Close', - subText: `Review the instructions on this page ${previewLink} to enable the feature `, + title: "Preview Feature", + closeButtonAriaLabel: "Close", }; - - function _openLink() { - window.open(`${previewLink}`, '_blank', 'noreferrer'); - } - + if(!show){ + return null; +} return ( -
- -
+ <> + + ); }