Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions frontend/src/components/plugins/flows/CustomPlaybookNode.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ function CustomPlaybookNode({ data }) {
<>
{/* Badge */}
<NodeToolbar position="top" align="start" isVisible offset={3}>
<Badge className="bg-secondary">Playbook</Badge>
<Badge
className="bg-secondary"
style={{ opacity: data.configured ? "1" : "0.5" }}
>
Playbook
</Badge>
</NodeToolbar>
{/* Info */}
<NodeToolbar
Expand All @@ -22,7 +27,9 @@ function CustomPlaybookNode({ data }) {
className="p-3 px-4 my-2 mx-2 d-flex flex-column bg-body"
>
<small
className="d-flex justify-content-between"
className={`d-flex justify-content-between text-white ${
!data.configured && "fst-italic"
}`}
style={{ maxWidth: "25vh" }}
>
<span>{data?.description}</span>
Expand All @@ -34,6 +41,7 @@ function CustomPlaybookNode({ data }) {
style={{
border: `1px solid`,
minWidth: "250px",
opacity: data.configured ? "1" : "0.5",
}}
>
<strong>{data?.label}</strong>
Expand Down
18 changes: 15 additions & 3 deletions frontend/src/components/plugins/flows/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function addNode(
node.data = {
...node.data,
description: nodeToAdd?.description,
configured: nodeToAdd?.configured,
};
}
nodesList.push(node);
Expand All @@ -58,9 +59,19 @@ function addNode(
});
} else if (nodeToAdd.playbooks_choice) {
nodeToAdd.playbooks_choice.forEach((child) => {
const playbookConfig = playbooksStored.find(
(plugin) => plugin.name === child,
);
let playbookConfig = {};
playbookConfig = playbooksStored.find((plugin) => plugin.name === child);
if (playbookConfig === undefined) {
playbookConfig = {};
playbookConfig.id = `${child}`;
playbookConfig.name = child;
playbookConfig.description =
"The playbook is not enabled or configured for this user.";
playbookConfig.pivots = [];
playbookConfig.configured = false;
} else {
playbookConfig.configured = true;
}
addNode(
nodesList,
edgesList,
Expand Down Expand Up @@ -92,6 +103,7 @@ export function getNodesAndEdges(playbook, pivotsStored, playbooksStored) {
id: playbook.id,
label: playbook.name,
description: playbook.description,
configured: true,
},
type: "playbookNode",
draggable: false,
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/plugins/tables/pluginTableColumns.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ export const playbookTableColumns = [
),
disableSortBy: true,
Filter: SelectColumnFilter,
maxWidth: 145,
},
{
Header: "Pivots",
Expand All @@ -359,6 +360,7 @@ export const playbookTableColumns = [
),
disableSortBy: true,
Filter: SelectColumnFilter,
maxWidth: 145,
},
{
Header: "Visualizers",
Expand All @@ -369,14 +371,15 @@ export const playbookTableColumns = [
),
disableSortBy: true,
Filter: SelectColumnFilter,
maxWidth: 145,
},
{
Header: "Actions",
id: "actions",
accessor: (playbookConfig) => playbookConfig,
disableSortBy: true,
Cell: ({ value }) => (
<div className="d-flex justify-content-center mx-2">
<div className="d-flex flex-wrap justify-content-center mx-2">
<PlaybookFlowsButton playbook={value} />
<OrganizationPluginStateToggle
pluginName={value?.name}
Expand All @@ -398,7 +401,6 @@ export const playbookTableColumns = [
)}
</div>
),
maxWidth: 100,
},
];

Expand Down
Loading