diff --git a/marko/page/logs/components/page/component.js b/marko/page/logs/components/page/component.js index 8f27a99..c1adcac 100644 --- a/marko/page/logs/components/page/component.js +++ b/marko/page/logs/components/page/component.js @@ -24,11 +24,12 @@ module.exports = class { } else { this.state.filter = Object.assign({}, this.state.filter, {search: null}) } - } else { this.state.filter = Object.assign({}, this.state.filter, {[type]: (this.state.filter[type] || []).filter(f => f !== filter).concat(filter)}) } + this.state.filter = Object.assign({}, this.state.filter, {limit: 0}) + this.updateQuery(this.state.filter) this.refresh() @@ -67,6 +68,9 @@ module.exports = class { if (filter.search) { queries.push("search=" + encodeURIComponent(filter.search)) } + if (filter.limit) { + queries.push("limit=" + encodeURIComponent(filter.limit.toString())) + } if (queries.length > 0) { history.replaceState("", "", `/logs/?${queries.join("&")}`) @@ -75,6 +79,13 @@ module.exports = class { } } + clearLimit() { + this.state.filter = Object.assign({}, this.state.filter, {limit: 0}) + + this.refresh() + this.updateQuery(this.state.filter) + } + refresh() { logHeaderApi.list(this.state.filter).then(logs => { this.state.logs = logs diff --git a/marko/page/logs/components/page/index.marko b/marko/page/logs/components/page/index.marko index 4a5e078..e138801 100644 --- a/marko/page/logs/components/page/index.marko +++ b/marko/page/logs/components/page/index.marko @@ -1,8 +1,13 @@ -
+
+ 0)> +
+ Show All +
+
diff --git a/marko/page/logs/components/page/style.less b/marko/page/logs/components/page/style.less new file mode 100644 index 0000000..cbef823 --- /dev/null +++ b/marko/page/logs/components/page/style.less @@ -0,0 +1,17 @@ +main.logs-page { + div.show-more-button { + margin: 1em 0; + padding: 0.5em 2em; + font-size: 2em; + text-align: center; + user-select: none; + + color: #DA1; + } + + div.show-more-button:hover { + cursor: pointer; + + text-decoration: underline; + } +} \ No newline at end of file diff --git a/routes/logs/index.js b/routes/logs/index.js index b73620a..29e98af 100644 --- a/routes/logs/index.js +++ b/routes/logs/index.js @@ -8,19 +8,26 @@ const {channelApi} = require("../../rpdata/api/Channel") const listTemplate = require("../../marko/page/logs/list.marko") router.get("/", async(req, res) => { - const filter = {limit: 0} + const filter = {limit: 75} if (req.query.characters) { filter.characters = req.query.characters.split(",") + filter.limit = 0 } if (req.query.channels) { filter.channels = req.query.channels.split(",") + filter.limit = 0 } if (req.query.events) { filter.events = req.query.events.split(",") + filter.limit = 0 } if (req.query.search) { filter.search = req.query.search + filter.limit = 0 + } + if (req.query.limit) { + filter.limit = parseInt(req.query.limit) } try {