mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-02 20:15:24 +02:00
fix: Restore Webhook Test Functionality (#3857)
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
This commit is contained in:
parent
aa6e109162
commit
6e6ae80c46
7 changed files with 50 additions and 9 deletions
|
@ -18,8 +18,6 @@
|
|||
icon: $globals.icons.testTube,
|
||||
text: $tc('general.test'),
|
||||
event: 'test',
|
||||
// TODO: There is no functionality hooked up to this. Enable it when there is
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
icon: $globals.icons.save,
|
||||
|
|
|
@ -64,7 +64,6 @@ export const useGroupWebhooks = function () {
|
|||
newDt.setMinutes(Number(minutes));
|
||||
|
||||
updateData.scheduledTime = `${pad(newDt.getUTCHours(), 2)}:${pad(newDt.getUTCMinutes(), 2)}`;
|
||||
console.log(updateData.scheduledTime);
|
||||
|
||||
const payload = {
|
||||
...updateData,
|
||||
|
@ -85,7 +84,14 @@ export const useGroupWebhooks = function () {
|
|||
if (data) {
|
||||
this.refreshAll();
|
||||
}
|
||||
loading.value = false;
|
||||
},
|
||||
|
||||
async testOne(id: string | number) {
|
||||
loading.value = true;
|
||||
await api.groupWebhooks.testOne(id);
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const webhooks = actions.getAll();
|
||||
|
|
|
@ -6,9 +6,15 @@ const prefix = "/api";
|
|||
const routes = {
|
||||
webhooks: `${prefix}/groups/webhooks`,
|
||||
webhooksId: (id: string | number) => `${prefix}/groups/webhooks/${id}`,
|
||||
webhooksIdTest: (id: string | number) => `${prefix}/groups/webhooks/${id}/test`,
|
||||
};
|
||||
|
||||
export class WebhooksAPI extends BaseCRUDAPI<CreateWebhook, ReadWebhook> {
|
||||
baseRoute = routes.webhooks;
|
||||
itemRoute = routes.webhooksId;
|
||||
itemTestRoute = routes.webhooksIdTest;
|
||||
|
||||
async testOne(itemId: string | number) {
|
||||
return await this.requests.post<null>(`${this.itemTestRoute(itemId)}`, {});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
</v-card-text>
|
||||
</BasePageTitle>
|
||||
|
||||
<BannerExperimental />
|
||||
|
||||
<BaseButton create @click="actions.createOne()" />
|
||||
<v-expansion-panels class="mt-2">
|
||||
<v-expansion-panel v-for="(webhook, index) in webhooks" :key="index" class="my-2 left-border rounded">
|
||||
|
@ -36,6 +34,7 @@
|
|||
:webhook="webhook"
|
||||
@save="actions.updateOne($event)"
|
||||
@delete="actions.deleteOne($event)"
|
||||
@test="actions.testOne($event).then(() => alert.success($tc('events.test-message-sent')))"
|
||||
/>
|
||||
</v-expansion-panel-content>
|
||||
</v-expansion-panel>
|
||||
|
@ -47,6 +46,7 @@
|
|||
import { defineComponent } from "@nuxtjs/composition-api";
|
||||
import { useGroupWebhooks, timeUTC } from "~/composables/use-group-webhooks";
|
||||
import GroupWebhookEditor from "~/components/Domain/Group/GroupWebhookEditor.vue";
|
||||
import { alert } from "~/composables/use-toast";
|
||||
|
||||
export default defineComponent({
|
||||
components: { GroupWebhookEditor },
|
||||
|
@ -55,6 +55,7 @@ export default defineComponent({
|
|||
const { actions, webhooks } = useGroupWebhooks();
|
||||
|
||||
return {
|
||||
alert,
|
||||
webhooks,
|
||||
actions,
|
||||
timeUTC
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue