Skip to content

Commit

Permalink
update stack error string
Browse files Browse the repository at this point in the history
  • Loading branch information
Qi Liu committed Nov 19, 2024
1 parent 2acec84 commit a558d14
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,36 +121,38 @@ const FunctionAppStackSettings: React.FC<StackProps> = props => {
);

const stackErrorMessage = React.useMemo(() => {
if (!siteStateContext.isWorkflowApp) {
// Handle errors on stack
if (!runtimeStack) {
return t('noRuntimeStackFound');
}
if (!currentStackData) {
return t('invalidStack').format(runtimeStack);
}
// Handle errors on stack
if (!runtimeStack) {
return t('noRuntimeStackFound');
}
if (!currentStackData) {
return t('invalidStack').format(runtimeStack);
}

// Handle errors on version
if (!StringUtils.equalsIgnoreCase(runtimeStack, WorkerRuntimeLanguages.custom)) {
const selectedVersionOption = options.find(option => option.key === selectedStackVersion);
if (!selectedVersionOption) {
if (isWindowsNodeApp(siteStateContext.isLinuxApp, runtimeStack)) {
return t('invalidWindowsNodeStackVersion');
} else {
return t('invalidNonWindowsNodeStackVersion').format(currentStackData.displayText);
}
// Handle errors on version
if (!StringUtils.equalsIgnoreCase(runtimeStack, WorkerRuntimeLanguages.custom)) {
const selectedVersionOption = options.find(option => option.key === selectedStackVersion);
if (!selectedVersionOption) {
if (isWindowsNodeApp(siteStateContext.isLinuxApp, runtimeStack)) {
return selectedStackVersion
? t('invalidWindowsNodeStackVersion').format(selectedStackVersion)
: t('missingWindowsNodeStackVersion');
} else {
return selectedStackVersion
? t('invalidNonWindowsNodeStackVersion').format(selectedStackVersion, currentStackData.displayText)
: t('missingNonWindowsNodeStackVersion').format(currentStackData.displayText);
}
}

if (selectedVersionOption.disabled) {
return t('disabledDotNetVersion').format(
selectedVersionOption.text,
runtimeStack,
StringUtils.equalsIgnoreCase(runtimeStack, WorkerRuntimeLanguages.dotnetIsolated) ? 'dotnet' : 'dotnet-isolated'
);
}
if (selectedVersionOption.disabled) {
return t('disabledDotNetVersion').format(
selectedVersionOption.text,
runtimeStack,
StringUtils.equalsIgnoreCase(runtimeStack, WorkerRuntimeLanguages.dotnetIsolated) ? 'dotnet' : 'dotnet-isolated'
);
}
}
}, [runtimeStack, currentStackData, selectedStackVersion, options, siteStateContext.isLinuxApp, siteStateContext.isWorkflowApp, t]);
}, [runtimeStack, currentStackData, selectedStackVersion, options, siteStateContext.isLinuxApp, t]);

const onMajorVersionChange = React.useCallback(
(_, option: IDropdownOption) => {
Expand Down
12 changes: 9 additions & 3 deletions server/Resources/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -7996,13 +7996,19 @@ 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>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>
<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>
</data>
<data name="invalidNonWindowsNodeStackVersion" xml:space="preserve">
<value>{0} version is missing or invalid. Please select a valid version</value>
<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>
</data>
<data name="disabledDotNetVersion" xml:space="preserve">
<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>
<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>
</data>
<data name="ipv4" xml:space="preserve">
<value>IPv4</value>
Expand Down

0 comments on commit a558d14

Please sign in to comment.