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)

static S webChatBotLogsHTML2(final S baseLink, final SS params) {
  ret withDBLock(func -> S {
    new L<S> l;
    for (Conversation conv : sortByCalculatedFieldDesc(list Conversation(), func(Conversation c) { empty(c.msgs) ? c.created : last(c.msgs).time })) {
      LL<Msg> dialogs = reversed(unnull(conv.oldDialogs));
      if (l(conv.msgs) > 1)
        l.add(webChatBotLogsHTML_formatDialog(str(conv.id), conv.msgs));
      int i = 2;
      for (L<Msg> msgs : dialogs)
        if (l(msgs) > 1)
          l.add(webChatBotLogsHTML_formatDialog(conv.id + "/" + (i++), msgs));
    }

    int perPage = 50, n = parseIntOpt(params.get("n"));
    ret h3_htitle("Chat Logs") +
      pageNav2(baseLink, l(l), n, perPage, "n")
        + ul(subList(l, n, n+perPage), null, style := "margin-top: 1em");
  });
}

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: 342 / 403
Version history: 7 change(s)
Referenced in: [show references]