Skip to content

Commit 7ef4426

Browse files
committed
speed + typo
1 parent c8babf1 commit 7ef4426

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

assets/js/mails.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ function loadMail(id) {
366366
}),
367367
jsCreateElement('option', {
368368
attrs: {
369-
value: 'flow',
369+
value: 'archived',
370370
selected: data.category == 'archived' ? 'selected' : false
371371
},
372372
children: ['Archived']

assets/js/table_load.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ function tableMails() {
204204
layout:"fitColumns",
205205
ajaxURL:"/api/mails/all",
206206
progressiveLoad:"load",
207+
paginationSize: 1000,
207208
initialSort:[
208209
{column:"name", dir:"asc"},
209210
{column:"category", dir:"asc"},
@@ -250,7 +251,12 @@ function tableMails() {
250251
});
251252

252253
objTableMails.on("rowClick", function(e, row){
253-
loadMail(row.getData().id);
254+
// loadMail(row.getData().id);
255+
if (e.ctrlKey) {
256+
window.open("/mails?viewMail=" + row.getData().id, "_blank");
257+
} else {
258+
window.location.href = "/mails?viewMail=" + row.getData().id;
259+
}
254260
});
255261

256262
// Query parameter is viewMail=<id> then open the mail
@@ -277,6 +283,7 @@ function tableLists() {
277283
layout:"fitColumns",
278284
ajaxURL:"/api/lists/all",
279285
progressiveLoad:"load",
286+
paginationSize: 1000,
280287
// rowHeight:50,
281288
columns:[
282289
{title:"ID", field:"id", width:60, headerFilter:true},
@@ -319,6 +326,7 @@ function tableFlows() {
319326
layout:"fitColumns",
320327
ajaxURL:"/api/flows/all",
321328
progressiveLoad:"load",
329+
paginationSize: 1000,
322330
columns:[
323331
{title:"ID", field:"id", width:60, headerFilter:true},
324332
// {title:"UUID", field:"uuid", width:200},
@@ -356,6 +364,7 @@ function tableFlowsteps(flowID) {
356364
layout:"fitColumns",
357365
ajaxURL:"/api/flowsteps/all?flowID=" + flowID,
358366
progressiveLoad:"load",
367+
paginationSize: 1000,
359368
columns:[
360369
{title:"ID", field:"id", width:100},
361370
{title:"Flow ID", field:"flow_id", width:200},

nimletter.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Package
22

3-
version = "0.6.3"
3+
version = "0.6.4"
44
author = "ThomasTJdev"
55
description = "Newsletter"
66
license = "AGPL v3"

src/routes/routes_mail.nim

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,25 +375,25 @@ proc(request: Request) =
375375
mails = getAllRows(conn, sqlSelect(
376376
table = "mails",
377377
select = [
378-
"DISTINCT ON (mails.id) mails.id",
378+
"mails.id",
379379
"mails.name",
380380
"mails.subject",
381381
"array_to_string(mails.tags, ',')",
382382
"mails.category",
383383
"to_char(mails.created_at, 'YYYY-MM-DD HH24:MI:SS') as created_at",
384384
"to_char(mails.updated_at, 'YYYY-MM-DD HH24:MI:SS') as updated_at",
385-
"(SELECT COUNT(*) FROM pending_emails WHERE flow_step_id = flow_steps.id AND status = 'sent') as sent_count",
386-
"(SELECT COUNT(*) FROM pending_emails WHERE flow_step_id = flow_steps.id AND status = 'pending') as pending_count",
385+
"COUNT(pending_emails.id) FILTER (WHERE pending_emails.status = 'sent') as sent_count",
386+
"COUNT(pending_emails.id) FILTER (WHERE pending_emails.status = 'pending') as pending_count",
387387
"mails.identifier"
388388
],
389389
joinargs = [
390-
(table: "flow_steps", tableAs: "", on: @["flow_steps.mail_id = mails.id"])
390+
(table: "pending_emails", tableAs: "", on: @["pending_emails.mail_id = mails.id"])
391391
],
392-
customSQL = "ORDER BY mails.id, mails.name ASC LIMIT $1 OFFSET $2".format(
392+
customSQL = "GROUP BY mails.category, mails.name, mails.subject, mails.id, mails.subject, mails.tags, mails.created_at, mails.updated_at, mails.identifier ORDER BY mails.id, mails.name ASC LIMIT $1 OFFSET $2".format(
393393
$limit,
394394
$offset
395395
)
396-
))
396+
))
397397

398398
mailsCount = getRow(conn, sqlSelect(
399399
table = "mails",

0 commit comments

Comments
 (0)