Skip to content

Commit abb510f

Browse files
committed
feat(notifications): add duplicate destination action
1 parent eca7008 commit abb510f

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

assets/components/Notification/DestinationCard.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
<li>
2828
<a @click="editDestination">{{ $t("notifications.destination.edit") }}</a>
2929
</li>
30+
<li v-if="destination.type !== 'cloud'">
31+
<a @click="duplicateDestination">{{ $t("notifications.destination.duplicate") }}</a>
32+
</li>
3033
<li v-if="destination.type !== 'cloud'">
3134
<a class="text-error" @click="deleteDestination">{{ $t("notifications.destination.delete") }}</a>
3235
</li>
@@ -61,6 +64,21 @@ function editDestination() {
6164
);
6265
}
6366
67+
async function duplicateDestination() {
68+
await fetch(withBase("/api/notifications/dispatchers"), {
69+
method: "POST",
70+
headers: { "Content-Type": "application/json" },
71+
body: JSON.stringify({
72+
name: `Copy of ${destination.name}`,
73+
type: destination.type,
74+
url: destination.url,
75+
template: destination.template,
76+
headers: destination.headers,
77+
}),
78+
});
79+
onUpdated?.();
80+
}
81+
6482
async function deleteDestination() {
6583
await fetch(withBase(`/api/notifications/dispatchers/${destination.id}`), { method: "DELETE" });
6684
onUpdated?.();

locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ notifications:
255255
http-webhook: HTTP Webhook
256256
dozzle-cloud: Dozzle Cloud
257257
edit: Edit
258+
duplicate: Duplicate
258259
delete: Delete
259260
alert-form:
260261
create-title: Create Alert

0 commit comments

Comments
 (0)