Merge pull request #896 from dhaval055/launch

added file editor
This commit is contained in:
Frikky
2022-07-14 13:28:43 +02:00
committed by GitHub
4 changed files with 1099 additions and 743 deletions
+2 -1
View File
@@ -6086,7 +6086,8 @@ func initHandlers() {
r.HandleFunc("/api/v1/files/namespaces/{namespace}", shuffle.HandleGetFileNamespace).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/files/namespaces/{namespace}", shuffle.HandleGetFileNamespace).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/files/{fileId}/content", shuffle.HandleGetFileContent).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/files/{fileId}/content", shuffle.HandleGetFileContent).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/files/create", shuffle.HandleCreateFile).Methods("POST", "OPTIONS") r.HandleFunc("/api/v1/files/create", shuffle.HandleCreateFile).Methods("POST", "OPTIONS")
r.HandleFunc("/api/v1/files/{fileId}/upload", shuffle.HandleUploadFile).Methods("POST", "OPTIONS") r.HandleFunc("/api/v1/files/{fileId}/upload", shuffle.HandleUploadFile).Methods("POST", "OPTIONS", "PATCH")
r.HandleFunc("/api/v1/files/{fileId}/edit", shuffle.HandleEditFile).Methods("PUT", "OPTIONS")
r.HandleFunc("/api/v1/files/{fileId}", shuffle.HandleGetFileMeta).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/files/{fileId}", shuffle.HandleGetFileMeta).Methods("GET", "OPTIONS")
r.HandleFunc("/api/v1/files/{fileId}", shuffle.HandleDeleteFile).Methods("DELETE", "OPTIONS") r.HandleFunc("/api/v1/files/{fileId}", shuffle.HandleDeleteFile).Methods("DELETE", "OPTIONS")
r.HandleFunc("/api/v1/files", shuffle.HandleGetFiles).Methods("GET", "OPTIONS") r.HandleFunc("/api/v1/files", shuffle.HandleGetFiles).Methods("GET", "OPTIONS")
+2 -1
View File
@@ -559,7 +559,8 @@ func runWorkflowExecutionTransaction(ctx context.Context, attempts int64, workfl
} }
//log.Printf("BASE LENGTH: %d", len(workflowExecution.Results)) //log.Printf("BASE LENGTH: %d", len(workflowExecution.Results))
workflowExecution, dbSave, err := shuffle.ParsedExecutionResult(ctx, *workflowExecution, actionResult, false, 4)
workflowExecution, dbSave, err := shuffle.ParsedExecutionResult(ctx, *workflowExecution, actionResult, false, 0)
if err != nil { if err != nil {
b, suberr := json.Marshal(actionResult) b, suberr := json.Marshal(actionResult)
if suberr != nil { if suberr != nil {
+48 -12
View File
@@ -23,7 +23,7 @@ import {
} from "@material-ui/icons"; } from "@material-ui/icons";
import { import {
AutoFixHigh as AutoFixHighIcon, CompressOutlined, AutoFixHigh as AutoFixHighIcon, CompressOutlined, QrCodeScannerOutlined,
} from '@mui/icons-material'; } from '@mui/icons-material';
import { useTheme } from '@material-ui/core/styles'; import { useTheme } from '@material-ui/core/styles';
@@ -37,6 +37,7 @@ import 'codemirror/addon/selection/mark-selection.js'
import 'codemirror/theme/gruvbox-dark.css'; import 'codemirror/theme/gruvbox-dark.css';
import 'codemirror/theme/duotone-light.css'; import 'codemirror/theme/duotone-light.css';
import { padding, textAlign } from '@mui/system'; import { padding, textAlign } from '@mui/system';
import data from '../frameworkStyle.jsx';
const liquidFilters = [ const liquidFilters = [
{"name": "Size", "value": "size", "example": ""}, {"name": "Size", "value": "size", "example": ""},
@@ -55,7 +56,7 @@ const pythonFilters = [
] ]
const CodeEditor = (props) => { const CodeEditor = (props) => {
const { fieldCount, setFieldCount, actionlist, changeActionParameterCodeMirror, expansionModalOpen, setExpansionModalOpen, codedata, setcodedata } = props const { fieldCount, setFieldCount, actionlist, changeActionParameterCodeMirror, expansionModalOpen, setExpansionModalOpen, codedata, setcodedata, isFileEditor, runUpdateText } = props
const [localcodedata, setlocalcodedata] = React.useState(codedata === undefined || codedata === null || codedata.length === 0 ? "" : codedata); const [localcodedata, setlocalcodedata] = React.useState(codedata === undefined || codedata === null || codedata.length === 0 ? "" : codedata);
// const {codelang, setcodelang} = props // const {codelang, setcodelang} = props
const theme = useTheme(); const theme = useTheme();
@@ -80,11 +81,16 @@ const CodeEditor = (props) => {
const mathOpen = Boolean(anchorEl2); const mathOpen = Boolean(anchorEl2);
const pythonOpen = Boolean(anchorEl3); const pythonOpen = Boolean(anchorEl3);
// console.log("is it file editor? - ", isFileEditor);
useEffect(() => { useEffect(() => {
var allVariables = [] var allVariables = []
var tmpVariables = [] var tmpVariables = []
if (actionlist === undefined || actionlist === null) {
return
}
for(var i=0; i < actionlist.length; i++){ for(var i=0; i < actionlist.length; i++){
allVariables.push('$'+actionlist[i].autocomplete.toLowerCase()) allVariables.push('$'+actionlist[i].autocomplete.toLowerCase())
tmpVariables.push('$'+actionlist[i].autocomplete.toLowerCase()) tmpVariables.push('$'+actionlist[i].autocomplete.toLowerCase())
@@ -367,7 +373,7 @@ const CodeEditor = (props) => {
disableEnforceFocus={true} disableEnforceFocus={true}
//style={{ pointerEvents: "none" }} //style={{ pointerEvents: "none" }}
hideBackdrop={true} hideBackdrop={true}
open={expansionModalOpen} open={expansionModalOpen}
onClose={() => { onClose={() => {
console.log("In closer") console.log("In closer")
changeActionParameterCodeMirror({target: {value: ""}}, fieldCount, localcodedata) changeActionParameterCodeMirror({target: {value: ""}}, fieldCount, localcodedata)
@@ -385,6 +391,26 @@ const CodeEditor = (props) => {
}, },
}} }}
> >
{ isFileEditor ?
<div
style={{
display: 'flex',
}}
>
<div style={{display: "flex"}}>
<DialogTitle
id="draggable-dialog-title"
style={{
cursor: "move",
paddingBottom:20,
paddingLeft: 10,
}}
>
File Editor
</DialogTitle>
</div>
</div>
:
<div <div
style={{ style={{
display: 'flex', display: 'flex',
@@ -420,8 +446,10 @@ const CodeEditor = (props) => {
</Tooltip> </Tooltip>
</IconButton> </IconButton>
</div> </div>
</div> </div> }
{ isFileEditor ? null :
<div style={{display: "flex"}}> <div style={{display: "flex"}}>
<Button <Button
id="basic-button" id="basic-button"
@@ -527,8 +555,8 @@ const CodeEditor = (props) => {
}}>{item.name}</MenuItem> }}>{item.name}</MenuItem>
) )
})} })}
</Menu> </Menu>
</div> </div> }
<span style={{ <span style={{
border: `2px solid ${theme.palette.inputColor}`, border: `2px solid ${theme.palette.inputColor}`,
borderRadius: theme.palette.borderRadius, borderRadius: theme.palette.borderRadius,
@@ -536,7 +564,7 @@ const CodeEditor = (props) => {
}}> }}>
<CodeMirror <CodeMirror
value = {localcodedata} value = {localcodedata}
height="200px" height= {isFileEditor ? "450px" : "200px"}
style={{ style={{
}} }}
onCursorActivity = {(value) => { onCursorActivity = {(value) => {
@@ -695,7 +723,7 @@ const CodeEditor = (props) => {
*/} */}
</div> </div>
{isFileEditor ? null :
<div> <div>
{isMobile ? null : {isMobile ? null :
<DialogTitle <DialogTitle
@@ -765,11 +793,12 @@ const CodeEditor = (props) => {
> >
JSON Validation: {validation ? "Correct" : "Incorrect"} JSON Validation: {validation ? "Correct" : "Incorrect"}
</p> </p>
</div> </div> }
<div <div
style={{ style={{
display: 'flex', display: 'flex',
paddingTop : 30, // maybe handle this as well?
}} }}
> >
<button <button
@@ -784,7 +813,7 @@ const CodeEditor = (props) => {
cursor: "pointer" cursor: "pointer"
}} }}
onClick={() => { onClick={() => {
setExpansionModalOpen(false) setExpansionModalOpen(false);
}} }}
> >
Cancel Cancel
@@ -794,6 +823,7 @@ const CodeEditor = (props) => {
color: "white", color: "white",
background: "#f85a3e", background: "#f85a3e",
border: "none", border: "none",
height: 35, height: 35,
flex: 1, flex: 1,
marginLeft: 10, marginLeft: 10,
@@ -803,9 +833,15 @@ const CodeEditor = (props) => {
onClick={(event) => { onClick={(event) => {
// console.log(codedata) // console.log(codedata)
// console.log(fieldCount) // console.log(fieldCount)
if (isFileEditor === true){
runUpdateText(localcodedata);
setcodedata(localcodedata);
setExpansionModalOpen(false)
}
else {
changeActionParameterCodeMirror(event, fieldCount, localcodedata) changeActionParameterCodeMirror(event, fieldCount, localcodedata)
setExpansionModalOpen(false) setExpansionModalOpen(false)
setcodedata(localcodedata) setcodedata(localcodedata)}
}} }}
> >
Done Done
+1047 -729
View File
File diff suppressed because it is too large Load Diff