Added copying to more JSON fields
This commit is contained in:
@@ -50,425 +50,6 @@ var cloudname = "cloud"
|
|||||||
var scheduledJobs = map[string]*newscheduler.Job{}
|
var scheduledJobs = map[string]*newscheduler.Job{}
|
||||||
var scheduledOrgs = map[string]*newscheduler.Job{}
|
var scheduledOrgs = map[string]*newscheduler.Job{}
|
||||||
|
|
||||||
// To test out firestore before potential merge
|
|
||||||
//var upgrader = websocket.Upgrader{
|
|
||||||
// ReadBufferSize: 1024,
|
|
||||||
// WriteBufferSize: 1024,
|
|
||||||
// CheckOrigin: func(r *http.Request) bool {
|
|
||||||
// return true
|
|
||||||
// },
|
|
||||||
//}
|
|
||||||
|
|
||||||
//type ExecutionRequest struct {
|
|
||||||
// ExecutionId string `json:"execution_id,omitempty"`
|
|
||||||
// ExecutionArgument string `json:"execution_argument,omitempty"`
|
|
||||||
// ExecutionSource string `json:"execution_source,omitempty"`
|
|
||||||
// WorkflowId string `json:"workflow_id,omitempty"`
|
|
||||||
// Environments []string `json:"environments,omitempty"`
|
|
||||||
// Authorization string `json:"authorization,omitempty"`
|
|
||||||
// Status string `json:"status,omitempty"`
|
|
||||||
// Start string `json:"start,omitempty"`
|
|
||||||
// Type string `json:"type,omitempty"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type SyncFeatures struct {
|
|
||||||
// Webhook SyncData `json:"webhook" datastore:"webhook"`
|
|
||||||
// Schedules SyncData `json:"schedules" datastore:"schedules"`
|
|
||||||
// UserInput SyncData `json:"user_input" datastore:"user_input"`
|
|
||||||
// SendMail SyncData `json:"send_mail" datastore:"send_mail"`
|
|
||||||
// SendSms SyncData `json:"send_sms" datastore:"send_sms"`
|
|
||||||
// Updates SyncData `json:"updates" datastore:"updates"`
|
|
||||||
// Notifications SyncData `json:"notifications" datastore:"notifications"`
|
|
||||||
// EmailTrigger SyncData `json:"email_trigger" datastore:"email_trigger"`
|
|
||||||
// AppExecutions SyncData `json:"app_executions" datastore:"app_executions"`
|
|
||||||
// WorkflowExecutions SyncData `json:"workflow_executions" datastore:"workflow_executions"`
|
|
||||||
// Apps SyncData `json:"apps" datastore:"apps"`
|
|
||||||
// Workflows SyncData `json:"workflows" datastore:"workflows"`
|
|
||||||
// Autocomplete SyncData `json:"autocomplete" datastore:"autocomplete"`
|
|
||||||
// Authentication SyncData `json:"authentication" datastore:"authentication"`
|
|
||||||
// Schedule SyncData `json:"schedule" datastore:"schedule"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type SyncData struct {
|
|
||||||
// Active bool `json:"active" datastore:"active"`
|
|
||||||
// Type string `json:"type,omitempty" datastore:"type"`
|
|
||||||
// Name string `json:"name,omitempty" datastore:"name"`
|
|
||||||
// Description string `json:"description,omitempty" datastore:"description"`
|
|
||||||
// Limit int64 `json:"limit,omitempty" datastore:"limit"`
|
|
||||||
// StartDate int64 `json:"start_date,omitempty" datastore:"start_date"`
|
|
||||||
// EndDate int64 `json:"end_date,omitempty" datastore:"end_date"`
|
|
||||||
// DataCollection int64 `json:"data_collection,omitempty" datastore:"data_collection"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type SyncConfig struct {
|
|
||||||
// Interval int64 `json:"interval" datastore:"interval"`
|
|
||||||
// Apikey string `json:"api_key" datastore:"api_key"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type PaymentSubscription struct {
|
|
||||||
// Active bool `json:"active" datastore:"active"`
|
|
||||||
// Startdate int64 `json:"startdate" datastore:"startdate"`
|
|
||||||
// CancellationDate int64 `json:"cancellationdate" datastore:"cancellationdate"`
|
|
||||||
// Enddate int64 `json:"enddate" datastore:"enddate"`
|
|
||||||
// Name string `json:"name" datastore:"name"`
|
|
||||||
// Recurrence string `json:"recurrence" datastore:"recurrence"`
|
|
||||||
// Reference string `json:"reference" datastore:"reference"`
|
|
||||||
// Level string `json:"level" datastore:"level"`
|
|
||||||
// Amount string `json:"amount" datastore:"amount"`
|
|
||||||
// Currency string `json:"currency" datastore:"currency"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type Defaults struct {
|
|
||||||
// AppDownloadRepo string `json:"app_download_repo" datastore:"app_download_repo"`
|
|
||||||
// AppDownloadBranch string `json:"app_download_branch" datastore:"app_download_branch"`
|
|
||||||
// WorkflowDownloadRepo string `json:"workflow_download_repo" datastore:"workflow_download_repo"`
|
|
||||||
// WorkflowDownloadBranch string `json:"workflow_download_branch" datastore:"workflow_download_branch"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type AppAuthenticationStorage struct {
|
|
||||||
// Active bool `json:"active" datastore:"active"`
|
|
||||||
// Label string `json:"label" datastore:"label"`
|
|
||||||
// Id string `json:"id" datastore:"id"`
|
|
||||||
// App WorkflowApp `json:"app" datastore:"app,noindex"`
|
|
||||||
// Fields []AuthenticationStore `json:"fields" datastore:"fields"`
|
|
||||||
// Usage []AuthenticationUsage `json:"usage" datastore:"usage"`
|
|
||||||
// WorkflowCount int64 `json:"workflow_count" datastore:"workflow_count"`
|
|
||||||
// NodeCount int64 `json:"node_count" datastore:"node_count"`
|
|
||||||
// OrgId string `json:"org_id" datastore:"org_id"`
|
|
||||||
// Created int64 `json:"created" datastore:"created"`
|
|
||||||
// Edited int64 `json:"edited" datastore:"edited"`
|
|
||||||
// Defined bool `json:"defined" datastore:"defined"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type AuthenticationUsage struct {
|
|
||||||
// WorkflowId string `json:"workflow_id" datastore:"workflow_id"`
|
|
||||||
// Nodes []string `json:"nodes" datastore:"nodes"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//// An app inside Shuffle
|
|
||||||
//// Source string `json:"source" datastore:"soure" yaml:"source"` - downloadlocation
|
|
||||||
//type WorkflowApp struct {
|
|
||||||
// Name string `json:"name" yaml:"name" required:true datastore:"name"`
|
|
||||||
// IsValid bool `json:"is_valid" yaml:"is_valid" required:true datastore:"is_valid"`
|
|
||||||
// ID string `json:"id" yaml:"id,omitempty" required:false datastore:"id"`
|
|
||||||
// Link string `json:"link" yaml:"link" required:false datastore:"link,noindex"`
|
|
||||||
// AppVersion string `json:"app_version" yaml:"app_version" required:true datastore:"app_version"`
|
|
||||||
// SharingConfig string `json:"sharing_config" yaml:"sharing_config" datastore:"sharing_config"`
|
|
||||||
// Generated bool `json:"generated" yaml:"generated" required:false datastore:"generated"`
|
|
||||||
// Downloaded bool `json:"downloaded" yaml:"downloaded" required:false datastore:"downloaded"`
|
|
||||||
// Sharing bool `json:"sharing" yaml:"sharing" required:false datastore:"sharing"`
|
|
||||||
// Verified bool `json:"verified" yaml:"verified" required:false datastore:"verified"`
|
|
||||||
// Invalid bool `json:"invalid" yaml:"invalid" required:false datastore:"invalid"`
|
|
||||||
// Activated bool `json:"activated" yaml:"activated" required:false datastore:"activated"`
|
|
||||||
// Tested bool `json:"tested" yaml:"tested" required:false datastore:"tested"`
|
|
||||||
// Owner string `json:"owner" datastore:"owner" yaml:"owner"`
|
|
||||||
// Hash string `json:"hash" datastore:"hash" yaml:"hash"` // api.yaml+dockerfile+src/app.py for apps
|
|
||||||
// PrivateID string `json:"private_id" yaml:"private_id" required:false datastore:"private_id"`
|
|
||||||
// Description string `json:"description" datastore:"description,noindex" required:false yaml:"description"`
|
|
||||||
// Environment string `json:"environment" datastore:"environment" required:true yaml:"environment"`
|
|
||||||
// SmallImage string `json:"small_image" datastore:"small_image,noindex" required:false yaml:"small_image"`
|
|
||||||
// LargeImage string `json:"large_image" datastore:"large_image,noindex" yaml:"large_image" required:false`
|
|
||||||
// ContactInfo struct {
|
|
||||||
// Name string `json:"name" datastore:"name" yaml:"name"`
|
|
||||||
// Url string `json:"url" datastore:"url" yaml:"url"`
|
|
||||||
// } `json:"contact_info" datastore:"contact_info" yaml:"contact_info" required:false`
|
|
||||||
// ReferenceInfo struct {
|
|
||||||
// DocumentationUrl string `json:"documentation_url" datastore:"documentation_url"`
|
|
||||||
// GithubUrl string `json:"github_url" datastore:"github_url"`
|
|
||||||
// }
|
|
||||||
// FolderMount struct {
|
|
||||||
// FolderMount bool `json:"folder_mount" datastore:"folder_mount"`
|
|
||||||
// SourceFolder string `json:"source_folder" datastore:"source_folder"`
|
|
||||||
// DestinationFolder string `json:"destination_folder" datastore:"destination_folder"`
|
|
||||||
// }
|
|
||||||
// Actions []WorkflowAppAction `json:"actions" yaml:"actions" required:true datastore:"actions,noindex"`
|
|
||||||
// Authentication Authentication `json:"authentication" yaml:"authentication" required:false datastore:"authentication"`
|
|
||||||
// Tags []string `json:"tags" yaml:"tags" required:false datastore:"activated"`
|
|
||||||
// Categories []string `json:"categories" yaml:"categories" required:false datastore:"categories"`
|
|
||||||
// Created int64 `json:"created" datastore:"created"`
|
|
||||||
// Edited int64 `json:"edited" datastore:"edited"`
|
|
||||||
// LastRuntime int64 `json:"last_runtime" datastore:"last_runtime"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type WorkflowAppActionParameter struct {
|
|
||||||
// Description string `json:"description" datastore:"description,noindex" yaml:"description"`
|
|
||||||
// ID string `json:"id" datastore:"id" yaml:"id,omitempty"`
|
|
||||||
// Name string `json:"name" datastore:"name" yaml:"name"`
|
|
||||||
// Example string `json:"example" datastore:"example,noindex" yaml:"example"`
|
|
||||||
// Value string `json:"value" datastore:"value,noindex" yaml:"value,omitempty"`
|
|
||||||
// Multiline bool `json:"multiline" datastore:"multiline" yaml:"multiline"`
|
|
||||||
// Options []string `json:"options" datastore:"options" yaml:"options"`
|
|
||||||
// ActionField string `json:"action_field" datastore:"action_field" yaml:"actionfield,omitempty"`
|
|
||||||
// Variant string `json:"variant" datastore:"variant" yaml:"variant,omitempty"`
|
|
||||||
// Required bool `json:"required" datastore:"required" yaml:"required"`
|
|
||||||
// Configuration bool `json:"configuration" datastore:"configuration" yaml:"configuration"`
|
|
||||||
// Tags []string `json:"tags" datastore:"tags" yaml:"tags"`
|
|
||||||
// Schema SchemaDefinition `json:"schema" datastore:"schema" yaml:"schema"`
|
|
||||||
// SkipMulticheck bool `json:"skip_multicheck" datastore:"skip_multicheck" yaml:"skip_multicheck"`
|
|
||||||
// ValueReplace []Valuereplace `json:"value_replace" datastore:"value_replace,noindex" yaml:"value_replace,omitempty"`
|
|
||||||
// UniqueToggled bool `json:"unique_toggled" datastore:"unique_toggled" yaml:"unique_toggled"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type Valuereplace struct {
|
|
||||||
// Key string `json:"key" datastore:"key" yaml:"key"`
|
|
||||||
// Value string `json:"value" datastore:"value" yaml:"value"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type SchemaDefinition struct {
|
|
||||||
// Type string `json:"type" datastore:"type"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type WorkflowAppAction struct {
|
|
||||||
// Description string `json:"description" datastore:"description,noindex"`
|
|
||||||
// ID string `json:"id" datastore:"id" yaml:"id,omitempty"`
|
|
||||||
// Name string `json:"name" datastore:"name"`
|
|
||||||
// Label string `json:"label" datastore:"label"`
|
|
||||||
// NodeType string `json:"node_type" datastore:"node_type"`
|
|
||||||
// Environment string `json:"environment" datastore:"environment"`
|
|
||||||
// Sharing bool `json:"sharing" datastore:"sharing"`
|
|
||||||
// PrivateID string `json:"private_id" datastore:"private_id"`
|
|
||||||
// AppID string `json:"app_id" datastore:"app_id"`
|
|
||||||
// Tags []string `json:"tags" datastore:"tags" yaml:"tags"`
|
|
||||||
// Authentication []AuthenticationStore `json:"authentication" datastore:"authentication,noindex" yaml:"authentication,omitempty"`
|
|
||||||
// Tested bool `json:"tested" datastore:"tested" yaml:"tested"`
|
|
||||||
// Parameters []WorkflowAppActionParameter `json:"parameters" datastore: "parameters"`
|
|
||||||
// ExecutionVariable struct {
|
|
||||||
// Description string `json:"description" datastore:"description,noindex"`
|
|
||||||
// ID string `json:"id" datastore:"id"`
|
|
||||||
// Name string `json:"name" datastore:"name"`
|
|
||||||
// Value string `json:"value" datastore:"value,noindex"`
|
|
||||||
// } `json:"execution_variable" datastore:"execution_variables"`
|
|
||||||
// Returns struct {
|
|
||||||
// Description string `json:"description" datastore:"returns" yaml:"description,omitempty"`
|
|
||||||
// Example string `json:"example" datastore:"example,noindex" yaml:"example"`
|
|
||||||
// ID string `json:"id" datastore:"id" yaml:"id,omitempty"`
|
|
||||||
// Schema SchemaDefinition `json:"schema" datastore:"schema" yaml:"schema"`
|
|
||||||
// } `json:"returns" datastore:"returns"`
|
|
||||||
// AuthenticationId string `json:"authentication_id" datastore:"authentication_id"`
|
|
||||||
// Example string `json:"example,noindex" datastore:"example" yaml:"example"`
|
|
||||||
// AuthNotRequired bool `json:"auth_not_required" datastore:"auth_not_required" yaml:"auth_not_required"`
|
|
||||||
//}
|
|
||||||
|
|
||||||
// FIXME: Generate a callback authentication ID?
|
|
||||||
// FIXME: Add org check ..
|
|
||||||
//type WorkflowExecution struct {
|
|
||||||
// Type string `json:"type" datastore:"type"`
|
|
||||||
// Status string `json:"status" datastore:"status"`
|
|
||||||
// Start string `json:"start" datastore:"start"`
|
|
||||||
// ExecutionArgument string `json:"execution_argument" datastore:"execution_argument,noindex"`
|
|
||||||
// ExecutionId string `json:"execution_id" datastore:"execution_id"`
|
|
||||||
// ExecutionSource string `json:"execution_source" datastore:"execution_source"`
|
|
||||||
// ExecutionParent string `json:"execution_parent" datastore:"execution_parent"`
|
|
||||||
// ExecutionOrg string `json:"execution_org" datastore:"execution_org"`
|
|
||||||
// WorkflowId string `json:"workflow_id" datastore:"workflow_id"`
|
|
||||||
// LastNode string `json:"last_node" datastore:"last_node"`
|
|
||||||
// Authorization string `json:"authorization" datastore:"authorization"`
|
|
||||||
// Result string `json:"result" datastore:"result,noindex"`
|
|
||||||
// StartedAt int64 `json:"started_at" datastore:"started_at"`
|
|
||||||
// CompletedAt int64 `json:"completed_at" datastore:"completed_at"`
|
|
||||||
// ProjectId string `json:"project_id" datastore:"project_id"`
|
|
||||||
// Locations []string `json:"locations" datastore:"locations"`
|
|
||||||
// Workflow Workflow `json:"workflow" datastore:"workflow,noindex"`
|
|
||||||
// Results []ActionResult `json:"results" datastore:"results,noindex"`
|
|
||||||
// ExecutionVariables []struct {
|
|
||||||
// Description string `json:"description" datastore:"description,noindex"`
|
|
||||||
// ID string `json:"id" datastore:"id"`
|
|
||||||
// Name string `json:"name" datastore:"name"`
|
|
||||||
// Value string `json:"value" datastore:"value,noindex"`
|
|
||||||
// } `json:"execution_variables,omitempty" datastore:"execution_variables,omitempty"`
|
|
||||||
// OrgId string `json:"org_id" datastore:"org_id"`
|
|
||||||
//}
|
|
||||||
|
|
||||||
// This is for the nodes in a workflow, NOT the app action itself.
|
|
||||||
//type Action struct {
|
|
||||||
// AppName string `json:"app_name" datastore:"app_name"`
|
|
||||||
// AppVersion string `json:"app_version" datastore:"app_version"`
|
|
||||||
// AppID string `json:"app_id" datastore:"app_id"`
|
|
||||||
// Errors []string `json:"errors" datastore:"errors"`
|
|
||||||
// ID string `json:"id" datastore:"id"`
|
|
||||||
// IsValid bool `json:"is_valid" datastore:"is_valid"`
|
|
||||||
// IsStartNode bool `json:"isStartNode,omitempty" datastore:"isStartNode"`
|
|
||||||
// Sharing bool `json:"sharing,omitempty" datastore:"sharing"`
|
|
||||||
// PrivateID string `json:"private_id,omitempty" datastore:"private_id"`
|
|
||||||
// Label string `json:"label,omitempty" datastore:"label"`
|
|
||||||
// SmallImage string `json:"small_image,omitempty" datastore:"small_image,noindex" required:false yaml:"small_image"`
|
|
||||||
// LargeImage string `json:"large_image,omitempty" datastore:"large_image,noindex" yaml:"large_image" required:false`
|
|
||||||
// Environment string `json:"environment,omitempty" datastore:"environment"`
|
|
||||||
// Name string `json:"name" datastore:"name"`
|
|
||||||
// Parameters []WorkflowAppActionParameter `json:"parameters" datastore: "parameters,noindex"`
|
|
||||||
// ExecutionVariable struct {
|
|
||||||
// Description string `json:"description,omitempty" datastore:"description,noindex"`
|
|
||||||
// ID string `json:"id,omitempty" datastore:"id"`
|
|
||||||
// Name string `json:"name,omitempty" datastore:"name"`
|
|
||||||
// Value string `json:"value,omitempty" datastore:"value,noindex"`
|
|
||||||
// } `json:"execution_variable,omitempty" datastore:"execution_variable,omitempty"`
|
|
||||||
// Position struct {
|
|
||||||
// X float64 `json:"x,omitempty" datastore:"x"`
|
|
||||||
// Y float64 `json:"y,omitempty" datastore:"y"`
|
|
||||||
// } `json:"position,omitempty"`
|
|
||||||
// Priority int `json:"priority,omitempty" datastore:"priority"`
|
|
||||||
// AuthenticationId string `json:"authentication_id" datastore:"authentication_id"`
|
|
||||||
// Example string `json:"example,omitempty" datastore:"example,noindex"`
|
|
||||||
// AuthNotRequired bool `json:"auth_not_required,omitempty" datastore:"auth_not_required" yaml:"auth_not_required"`
|
|
||||||
// Category string `json:"category" datastore:"category"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//// Added environment for location to execute
|
|
||||||
//type Trigger struct {
|
|
||||||
// AppName string `json:"app_name" datastore:"app_name"`
|
|
||||||
// Description string `json:"description" datastore:"description,noindex"`
|
|
||||||
// LongDescription string `json:"long_description" datastore:"long_description"`
|
|
||||||
// Status string `json:"status" datastore:"status"`
|
|
||||||
// AppVersion string `json:"app_version" datastore:"app_version"`
|
|
||||||
// Errors []string `json:"errors" datastore:"errors"`
|
|
||||||
// ID string `json:"id" datastore:"id"`
|
|
||||||
// IsValid bool `json:"is_valid" datastore:"is_valid"`
|
|
||||||
// IsStartNode bool `json:"isStartNode" datastore:"isStartNode"`
|
|
||||||
// Label string `json:"label" datastore:"label"`
|
|
||||||
// SmallImage string `json:"small_image" datastore:"small_image,noindex" required:false yaml:"small_image"`
|
|
||||||
// LargeImage string `json:"large_image" datastore:"large_image,noindex" yaml:"large_image" required:false`
|
|
||||||
// Environment string `json:"environment" datastore:"environment"`
|
|
||||||
// TriggerType string `json:"trigger_type" datastore:"trigger_type"`
|
|
||||||
// Name string `json:"name" datastore:"name"`
|
|
||||||
// Tags []string `json:"tags" datastore:"tags" yaml:"tags"`
|
|
||||||
// Parameters []WorkflowAppActionParameter `json:"parameters" datastore: "parameters,noindex"`
|
|
||||||
// Position struct {
|
|
||||||
// X float64 `json:"x" datastore:"x"`
|
|
||||||
// Y float64 `json:"y" datastore:"y"`
|
|
||||||
// } `json:"position"`
|
|
||||||
// Priority int `json:"priority" datastore:"priority"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type Branch struct {
|
|
||||||
// DestinationID string `json:"destination_id" datastore:"destination_id"`
|
|
||||||
// ID string `json:"id" datastore:"id"`
|
|
||||||
// SourceID string `json:"source_id" datastore:"source_id"`
|
|
||||||
// Label string `json:"label" datastore:"label"`
|
|
||||||
// HasError bool `json:"has_errors" datastore: "has_errors"`
|
|
||||||
// Conditions []Condition `json:"conditions" datastore: "conditions,noindex"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//// Same format for a lot of stuff
|
|
||||||
//type Condition struct {
|
|
||||||
// Condition WorkflowAppActionParameter `json:"condition" datastore:"condition"`
|
|
||||||
// Source WorkflowAppActionParameter `json:"source" datastore:"source"`
|
|
||||||
// Destination WorkflowAppActionParameter `json:"destination" datastore:"destination"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type Schedule struct {
|
|
||||||
// Name string `json:"name" datastore:"name"`
|
|
||||||
// Frequency string `json:"frequency" datastore:"frequency"`
|
|
||||||
// ExecutionArgument string `json:"execution_argument" datastore:"execution_argument,noindex"`
|
|
||||||
// Id string `json:"id" datastore:"id"`
|
|
||||||
// OrgId string `json:"org_id" datastore:"org_id"`
|
|
||||||
// Environment string `json:"environment" datastore:"environment"`
|
|
||||||
//}
|
|
||||||
|
|
||||||
//type Workflow struct {
|
|
||||||
// Actions []Action `json:"actions" datastore:"actions,noindex"`
|
|
||||||
// Branches []Branch `json:"branches" datastore:"branches,noindex"`
|
|
||||||
// Triggers []Trigger `json:"triggers" datastore:"triggers,noindex"`
|
|
||||||
// Schedules []Schedule `json:"schedules" datastore:"schedules,noindex"`
|
|
||||||
// Configuration struct {
|
|
||||||
// ExitOnError bool `json:"exit_on_error" datastore:"exit_on_error"`
|
|
||||||
// StartFromTop bool `json:"start_from_top" datastore:"start_from_top"`
|
|
||||||
// } `json:"configuration,omitempty" datastore:"configuration"`
|
|
||||||
// Created int64 `json:"created" datastore:"created"`
|
|
||||||
// Edited int64 `json:"edited" datastore:"edited"`
|
|
||||||
// LastRuntime int64 `json:"last_runtime" datastore:"last_runtime"`
|
|
||||||
// Errors []string `json:"errors,omitempty" datastore:"errors"`
|
|
||||||
// Tags []string `json:"tags,omitempty" datastore:"tags"`
|
|
||||||
// ID string `json:"id" datastore:"id"`
|
|
||||||
// IsValid bool `json:"is_valid" datastore:"is_valid"`
|
|
||||||
// Name string `json:"name" datastore:"name"`
|
|
||||||
// Description string `json:"description" datastore:"description,noindex"`
|
|
||||||
// Start string `json:"start" datastore:"start"`
|
|
||||||
// Owner string `json:"owner" datastore:"owner"`
|
|
||||||
// Sharing string `json:"sharing" datastore:"sharing"`
|
|
||||||
// Org []Org `json:"org,omitempty" datastore:"org"`
|
|
||||||
// ExecutingOrg Org `json:"execution_org,omitempty" datastore:"execution_org"`
|
|
||||||
// OrgId string `json:"org_id,omitempty" datastore:"org_id"`
|
|
||||||
// WorkflowVariables []struct {
|
|
||||||
// Description string `json:"description" datastore:"description,noindex"`
|
|
||||||
// ID string `json:"id" datastore:"id"`
|
|
||||||
// Name string `json:"name" datastore:"name"`
|
|
||||||
// Value string `json:"value" datastore:"value,noindex"`
|
|
||||||
// } `json:"workflow_variables" datastore:"workflow_variables"`
|
|
||||||
// ExecutionVariables []struct {
|
|
||||||
// Description string `json:"description" datastore:"description,noindex"`
|
|
||||||
// ID string `json:"id" datastore:"id"`
|
|
||||||
// Name string `json:"name" datastore:"name"`
|
|
||||||
// Value string `json:"value" datastore:"value,noindex"`
|
|
||||||
// } `json:"execution_variables,omitempty" datastore:"execution_variables"`
|
|
||||||
// ExecutionEnvironment string `json:"execution_environment" datastore:"execution_environment"`
|
|
||||||
// PreviouslySaved bool `json:"previously_saved" datastore:"first_save"`
|
|
||||||
// Categories Categories `json:"categories" datastore:"categories"`
|
|
||||||
// ExampleArgument string `json:"example_argument" datastore:"example_argument,noindex"`
|
|
||||||
//}
|
|
||||||
|
|
||||||
//type Category struct {
|
|
||||||
// Name string `json:"name" datastore:"name"`
|
|
||||||
// Description string `json:"description" datastore:"description"`
|
|
||||||
// Count int64 `json:"count" datastore:"count"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type Categories struct {
|
|
||||||
// SIEM Category `json:"siem" datastore:"siem"`
|
|
||||||
// Communication Category `json:"communication" datastore:"communication"`
|
|
||||||
// Assets Category `json:"assets" datastore:"assets"`
|
|
||||||
// Cases Category `json:"cases" datastore:"cases"`
|
|
||||||
// Network Category `json:"network" datastore:"network"`
|
|
||||||
// Intel Category `json:"intel" datastore:"intel"`
|
|
||||||
// EDR Category `json:"edr" datastore:"edr"`
|
|
||||||
// Other Category `json:"other" datastore:"other"`
|
|
||||||
//}
|
|
||||||
|
|
||||||
//type ActionResult struct {
|
|
||||||
// Action Action `json:"action" datastore:"action,noindex"`
|
|
||||||
// ExecutionId string `json:"execution_id" datastore:"execution_id"`
|
|
||||||
// Authorization string `json:"authorization" datastore:"authorization"`
|
|
||||||
// Result string `json:"result" datastore:"result,noindex"`
|
|
||||||
// StartedAt int64 `json:"started_at" datastore:"started_at"`
|
|
||||||
// CompletedAt int64 `json:"completed_at" datastore:"completed_at"`
|
|
||||||
// Status string `json:"status" datastore:"status"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type Authentication struct {
|
|
||||||
// Required bool `json:"required" datastore:"required" yaml:"required" `
|
|
||||||
// Parameters []AuthenticationParams `json:"parameters" datastore:"parameters" yaml:"parameters"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type AuthenticationParams struct {
|
|
||||||
// Description string `json:"description" datastore:"description,noindex" yaml:"description"`
|
|
||||||
// ID string `json:"id" datastore:"id" yaml:"id"`
|
|
||||||
// Name string `json:"name" datastore:"name" yaml:"name"`
|
|
||||||
// Example string `json:"example" datastore:"example,noindex" yaml:"example"`
|
|
||||||
// Value string `json:"value,omitempty" datastore:"value,noindex" yaml:"value"`
|
|
||||||
// Multiline bool `json:"multiline" datastore:"multiline" yaml:"multiline"`
|
|
||||||
// Required bool `json:"required" datastore:"required" yaml:"required"`
|
|
||||||
// In string `json:"in" datastore:"in" yaml:"in"`
|
|
||||||
// Schema SchemaDefinition `json:"schema" datastore:"schema" yaml:"schema"`
|
|
||||||
// Scheme string `json:"scheme" datastore:"scheme" yaml:"scheme"` // Deprecated
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type AuthenticationStore struct {
|
|
||||||
// Key string `json:"key" datastore:"key"`
|
|
||||||
// Value string `json:"value" datastore:"value,noindex"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type ExecutionRequestWrapper struct {
|
|
||||||
// Data []ExecutionRequest `json:"data"`
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//type AppExecutionExample struct {
|
|
||||||
// AppName string `json:"app_name" datastore:"app_name"`
|
|
||||||
// AppVersion string `json:"app_version" datastore:"app_version"`
|
|
||||||
// AppAction string `json:"app_action" datastore:"app_action"`
|
|
||||||
// AppId string `json:"app_id" datastore:"app_id"`
|
|
||||||
// ExampleId string `json:"example_id" datastore:"example_id"`
|
|
||||||
// SuccessExamples []string `json:"success_examples" datastore:"success_examples,noindex"`
|
|
||||||
// FailureExamples []string `json:"failure_examples" datastore:"failure_examples,noindex"`
|
|
||||||
//}
|
|
||||||
// Frequency = cronjob OR minutes between execution
|
// Frequency = cronjob OR minutes between execution
|
||||||
func createSchedule(ctx context.Context, scheduleId, workflowId, name, startNode, frequency, orgId string, body []byte) error {
|
func createSchedule(ctx context.Context, scheduleId, workflowId, name, startNode, frequency, orgId string, body []byte) error {
|
||||||
var err error
|
var err error
|
||||||
|
|||||||
@@ -3972,6 +3972,7 @@ const Admin = (props) => {
|
|||||||
<Tabs
|
<Tabs
|
||||||
value={curTab}
|
value={curTab}
|
||||||
indicatorColor="primary"
|
indicatorColor="primary"
|
||||||
|
textColor="primary"
|
||||||
onChange={setConfig}
|
onChange={setConfig}
|
||||||
aria-label="disabled tabs example"
|
aria-label="disabled tabs example"
|
||||||
>
|
>
|
||||||
@@ -4004,21 +4005,21 @@ const Admin = (props) => {
|
|||||||
Schedules
|
Schedules
|
||||||
</span>
|
</span>
|
||||||
/>
|
/>
|
||||||
{isCloud ? null : (
|
<Tab
|
||||||
<Tab
|
index={5}
|
||||||
label=<span>
|
disabled={isCloud}
|
||||||
<EcoIcon style={iconStyle} />
|
label=<span>
|
||||||
Environments
|
<EcoIcon style={iconStyle} />
|
||||||
</span>
|
Environments
|
||||||
/>
|
</span>
|
||||||
)}
|
/>
|
||||||
{isCloud ? null : (
|
<Tab
|
||||||
<Tab
|
index={6}
|
||||||
label=<span>
|
value={6}
|
||||||
<BusinessIcon style={iconStyle} /> Organizations
|
label=<span>
|
||||||
</span>
|
<BusinessIcon style={iconStyle} /> Organizations
|
||||||
/>
|
</span>
|
||||||
)}
|
/>
|
||||||
{/*window.location.protocol == "http:" && window.location.port === "3000" ? <Tab label=<span><CloudIcon style={iconStyle} /> Hybrid</span>/> : null*/}
|
{/*window.location.protocol == "http:" && window.location.port === "3000" ? <Tab label=<span><CloudIcon style={iconStyle} /> Hybrid</span>/> : null*/}
|
||||||
{/*window.location.protocol === "http:" && window.location.port === "3000" ? <Tab label=<span><LockIcon style={iconStyle} />Categories</span>/> : null*/}
|
{/*window.location.protocol === "http:" && window.location.port === "3000" ? <Tab label=<span><LockIcon style={iconStyle} />Categories</span>/> : null*/}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|||||||
@@ -1397,7 +1397,7 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
const getWorkflow = (workflow_id, sourcenode) => {
|
const getWorkflow = (workflow_id, sourcenode) => {
|
||||||
console.log(
|
console.log(
|
||||||
`Getting workflow ${workflow_id} with append value ${sourcenode}`
|
//`Getting workflow ${workflow_id} with append value ${sourcenode}`
|
||||||
);
|
);
|
||||||
|
|
||||||
fetch(globalUrl + "/api/v1/workflows/" + workflow_id, {
|
fetch(globalUrl + "/api/v1/workflows/" + workflow_id, {
|
||||||
@@ -2098,14 +2098,21 @@ const AngularWorkflow = (props) => {
|
|||||||
// FIXME: Trust it to just work?
|
// FIXME: Trust it to just work?
|
||||||
//event.target.data()
|
//event.target.data()
|
||||||
var curaction = workflow.actions.find((a) => a.id === data.id);
|
var curaction = workflow.actions.find((a) => a.id === data.id);
|
||||||
|
var newapps = JSON.parse(JSON.stringify(apps))
|
||||||
if (!curaction || curaction === undefined) {
|
if (!curaction || curaction === undefined) {
|
||||||
alert.error("Action not found. Please remake it.");
|
|
||||||
console.log("NOT FOUND DATA: ", event.target.data())
|
console.log("NOT FOUND DATA: ", event.target.data())
|
||||||
event.target.remove();
|
if (data.id !== undefined && data.app_name !== undefined) {
|
||||||
return;
|
//newapps.push(data)
|
||||||
|
workflow.actions.push(data)
|
||||||
|
curaction = data
|
||||||
|
} else {
|
||||||
|
alert.error("Action not found. Please remake it.");
|
||||||
|
event.target.remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const curapp = apps.find(
|
const curapp = newapps.find(
|
||||||
(a) =>
|
(a) =>
|
||||||
a.name === curaction.app_name &&
|
a.name === curaction.app_name &&
|
||||||
(a.app_version === curaction.app_version ||
|
(a.app_version === curaction.app_version ||
|
||||||
@@ -2655,14 +2662,14 @@ const AngularWorkflow = (props) => {
|
|||||||
setLastSaved(false);
|
setLastSaved(false);
|
||||||
const node = event.target;
|
const node = event.target;
|
||||||
const nodedata = event.target.data();
|
const nodedata = event.target.data();
|
||||||
console.log("Node added: ", nodedata)
|
if (nodedata.finished === false ||
|
||||||
if (
|
|
||||||
nodedata.finished === false ||
|
|
||||||
(nodedata.id !== undefined && nodedata.is_valid === undefined)
|
(nodedata.id !== undefined && nodedata.is_valid === undefined)
|
||||||
) {
|
) {
|
||||||
console.log("Returning because node is not valid: ", nodedata)
|
console.log("Returning because node is not valid: ", nodedata)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//parsedApp.data.finished = true;
|
||||||
|
|
||||||
//console.log("IS IT ADDED TO THE WORKFLOW?: ", nodedata)
|
//console.log("IS IT ADDED TO THE WORKFLOW?: ", nodedata)
|
||||||
if (node.isNode() && cy.nodes().size() === 1) {
|
if (node.isNode() && cy.nodes().size() === 1) {
|
||||||
@@ -3413,16 +3420,20 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
const onNodeHover = (event) => {
|
const onNodeHover = (event) => {
|
||||||
const nodedata = event.target.data();
|
const nodedata = event.target.data();
|
||||||
|
/*
|
||||||
if (nodedata.finished === false) {
|
if (nodedata.finished === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
var parentNode = cy.$("#" + event.target.data("id"));
|
//var parentNode = cy.$("#" + event.target.data("id"));
|
||||||
if (parentNode.data("isButton") || parentNode.data("buttonId")) return;
|
//if (parentNode.data("isButton") || parentNode.data("buttonId")) return;
|
||||||
|
|
||||||
if (nodedata.app_name !== undefined) {
|
if (nodedata.app_name !== undefined) {
|
||||||
const allNodes = cy.nodes().jsons();
|
const allNodes = cy.nodes().jsons();
|
||||||
|
|
||||||
|
//if (parentNode.data("isButton") || parentNode.data("buttonId")) return;
|
||||||
|
|
||||||
var found = false;
|
var found = false;
|
||||||
for (var key in allNodes) {
|
for (var key in allNodes) {
|
||||||
const currentNode = allNodes[key];
|
const currentNode = allNodes[key];
|
||||||
@@ -3443,8 +3454,11 @@ const AngularWorkflow = (props) => {
|
|||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
addDeleteButton(event);
|
addDeleteButton(event);
|
||||||
addCopyButton(event);
|
|
||||||
addStartnodeButton(event);
|
if (nodedata.type !== "TRIGGER") {
|
||||||
|
addCopyButton(event);
|
||||||
|
addStartnodeButton(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4772,12 +4786,13 @@ const AngularWorkflow = (props) => {
|
|||||||
if (newAppname.length > maxlen) {
|
if (newAppname.length > maxlen) {
|
||||||
newAppname = newAppname.slice(0, maxlen) + "..";
|
newAppname = newAppname.slice(0, maxlen) + "..";
|
||||||
}
|
}
|
||||||
|
|
||||||
newAppname = newAppname.replaceAll("_", " ");
|
newAppname = newAppname.replaceAll("_", " ");
|
||||||
|
|
||||||
const image = app.large_image;
|
const image = app.large_image;
|
||||||
const newAppStyle = JSON.parse(JSON.stringify(paperAppStyle));
|
const newAppStyle = JSON.parse(JSON.stringify(paperAppStyle));
|
||||||
const pixelSize = !hover ? "2px" : "4px";
|
const pixelSize = !hover ? "2px" : "4px";
|
||||||
newAppStyle.borderLeft = app.is_valid
|
newAppStyle.borderLeft = app.is_valid && app.actions !== null && app.actions !== undefined && app.actions.length > 0
|
||||||
? `${pixelSize} solid ${green}`
|
? `${pixelSize} solid ${green}`
|
||||||
: `${pixelSize} solid ${yellow}`;
|
: `${pixelSize} solid ${yellow}`;
|
||||||
|
|
||||||
@@ -9966,6 +9981,11 @@ const AngularWorkflow = (props) => {
|
|||||||
copy.name = copy.name.replaceAll(" ", "_");
|
copy.name = copy.name.replaceAll(" ", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//lol
|
||||||
|
if (typeof base === 'object' || typeof base === 'dict') {
|
||||||
|
base = JSON.stringify(base)
|
||||||
|
}
|
||||||
|
|
||||||
console.log("COPY: ", copy);
|
console.log("COPY: ", copy);
|
||||||
var newitem = JSON.parse(base);
|
var newitem = JSON.parse(base);
|
||||||
to_be_copied = "$" + base_node_name.toLowerCase().replaceAll(" ", "_");
|
to_be_copied = "$" + base_node_name.toLowerCase().replaceAll(" ", "_");
|
||||||
|
|||||||
@@ -726,6 +726,23 @@ const Apps = (props) => {
|
|||||||
</Link>
|
</Link>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
|
//var editNewButton = editButton === null ?
|
||||||
|
var editNewButton = null
|
||||||
|
/*
|
||||||
|
<Link to={editUrl} style={{ textDecoration: "none" }}>
|
||||||
|
<Tooltip title={"Add your version"}>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
component="label"
|
||||||
|
color="primary"
|
||||||
|
style={{ marginTop: 10, marginRight: 10 }}
|
||||||
|
>
|
||||||
|
<EditIcon />
|
||||||
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
|
</Link>
|
||||||
|
*/
|
||||||
|
|
||||||
const activateButton =
|
const activateButton =
|
||||||
selectedApp.generated && !selectedApp.activated ? (
|
selectedApp.generated && !selectedApp.activated ? (
|
||||||
<div>
|
<div>
|
||||||
@@ -972,6 +989,7 @@ const Apps = (props) => {
|
|||||||
!selectedApp.generated ? (
|
!selectedApp.generated ? (
|
||||||
<div>
|
<div>
|
||||||
{editButton}
|
{editButton}
|
||||||
|
{editNewButton}
|
||||||
{downloadButton}
|
{downloadButton}
|
||||||
{deleteButton}
|
{deleteButton}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -397,6 +397,10 @@ const Settings = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const runFlex = userdata.eth_info !== undefined && userdata.eth_info.account !== undefined &&
|
||||||
|
userdata.eth_info.account.length > 0 && userdata.eth_info.parsed_balance !== undefined
|
||||||
|
|
||||||
// Random names for type & autoComplete. Didn't research :^)
|
// Random names for type & autoComplete. Didn't research :^)
|
||||||
var imageData = file.length > 0 ? file : fileBase64;
|
var imageData = file.length > 0 ? file : fileBase64;
|
||||||
imageData =
|
imageData =
|
||||||
@@ -721,7 +725,7 @@ const Settings = (props) => {
|
|||||||
<h3>{passwordFormMessage}</h3>
|
<h3>{passwordFormMessage}</h3>
|
||||||
<Divider style={{ marginTop: "40px" }} />
|
<Divider style={{ marginTop: "40px" }} />
|
||||||
<h2>Platform Earnings</h2>
|
<h2>Platform Earnings</h2>
|
||||||
<div style={{ display: "flex", width: "100%" }}>
|
<div style={{ display: runFlex ? "flex" : "", width: "100%" }}>
|
||||||
<div style={{ flex: 1, display: "flex" }}>
|
<div style={{ flex: 1, display: "flex" }}>
|
||||||
<div>
|
<div>
|
||||||
{userdata.eth_info !== undefined &&
|
{userdata.eth_info !== undefined &&
|
||||||
|
|||||||
Reference in New Issue
Block a user