diff --git a/backend/go-app/walkoff.go b/backend/go-app/walkoff.go index 2f057c8e..75c979dd 100755 --- a/backend/go-app/walkoff.go +++ b/backend/go-app/walkoff.go @@ -1390,7 +1390,7 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request childNodes := shuffle.FindChildNodes(workflowExecution, workflowExecution.Start, []string{}, []string{}) - topic := "workflows" + //topic := "workflows" startFound := false // FIXME - remove this? newActions := []shuffle.Action{} @@ -1708,6 +1708,7 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request workflowExecution.Results = defaultResults workflowExecution.Workflow.Actions = newActions onpremExecution := true + _ = onpremExecution environments := []string{} 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) 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")) } @@ -1744,6 +1745,7 @@ func handleExecution(id string, workflow shuffle.Workflow, request *http.Request // Check if the actions are children of the startnode? imageNames := []string{} cloudExec := false + _ = cloudExec for _, action := range workflowExecution.Workflow.Actions { // Verify if the action environment exists and append found := false diff --git a/frontend/package.json b/frontend/package.json index 30683143..be999153 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -68,7 +68,7 @@ "react-markdown-github": "^3.3.1", "react-powerhooks": "0.0.7", "react-router": "6.2.1", - "react-router-dom": "6.2.1", + "react-router-dom": "^6.14.1", "react-scripts": "^4.0.1", "react-shepherd": "^3.3.6", "reactstrap": "^7.1.0", @@ -104,11 +104,11 @@ "not op_mini all" ], "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", "promise-window": "^1.2.1", - "@babel/core": "^7.15.8", - "babel-eslint": "^10.1.0", - "webpack": "^4.44.2", - "@babel/plugin-proposal-private-property-in-object": "^7.21.11" + "webpack": "^4.44.2" } } diff --git a/frontend/src/components/CacheView.jsx b/frontend/src/components/CacheView.jsx index 873f9f7e..12ec0c1c 100644 --- a/frontend/src/components/CacheView.jsx +++ b/frontend/src/components/CacheView.jsx @@ -41,18 +41,38 @@ import { Visibility as VisibilityIcon, VisibilityOff as VisibilityOffIcon, } 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 { globalUrl, userdata, serverside, orgId } = props; const [orgCache, setOrgCache] = React.useState(""); const [listCache, setListCache] = React.useState([]); const [addCache, setAddCache] = React.useState(""); + const [editedCache, setEditedCache] = React.useState(""); const [modalOpen, setModalOpen] = React.useState(false); - const [key, setKey]= React.useState(""); - const [value, setValue]= React.useState(""); - const [cacheInput, setCacheInput]= React.useState(""); - const [cacheCursor, setCacheCursor]= React.useState(""); - + const [key, setKey] = React.useState(""); + const [value, setValue] = React.useState(""); + const [cacheInput, setCacheInput] = 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(); useEffect(() => { listOrgCache(orgId); @@ -68,26 +88,26 @@ const CacheView = (props) => { }, credentials: "include", }) - .then((response) => { - if (response.status !== 200) { - console.log("Status not 200 for apps :O!"); - return; - } + .then((response) => { + if (response.status !== 200) { + console.log("Status not 200 for apps :O!"); + return; + } - return response.json(); - }) - .then((responseJson) => { - if (responseJson.success === true) { - setListCache(responseJson.keys); - } + return response.json(); + }) + .then((responseJson) => { + if (responseJson.success === true) { + setListCache(responseJson.keys); + } - if (responseJson.cursor !== undefined && responseJson.cursor !== null && responseJson.cursor !== "") { - setCacheCursor(responseJson.cursor); - } - }) - .catch((error) => { - alert.error(error.toString()); - }); + if (responseJson.cursor !== undefined && responseJson.cursor !== null && responseJson.cursor !== "") { + setCacheCursor(responseJson.cursor); + } + }) + .catch((error) => { + alert.error(error.toString()); + }); }; // const getCacheList = (orgId) => { @@ -103,8 +123,8 @@ const CacheView = (props) => { // if (response.status !== 200) { // console.log("Status not 200 for WORKFLOW EXECUTION :O!"); // } - - + + // return response.json(); // }) // .then((responseJson) => { @@ -126,37 +146,72 @@ const CacheView = (props) => { // console.log("Get userprofile error: ", error); // }) // } - + const deleteCache = (orgId, key) => { alert.info("Attempting to delete Cache"); fetch(globalUrl + `/api/v1/orgs/${orgId}/cache/${key}`, { - method: "DELETE", - headers: { - Accept: "application/json", - }, - credentials: "include", + method: "DELETE", + headers: { + Accept: "application/json", + }, + credentials: "include", }) - .then((response) => { - if (response.status === 200) { - alert.success("Successfully deleted Cache"); - setTimeout(() => { + .then((response) => { + if (response.status === 200) { + alert.success("Successfully deleted Cache"); + 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); - }, 1000); - } else { - alert.error("Failed deleting Cache. Does it still exist?"); - } - }) - .catch((error) => { - alert.error(error.toString()); - }); - }; + setModalOpen(false); + }) + .catch((error) => { + alert.error(error.toString()); + }); + }; const addOrgCache = (orgId) => { - const cache={key:key,value:value}; - setCacheInput([cache]); - console.log("cache input:",cacheInput) - + const cache = { key: key, value: value }; + setCacheInput([cache]); + console.log("cache input:", cacheInput) + fetch(globalUrl + `/api/v1/orgs/${orgId}/set_cache`, { method: "POST", @@ -187,6 +242,8 @@ const CacheView = (props) => { }; const modalView = ( + // console.log("key:", dataValue.key), + //console.log("value:",dataValue.value), { @@ -203,10 +260,10 @@ const CacheView = (props) => { > - Add Cache + { editCache ? "Edit Cache" : "Add Cache" } -
+
Key { fullWidth={true} autoComplete="Key" placeholder="abc" - id="keyfield" + id="keyfield" margin="normal" variant="outlined" - value={key} - onChange={(e)=>setKey(e.target.value)} + value={editCache ? dataValue.key : key} + onChange={(e) => setKey(e.target.value)} />
-
+
Value { id="Valuefield" margin="normal" variant="outlined" - value={value} - onChange={(e)=>setValue(e.target.value)} + defaultValue={editCache ? dataValue.value : ""} + onChange={(e) => setValue(e.target.value)} />
- +
@@ -282,7 +339,7 @@ const CacheView = (props) => {

Shuffle Datastore

- 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.  { style={{}} variant="contained" color="primary" - onClick={() => setModalOpen(true)} + onClick={() =>{ + setEditCache(false) + setModalOpen(true) + } + } > Add Cache @@ -319,19 +380,19 @@ const CacheView = (props) => { {listCache === undefined || listCache === null @@ -345,27 +406,41 @@ const CacheView = (props) => { return ( +
+ // 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} + /> +
@@ -377,7 +452,7 @@ const CacheView = (props) => { paddingLeft: "155px", }} primary= - {/* { { - + setEditCache(true) + setDataValue({"key":data.key,"value":data.value}) + setModalOpen(true) }} > { /> - */} + { console.log("Adding authorization from user side") 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 const orgId = urlParams.get("org_id"); if (orgId !== undefined && orgId !== null && orgId.length > 0) { @@ -524,6 +470,7 @@ const AuthenticationOauth2 = (props) => { } else { alert.info( "Field " + selectedApp.authentication.parameters[key].name.replace("_basic", "", -1).replace("_", " ", -1) + " can't be empty" + ); return; } diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index 1d628133..1871dee7 100755 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -1595,7 +1595,7 @@ const ParsedAction = (props) => { maxWidth: "95%", fontSize: "1em", }, - disableUnderline: true, + disableUnderline: true, endAdornment: hideExtraTypes ? null : ( diff --git a/frontend/src/views/Admin.jsx b/frontend/src/views/Admin.jsx index 58bf15fa..2082cf2a 100755 --- a/frontend/src/views/Admin.jsx +++ b/frontend/src/views/Admin.jsx @@ -3532,12 +3532,7 @@ Let me know if you're interested, or set up a call here: https://drift.me/${user

App Authentication

-<<<<<<< HEAD - Control the authentication options for individual apps. PS: Actions - performed here can be destructive! -======= Control the authentication options for individual apps. ->>>>>>> master  
-<<<<<<< HEAD - Learn more about authentication -======= Learn more about App Authentication ->>>>>>> master
{ .then((responseJson) => { //setUserSettings(responseJson) console.log("Resp: ", responseJson); + if (responseJson.reason !== undefined) { setResponse(responseJson.reason); setFinished(true);