diff --git a/README.md b/README.md index da740ce..03bb615 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,8 @@ Roadmap: - [x] Now we can customize the folder icon and color - [ ] Pagination on table view - [ ] Move the category to a collection for better UX and data structure -- [ ] Run Another flow ability +- [x] Run webhook flow ability +- [x] Manage another instance flows @@ -78,5 +79,10 @@ Changelogs: * Add feature to pull flows from another directus instance to the current instance - 1.4.4 (28 July 2024) * Add admin access checker on the flow manager module registration +- 1.4.5 (07 August 2024) + * Add feature to run webhook flow + * Add feature to manage another instance flows (duplicate, backup, restore, categorize, table view, run, and delete) + * Add checking for the flow manager field onload + Contributing: If you want to contribute kindly to create a PR and if you want to request a feature or report of a bug kindly create the Issue diff --git a/package-lock.json b/package-lock.json index a0f3dee..f9b637c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "directus-extension-flow-manager", - "version": "1.4.4", + "version": "1.4.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "directus-extension-flow-manager", - "version": "1.4.4", + "version": "1.4.5", "license": "gpl-3.0", "devDependencies": { "@directus/composables": "^10.1.12", diff --git a/package.json b/package.json index 217e6b9..992147a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "directus-extension-flow-manager", "description": "This is a custom module for managing Flow", "icon": "extension", - "version": "1.4.4", + "version": "1.4.5", "author": { "name": "Bagus Andreanto", "email": "andreanto.bagus@gmail.com" diff --git a/src/components/flow-item.vue b/src/components/flow-item.vue deleted file mode 100644 index 6f87c44..0000000 --- a/src/components/flow-item.vue +++ /dev/null @@ -1,187 +0,0 @@ - - - - - diff --git a/src/components/item-options.vue b/src/components/item-options.vue deleted file mode 100644 index 8a63fa5..0000000 --- a/src/components/item-options.vue +++ /dev/null @@ -1,90 +0,0 @@ - - - - - diff --git a/src/components/navigation-item-content.vue b/src/components/navigation-item-content.vue deleted file mode 100644 index 30550ac..0000000 --- a/src/components/navigation-item-content.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/src/components/navigation-item.vue b/src/components/navigation-item.vue deleted file mode 100644 index 03234cd..0000000 --- a/src/components/navigation-item.vue +++ /dev/null @@ -1,145 +0,0 @@ - - - - - diff --git a/src/components/navigation.vue b/src/components/navigation.vue deleted file mode 100644 index 558966d..0000000 --- a/src/components/navigation.vue +++ /dev/null @@ -1,211 +0,0 @@ - - - - - diff --git a/src/constants.ts b/src/constants.ts index 0fd466f..e6be781 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1 +1,3 @@ export const TRIGGER_TYPES = ["event", "manual", "operation", "schedule", "webhook"]; +export const NPM_LINK = "https://registry.npmjs.org/directus-extension-flow-manager"; +export const ENDPOINT_EXTENSION_NAME = "flow-manager-endpoint"; diff --git a/src/flow-manager-directus-flow-hook/index.ts b/src/flow-manager-directus-flow-hook/index.ts index 671587f..aa33163 100644 --- a/src/flow-manager-directus-flow-hook/index.ts +++ b/src/flow-manager-directus-flow-hook/index.ts @@ -1,17 +1,41 @@ import { defineHook } from "@directus/extensions-sdk"; -export default defineHook(({ action }, { services }) => { +export default defineHook(({ action }, { services, logger }) => { action("activity.create", async (data: any, { database, schema }) => { const { payload: { action, item: flowId }, } = data; - const { RevisionsService } = services; + const { RevisionsService, FieldsService } = services; if (action === "run") { const revisionsService = new RevisionsService({ knex: database, schema, }); + const fieldsService = new FieldsService({ + knex: database, + schema, + }); + + const fields = await fieldsService.readAll("directus_flows"); + + let isCounterFieldExists = false; + let isCounterDateFieldExists = false; + + for (const field of fields) { + if (field.field === "flow_manager_run_counter") { + isCounterFieldExists = true; + } + + if (field.field === "flow_manager_last_run_at") { + isCounterDateFieldExists = true; + } + + if (isCounterFieldExists && isCounterDateFieldExists) { + break; + } + } + const counter = await revisionsService.readByQuery({ filter: { _and: [ @@ -43,10 +67,16 @@ export default defineHook(({ action }, { services }) => { sort: ["-id"], }); - await database("directus_flows").where({ id: flowId }).update({ - flow_manager_last_run_at: new Date(), - flow_manager_run_counter: counter.length + 1, - }); + if (isCounterDateFieldExists && isCounterFieldExists) { + await database("directus_flows") + .where({ id: flowId }) + .update({ + flow_manager_last_run_at: new Date(), + flow_manager_run_counter: counter.length + 1, + }); + } else { + logger.warn("Flow Manager: flow_manager_run_counter or flow_manager_last_run_at field is missing in directus_flows collection"); + } } }); }); diff --git a/src/flow-manager-module/components/credential-dialog.vue b/src/flow-manager-module/components/credential-dialog.vue index 04bad85..e174de8 100644 --- a/src/flow-manager-module/components/credential-dialog.vue +++ b/src/flow-manager-module/components/credential-dialog.vue @@ -1,8 +1,9 @@ diff --git a/src/flow-manager-module/components/loading-dialog.vue b/src/flow-manager-module/components/loading-dialog.vue index b0701aa..f0e66cf 100644 --- a/src/flow-manager-module/components/loading-dialog.vue +++ b/src/flow-manager-module/components/loading-dialog.vue @@ -1,6 +1,6 @@ -