Add last_n_active field in UI #instance/filter-users

This commit is contained in:
Bofh 2022-12-17 22:06:57 +01:00
parent a50f14472f
commit f89fde5c66
2 changed files with 18 additions and 0 deletions

View File

@ -87,6 +87,16 @@
</div>
</div>
</div>
<div class="input" title="Limit database query when searching and ordering users by latest active ones">
<label>Last N active users:</label>
<br class="sep"/>
<div class="flex">
<div>
<label for="last_n_active">LIMIT value:</label>
<input type="number" name="last_n_active" value="NaN"/>
</div>
</div>
</div>
<br>
<div class="input flex">
<button class="btn center"

View File

@ -213,6 +213,12 @@ window.view.instance = {
if (newerThan > 0)
data.newer_than_days = newerThan;
}
var lastNActive = E.element('#filters-current input[name=last_n_active]').value;
if (lastNActive !== '') {
lastNActive = Number.parseInt(lastNActive);
if (lastNActive > 0)
data.last_n_active = lastNActive;
}
return data;
},
set_current_filter: function(data) {
@ -255,6 +261,8 @@ window.view.instance = {
E.element('#filters-current input[name=older_than_days]').value = Number.parseInt(d.older_than_days);
if (d.newer_than_days !== undefined)
E.element('#filters-current input[name=newer_than_days]').value = Number.parseInt(d.newer_than_days);
if (d.last_n_active !== undefined)
E.element('#filters-current input[name=last_n_active]').value = Number.parseInt(d.last_n_active);
};
if (typeof data === 'object')
_process(data);