remove bind flow if the flow is already bound (#2874)

fixes: #2764
This commit is contained in:
Erik Jan de Wit 2022-06-27 09:13:43 +02:00 committed by GitHub
parent 2d39e2cc4f
commit f6a4b8ab27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -228,8 +228,7 @@ export default function AuthenticationSection() {
</Button>
</ToolbarItem>
}
actionResolver={({ data }) => {
const defaultActions = [
actionResolver={({ data }) => [
{
title: t("duplicate"),
onClick: () => {
@ -237,7 +236,8 @@ export default function AuthenticationSection() {
setSelectedFlow(data);
},
},
...(data.providerId !== "client-flow"
...(data.usedBy.type !== "default" &&
data.providerId !== "client-flow"
? [
{
title: t("bindFlow"),
@ -248,12 +248,8 @@ export default function AuthenticationSection() {
},
]
: []),
];
// remove delete when it's in use or default flow
if (data.builtIn || data.usedBy.values.length > 0) {
return defaultActions;
} else {
return [
...(!data.builtIn && data.usedBy.values.length === 0
? [
{
title: t("common:delete"),
onClick: () => {
@ -261,10 +257,9 @@ export default function AuthenticationSection() {
toggleDeleteDialog();
},
},
...defaultActions,
];
}
}}
]
: []),
]}
columns={[
{
name: "alias",