Skip to content

Commit

Permalink
hide stack settings for logic app
Browse files Browse the repository at this point in the history
  • Loading branch information
Qi Liu committed Nov 19, 2024
1 parent 5d8da7a commit cb88709
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,9 @@ const FunctionAppStackSettings: React.FC<StackProps> = props => {
const selectedVersionOption = options.find(option => option.key === selectedStackVersion);
if (!selectedVersionOption) {
if (isWindowsNodeApp(siteStateContext.isLinuxApp, runtimeStack)) {
return selectedStackVersion
? t('invalidWindowsNodeStackVersion').format(selectedStackVersion)
: t('missingWindowsNodeStackVersion');
return t('invalidWindowsNodeStackVersion');
} else {
return selectedStackVersion
? t('invalidNonWindowsNodeStackVersion').format(selectedStackVersion, currentStackData.displayText)
: t('missingNonWindowsNodeStackVersion').format(currentStackData.displayText);
return t('invalidNonWindowsNodeStackVersion').format(currentStackData.displayText);
}
}

Expand Down Expand Up @@ -185,10 +181,6 @@ const FunctionAppStackSettings: React.FC<StackProps> = props => {
);

const getEolBanner = React.useCallback(() => {
if (siteStateContext.isWorkflowApp) {
return null;
}

const data = options.find(option => option.key === selectedStackVersion)?.data;
if (data) {
const eolDate = siteStateContext.isLinuxApp
Expand All @@ -200,7 +192,7 @@ const FunctionAppStackSettings: React.FC<StackProps> = props => {
}

return null;
}, [selectedStackVersion, options, siteStateContext.isLinuxApp, siteStateContext.isWorkflowApp, t]);
}, [selectedStackVersion, options, siteStateContext, t]);

useEffect(() => {
setDirtyState(initialStackVersion !== selectedStackVersion);
Expand Down Expand Up @@ -245,7 +237,7 @@ const FunctionAppStackSettings: React.FC<StackProps> = props => {
onChange={onMajorVersionChange}
dirty={dirtyState}
component={Dropdown}
disabled={disableAllControls || siteStateContext.isWorkflowApp}
disabled={disableAllControls}
label={t('versionLabel').format(currentStackData?.displayText)}
options={options}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef, useMemo } from 'react';
import React, { useRef, useMemo, useContext } from 'react';
import Platform from '../GeneralSettings/Platform';
import SlotAutoSwap from '../GeneralSettings/SlotAutoSwap';
import Stacks from '../GeneralSettings/Stacks';
Expand All @@ -14,10 +14,12 @@ import { isEqual } from 'lodash-es';
import ClientCert from '../GeneralSettings/ClientCert/ClientCert';
import { DeploymentCenterConstants } from '../../deployment-center/DeploymentCenterConstants';
import StringUtils from '../../../../utils/string';
import { SiteStateContext } from '../../../../SiteState';

const GeneralSettings: React.FC<FormikProps<AppSettingsFormValues>> = props => {
const { values } = props;
const { site } = values;
const siteStateContext = useContext(SiteStateContext);
const { t } = useTranslation();
const scenarioCheckerRef = useRef(new ScenarioService(t));
const scenarioChecker = scenarioCheckerRef.current!;
Expand All @@ -32,15 +34,17 @@ const GeneralSettings: React.FC<FormikProps<AppSettingsFormValues>> = props => {
return null;
};

const isSiteContainer = useMemo(() => {
return values.config?.properties.linuxFxVersion
const showStack = useMemo(() => {
const isSiteContainer = values.config?.properties.linuxFxVersion
? StringUtils.equalsIgnoreCase(values.config?.properties.linuxFxVersion, DeploymentCenterConstants.sitecontainers)
: false;
}, [values.config?.properties.linuxFxVersion]);

return !isSiteContainer && !siteStateContext.isWorkflowApp;
}, [values.config?.properties.linuxFxVersion, siteStateContext.isWorkflowApp]);

return (
<>
{!isSiteContainer && <Stacks {...props} />}
{showStack && <Stacks {...props} />}
{/* NOTE (krmitta): Need to hide platform settings except TLS settings for KubeApp as elements within are not shown */}
<>
<h3>{t('platformSettings')}</h3>
Expand Down
12 changes: 3 additions & 9 deletions server/Resources/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -7996,19 +7996,13 @@ Set to "External URL" to use an API definition that is hosted elsewhere.</value>
<value>{0} is not a valid stack</value>
</data>
<data name="invalidWindowsNodeStackVersion" xml:space="preserve">
<value>'{0}' is not a valid Node.js version. Please go to Environment variables to update WEBSITE_NODE_DEFAULT_VERSION app setting, or select a valid version if applicable.</value>
</data>
<data name="missingWindowsNodeStackVersion" xml:space="preserve">
<value>Node.js version is missing. Please go to Environment variables to add WEBSITE_NODE_DEFAULT_VERSION app setting, or select a valid version if applicable.</value>
<value>Node.js version is missing or invalid. Please select a valid version or go to Environment variables to add/update WEBSITE_NODE_DEFAULT_VERSION app setting</value>
</data>
<data name="invalidNonWindowsNodeStackVersion" xml:space="preserve">
<value>'{0}' is not a valid {1} version. Please select a valid version if applicable.</value>
</data>
<data name="missingNonWindowsNodeStackVersion" xml:space="preserve">
<value>{0} version is missing. Please select a valid version if applicable.</value>
<value>{0} version is missing or invalid. Please select a valid version</value>
</data>
<data name="disabledDotNetVersion" xml:space="preserve">
<value>The selected version '{0}' does not match with the stack {1}. Please go to Environment Variables to update FUNCTIONS_WORKER_RUNTIME to {2}, or select a valid .NET version if applicable.</value>
<value>The selected version '{0}' does not match with the stack {1}. Please select a valid .NET version or go to Environment Variables to add/update FUNCTIONS_WORKER_RUNTIME to {2}</value>
</data>
<data name="ipv4" xml:space="preserve">
<value>IPv4</value>
Expand Down

0 comments on commit cb88709

Please sign in to comment.