Added namespace downloads for files as ZIP

This commit is contained in:
frikky
2021-09-01 00:56:53 +02:00
parent da75cfd541
commit 24c01eb89d
8 changed files with 50 additions and 19 deletions
-5
View File
@@ -1,5 +0,0 @@
# 2. docker run -p 8000:8000
FROM google/cloud-sdk
EXPOSE 8000
CMD ["gcloud", "beta", "emulators", "datastore", "start", "--project=shuffle", "--host-port", "0.0.0.0:8000", "--data-dir=/etc/shuffle"]
+2 -2
View File
@@ -2076,9 +2076,9 @@ func executeWorkflow(resp http.ResponseWriter, request *http.Request) {
if user.Id != workflow.Owner && user.Role != "scheduler" && user.Role != fmt.Sprintf("workflow_%s", fileId) {
if workflow.OrgId == user.ActiveOrg.Id && user.Role == "admin" {
log.Printf("[INFO] Letting user %s execute %s because they're admin of the same org", user.Username, workflow.ID)
log.Printf("[AUDIT] Letting user %s execute %s because they're admin of the same org", user.Username, workflow.ID)
} else {
log.Printf("[WARNING] Wrong user (%s) for workflow %s (execute)", user.Username, workflow.ID)
log.Printf("[AUDIT] Wrong user (%s) for workflow %s (execute)", user.Username, workflow.ID)
resp.WriteHeader(401)
resp.Write([]byte(`{"success": false}`))
return
+35 -6
View File
@@ -11,8 +11,8 @@ import { FixName } from "../views/Apps.jsx";
// Triggers
//
// Specifically used for UNSAVED workflows only?
const Workflow = (props) => {
const { globalUrl, theme, workflow, appAuthentication, setSelectedAction, setAuthenticationModalOpen, setSelectedApp, apps, selectedAction,setConfigureWorkflowModalOpen, saveWorkflow, newWebhook, submitSchedule, referenceUrl, isCloud, setAuthenticationType, } = props
const ConfigureWorkflow = (props) => {
const { globalUrl, theme, workflow, appAuthentication, setSelectedAction, setAuthenticationModalOpen, setSelectedApp, apps, selectedAction,setConfigureWorkflowModalOpen, saveWorkflow, newWebhook, submitSchedule, referenceUrl, isCloud, setAuthenticationType, alert, } = props
const [requiredActions, setRequiredActions] = React.useState([])
const [requiredVariables, setRequiredVariables] = React.useState([])
const [requiredTriggers, setRequiredTriggers] = React.useState([])
@@ -90,7 +90,7 @@ const Workflow = (props) => {
const app = apps.find(app => app.name === action.app_name && (app.app_version === action.app_version || (app.loop_versions !== null && app.loop_versions.includes(action.app_version))))
if (app === undefined || app === null) {
console.log("App not found!")
console.log("App not found: ", action.app_name)
newaction.must_activate = true
} else {
@@ -395,8 +395,8 @@ const Workflow = (props) => {
:
null}
{action.must_activate ?
<Button disabled={true} color="primary" variant="contained" onClick={() => {
console.log("SHOULD ACTIVATE: ", action)
<Button color="primary" variant="contained" onClick={() => {
activateApp(action.app_id, action.app_name, action.app_version)
setItemChanged(true)
}}>
Activate
@@ -406,6 +406,35 @@ const Workflow = (props) => {
)
}
const activateApp = (app_id, app_name, app_version) => {
fetch(`${globalUrl}/api/v1/apps/app_id/activate?app_name=${app_name}&app_version=${app_version}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
credentials: "include",
})
.then((response) => {
if (response.status !== 200) {
//window.location.pathname = "/search"
//alert.error("Failed to find this app. Is it public?")
}
return response.json()
})
.then((responseJson) => {
if (responseJson.success === false) {
alert.error("Failed to activate the app")
} else {
alert.success("App activated for your organization!")
}
})
.catch(error => {
alert.error(error.toString())
});
}
return (
<div>
<Typography variant="h6">{workflow.name}</Typography>
@@ -478,4 +507,4 @@ const Workflow = (props) => {
)
}
export default Workflow
export default ConfigureWorkflow
+2 -1
View File
@@ -331,7 +331,8 @@ const ParsedAction = (props) => {
}
// 1. Take
const actionvalue = {"type": "action", "id": item.id, "name": item.label, "autocomplete": `${item.label.split(" ").join("_")}`, "example": exampledata}
const itemlabelComplete = item.label === null || item.label === undefined ? "" : item.label.split(" ").join("_")
const actionvalue = {"type": "action", "id": item.id, "name": item.label, "autocomplete": itemlabelComplete, "example": exampledata}
actionlist.push(actionvalue)
}
}
+7 -3
View File
@@ -74,6 +74,10 @@ export function sortByKey(array, key) {
}).reverse()
}
if (array === undefined || array === null) {
return []
}
return array.sort(function(a, b) {
var x = a[key]; var y = b[key]
return ((x < y) ? -1 : ((x > y) ? 1 : 0))
@@ -8157,7 +8161,7 @@ const AngularWorkflow = (props) => {
</div>
{data.action.app_name === "shuffle-subflow" && validate.result.success !== undefined && validate.result.success === true ?
<span style={{flex: 10, float: "right", textAlign: "right",}}>
{validate.valid && data.action.parameters !== undefined && data.action.parameters !== null ?
{validate.valid && data.action.parameters !== undefined && data.action.parameters !== null && data.action.parameters.length > 0 ?
data.action.parameters[0].value === props.match.params.key ?
<span style={{cursor: "pointer", color: "#f85a3e"}} onClick={(event) => {
getWorkflowExecution(props.match.params.key, validate.result.execution_id)
@@ -8170,7 +8174,7 @@ const AngularWorkflow = (props) => {
<OpenInNewIcon />
</a>
:
"TBD: Load subexecution result for"
""
}
</span>
: null
@@ -8972,7 +8976,7 @@ const AngularWorkflow = (props) => {
}}>
<CloseIcon />
</IconButton>
<ConfigureWorkflow theme={theme} setAuthenticationType={setAuthenticationType} globalUrl={globalUrl} workflow={workflow} setSelectedAction={setSelectedAction} setSelectedApp={setSelectedApp} setAuthenticationModalOpen={setAuthenticationModalOpen} appAuthentication={appAuthentication} selectedAction={selectedAction} apps={apps} setConfigureWorkflowModalOpen={setConfigureWorkflowModalOpen} saveWorkflow={saveWorkflow} newWebhook={newWebhook} submitSchedule={submitSchedule} referenceUrl={referenceUrl} isCloud={isCloud} />
<ConfigureWorkflow alert={alert} theme={theme} setAuthenticationType={setAuthenticationType} globalUrl={globalUrl} workflow={workflow} setSelectedAction={setSelectedAction} setSelectedApp={setSelectedApp} setAuthenticationModalOpen={setAuthenticationModalOpen} appAuthentication={appAuthentication} selectedAction={selectedAction} apps={apps} setConfigureWorkflowModalOpen={setConfigureWorkflowModalOpen} saveWorkflow={saveWorkflow} newWebhook={newWebhook} submitSchedule={submitSchedule} referenceUrl={referenceUrl} isCloud={isCloud} />
</Dialog>
: null
+2
View File
@@ -873,6 +873,7 @@ const Workflows = (props) => {
}
const sanitizeWorkflow = (data) => {
data = JSON.parse(JSON.stringify(data))
data["owner"] = ""
console.log("Sanitize start: ", data)
data = deduplicateIds(data)
@@ -890,6 +891,7 @@ const Workflows = (props) => {
}
const exportWorkflow = (data) => {
data = JSON.parse(JSON.stringify(data))
let exportFileDefaultName = data.name+'.json';
data = sanitizeWorkflow(data)
//return
+1 -1
View File
@@ -1,5 +1,5 @@
NAME=shuffle-worker
VERSION=0.9.12
VERSION=0.9.13
echo "Running docker build with $NAME:$VERSION"
#CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker.bin .
+1 -1
View File
@@ -12,7 +12,7 @@ require (
github.com/docker/docker v20.10.5+incompatible
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/frikky/shuffle-shared v0.0.86
github.com/frikky/shuffle-shared v0.0.88
github.com/fsouza/go-dockerclient v1.7.2
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-git/go-git/v5 v5.4.2 // indirect