2024-04-15 20:03:40 +00:00
|
|
|
import React, { ComponentProps } from 'react';
|
2024-01-08 05:11:31 +00:00
|
|
|
|
2023-05-31 03:08:41 +00:00
|
|
|
import { FormSection } from '@@/form-components/FormSection';
|
|
|
|
import { TextTip } from '@@/Tip/TextTip';
|
|
|
|
|
|
|
|
import { EnvironmentVariablesFieldset } from './EnvironmentVariablesFieldset';
|
|
|
|
|
2024-01-08 05:11:31 +00:00
|
|
|
type FieldsetProps = ComponentProps<typeof EnvironmentVariablesFieldset>;
|
|
|
|
|
2023-05-31 03:08:41 +00:00
|
|
|
export function EnvironmentVariablesPanel({
|
|
|
|
explanation,
|
|
|
|
onChange,
|
|
|
|
values,
|
|
|
|
showHelpMessage,
|
|
|
|
errors,
|
2023-09-07 13:45:59 +00:00
|
|
|
isFoldable = false,
|
2024-04-15 20:03:40 +00:00
|
|
|
alertMessage,
|
2023-05-31 03:08:41 +00:00
|
|
|
}: {
|
2024-04-15 20:03:40 +00:00
|
|
|
explanation?: React.ReactNode;
|
2023-05-31 03:08:41 +00:00
|
|
|
showHelpMessage?: boolean;
|
2023-09-07 13:45:59 +00:00
|
|
|
isFoldable?: boolean;
|
2024-04-15 20:03:40 +00:00
|
|
|
alertMessage?: React.ReactNode;
|
2024-01-08 05:11:31 +00:00
|
|
|
} & FieldsetProps) {
|
2023-05-31 03:08:41 +00:00
|
|
|
return (
|
2023-09-07 13:45:59 +00:00
|
|
|
<FormSection
|
|
|
|
title="Environment variables"
|
|
|
|
isFoldable={isFoldable}
|
|
|
|
defaultFolded={isFoldable}
|
2024-04-15 20:03:40 +00:00
|
|
|
className="flex flex-col w-full"
|
2023-09-07 13:45:59 +00:00
|
|
|
>
|
2023-05-31 03:08:41 +00:00
|
|
|
<div className="form-group">
|
|
|
|
{!!explanation && (
|
|
|
|
<div className="col-sm-12 environment-variables-panel--explanation">
|
|
|
|
{explanation}
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
|
2024-04-15 20:03:40 +00:00
|
|
|
{alertMessage}
|
|
|
|
|
2024-01-02 19:17:54 +00:00
|
|
|
<div className="col-sm-12">
|
|
|
|
<EnvironmentVariablesFieldset
|
|
|
|
values={values}
|
|
|
|
onChange={onChange}
|
|
|
|
errors={errors}
|
|
|
|
/>
|
|
|
|
</div>
|
2023-05-31 03:08:41 +00:00
|
|
|
|
|
|
|
{showHelpMessage && (
|
|
|
|
<div className="col-sm-12">
|
|
|
|
<TextTip color="blue" inline={false}>
|
|
|
|
Environment changes will not take effect until redeployment occurs
|
|
|
|
manually or via webhook.
|
|
|
|
</TextTip>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</FormSection>
|
|
|
|
);
|
|
|
|
}
|