Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1013737 // webChatBotLogsHTML2 - with page navigation; also doesn't show conversations with just one entry

JavaX fragment (include)

1  
static S webChatBotLogsHTML2(final S baseLink, final SS params) {
2  
  ret withDBLock(func -> S {
3  
    new L<S> l;
4  
    for (Conversation conv : sortByCalculatedFieldDesc(list Conversation(), func(Conversation c) { empty(c.msgs) ? c.created : last(c.msgs).time })) {
5  
      LL<Msg> dialogs = reversed(unnull(conv.oldDialogs));
6  
      if (l(conv.msgs) > 1)
7  
        l.add(webChatBotLogsHTML_formatDialog(str(conv.id), conv.msgs));
8  
      int i = 2;
9  
      for (L<Msg> msgs : dialogs)
10  
        if (l(msgs) > 1)
11  
          l.add(webChatBotLogsHTML_formatDialog(conv.id + "/" + (i++), msgs));
12  
    }
13  
14  
    int perPage = 50, n = parseIntOpt(params.get("n"));
15  
    ret h3_htitle("Chat Logs") +
16  
      pageNav2(baseLink, l(l), n, perPage, "n")
17  
        + ul(subList(l, n, n+perPage), null, style := "margin-top: 1em");
18  
  });
19  
}

Author comment

Began life as a copy of #1008935

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jmyaexzvplwz, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1013737
Snippet name: webChatBotLogsHTML2 - with page navigation; also doesn't show conversations with just one entry
Eternal ID of this version: #1013737/8
Text MD5: 1da1aee60a542364e9602b919388e7ce
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-27 12:56:49
Source code size: 820 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 345 / 407
Version history: 7 change(s)
Referenced in: [show references]