Fix minor bugs
This commit is contained in:
parent
b074122928
commit
06de7440f3
2 changed files with 17 additions and 11 deletions
|
@ -13,6 +13,7 @@ import ConfirmButton, {
|
|||
import Form from "@saleor/components/Form";
|
||||
import Skeleton from "@saleor/components/Skeleton";
|
||||
import { buttonMessages } from "@saleor/intl";
|
||||
import { maybe } from "@saleor/misc";
|
||||
import { Plugin_plugin_configuration } from "@saleor/plugins/types/Plugin";
|
||||
import { DialogProps } from "@saleor/types";
|
||||
import { ConfigurationTypeFieldEnum } from "@saleor/types/globalTypes";
|
||||
|
@ -67,8 +68,8 @@ const PluginSecretFieldDialog: React.FC<PluginSecretFieldDialogProps> = ({
|
|||
label={field && field.label}
|
||||
name="value"
|
||||
type={
|
||||
field.type === ConfigurationTypeFieldEnum.PASSWORD &&
|
||||
"password"
|
||||
maybe(() => field.type) ===
|
||||
ConfigurationTypeFieldEnum.PASSWORD && "password"
|
||||
}
|
||||
value={data.value || ""}
|
||||
onChange={change}
|
||||
|
|
|
@ -67,9 +67,12 @@ const PluginsDetailsPage: React.FC<PluginsDetailsPageProps> = props => {
|
|||
const initialForm: FormData = {
|
||||
active: maybe(() => plugin.active, false),
|
||||
configuration: maybe(() =>
|
||||
plugin.configuration.filter(
|
||||
field => !isSecretField(plugin.configuration, field.name)
|
||||
)
|
||||
plugin.configuration
|
||||
.filter(field => !isSecretField(plugin.configuration, field.name))
|
||||
.map(field => ({
|
||||
...field,
|
||||
value: field.value || ""
|
||||
}))
|
||||
)
|
||||
};
|
||||
|
||||
|
@ -157,17 +160,19 @@ const PluginsDetailsPage: React.FC<PluginsDetailsPageProps> = props => {
|
|||
disabled={disabled}
|
||||
onChange={onChange}
|
||||
/>
|
||||
<CardSpacer />
|
||||
{maybe(() =>
|
||||
plugin.configuration.some(field =>
|
||||
isSecretField(plugin.configuration, field.name)
|
||||
)
|
||||
) && (
|
||||
<PluginAuthorization
|
||||
fields={plugin.configuration}
|
||||
onClear={onClear}
|
||||
onEdit={onEdit}
|
||||
/>
|
||||
<>
|
||||
<CardSpacer />
|
||||
<PluginAuthorization
|
||||
fields={plugin.configuration}
|
||||
onClear={onClear}
|
||||
onEdit={onEdit}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
|
|
Loading…
Reference in a new issue