mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
feat: add node/status filters, custom date range, connected devices to traffic page
- Add NodeFilter dropdown with flag emojis and checkbox selection - Add StatusFilter dropdown with colored status dots - Add DateRangePicker with From/To date inputs, toggle from period mode - Devices column now shows N/M (connected/limit) with accent color - Export CSV passes all active filters to backend - New i18n keys for nodes, statuses, dates in ru/en/zh/fa
This commit is contained in:
@@ -15,6 +15,7 @@ export interface UserTrafficItem {
|
||||
subscription_status: string | null;
|
||||
traffic_limit_gb: number;
|
||||
device_limit: number;
|
||||
connected_devices: number;
|
||||
node_traffic: Record<string, number>;
|
||||
total_bytes: number;
|
||||
}
|
||||
@@ -27,6 +28,7 @@ export interface TrafficUsageResponse {
|
||||
limit: number;
|
||||
period_days: number;
|
||||
available_tariffs: string[];
|
||||
available_statuses: string[];
|
||||
}
|
||||
|
||||
export interface ExportCsvResponse {
|
||||
@@ -42,6 +44,10 @@ export type TrafficParams = {
|
||||
sort_by?: string;
|
||||
sort_desc?: boolean;
|
||||
tariffs?: string;
|
||||
nodes?: string;
|
||||
statuses?: string;
|
||||
start_date?: string;
|
||||
end_date?: string;
|
||||
};
|
||||
|
||||
const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
|
||||
@@ -57,6 +63,10 @@ function buildCacheKey(params: TrafficParams): string {
|
||||
sb: params.sort_by ?? 'total_bytes',
|
||||
sd: params.sort_desc ?? true,
|
||||
t: params.tariffs ?? '',
|
||||
n: params.nodes ?? '',
|
||||
st: params.statuses ?? '',
|
||||
sd2: params.start_date ?? '',
|
||||
ed: params.end_date ?? '',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -95,7 +105,15 @@ export const adminTrafficApi = {
|
||||
trafficCache.clear();
|
||||
},
|
||||
|
||||
exportCsv: async (data: { period: number }): Promise<ExportCsvResponse> => {
|
||||
exportCsv: async (data: {
|
||||
period: number;
|
||||
start_date?: string;
|
||||
end_date?: string;
|
||||
tariffs?: string;
|
||||
nodes?: string;
|
||||
statuses?: string;
|
||||
search?: string;
|
||||
}): Promise<ExportCsvResponse> => {
|
||||
const response = await apiClient.post('/cabinet/admin/traffic/export-csv', data);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user