diff --git a/messages/en.json b/messages/en.json index 06ca015c..a72c1f74 100644 --- a/messages/en.json +++ b/messages/en.json @@ -42,6 +42,8 @@ "nav_billing": "Billing", "nav_settings": "Settings", "nav_logout": "Logout", + "nav_group_info_management": "Info and Management", + "nav_group_connectivity_hardware": "Connectivity & Hardware", "header_privacy_mode": "Privacy Mode", "header_logout_error": "An error occurred while logging out. Please try again.", "status_online": "Online", @@ -891,11 +893,23 @@ "stat_aboveAvg": "Above Avg", "stat_belowAvg": "Below Avg", "stat_atAvg": "At Avg", + "stat_expand": "Expand", + "stat_collapse": "Collapse", "traffic_metric_bicycle_count": "Bicycle Count", "traffic_metric_bus_count": "Bus Count", "traffic_metric_car_count": "Car Count", "traffic_metric_motorcycle_count": "Motorcycle Count", "traffic_metric_people_count": "People Count", "traffic_metric_train_count": "Train Count", - "traffic_metric_truck_count": "Truck Count" + "traffic_metric_truck_count": "Truck Count", + "nav_gateways": "Gateways", + "gateways_page_title": "Gateways", + "gateways_your_gateways": "Your Gateways", + "gateways_gateway_id": "Gateway ID", + "gateways_gateway_name": "Gateway Name", + "gateways_status": "Status", + "gateways_public": "Public", + "gateways_online": "Online", + "gateways_offline": "Offline", + "gateways_private": "Private" } diff --git a/messages/ja.json b/messages/ja.json index dee67e11..d9f664ca 100644 --- a/messages/ja.json +++ b/messages/ja.json @@ -42,6 +42,8 @@ "nav_billing": "請求", "nav_settings": "設定", "nav_logout": "ログアウト", + "nav_group_info_management": "情報と管理", + "nav_group_connectivity_hardware": "接続とハードウェア", "header_privacy_mode": "プライバシーモード", "header_logout_error": "ログアウト中にエラーが発生しました。もう一度お試しください。", "status_online": "オンライン", @@ -899,5 +901,15 @@ "traffic_metric_motorcycle_count": "バイク台数", "traffic_metric_people_count": "人数", "traffic_metric_train_count": "電車本数", - "traffic_metric_truck_count": "トラック台数" + "traffic_metric_truck_count": "トラック台数", + "nav_gateways": "ゲートウェイ", + "gateways_page_title": "ゲートウェイ", + "gateways_your_gateways": "あなたのゲートウェイ", + "gateways_gateway_id": "ゲートウェイ ID", + "gateways_gateway_name": "ゲートウェイ名", + "gateways_status": "状態", + "gateways_public": "公開", + "gateways_online": "オンライン", + "gateways_offline": "オフライン", + "gateways_private": "非公開" } diff --git a/package.json b/package.json index 058d811f..cffd1312 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ }, "packageManager": "pnpm@10.18.2+sha512.9fb969fa749b3ade6035e0f109f0b8a60b5d08a1a87fdf72e337da90dcc93336e2280ca4e44f2358a649b83c17959e9993e777c2080879f3801e6f0d999ad3dd", "dependencies": { - "@cropwatchdevelopment/cwui": "0.1.82", + "@cropwatchdevelopment/cwui": "0.1.84", "@supabase/supabase-js": "^2.98.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c232fb13..3495eaba 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@cropwatchdevelopment/cwui': - specifier: 0.1.82 - version: 0.1.82(svelte@5.53.0) + specifier: 0.1.84 + version: 0.1.84(svelte@5.53.0) '@supabase/supabase-js': specifier: ^2.98.0 version: 2.98.0 @@ -117,8 +117,8 @@ importers: packages: - '@cropwatchdevelopment/cwui@0.1.82': - resolution: {integrity: sha512-oIk6QKCeAwCabO40NABwPIwe2hlfP+/sFy+/riRG3qzJbrgAJhgJFC+X9cgW7zUi/qb5X4wUQWCmHDDxh/SOJQ==, tarball: https://npm.pkg.github.com/download/@cropwatchdevelopment/cwui/0.1.82/9189c6d2fd170c2100f95b49f8bc26183b8a5be1} + '@cropwatchdevelopment/cwui@0.1.84': + resolution: {integrity: sha512-aUKXyn0JaNZITCrr1h3waBIKGvIR16g5L+0GwS1PJyzGpzUdIstu3NB5er9H8twFg2drLj2eNc8n/aOrbOlEHg==, tarball: https://npm.pkg.github.com/download/@cropwatchdevelopment/cwui/0.1.84/028c5318b58155ec7cd7cb09cfeed35f8ba47bbe} peerDependencies: svelte: ^5.0.0 @@ -2147,7 +2147,7 @@ packages: snapshots: - '@cropwatchdevelopment/cwui@0.1.82(svelte@5.53.0)': + '@cropwatchdevelopment/cwui@0.1.84(svelte@5.53.0)': dependencies: svelte: 5.53.0 diff --git a/src/lib/api/api.dtos.ts b/src/lib/api/api.dtos.ts index 5f3c09cf..3411cdfd 100644 --- a/src/lib/api/api.dtos.ts +++ b/src/lib/api/api.dtos.ts @@ -409,3 +409,21 @@ export type UpdateLocationRequest = { description?: string | null; group?: string | null; }; + +export interface GatewayOwnerDto { + created_at: string; + gateway_id: number; + id: number; + user_id: string; +} + +export interface GatewayDto { + created_at: string; + gateway_id: string; + gateway_name: string; + id: number; + is_online: boolean; + is_public: boolean; + updated_at: string | null; + cw_gateways_owners?: GatewayOwnerDto[]; +} diff --git a/src/lib/api/api.service.ts b/src/lib/api/api.service.ts index 1c80ffbf..dba669f9 100644 --- a/src/lib/api/api.service.ts +++ b/src/lib/api/api.service.ts @@ -36,7 +36,8 @@ import type { UpdateLocationOwnerRequest, UpdateReportRequest, UpdateRuleRequest, - WaterDataPoint + WaterDataPoint, + GatewayDto } from './api.dtos'; type FetchLike = typeof fetch; @@ -142,6 +143,7 @@ const TRAFFIC_ENDPOINT = '/traffic/{dev_eui}'; const TRAFFIC_MONTHLY_ENDPOINT = '/traffic/{dev_eui}/monthly'; const WATER_ENDPOINT = '/water/{dev_eui}'; const DEVICE_PERMISSION_LEVEL_ENDPOINT = '/devices/{dev_eui}/permission-level'; +const GATEWAYS_ENDPOINT = '/gateway'; const DEVICE_LIST_PAGE_SIZE = 1000; function toIsoIfDate(value: string | Date | undefined): string | undefined { @@ -1130,6 +1132,12 @@ export class ApiService { }); } + public getGateways(): Promise { + return this.request(GATEWAYS_ENDPOINT, { + method: 'GET' + }); + } + public cancelPaymentsSubscription(subscriptionId: string): Promise { return this.request( `${PAYMENTS_SUBSCRIPTIONS_ENDPOINT}/${encodeURIComponent(subscriptionId)}`, diff --git a/src/routes/Header.svelte b/src/routes/Header.svelte index a033ab60..969a2e15 100644 --- a/src/routes/Header.svelte +++ b/src/routes/Header.svelte @@ -51,12 +51,12 @@ {/snippet} {#snippet actions()} -
+ { + return {}; +}; diff --git a/src/routes/gateways/+page.svelte b/src/routes/gateways/+page.svelte new file mode 100644 index 00000000..a78ca2aa --- /dev/null +++ b/src/routes/gateways/+page.svelte @@ -0,0 +1,110 @@ + + + + {m.gateways_page_title()} + + + + goto(resolve('/'))}> + ← {m.action_back_to_dashboard()} + + + + + {#snippet cell(row: GatewayDto, col: CwColumnDef, defaultValue: string)} + {#if col.key === 'is_online'} + {#if row.is_online} + + {:else} + + + + {/if} + {:else if col.key === 'is_public'} + {#if row.is_public} + + {:else} + + + + {/if} + {:else if col.key === 'created_at'} + {formatDateTime(row.created_at, undefined, m.common_not_available())} + {:else} + {defaultValue} + {/if} + {/snippet} + + +