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, }}>
<CustomSearchBox />
</div>
<CustomHits hitsPerPage={5}/>
<CustomHits hitsPerPage={20}/>
</InstantSearch>
{showSuggestion === true ?
<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
color="secondary"
title={`Show executions ${workflowExecutions.length}`}
title={`Show executions (${workflowExecutions.length})`}
placement="top-start"
>
<span>
+14 -87
View File
@@ -349,7 +349,7 @@ const Dashboard = (props) => {
const [workflows, setWorkflows] = useState([]);
const [frameworkData, setFrameworkData] = useState(undefined);
const [widgetData, setWidgetData] = useState(undefined);
const [widgetData, setWidgetData] = useState([]);
let navigate = useNavigate();
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) => {
@@ -470,89 +477,9 @@ const Dashboard = (props) => {
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(() => {
getWidget("main", "tmp")
//fetchUsecases()
getWidget("main", "Overall")
getWidget("main", "Overall2")
}, []);
const fetchdata = (stats_id) => {
@@ -812,10 +739,10 @@ const Dashboard = (props) => {
: null}
</div>
{widgetData === undefined ? null :
{widgetData === undefined || widgetData === null || widgetData === [] || widgetData.length === 0 ? null :
<Draggable>
<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>
</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) {
// return <Navigate to="/getting-started" replace />;
//}
return (
<div style={emptyWorkflowStyle}>
<Paper style={boxStyle}>
<div>
<h2>Welcome to Shuffle</h2>
</div>
<div>
<p>
<b>Shuffle</b> is a flexible, easy to use, automation platform
allowing users to integrate their services and devices freely.
It's made to significantly reduce the amount of manual labor,
and is focused on security applications.{" "}
<a
href="/docs/about"
style={{ textDecoration: "none", color: "#f85a3e" }}
>
Click here to learn more.
</a>
</p>
</div>
<div>
If you want to jump straight into it, click here to create your
first workflow:
</div>
<div style={{ display: "flex" }}>
<Button
id="second-step"
color="primary"
style={{ marginTop: "20px" }}
variant="outlined"
onClick={() => setModalOpen(true)}
>
New workflow
</Button>
<span style={{ paddingTop: 20, display: "flex" }}>
<Typography
style={{ marginTop: 5, marginLeft: 30, marginRight: 15 }}
>
..OR
</Typography>
{workflowButtons}
</span>
</div>
</Paper>
</div>
)
//return (
// <div style={emptyWorkflowStyle}>
// <Paper style={boxStyle}>
// <div>
// <h2>Welcome to Shuffle</h2>
// </div>
// <div>
// <p>
// <b>Shuffle</b> is a flexible, easy to use, automation platform
// allowing users to integrate their services and devices freely.
// It's made to significantly reduce the amount of manual labor,
// and is focused on security applications.{" "}
// <a
// href="/docs/about"
// style={{ textDecoration: "none", color: "#f85a3e" }}
// >
// Click here to learn more.
// </a>
// </p>
// </div>
// <div>
// If you want to jump straight into it, click here to create your
// first workflow:
// </div>
// <div style={{ display: "flex" }}>
// <Button
// id="second-step"
// color="primary"
// style={{ marginTop: "20px" }}
// variant="outlined"
// onClick={() => setModalOpen(true)}
// >
// New workflow
// </Button>
// <span style={{ paddingTop: 20, display: "flex" }}>
// <Typography
// style={{ marginTop: 5, marginLeft: 30, marginRight: 15 }}
// >
// ..OR
// </Typography>
// {workflowButtons}
// </span>
// </div>
// </Paper>
// </div>
//)
}
var workflowDelay = -150