Selaa lähdekoodia

Update

stable1
B.E.N.S.O.N 2 viikkoa sitten
vanhempi
commit
4e5d0215ab
3 muutettua tiedostoa jossa 28 lisäystä ja 4 poistoa
  1. +5
    -1
      src/i18n/en/dashboard.json
  2. +5
    -1
      src/i18n/zh/dashboard.json
  3. +18
    -2
      src/lib/featureUsageLog.ts

+ 5
- 1
src/i18n/en/dashboard.json Näytä tiedosto

@@ -121,5 +121,9 @@
"Usage stats downloads": "Downloads",
"Usage stats prints": "Direct prints",
"Usage stats refresh": "Refresh",
"Usage stats load error": "Could not load usage statistics."
"Usage stats load error": "Could not load usage statistics.",
"Usage stats start date": "Start date",
"Usage stats end date": "End date",
"Usage stats search": "Search",
"Usage stats invalid date range": "Start date must be earlier than or equal to end date."
}

+ 5
- 1
src/i18n/zh/dashboard.json Näytä tiedosto

@@ -129,5 +129,9 @@
"Usage stats downloads": "下載次數",
"Usage stats prints": "直接列印次數",
"Usage stats refresh": "重新整理",
"Usage stats load error": "無法載入使用統計。"
"Usage stats load error": "無法載入使用統計。",
"Usage stats start date": "開始日期",
"Usage stats end date": "結束日期",
"Usage stats search": "搜尋",
"Usage stats invalid date range": "開始日期必須早於或等於結束日期。"
}

+ 18
- 2
src/lib/featureUsageLog.ts Näytä tiedosto

@@ -25,6 +25,11 @@ export type FeatureUsageSummaryPayload = {
truckRoutingSummary: FeatureUsageSummaryRow[];
};

export type FeatureUsageSummaryFilters = {
startDate?: string;
endDate?: string;
};

function toInt(v: unknown): number {
if (v == null) return 0;
if (typeof v === "number") return Number.isFinite(v) ? v : 0;
@@ -68,8 +73,19 @@ export function logFeatureUsage(
})();
}

export async function fetchFeatureUsageSummary(): Promise<FeatureUsageSummaryPayload> {
const res = await clientAuthFetch(`${NEXT_PUBLIC_API_URL}/feature-usage/summary`, {
export async function fetchFeatureUsageSummary(
filters?: FeatureUsageSummaryFilters,
): Promise<FeatureUsageSummaryPayload> {
const params = new URLSearchParams();
if (filters?.startDate) {
params.set("startDate", filters.startDate);
}
if (filters?.endDate) {
params.set("endDate", filters.endDate);
}
const query = params.toString();
const url = `${NEXT_PUBLIC_API_URL}/feature-usage/summary${query ? `?${query}` : ""}`;
const res = await clientAuthFetch(url, {
method: "GET",
headers: { Accept: "application/json" },
});


Ladataan…
Peruuta
Tallenna