Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Hide deprecated "custom runtime" related features for adaptive rutime #6367

Merged
merged 17 commits into from
Mar 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

/** @jsx jsx */
import { jsx } from '@emotion/core';
import { useState, Fragment, useEffect } from 'react';
import { useState, Fragment, useEffect, useMemo } from 'react';
import formatMessage from 'format-message';
import { mergeStyleSets } from '@uifabric/styling';
import { Toggle } from 'office-ui-fabric-react/lib/Toggle';
import { DefaultButton } from 'office-ui-fabric-react/lib/Button';
import { TextField } from 'office-ui-fabric-react/lib/TextField';
Expand All @@ -15,6 +16,7 @@ import { RouteComponentProps } from '@reach/router';
import { useRecoilValue } from 'recoil';
import { Spinner } from 'office-ui-fabric-react/lib/Spinner';
import { OpenConfirmModal } from '@bfc/ui-shared';
import { isUsingAdaptiveRuntime } from '@bfc/shared';

import {
dispatcherState,
Expand Down Expand Up @@ -68,6 +70,7 @@ export const RuntimeSettings: React.FC<RouteComponentProps<{ projectId: string }
const [runtimePath, setRuntimePath] = useState(settings.runtime?.path ?? '');
const [runtimeCommand, setRuntimeCommand] = useState(settings.runtime?.command ?? '');
const [usingCustomRuntime, setUsingCustomRuntime] = useState(settings.runtime?.customRuntime ?? false);
const isAdaptive = useMemo(() => isUsingAdaptiveRuntime(settings.runtime), [settings]);

useEffect(() => {
// check the status of the boilerplate material and see if it requires an update
Expand Down Expand Up @@ -225,36 +228,43 @@ export const RuntimeSettings: React.FC<RouteComponentProps<{ projectId: string }
return botName ? (
<div css={runtimeSettingsStyle} id="runtimeSettings">
{header()}
{toggleOfCustomRuntime()}
{!isAdaptive && toggleOfCustomRuntime()}
<div>
{!isAdaptive && (
<TextField
required
data-testid="runtimeCodeLocation"
disabled={!settings.runtime || !settings.runtime.customRuntime}
errorMessage={errorElement(formDataErrors.path)}
label={formatMessage('Runtime code location')}
styles={mergeStyleSets({ root: { marginTop: 10 } }, customError)}
value={runtimePath}
onBlur={() => handleRuntimeSettingOnBlur('path')}
onChange={handleRuntimeSettingOnChange('path')}
onRenderLabel={onRenderLabel}
/>
)}
{!isAdaptive && (
<div>
<span css={textOr}>{formatMessage('Or: ')}</span>
<Link
css={breathingSpace}
disabled={!settings.runtime || !settings.runtime.customRuntime}
onClick={showEjectModal}
>
{formatMessage('Get a new copy of the runtime code')}
</Link>
</div>
)}
</div>
<div>
<TextField
required
data-testid="runtimeCodeLocation"
disabled={!settings.runtime || !settings.runtime.customRuntime}
errorMessage={errorElement(formDataErrors.path)}
label={formatMessage('Runtime code location')}
styles={customError}
value={runtimePath}
onBlur={() => handleRuntimeSettingOnBlur('path')}
onChange={handleRuntimeSettingOnChange('path')}
onRenderLabel={onRenderLabel}
/>
<span css={textOr}>{formatMessage('Or: ')}</span>
<Link
css={breathingSpace}
disabled={!settings.runtime || !settings.runtime.customRuntime}
onClick={showEjectModal}
>
{formatMessage('Get a new copy of the runtime code')}
</Link>

<TextField
required
data-testid="runtimeCommand"
disabled={!settings.runtime || !settings.runtime.customRuntime}
errorMessage={errorElement(formDataErrors.command)}
label={formatMessage('Start command')}
styles={customError}
styles={mergeStyleSets({ root: { marginTop: 10 } }, customError)}
value={runtimeCommand}
onBlur={() => handleRuntimeSettingOnBlur('command')}
onChange={handleRuntimeSettingOnChange('command')}
Expand Down