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 Form from "@saleor/components/Form";
|
||||||
import Skeleton from "@saleor/components/Skeleton";
|
import Skeleton from "@saleor/components/Skeleton";
|
||||||
import { buttonMessages } from "@saleor/intl";
|
import { buttonMessages } from "@saleor/intl";
|
||||||
|
import { maybe } from "@saleor/misc";
|
||||||
import { Plugin_plugin_configuration } from "@saleor/plugins/types/Plugin";
|
import { Plugin_plugin_configuration } from "@saleor/plugins/types/Plugin";
|
||||||
import { DialogProps } from "@saleor/types";
|
import { DialogProps } from "@saleor/types";
|
||||||
import { ConfigurationTypeFieldEnum } from "@saleor/types/globalTypes";
|
import { ConfigurationTypeFieldEnum } from "@saleor/types/globalTypes";
|
||||||
|
@ -67,8 +68,8 @@ const PluginSecretFieldDialog: React.FC<PluginSecretFieldDialogProps> = ({
|
||||||
label={field && field.label}
|
label={field && field.label}
|
||||||
name="value"
|
name="value"
|
||||||
type={
|
type={
|
||||||
field.type === ConfigurationTypeFieldEnum.PASSWORD &&
|
maybe(() => field.type) ===
|
||||||
"password"
|
ConfigurationTypeFieldEnum.PASSWORD && "password"
|
||||||
}
|
}
|
||||||
value={data.value || ""}
|
value={data.value || ""}
|
||||||
onChange={change}
|
onChange={change}
|
||||||
|
|
|
@ -67,9 +67,12 @@ const PluginsDetailsPage: React.FC<PluginsDetailsPageProps> = props => {
|
||||||
const initialForm: FormData = {
|
const initialForm: FormData = {
|
||||||
active: maybe(() => plugin.active, false),
|
active: maybe(() => plugin.active, false),
|
||||||
configuration: maybe(() =>
|
configuration: maybe(() =>
|
||||||
plugin.configuration.filter(
|
plugin.configuration
|
||||||
field => !isSecretField(plugin.configuration, field.name)
|
.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}
|
disabled={disabled}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
/>
|
/>
|
||||||
<CardSpacer />
|
|
||||||
{maybe(() =>
|
{maybe(() =>
|
||||||
plugin.configuration.some(field =>
|
plugin.configuration.some(field =>
|
||||||
isSecretField(plugin.configuration, field.name)
|
isSecretField(plugin.configuration, field.name)
|
||||||
)
|
)
|
||||||
) && (
|
) && (
|
||||||
|
<>
|
||||||
|
<CardSpacer />
|
||||||
<PluginAuthorization
|
<PluginAuthorization
|
||||||
fields={plugin.configuration}
|
fields={plugin.configuration}
|
||||||
onClear={onClear}
|
onClear={onClear}
|
||||||
onEdit={onEdit}
|
onEdit={onEdit}
|
||||||
/>
|
/>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
Loading…
Reference in a new issue