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