Added new cloud fixes
This commit is contained in:
@@ -1390,7 +1390,7 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
|
|||||||
|
|
||||||
childNodes := shuffle.FindChildNodes(workflowExecution, workflowExecution.Start, []string{}, []string{})
|
childNodes := shuffle.FindChildNodes(workflowExecution, workflowExecution.Start, []string{}, []string{})
|
||||||
|
|
||||||
topic := "workflows"
|
//topic := "workflows"
|
||||||
startFound := false
|
startFound := false
|
||||||
// FIXME - remove this?
|
// FIXME - remove this?
|
||||||
newActions := []shuffle.Action{}
|
newActions := []shuffle.Action{}
|
||||||
@@ -1708,6 +1708,7 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
|
|||||||
workflowExecution.Results = defaultResults
|
workflowExecution.Results = defaultResults
|
||||||
workflowExecution.Workflow.Actions = newActions
|
workflowExecution.Workflow.Actions = newActions
|
||||||
onpremExecution := true
|
onpremExecution := true
|
||||||
|
_ = onpremExecution
|
||||||
environments := []string{}
|
environments := []string{}
|
||||||
|
|
||||||
if len(workflowExecution.ExecutionOrg) == 0 && len(workflow.ExecutingOrg.Id) > 0 {
|
if len(workflowExecution.ExecutionOrg) == 0 && len(workflow.ExecutingOrg.Id) > 0 {
|
||||||
@@ -1720,7 +1721,7 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
|
|||||||
|
|
||||||
allEnvironments, err := shuffle.GetEnvironments(ctx, workflowExecution.ExecutionOrg)
|
allEnvironments, err := shuffle.GetEnvironments(ctx, workflowExecution.ExecutionOrg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed finding environments: %s", err)
|
log.Printf("[WARNING] Failed finding environments: %s", err)
|
||||||
return shuffle.WorkflowExecution{}, fmt.Sprintf("Workflow environments not found for this org"), errors.New(fmt.Sprintf("Workflow environments not found for this org"))
|
return shuffle.WorkflowExecution{}, fmt.Sprintf("Workflow environments not found for this org"), errors.New(fmt.Sprintf("Workflow environments not found for this org"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1744,6 +1745,7 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request
|
|||||||
// Check if the actions are children of the startnode?
|
// Check if the actions are children of the startnode?
|
||||||
imageNames := []string{}
|
imageNames := []string{}
|
||||||
cloudExec := false
|
cloudExec := false
|
||||||
|
_ = cloudExec
|
||||||
for _, action := range workflowExecution.Workflow.Actions {
|
for _, action := range workflowExecution.Workflow.Actions {
|
||||||
// Verify if the action environment exists and append
|
// Verify if the action environment exists and append
|
||||||
found := false
|
found := false
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
"react-markdown-github": "^3.3.1",
|
"react-markdown-github": "^3.3.1",
|
||||||
"react-powerhooks": "0.0.7",
|
"react-powerhooks": "0.0.7",
|
||||||
"react-router": "6.2.1",
|
"react-router": "6.2.1",
|
||||||
"react-router-dom": "6.2.1",
|
"react-router-dom": "^6.14.1",
|
||||||
"react-scripts": "^4.0.1",
|
"react-scripts": "^4.0.1",
|
||||||
"react-shepherd": "^3.3.6",
|
"react-shepherd": "^3.3.6",
|
||||||
"reactstrap": "^7.1.0",
|
"reactstrap": "^7.1.0",
|
||||||
@@ -104,11 +104,11 @@
|
|||||||
"not op_mini all"
|
"not op_mini all"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.15.8",
|
||||||
|
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
|
||||||
|
"babel-eslint": "^10.1.0",
|
||||||
"prettier": "2.4.1",
|
"prettier": "2.4.1",
|
||||||
"promise-window": "^1.2.1",
|
"promise-window": "^1.2.1",
|
||||||
"@babel/core": "^7.15.8",
|
"webpack": "^4.44.2"
|
||||||
"babel-eslint": "^10.1.0",
|
|
||||||
"webpack": "^4.44.2",
|
|
||||||
"@babel/plugin-proposal-private-property-in-object": "^7.21.11"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,18 +41,38 @@ import {
|
|||||||
Visibility as VisibilityIcon,
|
Visibility as VisibilityIcon,
|
||||||
VisibilityOff as VisibilityOffIcon,
|
VisibilityOff as VisibilityOffIcon,
|
||||||
} from "@material-ui/icons";
|
} from "@material-ui/icons";
|
||||||
|
import data from "./frameworkStyle.jsx";
|
||||||
|
|
||||||
|
const scrollStyle1 = {
|
||||||
|
height: 100,
|
||||||
|
width: 225,
|
||||||
|
overflow: "hidden",
|
||||||
|
position: "relative",
|
||||||
|
}
|
||||||
|
|
||||||
|
const scrollStyle2 = {
|
||||||
|
position: "absolute",
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
bottom: "-20px",
|
||||||
|
right: "-20px",
|
||||||
|
overflow: "scroll",
|
||||||
|
}
|
||||||
|
|
||||||
const CacheView = (props) => {
|
const CacheView = (props) => {
|
||||||
const { globalUrl, userdata, serverside, orgId } = props;
|
const { globalUrl, userdata, serverside, orgId } = props;
|
||||||
const [orgCache, setOrgCache] = React.useState("");
|
const [orgCache, setOrgCache] = React.useState("");
|
||||||
const [listCache, setListCache] = React.useState([]);
|
const [listCache, setListCache] = React.useState([]);
|
||||||
const [addCache, setAddCache] = React.useState("");
|
const [addCache, setAddCache] = React.useState("");
|
||||||
|
const [editedCache, setEditedCache] = React.useState("");
|
||||||
const [modalOpen, setModalOpen] = React.useState(false);
|
const [modalOpen, setModalOpen] = React.useState(false);
|
||||||
const [key, setKey]= React.useState("");
|
const [key, setKey] = React.useState("");
|
||||||
const [value, setValue]= React.useState("");
|
const [value, setValue] = React.useState("");
|
||||||
const [cacheInput, setCacheInput]= React.useState("");
|
const [cacheInput, setCacheInput] = React.useState("");
|
||||||
const [cacheCursor, setCacheCursor]= React.useState("");
|
const [cacheCursor, setCacheCursor] = React.useState("");
|
||||||
|
const [dataValue, setDataValue] = React.useState({});
|
||||||
|
const [editCache, setEditCache] = React.useState(false);
|
||||||
|
const [show, setShow] = useState({});
|
||||||
const alert = useAlert();
|
const alert = useAlert();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
listOrgCache(orgId);
|
listOrgCache(orgId);
|
||||||
@@ -68,26 +88,26 @@ const CacheView = (props) => {
|
|||||||
},
|
},
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.status !== 200) {
|
if (response.status !== 200) {
|
||||||
console.log("Status not 200 for apps :O!");
|
console.log("Status not 200 for apps :O!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.json();
|
return response.json();
|
||||||
})
|
})
|
||||||
.then((responseJson) => {
|
.then((responseJson) => {
|
||||||
if (responseJson.success === true) {
|
if (responseJson.success === true) {
|
||||||
setListCache(responseJson.keys);
|
setListCache(responseJson.keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseJson.cursor !== undefined && responseJson.cursor !== null && responseJson.cursor !== "") {
|
if (responseJson.cursor !== undefined && responseJson.cursor !== null && responseJson.cursor !== "") {
|
||||||
setCacheCursor(responseJson.cursor);
|
setCacheCursor(responseJson.cursor);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
alert.error(error.toString());
|
alert.error(error.toString());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// const getCacheList = (orgId) => {
|
// const getCacheList = (orgId) => {
|
||||||
@@ -103,8 +123,8 @@ const CacheView = (props) => {
|
|||||||
// if (response.status !== 200) {
|
// if (response.status !== 200) {
|
||||||
// console.log("Status not 200 for WORKFLOW EXECUTION :O!");
|
// console.log("Status not 200 for WORKFLOW EXECUTION :O!");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// return response.json();
|
// return response.json();
|
||||||
// })
|
// })
|
||||||
// .then((responseJson) => {
|
// .then((responseJson) => {
|
||||||
@@ -126,37 +146,72 @@ const CacheView = (props) => {
|
|||||||
// console.log("Get userprofile error: ", error);
|
// console.log("Get userprofile error: ", error);
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
const deleteCache = (orgId, key) => {
|
const deleteCache = (orgId, key) => {
|
||||||
alert.info("Attempting to delete Cache");
|
alert.info("Attempting to delete Cache");
|
||||||
fetch(globalUrl + `/api/v1/orgs/${orgId}/cache/${key}`, {
|
fetch(globalUrl + `/api/v1/orgs/${orgId}/cache/${key}`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
},
|
},
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
alert.success("Successfully deleted Cache");
|
alert.success("Successfully deleted Cache");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
listOrgCache(orgId);
|
||||||
|
}, 1000);
|
||||||
|
} else {
|
||||||
|
alert.error("Failed deleting Cache. Does it still exist?");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
alert.error(error.toString());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const editOrgCache = (orgId) => {
|
||||||
|
const cache = { key: dataValue.key , value: value };
|
||||||
|
setCacheInput([cache]);
|
||||||
|
console.log("cache:", cache)
|
||||||
|
console.log("cache input: ", cacheInput)
|
||||||
|
|
||||||
|
fetch(globalUrl + `/api/v1/orgs/${orgId}/set_cache`, {
|
||||||
|
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
Accept: "application/json",
|
||||||
|
},
|
||||||
|
credentials: "include",
|
||||||
|
body: JSON.stringify(cache),
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
if (response.status !== 200) {
|
||||||
|
console.log("Status not 200 for Cache :O!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return response.json();
|
||||||
|
})
|
||||||
|
.then((responseJson) => {
|
||||||
|
setAddCache(responseJson);
|
||||||
|
alert.success("Cache Edited Successfully!");
|
||||||
listOrgCache(orgId);
|
listOrgCache(orgId);
|
||||||
}, 1000);
|
setModalOpen(false);
|
||||||
} else {
|
})
|
||||||
alert.error("Failed deleting Cache. Does it still exist?");
|
.catch((error) => {
|
||||||
}
|
alert.error(error.toString());
|
||||||
})
|
});
|
||||||
.catch((error) => {
|
};
|
||||||
alert.error(error.toString());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const addOrgCache = (orgId) => {
|
const addOrgCache = (orgId) => {
|
||||||
const cache={key:key,value:value};
|
const cache = { key: key, value: value };
|
||||||
setCacheInput([cache]);
|
setCacheInput([cache]);
|
||||||
console.log("cache input:",cacheInput)
|
console.log("cache input:", cacheInput)
|
||||||
|
|
||||||
fetch(globalUrl + `/api/v1/orgs/${orgId}/set_cache`, {
|
fetch(globalUrl + `/api/v1/orgs/${orgId}/set_cache`, {
|
||||||
|
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -187,6 +242,8 @@ const CacheView = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const modalView = (
|
const modalView = (
|
||||||
|
// console.log("key:", dataValue.key),
|
||||||
|
//console.log("value:",dataValue.value),
|
||||||
<Dialog
|
<Dialog
|
||||||
open={modalOpen}
|
open={modalOpen}
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
@@ -203,10 +260,10 @@ const CacheView = (props) => {
|
|||||||
>
|
>
|
||||||
<DialogTitle>
|
<DialogTitle>
|
||||||
<span style={{ color: "white" }}>
|
<span style={{ color: "white" }}>
|
||||||
Add Cache
|
{ editCache ? "Edit Cache" : "Add Cache" }
|
||||||
</span>
|
</span>
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<div style={{paddingLeft: "30px", paddingRight: '30px'}}>
|
<div style={{ paddingLeft: "30px", paddingRight: '30px' }}>
|
||||||
Key
|
Key
|
||||||
<TextField
|
<TextField
|
||||||
color="primary"
|
color="primary"
|
||||||
@@ -223,14 +280,14 @@ const CacheView = (props) => {
|
|||||||
fullWidth={true}
|
fullWidth={true}
|
||||||
autoComplete="Key"
|
autoComplete="Key"
|
||||||
placeholder="abc"
|
placeholder="abc"
|
||||||
id="keyfield"
|
id="keyfield"
|
||||||
margin="normal"
|
margin="normal"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
value={key}
|
value={editCache ? dataValue.key : key}
|
||||||
onChange={(e)=>setKey(e.target.value)}
|
onChange={(e) => setKey(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div style={{paddingLeft: "30px", paddingRight: '30px'}}>
|
<div style={{ paddingLeft: "30px", paddingRight: '30px' }}>
|
||||||
Value
|
Value
|
||||||
<TextField
|
<TextField
|
||||||
color="primary"
|
color="primary"
|
||||||
@@ -249,11 +306,11 @@ const CacheView = (props) => {
|
|||||||
id="Valuefield"
|
id="Valuefield"
|
||||||
margin="normal"
|
margin="normal"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
value={value}
|
defaultValue={editCache ? dataValue.value : ""}
|
||||||
onChange={(e)=>setValue(e.target.value)}
|
onChange={(e) => setValue(e.target.value)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<DialogActions style={{paddingLeft: "30px", paddingRight: '30px'}}>
|
<DialogActions style={{ paddingLeft: "30px", paddingRight: '30px' }}>
|
||||||
<Button
|
<Button
|
||||||
style={{ borderRadius: "0px" }}
|
style={{ borderRadius: "0px" }}
|
||||||
onClick={() => setModalOpen(false)}
|
onClick={() => setModalOpen(false)}
|
||||||
@@ -265,11 +322,11 @@ const CacheView = (props) => {
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
style={{ borderRadius: "0px" }}
|
style={{ borderRadius: "0px" }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
addOrgCache(orgId)
|
{editCache ? editOrgCache(orgId) : addOrgCache(orgId)}
|
||||||
}}
|
}}
|
||||||
color="primary"
|
color="primary"
|
||||||
>
|
>
|
||||||
Submit
|
{editCache ? "Edit":"Submit"}
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@@ -282,7 +339,7 @@ const CacheView = (props) => {
|
|||||||
<div style={{ marginTop: 20, marginBottom: 20 }}>
|
<div style={{ marginTop: 20, marginBottom: 20 }}>
|
||||||
<h2 style={{ display: "inline" }}>Shuffle Datastore</h2>
|
<h2 style={{ display: "inline" }}>Shuffle Datastore</h2>
|
||||||
<span style={{ marginLeft: 25 }}>
|
<span style={{ marginLeft: 25 }}>
|
||||||
Datastore is a key-value store for storing data that can be used cross-workflow.
|
Datastore is a key-value store for storing data that can be used cross-workflow.
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
@@ -297,7 +354,11 @@ const CacheView = (props) => {
|
|||||||
style={{}}
|
style={{}}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
onClick={() => setModalOpen(true)}
|
onClick={() =>{
|
||||||
|
setEditCache(false)
|
||||||
|
setModalOpen(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
>
|
>
|
||||||
Add Cache
|
Add Cache
|
||||||
</Button>
|
</Button>
|
||||||
@@ -319,19 +380,19 @@ const CacheView = (props) => {
|
|||||||
<ListItem>
|
<ListItem>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary="Key"
|
primary="Key"
|
||||||
// style={{ minWidth: 150, maxWidth: 150 }}
|
// style={{ minWidth: 150, maxWidth: 150 }}
|
||||||
/>
|
/>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary="value"
|
primary="value"
|
||||||
// style={{ minWidth: 150, maxWidth: 150 }}
|
// style={{ minWidth: 150, maxWidth: 150 }}
|
||||||
/>
|
/>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary="Updated"
|
primary="Updated"
|
||||||
// style={{ minWidth: 150, maxWidth: 150 }}
|
// style={{ minWidth: 150, maxWidth: 150 }}
|
||||||
/>
|
/>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary="Actions"
|
primary="Actions"
|
||||||
// style={{ minWidth: 150, maxWidth: 150 }}
|
// style={{ minWidth: 150, maxWidth: 150 }}
|
||||||
/>
|
/>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
{listCache === undefined || listCache === null
|
{listCache === undefined || listCache === null
|
||||||
@@ -345,27 +406,41 @@ const CacheView = (props) => {
|
|||||||
return (
|
return (
|
||||||
<ListItem key={index} style={{ backgroundColor: bgColor }}>
|
<ListItem key={index} style={{ backgroundColor: bgColor }}>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
style={{
|
style={{
|
||||||
maxWidth: 225,
|
maxWidth: 225,
|
||||||
minWidth: 225,
|
minWidth: 225,
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
}}
|
}}
|
||||||
primary={data.key}
|
primary={data.key}
|
||||||
/>
|
/>
|
||||||
|
<div style={scrollStyle1}>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
style={{
|
// style={{
|
||||||
maxWidth: 225,
|
// maxWidth: 225,
|
||||||
minWidth: 225,
|
// maxHeight: 150,
|
||||||
overflow: "hidden",
|
// // overflow: "hidden",
|
||||||
paddingLeft: "52px",
|
// paddingLeft: "52px",
|
||||||
}}
|
// overflow: "scroll",
|
||||||
|
|
||||||
|
// }}
|
||||||
|
style={scrollStyle2}
|
||||||
// style={{ maxWidth: 100, minWidth: 100 }}
|
// style={{ maxWidth: 100, minWidth: 100 }}
|
||||||
primary={data.value} />
|
// onMouseOver={() =>
|
||||||
|
// setShow((prevState) => ({ ...prevState, [data.value]: true }))
|
||||||
|
// }
|
||||||
|
// onMouseLeave={() =>
|
||||||
|
// setShow((prevState) => ({ ...prevState, [data.value]: false }))
|
||||||
|
// }
|
||||||
|
//primary={show[data.value] ? data.value : `${data.value.substring(0, 5)}...`}
|
||||||
|
primary={data.value}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
style={{
|
style={{
|
||||||
maxWidth: 225,
|
maxWidth: 225,
|
||||||
minWidth: 225,
|
minWidth: 225,
|
||||||
overflow: "hidden",
|
overflow: "hidden",
|
||||||
|
marginLeft: "42px",
|
||||||
}}
|
}}
|
||||||
primary={new Date(data.edited * 1000).toISOString()}
|
primary={new Date(data.edited * 1000).toISOString()}
|
||||||
/>
|
/>
|
||||||
@@ -377,7 +452,7 @@ const CacheView = (props) => {
|
|||||||
paddingLeft: "155px",
|
paddingLeft: "155px",
|
||||||
}}
|
}}
|
||||||
primary=<span style={{ display: "inline" }}>
|
primary=<span style={{ display: "inline" }}>
|
||||||
{/* <Tooltip
|
<Tooltip
|
||||||
title="Edit"
|
title="Edit"
|
||||||
style={{}}
|
style={{}}
|
||||||
aria-label={"Edit"}
|
aria-label={"Edit"}
|
||||||
@@ -386,7 +461,9 @@ const CacheView = (props) => {
|
|||||||
<IconButton
|
<IconButton
|
||||||
style={{ padding: "6px" }}
|
style={{ padding: "6px" }}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
setEditCache(true)
|
||||||
|
setDataValue({"key":data.key,"value":data.value})
|
||||||
|
setModalOpen(true)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<EditIcon
|
<EditIcon
|
||||||
@@ -394,7 +471,7 @@ const CacheView = (props) => {
|
|||||||
/>
|
/>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</span>
|
</span>
|
||||||
</Tooltip> */}
|
</Tooltip>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
title={"Delete Cache"}
|
title={"Delete Cache"}
|
||||||
style={{ marginLeft: 15, }}
|
style={{ marginLeft: 15, }}
|
||||||
|
|||||||
@@ -325,61 +325,7 @@ const AuthenticationOauth2 = (props) => {
|
|||||||
console.log("Adding authorization from user side")
|
console.log("Adding authorization from user side")
|
||||||
state += `%26authorization%3d${userAuth}`;
|
state += `%26authorization%3d${userAuth}`;
|
||||||
}
|
}
|
||||||
// write:request:jira-service-management
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const handleOauth2Request = (client_id, client_secret, oauth_url, scopes, admin_consent, prompt) => {
|
|
||||||
setButtonClicked(true);
|
|
||||||
//console.log("SCOPES: ", scopes);
|
|
||||||
|
|
||||||
client_id = client_id.trim()
|
|
||||||
client_secret = client_secret.trim()
|
|
||||||
oauth_url = oauth_url.trim()
|
|
||||||
|
|
||||||
var resources = "";
|
|
||||||
if (scopes !== undefined && (scopes !== null) & (scopes.length > 0)) {
|
|
||||||
console.log("IN scope 1")
|
|
||||||
if (offlineAccess === true && !scopes.includes("offline_access")) {
|
|
||||||
|
|
||||||
console.log("IN scope 2")
|
|
||||||
if (!authenticationType.redirect_uri.includes("google")) {
|
|
||||||
console.log("Appending offline access")
|
|
||||||
scopes.push("offline_access")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resources = scopes.join(" ");
|
|
||||||
//resources = scopes.join(",");
|
|
||||||
}
|
|
||||||
|
|
||||||
const authentication_url = authenticationType.token_uri;
|
|
||||||
//console.log("AUTH: ", authenticationType)
|
|
||||||
//console.log("SCOPES2: ", resources)
|
|
||||||
const redirectUri = `${window.location.protocol}//${window.location.host}/set_authentication`;
|
|
||||||
const workflowId = workflow !== undefined ? workflow.id : "";
|
|
||||||
var state = `workflow_id%3D${workflowId}%26reference_action_id%3d${selectedAction.app_id}%26app_name%3d${selectedAction.app_name}%26app_id%3d${selectedAction.app_id}%26app_version%3d${selectedAction.app_version}%26authentication_url%3d${authentication_url}%26scope%3d${resources}%26client_id%3d${client_id}%26client_secret%3d${client_secret}`;
|
|
||||||
if (oauth_url !== undefined && oauth_url !== null && oauth_url.length > 0) {
|
|
||||||
state += `%26oauth_url%3d${oauth_url}`;
|
|
||||||
console.log("ADDING OAUTH2 URL: ", state);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
authenticationType.refresh_uri !== undefined &&
|
|
||||||
authenticationType.refresh_uri !== null &&
|
|
||||||
authenticationType.refresh_uri.length > 0
|
|
||||||
) {
|
|
||||||
state += `%26refresh_uri%3d${authenticationType.refresh_uri}`;
|
|
||||||
} else {
|
|
||||||
state += `%26refresh_uri%3d${authentication_url}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// No prompt forcing
|
|
||||||
//var url = `${authenticationType.redirect_uri}?client_id=${client_id}&redirect_uri=${redirectUri}&response_type=code&prompt=login&scope=${resources}&state=${state}&access_type=offline`;
|
|
||||||
var defaultPrompt = "login"
|
|
||||||
if (prompt !== undefined && prompt !== null && prompt.length > 0) {
|
|
||||||
defaultPrompt = prompt
|
|
||||||
}
|
|
||||||
// Check for org_id
|
// Check for org_id
|
||||||
const orgId = urlParams.get("org_id");
|
const orgId = urlParams.get("org_id");
|
||||||
if (orgId !== undefined && orgId !== null && orgId.length > 0) {
|
if (orgId !== undefined && orgId !== null && orgId.length > 0) {
|
||||||
@@ -524,6 +470,7 @@ const AuthenticationOauth2 = (props) => {
|
|||||||
} else {
|
} else {
|
||||||
alert.info(
|
alert.info(
|
||||||
"Field " + selectedApp.authentication.parameters[key].name.replace("_basic", "", -1).replace("_", " ", -1) + " can't be empty"
|
"Field " + selectedApp.authentication.parameters[key].name.replace("_basic", "", -1).replace("_", " ", -1) + " can't be empty"
|
||||||
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1595,7 +1595,7 @@ const ParsedAction = (props) => {
|
|||||||
maxWidth: "95%",
|
maxWidth: "95%",
|
||||||
fontSize: "1em",
|
fontSize: "1em",
|
||||||
},
|
},
|
||||||
disableUnderline: true,
|
disableUnderline: true,
|
||||||
endAdornment: hideExtraTypes ? null : (
|
endAdornment: hideExtraTypes ? null : (
|
||||||
<InputAdornment position="end">
|
<InputAdornment position="end">
|
||||||
<ButtonGroup orientation={multiline ? "vertical" : "horizontal"}>
|
<ButtonGroup orientation={multiline ? "vertical" : "horizontal"}>
|
||||||
|
|||||||
@@ -3532,12 +3532,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
|||||||
<div style={{ marginTop: 20, marginBottom: 20 }}>
|
<div style={{ marginTop: 20, marginBottom: 20 }}>
|
||||||
<h2 style={{ display: "inline" }}>App Authentication</h2>
|
<h2 style={{ display: "inline" }}>App Authentication</h2>
|
||||||
<span style={{ marginLeft: 25 }}>
|
<span style={{ marginLeft: 25 }}>
|
||||||
<<<<<<< HEAD
|
|
||||||
Control the authentication options for individual apps. PS: Actions
|
|
||||||
performed here can be destructive!
|
|
||||||
=======
|
|
||||||
Control the authentication options for individual apps.
|
Control the authentication options for individual apps.
|
||||||
>>>>>>> master
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<a
|
<a
|
||||||
@@ -3546,11 +3541,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user
|
|||||||
href="/docs/organizations#app_authentication"
|
href="/docs/organizations#app_authentication"
|
||||||
style={{ textDecoration: "none", color: "#f85a3e" }}
|
style={{ textDecoration: "none", color: "#f85a3e" }}
|
||||||
>
|
>
|
||||||
<<<<<<< HEAD
|
|
||||||
Learn more about authentication
|
|
||||||
=======
|
|
||||||
Learn more about App Authentication
|
Learn more about App Authentication
|
||||||
>>>>>>> master
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<Divider
|
<Divider
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ const SetAuthentication = (props) => {
|
|||||||
.then((responseJson) => {
|
.then((responseJson) => {
|
||||||
//setUserSettings(responseJson)
|
//setUserSettings(responseJson)
|
||||||
console.log("Resp: ", responseJson);
|
console.log("Resp: ", responseJson);
|
||||||
|
|
||||||
if (responseJson.reason !== undefined) {
|
if (responseJson.reason !== undefined) {
|
||||||
setResponse(responseJson.reason);
|
setResponse(responseJson.reason);
|
||||||
setFinished(true);
|
setFinished(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user