Skip to content

Commit

Permalink
Merge pull request AutomaApp#1367 from Siykt/feat/insert-all-global-data
Browse files Browse the repository at this point in the history
Feat: Use all current workflow globalData
  • Loading branch information
Kholid060 authored Sep 14, 2023
2 parents 757677e + 9a91b62 commit e452652
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 17 deletions.
7 changes: 7 additions & 0 deletions src/components/newtab/workflow/edit/EditExecuteWorkflow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
<p class="mt-4 ml-1 mb-1 text-sm text-gray-600 dark:text-gray-200">
{{ t('common.globalData') }}
</p>
<ui-checkbox
:model-value="data.insertAllGlobalData"
class="mb-4 leading-tight text-sm"
@change="updateData({ insertAllGlobalData: $event })"
>
{{ t('workflow.blocks.execute-workflow.insertAllGlobalData') }}
</ui-checkbox>
<pre
v-if="!state.showGlobalData"
class="max-h-80 overflow-auto rounded-lg bg-gray-900 p-4 text-gray-200"
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en/blocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@
"description": "",
"insertAllVars": "Use all current workflow variables",
"insertVars": "Insert current workflow variables",
"useCommas": "Use commas to separate the variable name"
"useCommas": "Use commas to separate the variable name",
"insertAllGlobalData": "Use all current workflow globalData"
},
"google-sheets-drive": {
"name": "@:workflow.blocks.google-sheets.name (GDrive)",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/it/blocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@
"description": "",
"insertAllVars": "Usa tutte le variabili del workflow corrente",
"insertVars": "Inserisci le variabili del workflow corrente",
"useCommas": "Usa le virgole per separare i nomi delle variabili"
"useCommas": "Usa le virgole per separare i nomi delle variabili",
"insertAllGlobalData": "Utilizza tutto il flusso di lavoro corrente globalData"
},
"google-sheets": {
"name": "Google Sheets",
Expand Down
5 changes: 4 additions & 1 deletion src/locales/uk/blocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,10 @@
"iframe": "Iframe"
}
}
},
"execute-workflow": {
"insertAllGlobalData": "Використовувати весь поточний робочий процес globalData"
}
}
}
}
}
19 changes: 13 additions & 6 deletions src/locales/vi/blocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,10 @@
"description": "",
"insertAllVars": "Chèn tất cả các biến quy trình làm việc hiện tại",
"insertVars": "Chèn các biến quy trình công việc hiện tại",
"useCommas": "Sử dụng dấu phẩy để phân tách tên biến"
"useCommas": "Sử dụng dấu phẩy để phân tách tên biến",
"insertAllGlobalData": "Sử dụng tất cả quy trình công việc hiện tại GlobalData"
},
"google-sheets": {
"google-sheets": {
"name": "Google sheets",
"description": "Đọc hoặc cập nhật dữ liệu Google Trang tính",
"previewData": "Xem trước dữ liệu",
Expand Down Expand Up @@ -571,9 +572,15 @@
"label": "Nhập độ trễ (mili giây)(0 là vô hiệu hóa)"
}
},
"select": { "name": "Select" },
"radio": { "name": "Radio" },
"checkbox": { "name": "Checkbox" }
"select": {
"name": "Select"
},
"radio": {
"name": "Radio"
},
"checkbox": {
"name": "Checkbox"
}
},
"repeat-task": {
"name": "Nhiệm vụ lặp lại",
Expand Down Expand Up @@ -682,7 +689,7 @@
"name": "Dữ liệu vòng lặp",
"description": "Lặp lại qua các cột dữ liệu hoặc dữ liệu tùy chỉnh của bạn",
"loopId": "ID Vòng lặp",
"refKey": "Khóa liên kết",
"refKey": "Khóa liên kết",
"startIndex": "Bắt đầu từ chỉ mục",
"resumeLastWorkflow": "Tiếp tục quy trình làm việc cuối cùng",
"reverse": "Thứ tự vòng lặp đảo ngược",
Expand Down
15 changes: 12 additions & 3 deletions src/locales/zh-TW/blocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,15 @@
"label": "設定執行文字輸入前的等待時間; 單位: ms(0為停用)"
}
},
"select": { "name": "下拉式選單" },
"radio": { "name": "單選框" },
"checkbox": { "name": "複選框" }
"select": {
"name": "下拉式選單"
},
"radio": {
"name": "單選框"
},
"checkbox": {
"name": "複選框"
}
},
"repeat-task": {
"name": "重新執行任務",
Expand Down Expand Up @@ -279,6 +285,9 @@
"main": "主視窗",
"iframe": "iframe"
}
},
"execute-workflow": {
"insertAllGlobalData": "插入當前工作流的 GlobalData"
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/locales/zh/blocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"timeout": "超时 (毫秒)",
"noPermission": "Automa 没有足够的权限执行此操作",
"grantPermission": "授予权限",
"action": "操作",
"action": "操作",
"element": {
"select": "选择一个元素",
"verify": "验证选择器"
Expand Down Expand Up @@ -393,7 +393,8 @@
"description": "",
"insertAllVars": "插入所有当前工作流变量",
"insertVars": "插入当前工作流变量",
"useCommas": "使用逗号分隔变量名"
"useCommas": "使用逗号分隔变量名",
"insertAllGlobalData": "插入当前工作流的 GlobalData"
},
"google-sheets": {
"name": "Google sheets",
Expand Down
1 change: 1 addition & 0 deletions src/utils/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const tasks = {
globalData: '',
description: '',
insertAllVars: false,
insertAllGlobalData: false,
},
},
'active-tab': {
Expand Down
15 changes: 12 additions & 3 deletions src/workflowEngine/blocksHandler/handlerExecuteWorkflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function findWorkflow(workflows, workflowId) {
return workflow;
}

async function executeWorkflow({ id: blockId, data }) {
async function executeWorkflow({ id: blockId, data }, { refData }) {
if (data.workflowId === '') throw new Error('empty-workflow');

const { workflows, teamWorkflows } = await browser.storage.local.get([
Expand Down Expand Up @@ -74,8 +74,17 @@ async function executeWorkflow({ id: blockId, data }) {

if (workflow.testingMode) workflow.testingMode = false;

if (!isWhitespace(data.globalData))
optionsParams.globalData = data.globalData;
if (data.insertAllGlobalData) {
optionsParams.globalData = refData.globalData;
}

if (!isWhitespace(data.globalData)) {
// shallow copy
optionsParams.globalData = {
...optionsParams.globalData,
...JSON.parse(data.globalData),
};
}

if (data.insertAllVars) {
optionsParams.variables = JSON.parse(
Expand Down

0 comments on commit e452652

Please sign in to comment.