Added edit functionality for apps that are public, ensuring they can be worked on and explored together (NOT gonna work for Workflows due to sensitive data)

This commit is contained in:
frikky
2022-02-06 18:03:58 +01:00
parent 6886f9e585
commit d3ec5c4ffa
2 changed files with 49 additions and 13 deletions
+15 -10
View File
@@ -721,6 +721,8 @@ const Apps = (props) => {
</Tooltip>
) : null;
// FIXME: Add /apps/new?id=<PUBLIC> to allow for changes of the original
// Should always reference the original ID.
var editButton =
selectedApp.activated &&
selectedApp.private_id !== undefined &&
@@ -741,10 +743,10 @@ const Apps = (props) => {
) : null;
//var editNewButton = editButton === null ?
var editNewButton = null
/*
<Link to={editUrl} style={{ textDecoration: "none" }}>
<Tooltip title={"Add your version"}>
console.log("User, & genrrated, activate: ", props.userdata, selectedApp.generated, selectedApp.activated)
var editNewButton = selectedApp.generated && selectedApp.activated && props.userdata.id !== selectedApp.owner ?
<Link to={activateUrl} style={{ textDecoration: "none" }}>
<Tooltip title={"Edit this public app to your liking"}>
<Button
variant="contained"
component="label"
@@ -755,9 +757,9 @@ const Apps = (props) => {
</Button>
</Tooltip>
</Link>
*/
: null
const activateButton =
const activateButton =
selectedApp.generated && !selectedApp.activated ? (
<div>
<Link to={activateUrl} style={{ textDecoration: "none" }}>
@@ -997,15 +999,14 @@ const Apps = (props) => {
) : null}
{activateButton}
{editNewButton}
{(props.userdata !== undefined &&
(props.userdata.role === "admin" ||
props.userdata.id === selectedApp.owner ||
selectedApp.owner === ""
)) ||
!selectedApp.generated ? (
)) || !selectedApp.generated ? (
<div>
{editButton}
{editNewButton}
{downloadButton}
{deleteButton}
</div>
@@ -1821,7 +1822,11 @@ const Apps = (props) => {
if (responseJson.success) {
alert.success("Successfully updated app configuration");
} else {
alert.error("Error updating app configuration");
if (responseJson.reason !== undefined && responseJson.reason !== null) {
alert.error("Error: "+responseJson.reason);
} else {
alert.error("Error updating app configuration");
}
}
})
.catch((error) => {