Fixed small issues with Workflow view and added new standard view

This commit is contained in:
frikky
2022-12-05 14:48:48 +01:00
parent 98607e44d2
commit 0f28aa9c8e
4 changed files with 62 additions and 137 deletions
+1 -1
View File
@@ -233,7 +233,7 @@ const CreatorGrid = props => {
<div style={{maxWidth: 450, margin: "auto", marginTop: 15, marginBottom: 15, }}> <div style={{maxWidth: 450, margin: "auto", marginTop: 15, marginBottom: 15, }}>
<CustomSearchBox /> <CustomSearchBox />
</div> </div>
<CustomHits hitsPerPage={5}/> <CustomHits hitsPerPage={20}/>
</InstantSearch> </InstantSearch>
{showSuggestion === true ? {showSuggestion === true ?
<div style={{maxWidth: isMobile ? "100%" : "60%", margin: "auto", paddingTop: 50, textAlign: "center",}}> <div style={{maxWidth: isMobile ? "100%" : "60%", margin: "auto", paddingTop: 50, textAlign: "center",}}>
+1 -1
View File
@@ -11871,7 +11871,7 @@ const AngularWorkflow = (defaultprops) => {
</Tooltip> </Tooltip>
<Tooltip <Tooltip
color="secondary" color="secondary"
title={`Show executions ${workflowExecutions.length}`} title={`Show executions (${workflowExecutions.length})`}
placement="top-start" placement="top-start"
> >
<span> <span>
+14 -87
View File
@@ -349,7 +349,7 @@ const Dashboard = (props) => {
const [workflows, setWorkflows] = useState([]); const [workflows, setWorkflows] = useState([]);
const [frameworkData, setFrameworkData] = useState(undefined); const [frameworkData, setFrameworkData] = useState(undefined);
const [widgetData, setWidgetData] = useState(undefined); const [widgetData, setWidgetData] = useState([]);
let navigate = useNavigate(); let navigate = useNavigate();
const isCloud = const isCloud =
@@ -440,9 +440,16 @@ const Dashboard = (props) => {
} }
} }
console.log("VAl: ", tmpdata) const foundWidget = widgetData.findIndex(data => data.title === widget)
console.log("Found: ", foundWidget)
if (foundWidget !== undefined && foundWidget !== null && foundWidget >= 0) {
widgetData[foundWidget] = tmpdata
} else {
widgetData.push(tmpdata)
}
setWidgetData(tmpdata) console.log("Data: ", widgetData)
setWidgetData(widgetData)
} }
}) })
.catch((error) => { .catch((error) => {
@@ -470,89 +477,9 @@ const Dashboard = (props) => {
setTreeKeys(treeCategories) setTreeKeys(treeCategories)
} }
const fetchUsecases = (workflows) => {
fetch(globalUrl + "/api/v1/workflows/usecases", {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
credentials: "include",
})
.then((response) => {
if (response.status !== 200) {
console.log("Status not 200 for usecases");
}
return response.json();
})
.then((responseJson) => {
// Matching workflows with usecases
if (responseJson.success !== false) {
if (workflows !== undefined && workflows !== null && workflows.length > 0) {
var categorydata = responseJson
var newcategories = []
for (var key in categorydata) {
var category = categorydata[key]
category.matches = []
for (var subcategorykey in category.list) {
var subcategory = category.list[subcategorykey]
subcategory.matches = []
for (var workflowkey in workflows) {
const workflow = workflows[workflowkey]
if (workflow.usecase_ids !== undefined && workflow.usecase_ids !== null) {
for (var usecasekey in workflow.usecase_ids) {
if (workflow.usecase_ids[usecasekey].toLowerCase() === subcategory.name.toLowerCase()) {
category.matches.push({
"workflow": workflow.id,
"category": subcategory.name,
})
subcategory.matches.push(workflow)
break
}
}
}
if (subcategory.matches.length > 0) {
break
}
}
}
newcategories.push(category)
}
if (newcategories !== undefined && newcategories !== null && newcategories.length > 0) {
handleKeysetting(newcategories)
setUsecases(newcategories)
setSelectedUsecases(newcategories)
} else {
handleKeysetting(responseJson)
setUsecases(responseJson)
setSelectedUsecases(responseJson)
}
} else {
handleKeysetting(responseJson)
setUsecases(responseJson)
setSelectedUsecases(responseJson)
}
}
})
.catch((error) => {
//alert.error("ERROR: " + error.toString());
console.log("ERROR: " + error.toString());
});
};
useEffect(() => { useEffect(() => {
getWidget("main", "tmp") getWidget("main", "Overall")
//fetchUsecases() getWidget("main", "Overall2")
}, []); }, []);
const fetchdata = (stats_id) => { const fetchdata = (stats_id) => {
@@ -812,10 +739,10 @@ const Dashboard = (props) => {
: null} : null}
</div> </div>
{widgetData === undefined ? null : {widgetData === undefined || widgetData === null || widgetData === [] || widgetData.length === 0 ? null :
<Draggable> <Draggable>
<Paper style={{height: 350, width: 500, padding: "15px 15px 15px 15px", }}> <Paper style={{height: 350, width: 500, padding: "15px 15px 15px 15px", }}>
<LineChartWrapper keys={widgetData} height={280} width={470} /> <LineChartWrapper keys={widgetData[0]} height={280} width={470} />
</Paper> </Paper>
</Draggable> </Draggable>
} }
+46 -48
View File
@@ -3136,54 +3136,52 @@ const Workflows = (props) => {
//if ((userdata.tutorials !== undefined && userdata.tutorials !== null && !userdata.tutorials.includes("getting-started")) || userdata.tutorials === null) { //if ((userdata.tutorials !== undefined && userdata.tutorials !== null && !userdata.tutorials.includes("getting-started")) || userdata.tutorials === null) {
// return <Navigate to="/getting-started" replace />; // return <Navigate to="/getting-started" replace />;
//} //}
//return (
return ( // <div style={emptyWorkflowStyle}>
<div style={emptyWorkflowStyle}> // <Paper style={boxStyle}>
<Paper style={boxStyle}> // <div>
<div> // <h2>Welcome to Shuffle</h2>
<h2>Welcome to Shuffle</h2> // </div>
</div> // <div>
<div> // <p>
<p> // <b>Shuffle</b> is a flexible, easy to use, automation platform
<b>Shuffle</b> is a flexible, easy to use, automation platform // allowing users to integrate their services and devices freely.
allowing users to integrate their services and devices freely. // It's made to significantly reduce the amount of manual labor,
It's made to significantly reduce the amount of manual labor, // and is focused on security applications.{" "}
and is focused on security applications.{" "} // <a
<a // href="/docs/about"
href="/docs/about" // style={{ textDecoration: "none", color: "#f85a3e" }}
style={{ textDecoration: "none", color: "#f85a3e" }} // >
> // Click here to learn more.
Click here to learn more. // </a>
</a> // </p>
</p> // </div>
</div> // <div>
<div> // If you want to jump straight into it, click here to create your
If you want to jump straight into it, click here to create your // first workflow:
first workflow: // </div>
</div> // <div style={{ display: "flex" }}>
<div style={{ display: "flex" }}> // <Button
<Button // id="second-step"
id="second-step" // color="primary"
color="primary" // style={{ marginTop: "20px" }}
style={{ marginTop: "20px" }} // variant="outlined"
variant="outlined" // onClick={() => setModalOpen(true)}
onClick={() => setModalOpen(true)} // >
> // New workflow
New workflow // </Button>
</Button> // <span style={{ paddingTop: 20, display: "flex" }}>
<span style={{ paddingTop: 20, display: "flex" }}> // <Typography
<Typography // style={{ marginTop: 5, marginLeft: 30, marginRight: 15 }}
style={{ marginTop: 5, marginLeft: 30, marginRight: 15 }} // >
> // ..OR
..OR // </Typography>
</Typography> // {workflowButtons}
{workflowButtons} // </span>
</span> // </div>
</div> // </Paper>
</Paper> // </div>
</div> //)
)
} }
var workflowDelay = -150 var workflowDelay = -150