Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

SSR: Port subscriber bounces page.

Kailash Nadh1aec037f1eb6
diff --git a/cmd/admin.go b/cmd/admin.go
index 2e804fa3..34810f54 100644
--- a/cmd/admin.go
+++ b/cmd/admin.go
@@ -40,6 +40,7 @@ type serverConfig struct {
var adminJSI18nKeys = []string{
"globals.buttons.back",
+ "globals.terms.bounce",
"globals.buttons.cancel",
"globals.buttons.ok",
"globals.messages.copied",
diff --git a/cmd/bounce.go b/cmd/bounce.go
index 2467ae4f..9194972d 100644
--- a/cmd/bounce.go
+++ b/cmd/bounce.go
@@ -12,6 +12,43 @@ import (
"github.com/labstack/echo/v4"
)
+// bouncesView is the admin page view for the bounces list page.
+type bouncesView struct {
+ adminView
+
+ Bounces []models.Bounce
+ Page models.PageProps
+}
+
+// ViewBounces renders the HTML view for bounces.
+func (a *App) ViewBounces(c echo.Context) error {
+ q := makeQuery(c.Request().URL.Query(), map[string]string{
+ "page": "",
+ "order_by": "",
+ "order": "",
+ "source": "",
+ "type": "",
+ "campaign_id": "",
+ })
+
+ campID, _ := strconv.Atoi(q.Get("campaign_id"))
+
+ // Query and fetch bounces from the DB.
+ pg := a.pg.NewFromURL(q)
+ res, total, err := a.core.QueryBounces(campID, 0, q.Get("source"), q.Get("type"), q.Get("order_by"), q.Get("order"), pg.Offset, pg.Limit)
+ if err != nil {
+ return err
+ }
+
+ data := bouncesView{
+ adminView: newAdminView(c, a.i18n.T("globals.terms.bounces"), ""),
+ Bounces: res,
+ Page: models.NewPageProps(q, total, pg.Page, pg.PerPage),
+ }
+
+ return c.Render(http.StatusOK, "admin-bounces", data)
+}
+
// GetBounce handles retrieval of a specific bounce record by ID.
func (a *App) GetBounce(c echo.Context) error {
// Fetch one bounce from the DB.
@@ -29,6 +66,7 @@ func (a *App) GetBounces(c echo.Context) error {
var (
campID, _ = strconv.Atoi(c.QueryParam("campaign_id"))
source = c.FormValue("source")
+ typ = c.FormValue("type")
orderBy = c.FormValue("order_by")
order = c.FormValue("order")
@@ -36,7 +74,7 @@ func (a *App) GetBounces(c echo.Context) error {
)
// Query and fetch bounces from the DB.
- res, total, err := a.core.QueryBounces(campID, 0, source, orderBy, order, pg.Offset, pg.Limit)
+ res, total, err := a.core.QueryBounces(campID, 0, source, typ, orderBy, order, pg.Offset, pg.Limit)
if err != nil {
return err
}
@@ -68,7 +106,7 @@ func (a *App) GetSubscriberBounces(c echo.Context) error {
}
// Query and fetch bounces from the DB.
- out, _, err := a.core.QueryBounces(0, subID, "", "", "", 0, 1000)
+ out, _, err := a.core.QueryBounces(0, subID, "", "", "", "", 0, 1000)
if err != nil {
return err
}
diff --git a/cmd/handlers.go b/cmd/handlers.go
index 8d226941..f19ac585 100644
--- a/cmd/handlers.go
+++ b/cmd/handlers.go
@@ -75,7 +75,8 @@ func initHTTPHandlers(e *echo.Echo, a *App) {
g.GET(path.Join(uriAdmin, "/lists"), a.ViewLists)
g.GET(path.Join(uriAdmin, "/lists/:id"), hasID(a.ViewList))
g.GET(path.Join(uriAdmin, "/lists/forms"), a.ViewForms)
- g.GET(path.Join(uriAdmin, "/import"), a.ViewImport)
+ g.GET(path.Join(uriAdmin, "/subscribers/import"), a.ViewImport)
+ g.GET(path.Join(uriAdmin, "/subscribers/bounces"), a.ViewBounces)
g.GET(path.Join(uriAdmin, "/subscribers"), a.ViewSubscribers)
g.POST(path.Join(uriAdmin, "/subscribers"), a.ViewSubscribers)
g.GET(path.Join(uriAdmin, "/subscribers/lists/:id"), hasID(a.ViewSubscribers))
diff --git a/cmd/subscribers.go b/cmd/subscribers.go
index f83f1384..ec5c9142 100644
--- a/cmd/subscribers.go
+++ b/cmd/subscribers.go
@@ -167,7 +167,7 @@ func (a *App) ViewSubscriberBounces(c echo.Context) error {
return err
}
- bounces, _, err := a.core.QueryBounces(0, out.ID, "", "", "", 0, 1000)
+ bounces, _, err := a.core.QueryBounces(0, out.ID, "", "", "", "", 0, 1000)
if err != nil {
return err
}
diff --git a/frontend-vue/src/router/index.js b/frontend-vue/src/router/index.js
index 245bed8f..40b5d532 100644
--- a/frontend-vue/src/router/index.js
+++ b/frontend-vue/src/router/index.js
@@ -17,12 +17,6 @@ const routes = [
meta: { title: '' },
component: () => import('../views/Dashboard.vue'),
},
- {
- path: '/subscribers/bounces',
- name: 'bounces',
- meta: { title: 'globals.terms.bounces', group: 'subscribers' },
- component: () => import('../views/Bounces.vue'),
- },
{
path: '/campaigns',
name: 'campaigns',
diff --git a/frontend-vue/src/views/Bounces.vue b/frontend-vue/src/views/Bounces.vue
deleted file mode 100644
index 484d2511..00000000
--- a/frontend-vue/src/views/Bounces.vue
+++ /dev/null
@@ -1,239 +0,0 @@
-<template>
- <section class="bounces">
- <header class="page-header row">
- <div class="col-8">
- <h1>
- {{ $t('globals.terms.bounces') }}
- <span v-if="bounces.total > 0">({{ bounces.total }})</span>
- </h1>
- </div>
- </header>
-
- <div class="card page-content">
- <b-table :data="bounces.results" :hoverable="true" :loading="loading.bounces" default-sort="createdAt"
- checkable @check-all="onTableCheck" @check="onTableCheck" :checked-rows.sync="bulk.checked" detailed paginated
- backend-pagination @page-change="onPageChange" :current-page="queryParams.page" :per-page="bounces.perPage"
- :total="bounces.total" backend-sorting @sort="onSort">
- <template #top-left>
- <div class="actions">
- <template v-if="bulk.checked.length > 0">
- <a class="a" href="#" @click.prevent="$utils.confirm(null, () => deleteBounces())" data-cy="btn-delete">
- <b-icon icon="trash-can-outline" /> {{ $t('globals.buttons.delete') }}
- </a>
- <a class="a" href="#" @click.prevent="$utils.confirm(null, () => blocklistSubscribers())"
- data-cy="btn-manage-blocklist">
- <b-icon icon="account-off-outline" /> {{ $t('import.blocklist') }}
- </a>
- <span>
- {{ $t('globals.messages.numSelected', { num: numSelectedBounces }) }}
- <span v-if="!bulk.all && bounces.total > bounces.perPage">
- &mdash;
- <a href="#" @click.prevent="selectAllBounces">
- {{ $t('subscribers.selectAll', { num: bounces.total }) }}
- </a>
- </span>
- </span>
- </template>
- </div>
- </template>
- <b-table-column v-slot="props" field="email" :label="$t('subscribers.email')" :td-attrs="$utils.tdID"
- sortable>
- <router-link :to="{ name: 'subscriber', params: { id: props.row.subscriberId } }"
- :class="{ 'blocklisted': props.row.subscriberStatus === 'blocklisted' }">
- {{ props.row.email }}
- <b-tag v-if="props.row.subscriberStatus !== 'enabled'" :type="props.row.subscriberStatus"
- data-cy="blocklisted">
- {{ $t(`subscribers.status.${props.row.subscriberStatus}`) }}
- </b-tag>
- </router-link>
- </b-table-column>
-
- <b-table-column v-slot="props" field="campaign" :label="$tc('globals.terms.campaign')" sortable>
- <router-link v-if="props.row.campaign"
- :to="{ name: 'bounces', query: { campaign_id: props.row.campaign.id } }">
- {{ props.row.campaign.name }}
- </router-link>
- <span v-else>-</span>
- </b-table-column>
-
- <b-table-column v-slot="props" field="source" :label="$t('bounces.source')" sortable>
- <router-link :to="{ name: 'bounces', query: { source: props.row.source } }">
- {{ props.row.source }}
- </router-link>
- </b-table-column>
-
- <b-table-column v-slot="props" field="type" :label="$t('globals.fields.type')" sortable>
- <router-link :to="{ name: 'bounces', query: { type: props.row.type } }">
- {{ $t(`bounces.${props.row.type}`) }}
- </router-link>
- </b-table-column>
-
- <b-table-column v-slot="props" field="created_at" :label="$t('globals.fields.createdAt')" sortable>
- {{ $utils.niceDate(props.row.createdAt, true) }}
- </b-table-column>
-
- <b-table-column v-slot="props" cell-class="actions" align="right">
- <div>
- <a v-if="!props.row.isDefault" href="#" @click.prevent="$utils.confirm(null, () => deleteBounce(props.row))"
- data-cy="btn-delete" :aria-label="$t('globals.buttons.delete')">
-
- <b-icon icon="trash-can-outline" />
-
- </a>
- <span v-else class="a text-lighter">
- <b-icon icon="trash-can-outline" />
- </span>
- </div>
- </b-table-column>
-
- <template #detail="props">
- <pre class="text-7">{{ props.row.meta }}</pre>
- </template>
-
- <template #empty v-if="!loading.templates">
- <empty-placeholder />
- </template>
- </b-table>
- </div>
- </section>
-</template>
-
-<script>
-import Vue from 'vue';
-import { mapState } from 'vuex';
-import EmptyPlaceholder from '../components/EmptyPlaceholder.vue';
-
-export default Vue.extend({
- components: {
- EmptyPlaceholder,
- },
-
- data() {
- return {
- bounces: {},
-
- // Table bulk row selection states.
- bulk: {
- checked: [],
- all: false,
- },
-
- // Query params to filter the getSubscribers() API call.
- queryParams: {
- page: 1,
- orderBy: 'created_at',
- order: 'desc',
- campaignID: 0,
- source: '',
- },
- };
- },
-
- methods: {
- onSort(field, direction) {
- this.queryParams.orderBy = field;
- this.queryParams.order = direction;
- this.getBounces();
- },
-
- onPageChange(p) {
- this.queryParams.page = p;
- this.getBounces();
- },
- // Mark all bounces in the query as selected.
- selectAllBounces() {
- this.bulk.all = true;
- },
- onTableCheck() {
- // Disable bulk.all selection if there are no rows checked in the table.
- if (this.bulk.checked.length !== this.bounces.total) {
- this.bulk.all = false;
- }
- },
-
- getBounces() {
- this.bulk.checked = [];
- this.bulk.all = false;
-
- this.$api.getBounces({
- page: this.queryParams.page,
- order_by: this.queryParams.orderBy,
- order: this.queryParams.order,
- campaign_id: this.queryParams.campaign_id,
- source: this.queryParams.source,
- }).then((data) => {
- this.bounces = data;
- });
- },
-
- deleteBounce(b) {
- this.$api.deleteBounce(b.id).then(() => {
- this.getBounces();
- this.$utils.toast(this.$t('globals.messages.deleted', { name: b.email }));
- });
- },
-
- deleteBounces() {
- const params = {};
- if (!this.bulk.all && this.bulk.checked.length > 0) {
- params.id = this.bulk.checked.map((s) => s.id);
- } else if (this.bulk.all) {
- params.all = true;
- }
-
- this.$api.deleteBounces(params).then(() => {
- this.getBounces();
- this.$utils.toast(this.$t(
- 'globals.messages.deletedCount',
- { name: this.$tc('globals.terms.bounces'), num: this.numSelectedBounces },
- ));
- });
- },
-
- blocklistSubscribers() {
- const cb = () => {
- this.getBounces();
- this.$utils.toast(this.$t('globals.messages.done'));
- };
-
- if (!this.bulk.all && this.bulk.checked.length > 0) {
- const subIds = this.bulk.checked.map((s) => s.subscriberId);
- this.$api.blocklistSubscribers({ ids: subIds }).then(cb);
- return;
- }
-
- this.$api.blocklistBouncedSubscribers({ all: true }).then(cb);
- },
- },
-
- computed: {
- ...mapState(['templates', 'loading']),
- numSelectedBounces() {
- if (this.bulk.all) {
- return this.bounces.total;
- }
- return this.bulk.checked.length;
- },
- },
-
- created() {
- this.$root.$on('page.refresh', this.getBounces);
- },
-
- destroyed() {
- this.$root.$off('page.refresh', this.getBounces);
- },
-
- mounted() {
- if (this.$route.query.campaign_id) {
- this.queryParams.campaign_id = parseInt(this.$route.query.campaign_id, 10);
- }
-
- if (this.$route.query.source) {
- this.queryParams.source = this.$route.query.source;
- }
-
- this.getBounces();
- },
-});
-</script>
diff --git a/internal/core/bounces.go b/internal/core/bounces.go
index 1fc3732c..0252a5ac 100644
--- a/internal/core/bounces.go
+++ b/internal/core/bounces.go
@@ -13,7 +13,7 @@ var bounceQuerySortFields = []string{"email", "campaign_name", "source", "create
// QueryBounces retrieves paginated bounce entries based on the given params.
// It also returns the total number of bounce records in the DB.
-func (c *Core) QueryBounces(campID, subID int, source, orderBy, order string, offset, limit int) ([]models.Bounce, int, error) {
+func (c *Core) QueryBounces(campID, subID int, source, typ, orderBy, order string, offset, limit int) ([]models.Bounce, int, error) {
if !strSliceContains(orderBy, bounceQuerySortFields) {
orderBy = "created_at"
}
@@ -23,7 +23,7 @@ func (c *Core) QueryBounces(campID, subID int, source, orderBy, order string, of
out := []models.Bounce{}
stmt := strings.ReplaceAll(c.q.QueryBounces, "%order%", orderBy+" "+order)
- if err := c.db.Select(&out, stmt, 0, campID, subID, source, offset, limit); err != nil {
+ if err := c.db.Select(&out, stmt, 0, campID, subID, source, typ, offset, limit); err != nil {
c.log.Printf("error fetching bounces: %v", err)
return nil, 0, echo.NewHTTPError(http.StatusInternalServerError,
c.i18n.Ts("globals.messages.errorFetching", "name", "{globals.terms.bounce}", "error", pqErrMsg(err)))
@@ -41,7 +41,7 @@ func (c *Core) QueryBounces(campID, subID int, source, orderBy, order string, of
func (c *Core) GetBounce(id int) (models.Bounce, error) {
var out []models.Bounce
stmt := strings.ReplaceAll(c.q.QueryBounces, "%order%", "id "+SortAsc)
- if err := c.db.Select(&out, stmt, id, 0, 0, "", 0, 1); err != nil {
+ if err := c.db.Select(&out, stmt, id, 0, 0, "", "", 0, 1); err != nil {
c.log.Printf("error fetching bounces: %v", err)
return models.Bounce{}, echo.NewHTTPError(http.StatusInternalServerError,
c.i18n.Ts("globals.messages.errorFetching", "name", "{globals.terms.bounce}", "error", pqErrMsg(err)))
diff --git a/queries/bounces.sql b/queries/bounces.sql
index b8b1d70b..df0b1855 100644
--- a/queries/bounces.sql
+++ b/queries/bounces.sql
@@ -52,7 +52,8 @@ WHERE ($1 = 0 OR bounces.id = $1)
AND ($2 = 0 OR bounces.campaign_id = $2)
AND ($3 = 0 OR bounces.subscriber_id = $3)
AND ($4 = '' OR bounces.source = $4)
-ORDER BY %order% OFFSET $5 LIMIT (CASE WHEN $6 < 1 THEN NULL ELSE $6 END);
+ AND ($5 = '' OR bounces.type = $5::bounce_type)
+ORDER BY %order% OFFSET $6 LIMIT (CASE WHEN $7 < 1 THEN NULL ELSE $7 END);
-- name: delete-bounces
DELETE FROM bounces WHERE $2 = TRUE OR id = ANY($1);
diff --git a/static/admin/partials/sidebar.html b/static/admin/partials/sidebar.html
index 05f0f37f..707fd46d 100644
--- a/static/admin/partials/sidebar.html
+++ b/static/admin/partials/sidebar.html
@@ -26,10 +26,10 @@
<li><a href="{{ URI "/admin/subscribers" }}" data-cy="all-subscribers">{{ .L.T "menu.allSubscribers" }}</a></li>
{{ end }}
{{ if Can $u "subscribers:import" }}
- <li><a href="{{ URI "/admin/import" }}" data-cy="import">{{ .L.T "menu.import" }}</a></li>
+ <li><a href="{{ URI "/admin/subscribers/import" }}" data-cy="import">{{ .L.T "menu.import" }}</a></li>
{{ end }}
{{ if Can $u "bounces:get" }}
- <li><a href="{{ URI "/admin/bounces" }}" data-cy="bounces">{{ .L.T "globals.terms.bounces" }}</a></li>
+ <li><a href="{{ URI "/admin/subscribers/bounces" }}" data-cy="bounces">{{ .L.T "globals.terms.bounces" }}</a></li>
{{ end }}
</ul>
</details>
diff --git a/static/admin/src/js/views/bounces.js b/static/admin/src/js/views/bounces.js
new file mode 100644
index 00000000..35dd3321
--- /dev/null
+++ b/static/admin/src/js/views/bounces.js
@@ -0,0 +1,79 @@
+import {
+ api,
+ i18n,
+} from '../main.js';
+import * as u from '../utils.js';
+
+function component() {
+ return {
+ // JSON meta details of a given bounce item viewed in the dialog.
+ meta: {},
+ metaTitle: '',
+
+ onView(title, meta) {
+ this.metaTitle = title;
+ this.meta = meta || {};
+ this.$refs.metaDialog.showModal();
+ },
+
+ async onDeleteBounce(id, email) {
+ if (!(await u.confirm())) {
+ return;
+ }
+
+ await api('bounces', `/bounces/${id}`, 'DELETE');
+ u.reload({ message: i18n.ts('globals.messages.deleted', { name: email }) });
+ },
+
+ // ===============
+ // Bulk actions.
+ async onDeleteSelected(allSelected, selected, total) {
+ const num = allSelected ? total : selected.length;
+ if (num === 0 || !(await u.confirm(i18n.ts('globals.messages.confirmDelete', {
+ num,
+ name: i18n.tc('globals.terms.bounce', num).toLowerCase(),
+ })))) {
+ return;
+ }
+
+ if (allSelected) {
+ await api('bounces', '/bounces?all=true', 'DELETE');
+ } else {
+ const q = new URLSearchParams();
+ selected.forEach((id) => q.append('id', id));
+ await api('bounces', `/bounces?${q.toString()}`, 'DELETE');
+ }
+
+ u.reload({
+ message: i18n.ts('globals.messages.deletedCount', {
+ num,
+ name: i18n.tc('globals.terms.bounce', num),
+ }),
+ });
+ },
+
+ async onBlocklistSelected(allSelected, total) {
+ const subIDs = Array.from(document.querySelectorAll('input[name="id"]:checked'))
+ .map((el) => Number(el.dataset.subscriberId))
+ .filter((id) => id > 0);
+
+ const num = allSelected ? total : subIDs.length;
+ if (num === 0 || !(await u.confirm(i18n.ts('subscribers.confirmBlocklist', { num })))) {
+ return;
+ }
+
+ // "Select all" blocklists every bounced subscriber or blocklist selected rows.
+ if (allSelected) {
+ await api('bounces', '/bounces/blocklist', 'PUT');
+ } else {
+ await api('bounces', '/subscribers/blocklist', 'PUT', { ids: subIDs });
+ }
+
+ u.reload({ message: i18n.t('globals.messages.done') });
+ },
+ };
+}
+
+document.addEventListener('alpine:init', () => {
+ window.Alpine.data('bouncesView', component);
+}, { once: true });
diff --git a/static/admin/views/bounces.html b/static/admin/views/bounces.html
new file mode 100644
index 00000000..0ad6deb3
--- /dev/null
+++ b/static/admin/views/bounces.html
@@ -0,0 +1,114 @@
+{{ define "admin-bounces" -}}
+{{ template "admin-header" . }}
+{{- $d := .Data -}}
+{{- $base := URI "/admin/subscribers/bounces" -}}
+{{- $source := $d.Page.Param "source" -}}
+{{- $type := $d.Page.Param "type" -}}
+{{- $campaign := $d.Page.Param "campaign_id" -}}
+
+<section class="bounces" x-data="bouncesView">
+ <header class="row page-header">
+ <div class="col-6">
+ <div class="hstack">
+ <h1 class="page-title">
+ {{ .L.T "globals.terms.bounces" }}
+ <span>({{ $d.Page.Total }})</span>
+ </h1>
+ <div class="text-7 hstack gap-1">
+ {{- if $source }}<a href="{{ $base }}" class="badge">{{ $source }} &times;</a>{{ end }}
+ {{- if $type }}<a href="{{ $base }}" class="badge">{{ .L.T (printf "bounces.%s" $type) }} &times;</a>{{ end }}
+ {{- if $campaign }}<a href="{{ $base }}" class="badge">#{{ $campaign }} &times;</a>{{ end }}
+ </div>
+ </div>
+ </div>
+ </header>
+
+ <div class="card page-content has-table">
+ <div class="table-wrapper" x-data="table({ query: {{ ToJSON $d.Page.Query }}, filters: {{ ToJSON $d.Page.QueryParams }}, total: {{ $d.Page.Total }} })" :aria-busy="isLoading('bounces')" @change="onChange($event)">
+ <template x-if="numSelected > 0">
+ <ot-dropdown class="bulk-actions">
+ <button popovertarget="bounce-bulk-actions" type="button" class="small" data-cy="btn-bulk-actions">
+ <span x-text="numSelectedLabel"></span> {{ Icon "more-vertical" }}
+ </button>
+ <menu popover id="bounce-bulk-actions">
+ {{- if gt $d.Page.Total $d.Page.PerPage }}
+ <button type="button" role="menuitem" class="ghost" data-cy="select-all-bounces" x-cloak x-show="!allSelected" @click.prevent="onSelectAllQuery()">
+ {{ Icon "list" }} <span x-text="selectAllLabel"></span>
+ </button>
+ {{- end }}
+ {{- if $d.Can "bounces:manage" }}
+ <button type="button" role="menuitem" class="ghost" data-cy="btn-manage-blocklist" @click.prevent="onBlocklistSelected(allSelected, total)">{{ Icon "user-x" }} {{ .L.T "import.blocklist" }}</button>
+ <hr />
+ <button type="button" role="menuitem" class="ghost" data-variant="danger" data-cy="btn-delete-bounces" :disabled="isLoading('bounces')" @click.prevent="onDeleteSelected(allSelected, selected, total)">{{ Icon "trash-2" }} {{ .L.T "globals.buttons.delete" }} <span x-text="numSelected"></span></button>
+ {{- end }}
+ </menu>
+ </ot-dropdown>
+ </template>
+
+ <table>
+ <thead>
+ <tr>
+ <th width="5%"><input type="checkbox" aria-label="{{ .L.T "globals.buttons.toggleSelect" }}"></th>
+ <th class="cy-email">{{ $d.Page.SortLink $base "email" (.L.T "subscribers.email") }}</th>
+ <th class="cy-campaign">{{ .L.T "globals.terms.campaign" }}</th>
+ <th class="cy-source">{{ $d.Page.SortLink $base "source" (.L.T "bounces.source") }}</th>
+ <th class="cy-type">{{ $d.Page.SortLink $base "type" (.L.T "globals.fields.type") }}</th>
+ <th class="cy-created_at">{{ $d.Page.SortLink $base "created_at" (.L.T "globals.fields.createdAt") }}</th>
+ <th class="align-right"></th>
+ </tr>
+ </thead>
+ <tbody>
+ {{- range $d.Bounces }}
+ <tr>
+ <td><input name="id" type="checkbox" value="{{ .ID }}" data-subscriber-id="{{ .SubscriberID }}"></td>
+ <td>
+ <a href="{{ URI "/admin/subscribers" }}/{{ .SubscriberID }}" {{ if eq .SubscriberStatus "blocklisted" }}class="blocklisted"{{ end }}>{{ .Email }}</a>
+ {{ if ne .SubscriberStatus "enabled" }}<span class="badge status-{{ .SubscriberStatus }}" data-cy="blocklisted">{{ $.L.T (printf "subscribers.status.%s" .SubscriberStatus) }}</span>{{ end }}
+ </td>
+ <td>
+ {{- with .ParsedCampaign }}<a href="{{ $base }}?campaign_id={{ .ID }}">{{ .Name }}</a>{{ else }}-{{ end }}
+ </td>
+ <td><a href="{{ $base }}?source={{ .Source }}">{{ .Source }}</a></td>
+ <td><a href="{{ $base }}?type={{ .Type }}"><span class="badge enum {{ .Type }}" data-cy="type-{{ .Type }}" data-variant="secondary">{{ $.L.T (printf "bounces.%s" .Type) }}</span></a></td>
+ <td class="date-stack">{{ NiceDate .CreatedAt }}</td>
+ <td class="actions align-right">
+ <ot-dropdown>
+ <button popovertarget="bounce-actions-{{ .ID }}" type="button" class="ghost small icon" aria-label="{{ $.L.T "globals.buttons.more" }}">
+ {{ Icon "more-vertical" }}
+ </button>
+ <menu popover id="bounce-actions-{{ .ID }}">
+ <button type="button" role="menuitem" class="ghost" data-cy="btn-meta" @click.prevent="onView({{ ToJSON .Email }}, {{ ToJSON .Meta }})">{{ Icon "file-text" }} {{ $.L.T "globals.buttons.view" }}</button>
+ {{- if $d.Can "bounces:manage" }}
+ <button type="button" role="menuitem" class="ghost" data-variant="danger" data-cy="btn-delete" :disabled="isLoading('bounces')" @click.prevent="onDeleteBounce({{ .ID }}, {{ ToJSON .Email }})">{{ Icon "trash-2" }} {{ $.L.T "globals.buttons.delete" }}</button>
+ {{- end }}
+ </menu>
+ </ot-dropdown>
+ </td>
+ </tr>
+ {{- else }}
+ <tr><td colspan="7" class="align-center text-light">{{ .L.T "globals.messages.emptyState" }}</td></tr>
+ {{- end }}
+ </tbody>
+ </table>
+
+ {{- template "pagination" $d.Page.Pagination }}
+ </div>
+ </div>
+
+ <dialog class="b-modal" x-ref="metaDialog">
+ <div class="dialog-card content">
+ <header class="dialog-head"><h3 class="dialog-title" x-text="metaTitle"></h3></header>
+ <section class="dialog-body">
+ <pre class="text-7" x-text="JSON.stringify(meta, null, 2)"></pre>
+ </section>
+ <footer class="dialog-foot hstack justify-end">
+ <button type="button" class="outline" @click="$refs.metaDialog.close()">{{ .L.T "globals.buttons.close" }}</button>
+ </footer>
+ </div>
+ </dialog>
+</section>
+
+<script type="module" src="{{ URI "/admin/static/js/views/bounces.js" }}?v={{ .AssetVersion }}" defer></script>
+
+{{ template "admin-footer" . -}}
+{{ end }}