feat(users): update user display to show usage days and remove expiry days column
This commit is contained in:
@ -279,7 +279,8 @@ $(function () {
|
||||
const url = GET_USER_URL_TEMPLATE.replace('U', user);
|
||||
|
||||
const trafficText = dataRow.find("td:eq(4)").text();
|
||||
const expiryText = dataRow.find("td:eq(6)").text();
|
||||
const usageDaysText = dataRow.find("td:eq(6)").text();
|
||||
const expiryText = usageDaysText.split('/')[1] || "0";
|
||||
const note = dataRow.data('note');
|
||||
const statusText = dataRow.find("td:eq(3)").text().trim();
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ class User(BaseModel):
|
||||
expiry_date: str
|
||||
expiry_days: str
|
||||
day_usage: str
|
||||
usage_days_display: str
|
||||
enable: bool
|
||||
unlimited_ip: bool
|
||||
online_count: int = 0
|
||||
@ -88,6 +89,7 @@ class User(BaseModel):
|
||||
percentage = (used_bytes / quota_bytes) * 100
|
||||
|
||||
traffic_used_display = f"{used_formatted}/{quota_formatted} ({percentage:.1f}%)"
|
||||
usage_days_display = f"{day_usage}/{display_expiry_days}"
|
||||
|
||||
return {
|
||||
'username': user_data['username'],
|
||||
@ -97,6 +99,7 @@ class User(BaseModel):
|
||||
'expiry_date': display_expiry_date,
|
||||
'expiry_days': display_expiry_days,
|
||||
'day_usage': day_usage,
|
||||
'usage_days_display': usage_days_display,
|
||||
'enable': not user_data.get('blocked', False),
|
||||
'unlimited_ip': user_data.get('unlimited_user', False),
|
||||
'online_count': user_data.get('online_count', 0),
|
||||
|
||||
@ -129,7 +129,6 @@
|
||||
<th class="d-none d-md-table-cell">Status</th>
|
||||
<th class="d-none d-md-table-cell">Traffic Usage</th>
|
||||
<th class="d-none d-md-table-cell text-nowrap">Expiry Date</th>
|
||||
<th class="d-none d-md-table-cell text-nowrap">Expiry Days</th>
|
||||
<th class="d-none d-md-table-cell text-nowrap">Day Usage</th>
|
||||
<th class="d-none d-md-table-cell">Enable</th>
|
||||
<th class="d-none d-md-table-cell">Note</th>
|
||||
|
||||
@ -30,8 +30,7 @@
|
||||
</td>
|
||||
<td class="d-none d-md-table-cell">{{ user.traffic_used }}</td>
|
||||
<td class="d-none d-md-table-cell">{{ user.expiry_date }}</td>
|
||||
<td class="d-none d-md-table-cell">{{ user.expiry_days }}</td>
|
||||
<td class="d-none d-md-table-cell">{{ user.day_usage }}</td>
|
||||
<td class="d-none d-md-table-cell">{{ user.usage_days_display }}</td>
|
||||
<td class="d-none d-md-table-cell">
|
||||
{% if user.enable %}
|
||||
<i class="fas fa-check-circle text-success"></i>
|
||||
@ -101,8 +100,7 @@
|
||||
</p>
|
||||
<p><strong>Traffic Usage:</strong> <span>{{ user.traffic_used }}</span></p>
|
||||
<p><strong>Expiry Date:</strong> <span>{{ user.expiry_date }}</span></p>
|
||||
<p><strong>Expiry Days:</strong> <span>{{ user.expiry_days }}</span></p>
|
||||
<p><strong>Day Usage:</strong> <span>{{ user.day_usage }}</span></p>
|
||||
<p><strong>Day Usage:</strong> <span>{{ user.usage_days_display }}</span></p>
|
||||
<p><strong>Note:</strong> <span>{{ user.note or 'N/A' }}</span></p>
|
||||
<p><strong>Enable:</strong>
|
||||
<span>
|
||||
|
||||
Reference in New Issue
Block a user