From 6eda2a6d06ab82d067a9bb6e08c62c17ebc25a86 Mon Sep 17 00:00:00 2001 From: sadnub Date: Sun, 14 Apr 2024 19:02:03 -0400 Subject: [PATCH] Split up global settings rest/web actions in th eUI --- quasar.extensions.json | 7 ---- src/api/core.ts | 2 +- .../modals/coresettings/EditCoreSettings.vue | 14 ++++++- .../modals/coresettings/URLActionsForm.vue | 35 +++++++--------- .../modals/coresettings/URLActionsTable.vue | 40 ++++++++++--------- src/types/core/urlactions.ts | 4 +- vitest.config.mts | 27 ------------- 7 files changed, 51 insertions(+), 78 deletions(-) delete mode 100644 quasar.extensions.json delete mode 100644 vitest.config.mts diff --git a/quasar.extensions.json b/quasar.extensions.json deleted file mode 100644 index 64019344..00000000 --- a/quasar.extensions.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "@quasar/testing-unit-vitest": { - "options": [ - "ui" - ] - } -} \ No newline at end of file diff --git a/src/api/core.ts b/src/api/core.ts index 316b5114..45916d91 100644 --- a/src/api/core.ts +++ b/src/api/core.ts @@ -21,7 +21,7 @@ export async function fetchCustomFields(params = {}) { } } -export async function fetchURLActions(params = {}) { +export async function fetchURLActions(params = {}): Promise { const { data } = await axios.get(`${baseUrl}/urlaction/`, { params: params, }); diff --git a/src/components/modals/coresettings/EditCoreSettings.vue b/src/components/modals/coresettings/EditCoreSettings.vue index 6531140b..7626eba5 100644 --- a/src/components/modals/coresettings/EditCoreSettings.vue +++ b/src/components/modals/coresettings/EditCoreSettings.vue @@ -10,6 +10,7 @@ + @@ -489,17 +490,28 @@ + + + + - + + + + + + + +
Check History (days):
diff --git a/src/components/modals/coresettings/URLActionsForm.vue b/src/components/modals/coresettings/URLActionsForm.vue index 2a21c29d..abfe7b45 100644 --- a/src/components/modals/coresettings/URLActionsForm.vue +++ b/src/components/modals/coresettings/URLActionsForm.vue @@ -7,7 +7,15 @@ > - {{ props.action ? "Edit URL Action" : "Add URL Action" }} + {{ + props.action + ? props.type === "web" + ? "Edit URL Action" + : "Edit Web Hook" + : props.type === "web" + ? "Add URL Action" + : "Add Web Hook" + }} Close @@ -36,16 +44,6 @@ />
- - - - - - + - + @@ -100,7 +98,7 @@ import { ref, computed, reactive, watch } from "vue"; import { useDialogPluginComponent, useQuasar, extend } from "quasar"; import { editURLAction, saveURLAction } from "@/api/core"; import { notifySuccess } from "@/utils/notify"; -import { URLAction } from "@/types/core/urlactions"; +import { URLAction, URLActionType } from "@/types/core/urlactions"; import * as monaco from "monaco-editor"; @@ -108,18 +106,13 @@ import * as monaco from "monaco-editor"; defineEmits([...useDialogPluginComponent.emits]); // define props -const props = defineProps<{ action?: URLAction }>(); +const props = defineProps<{ type: URLActionType; action?: URLAction }>(); // setup quasar const $q = useQuasar(); const { dialogRef, onDialogHide, onDialogOK } = useDialogPluginComponent(); // static data -const URLActionOptions = [ - { value: "web", label: "Web" }, - { value: "rest", label: "REST" }, -]; - const URLActionMethods = [ { value: "get", label: "GET" }, { value: "post", label: "POST" }, @@ -134,7 +127,7 @@ const localAction: URLAction = props.action name: "", desc: "", pattern: "", - action_type: "web", + action_type: props.type, rest_body: "{\n \n}", rest_method: "get", rest_headers: "{\n \n}", diff --git a/src/components/modals/coresettings/URLActionsTable.vue b/src/components/modals/coresettings/URLActionsTable.vue index 0fe36184..0fcc04ec 100644 --- a/src/components/modals/coresettings/URLActionsTable.vue +++ b/src/components/modals/coresettings/URLActionsTable.vue @@ -1,7 +1,9 @@