Removed commented code
This commit is contained in:
parent
53860f4736
commit
a8c7ab8600
|
@ -110,112 +110,6 @@ const getFinalDefinitions = (
|
||||||
}
|
}
|
||||||
|
|
||||||
const automationActions = (store: AutomationStore) => ({
|
const automationActions = (store: AutomationStore) => ({
|
||||||
// generateContext: (): Readable<AutomationContext> => {
|
|
||||||
// return derived(
|
|
||||||
// [organisation, store.selected, environment, tables],
|
|
||||||
// ([$organisation, $selectedAutomation, $env, $tables]) => {
|
|
||||||
// const { platformUrl: url, company, logoUrl: logo } = $organisation
|
|
||||||
|
|
||||||
// const results: TestAutomationResponse | undefined =
|
|
||||||
// $selectedAutomation?.testResults
|
|
||||||
|
|
||||||
// const testData: AutomationTriggerResultOutputs | undefined =
|
|
||||||
// $selectedAutomation.data?.testData
|
|
||||||
|
|
||||||
// const triggerDef = $selectedAutomation.data?.definition?.trigger
|
|
||||||
|
|
||||||
// const isWebhook = triggerDef?.stepId === AutomationTriggerStepId.WEBHOOK
|
|
||||||
// const isRowAction =
|
|
||||||
// triggerDef?.stepId === AutomationTriggerStepId.ROW_ACTION
|
|
||||||
|
|
||||||
// const triggerInputs = triggerDef
|
|
||||||
// ? (triggerDef.inputs as AutomationTriggerInputs<
|
|
||||||
// typeof triggerDef.stepId
|
|
||||||
// >)
|
|
||||||
// : undefined
|
|
||||||
|
|
||||||
// let triggerData: AutomationTriggerResultOutputs | undefined
|
|
||||||
|
|
||||||
// if (results && isAutomationResults(results)) {
|
|
||||||
// const automationTrigger: AutomationTriggerResult | undefined =
|
|
||||||
// results?.trigger
|
|
||||||
|
|
||||||
// const outputs: AutomationTriggerResultOutputs | undefined =
|
|
||||||
// automationTrigger?.outputs
|
|
||||||
// triggerData = outputs ? outputs : undefined
|
|
||||||
|
|
||||||
// if (triggerData) {
|
|
||||||
// if (isRowAction) {
|
|
||||||
// const rowActionInputs: RowActionTriggerInputs =
|
|
||||||
// triggerInputs as RowActionTriggerInputs
|
|
||||||
// const rowActionTableId = rowActionInputs.tableId
|
|
||||||
// const rowActionTable = $tables.list.find(
|
|
||||||
// table => table._id === rowActionTableId
|
|
||||||
// )
|
|
||||||
|
|
||||||
// const rowTriggerOutputs = triggerData as RowActionTriggerOutputs
|
|
||||||
|
|
||||||
// if (rowActionTable) {
|
|
||||||
// // Row action table must always be retrieved as it is never
|
|
||||||
// // returned in the test results
|
|
||||||
// rowTriggerOutputs.table = rowActionTable
|
|
||||||
// }
|
|
||||||
// } else if (isWebhook) {
|
|
||||||
// const webhookTrigger = triggerData as WebhookTriggerOutputs
|
|
||||||
// // Ensure it displays in the event that the configuration was been skipped
|
|
||||||
// webhookTrigger.body = webhookTrigger.body ?? {}
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Clean up unnecessary data from the context
|
|
||||||
// // Meta contains UI/UX config data. Non-bindable
|
|
||||||
// delete triggerData?.meta
|
|
||||||
// } else {
|
|
||||||
// // Substitute test data in place of the trigger data if the test hasn't been run
|
|
||||||
// triggerData = testData
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // AppSelf context required to mirror server user context
|
|
||||||
// const userContext = $selectedAutomation.appSelf || {}
|
|
||||||
|
|
||||||
// // Extract step results from a valid response
|
|
||||||
// const stepResults =
|
|
||||||
// results && isAutomationResults(results) ? results?.steps : []
|
|
||||||
|
|
||||||
// // Env vars require a license. In the event they are empty or unavailable
|
|
||||||
// // the UI wont display an empty section in the context
|
|
||||||
// const envVars = $env?.variables.length
|
|
||||||
// ? $env?.variables.reduce(
|
|
||||||
// (acc: Record<string, any>, variable: Record<string, any>) => {
|
|
||||||
// acc[variable.name] = ""
|
|
||||||
// return acc
|
|
||||||
// },
|
|
||||||
// {}
|
|
||||||
// )
|
|
||||||
// : undefined
|
|
||||||
|
|
||||||
// // Result data from a completed test run
|
|
||||||
// // Initially contain info around
|
|
||||||
// const stepContext = stepResults.reduce(
|
|
||||||
// (acc: Record<string, any>, res: Record<string, any>) => {
|
|
||||||
// acc[res.id] = res.outputs
|
|
||||||
// return acc
|
|
||||||
// },
|
|
||||||
// {}
|
|
||||||
// )
|
|
||||||
|
|
||||||
// return {
|
|
||||||
// user: userContext,
|
|
||||||
// // Merge in the trigger data.
|
|
||||||
// ...(triggerData ? { trigger: { ...triggerData } } : {}),
|
|
||||||
// steps: stepContext,
|
|
||||||
// ...(envVars ? { env: envVars } : {}),
|
|
||||||
// settings: { url, company, logo },
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// )
|
|
||||||
// },
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Automation} auto
|
* @param {Automation} auto
|
||||||
* @param {BlockRef} blockRef
|
* @param {BlockRef} blockRef
|
||||||
|
|
Loading…
Reference in New Issue