Add campaign search UI.
This commit is contained in:
parent
ccf1c499ad
commit
378e8145fe
8 changed files with 38 additions and 23 deletions
|
@ -84,7 +84,8 @@ func handleGetCampaigns(c echo.Context) error {
|
|||
single = true
|
||||
}
|
||||
if query != "" {
|
||||
query = string(regexFullTextQuery.ReplaceAll([]byte(query), []byte("&")))
|
||||
query = `%` +
|
||||
string(regexFullTextQuery.ReplaceAll([]byte(query), []byte("&"))) + `%`
|
||||
}
|
||||
|
||||
err := app.queries.QueryCampaigns.Select(&out.Results, id, pq.StringArray(status), query, pg.Offset, pg.Limit)
|
||||
|
|
|
@ -496,6 +496,20 @@
|
|||
"cancel"
|
||||
]
|
||||
},
|
||||
{
|
||||
"uid": "110ec51ea49a7f0cc9bfbde321f3c28d",
|
||||
"css": "magnify",
|
||||
"code": 59427,
|
||||
"src": "custom_icons",
|
||||
"selected": true,
|
||||
"svg": {
|
||||
"path": "M396.5 125Q468.8 125 531.3 161.1T629.9 259.8 666 396.5Q666 496.1 601.6 572.3L613.3 584H646.5L853.5 791 791 853.5 584 646.5V613.3L572.3 601.6Q496.1 666 396.5 666 322.3 666 259.8 629.9T161.1 531.3 125 395.5 161.1 259.8 259.8 161.1 396.5 125ZM396.5 209Q318.4 209 263.7 263.7T209 396.5 263.7 529.3 396.5 584 529.3 529.3 584 396.5 529.3 263.7 396.5 209Z",
|
||||
"width": 1000
|
||||
},
|
||||
"search": [
|
||||
"magnify"
|
||||
]
|
||||
},
|
||||
{
|
||||
"uid": "f4ad3f6d071a0bfb3a8452b514ed0892",
|
||||
"css": "vector-square",
|
||||
|
@ -12200,20 +12214,6 @@
|
|||
"magnet-on"
|
||||
]
|
||||
},
|
||||
{
|
||||
"uid": "110ec51ea49a7f0cc9bfbde321f3c28d",
|
||||
"css": "magnify",
|
||||
"code": 59416,
|
||||
"src": "custom_icons",
|
||||
"selected": false,
|
||||
"svg": {
|
||||
"path": "M396.5 125Q468.8 125 531.3 161.1T629.9 259.8 666 396.5Q666 496.1 601.6 572.3L613.3 584H646.5L853.5 791 791 853.5 584 646.5V613.3L572.3 601.6Q496.1 666 396.5 666 322.3 666 259.8 629.9T161.1 531.3 125 395.5 161.1 259.8 259.8 161.1 396.5 125ZM396.5 209Q318.4 209 263.7 263.7T209 396.5 263.7 529.3 396.5 584 529.3 529.3 584 396.5 529.3 263.7 396.5 209Z",
|
||||
"width": 1000
|
||||
},
|
||||
"search": [
|
||||
"magnify"
|
||||
]
|
||||
},
|
||||
{
|
||||
"uid": "cd529f71c055cf2da4843aafc1d70c8d",
|
||||
"css": "magnify-minus",
|
||||
|
|
1
frontend/src/assets/icons/fontello.css
vendored
1
frontend/src/assets/icons/fontello.css
vendored
|
@ -75,3 +75,4 @@
|
|||
.mdi-arrow-up:before { content: '\e820'; } /* '' */
|
||||
.mdi-arrow-down:before { content: '\e821'; } /* '' */
|
||||
.mdi-cancel:before { content: '\e822'; } /* '' */
|
||||
.mdi-magnify:before { content: '\e823'; } /* '' */
|
||||
|
|
Binary file not shown.
|
@ -3,7 +3,7 @@
|
|||
<header class="columns">
|
||||
<div class="column is-two-thirds">
|
||||
<h1 class="title is-4">Campaigns
|
||||
<span v-if="campaigns.total > 0">({{ campaigns.total }})</span>
|
||||
<span v-if="!isNaN(campaigns.total)">({{ campaigns.total }})</span>
|
||||
</h1>
|
||||
</div>
|
||||
<div class="column has-text-right">
|
||||
|
@ -12,6 +12,16 @@
|
|||
</div>
|
||||
</header>
|
||||
|
||||
<form @submit.prevent="getCampaigns">
|
||||
<b-field grouped>
|
||||
<b-input v-model="queryParams.query"
|
||||
placeholder="Name or subject" icon="magnify" ref="query"
|
||||
:disabled="isSearchAdvanced"></b-input>
|
||||
<b-button native-type="submit" type="is-primary" icon-left="magnify"
|
||||
:disabled="isSearchAdvanced"></b-button>
|
||||
</b-field>
|
||||
</form>
|
||||
|
||||
<b-table
|
||||
:data="campaigns.results"
|
||||
:loading="loading.campaigns"
|
||||
|
@ -207,6 +217,7 @@ export default Vue.extend({
|
|||
previewItem: null,
|
||||
queryParams: {
|
||||
page: 1,
|
||||
query: '',
|
||||
},
|
||||
pollID: null,
|
||||
campaignStatsData: {},
|
||||
|
@ -271,6 +282,7 @@ export default Vue.extend({
|
|||
getCampaigns() {
|
||||
this.$api.getCampaigns({
|
||||
page: this.queryParams.page,
|
||||
query: this.queryParams.query,
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
<section class="lists">
|
||||
<header class="columns">
|
||||
<div class="column is-two-thirds">
|
||||
<h1 class="title is-4">Lists <span v-if="lists.total > 0">({{ lists.total }})</span></h1>
|
||||
<h1 class="title is-4">Lists
|
||||
<span v-if="!isNaN(lists.total)">({{ lists.total }})</span>
|
||||
</h1>
|
||||
</div>
|
||||
<div class="column has-text-right">
|
||||
<b-button type="is-primary" icon-left="plus" @click="showNewForm">New</b-button>
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
<header class="columns">
|
||||
<div class="column is-half">
|
||||
<h1 class="title is-4">Subscribers
|
||||
<span v-if="subscribers.total > 0">({{ subscribers.total }})</span>
|
||||
|
||||
<span v-if="!isNaN(subscribers.total)">({{ subscribers.total }})</span>
|
||||
<span v-if="currentList">
|
||||
» {{ currentList.name }}
|
||||
</span>
|
||||
|
@ -21,9 +20,9 @@
|
|||
<div>
|
||||
<b-field grouped>
|
||||
<b-input @input="onSimpleQueryInput" v-model="queryInput"
|
||||
placeholder="E-mail or name" icon="account-search-outline" ref="query"
|
||||
placeholder="E-mail or name" icon="magnify" ref="query"
|
||||
:disabled="isSearchAdvanced"></b-input>
|
||||
<b-button native-type="submit" type="is-primary" icon-left="account-search-outline"
|
||||
<b-button native-type="submit" type="is-primary" icon-left="magnify"
|
||||
:disabled="isSearchAdvanced"></b-button>
|
||||
</b-field>
|
||||
|
||||
|
@ -51,7 +50,7 @@
|
|||
|
||||
<div class="buttons">
|
||||
<b-button native-type="submit" type="is-primary"
|
||||
icon-left="account-search-outline">Query</b-button>
|
||||
icon-left="magnify">Query</b-button>
|
||||
<b-button @click.prevent="toggleAdvancedSearch" icon-left="cancel">Reset</b-button>
|
||||
</div>
|
||||
</div><!-- advanced query -->
|
||||
|
|
|
@ -380,7 +380,7 @@ SELECT COUNT(*) OVER () AS total, campaigns.*, (
|
|||
FROM campaigns
|
||||
WHERE ($1 = 0 OR id = $1)
|
||||
AND status=ANY(CASE WHEN ARRAY_LENGTH($2::campaign_status[], 1) != 0 THEN $2::campaign_status[] ELSE ARRAY[status] END)
|
||||
AND ($3 = '' OR (to_tsvector(name || subject) @@ to_tsquery($3)))
|
||||
AND ($3 = '' OR CONCAT(name, subject) ILIKE $3)
|
||||
ORDER BY campaigns.updated_at DESC OFFSET $4 LIMIT $5;
|
||||
|
||||
-- name: get-campaign
|
||||
|
|
Loading…
Reference in a new issue