From 5dca18edf9affa3b9d67f004acf6c91cb563f995 Mon Sep 17 00:00:00 2001 From: frikky Date: Wed, 12 May 2021 12:40:45 +0200 Subject: [PATCH] Added extra authentication checker to workflow configuration popup --- frontend/src/components/ConfigureWorkflow.jsx | 21 ++++++++++++++++--- frontend/src/views/AngularWorkflow.jsx | 20 ++++++++---------- frontend/src/views/Apps.jsx | 7 +++++++ 3 files changed, 34 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/ConfigureWorkflow.jsx b/frontend/src/components/ConfigureWorkflow.jsx index 215617ab..337c8649 100644 --- a/frontend/src/components/ConfigureWorkflow.jsx +++ b/frontend/src/components/ConfigureWorkflow.jsx @@ -2,6 +2,7 @@ import React, {useState} from 'react'; import { InputAdornment, Tooltip, TextField, CircularProgress, ButtonGroup, Button, Avatar, ListItemAvatar, Typography, List, ListItem, ListItemText} from '@material-ui/core'; import {FavoriteBorder as FavoriteBorderIcon} from '@material-ui/icons'; +import { FixName } from "../views/Apps.jsx"; // Handles workflow updates on first open to highlight the issues of the workflow // Variables @@ -88,8 +89,22 @@ const Workflow = (props) => { newaction.must_activate = true } else { if (action.authentication_id === "" && app.authentication.required === true) { - newaction.must_authenticate = true - newaction.action_ids.push(action.id) + // Check if configuration is filled or not + var filled = true + for (var key in action.parameters) { + if (action.parameters[key].configuration) { + console.log("Found config: ", action.parameters[key]) + if (action.parameters[key].value === null || action.parameters[key].value.length === 0) { + filled = false + break + } + } + } + + if (!filled) { + newaction.must_authenticate = true + newaction.action_ids.push(action.id) + } } newaction.app = app @@ -339,7 +354,7 @@ const Workflow = (props) => { diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index b10875d0..f8fdf9f5 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -6554,6 +6554,15 @@ const AngularWorkflow = (props) => { + + + + + - - - : null} ) diff --git a/frontend/src/views/Apps.jsx b/frontend/src/views/Apps.jsx index dd86648e..a2255cc6 100644 --- a/frontend/src/views/Apps.jsx +++ b/frontend/src/views/Apps.jsx @@ -20,6 +20,13 @@ const chipStyle = { backgroundColor: "#3d3f43", height: 30, marginRight: 5, paddingLeft: 5, paddingRight: 5, height: 28, cursor: "pointer", borderColor: "#3d3f43", color: "white", } +// Fixes names by making them uppercase and such +// Used for labels. A lot of places don't use this yet +export const FixName = (name) => { + const newAppname = (name.charAt(0).toUpperCase()+name.substring(1)).replaceAll("_", " ") + return newAppname +} + // Parses JSON data into keys that can be used everywhere :) export const GetParsedPaths = (inputdata, basekey) => { const splitkey = " > "