From cae3de55860224deb95bff03c2132314f6a79873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=84=B1=EA=B2=BD?= Date: Thu, 8 Oct 2026 11:32:07 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20solution/frontend:=20=EC=82=AC?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=EA=B4=80=EB=A6=AC=20=ED=81=AC=EB=A1=A4?= =?UTF-8?q?=EB=9F=AC=20=ED=86=B5=EA=B3=84=20=E2=80=94=20=EC=A0=84=EC=B2=B4?= =?UTF-8?q?=20=ED=86=B5=EA=B3=84=20=ED=83=AD=EA=B3=BC=20=EC=82=AC=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=EB=B3=84=20=ED=8E=98=EC=9D=B4=EC=A7=80,=20recharts=20?= =?UTF-8?q?=EC=A7=80=EC=97=B0=20=EB=A1=9C=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 사이트관리에 "목록 / 전체 통계" 탭(?tab=stats)과 각 행의 "통계" 버튼(/ops/sites/:placeId/stats) - 크롤링 화면: 요약 카드 → 일별 누적 막대(용도 4분류+기타) → 봇별 → (전체) 사이트 순위·robots/sitemap· 기타 UA, (사이트별) 많이 읽힌 페이지·최근 50건. 기간 7/30/90일 - recharts 는 CrawlerDailyChart 한 파일에만 두고 lazy() 로 부른다 — 빌드 확인: 그 청크에만 있고 사장님 화면의 첫 로딩 스크립트에는 없다 - OpsSitesPage 는 기존 목록 코드를 다시 들여쓰지 않으려고, stats 탭이면 앞에서 바로 return 하고 탭 UI 는 SitesTabs 로 분리했다(+29/-3) - orval 로 API 클라이언트 재생성 — 줄바꿈(LF/CRLF)만 바뀐 생성 파일 약 90개는 되돌리고 실제 변경분만 담았다 lint(typegen·tsc·eslint)·build 통과. 화면 레이아웃·차트는 브라우저로 직접 보지 못했다(확장 미연결) — nginx 경유 API 호출과 SPA 라우트 200 까지만 확인. --- package-lock.json | 489 +++++++++++++++--- solution/frontend/package.json | 1 + .../src/api/generated/model/crawlerBotRow.ts | 16 + .../api/generated/model/crawlerBotRowBot.ts | 8 + .../generated/model/crawlerBotRowVendor.ts | 8 + .../src/api/generated/model/crawlerDaily.ts | 12 + .../src/api/generated/model/crawlerHitRow.ts | 17 + .../api/generated/model/crawlerHitRowBot.ts | 8 + .../generated/model/crawlerHitRowVendor.ts | 8 + .../src/api/generated/model/crawlerPathRow.ts | 12 + .../src/api/generated/model/crawlerRootRow.ts | 15 + .../api/generated/model/crawlerRootRowBot.ts | 8 + .../src/api/generated/model/crawlerSiteRow.ts | 15 + .../api/generated/model/crawlerStatsParams.ts | 17 + .../src/api/generated/model/crawlerSummary.ts | 14 + .../generated/model/crawlerSummaryLastAt.ts | 8 + .../src/api/generated/model/crawlerUaRow.ts | 12 + .../frontend/src/api/generated/model/index.ts | 20 + .../api/generated/model/resCrawlerStats.ts | 36 ++ .../model/resCrawlerStatsDateFrom.ts | 8 + .../generated/model/resCrawlerStatsDateTo.ts | 8 + .../api/generated/model/resCrawlerStatsMsg.ts | 8 + .../generated/model/siteCrawlerStatsParams.ts | 17 + .../frontend/src/api/generated/ops/ops.ts | 334 ++++++++++++ .../features/ops-stats/CrawlerDailyChart.tsx | 34 ++ .../features/ops-stats/CrawlerStatsPanel.tsx | 195 +++++++ .../ops-stats/OverallCrawlerStats.tsx | 35 ++ .../src/features/ops-stats/SitesTabs.tsx | 31 ++ .../frontend/src/features/ops-stats/labels.ts | 35 ++ .../frontend/src/features/ops-stats/range.ts | 22 + .../frontend/src/pages/OpsSiteStatsPage.tsx | 62 +++ solution/frontend/src/pages/OpsSitesPage.tsx | 31 +- solution/frontend/src/routes.ts | 1 + 33 files changed, 1470 insertions(+), 75 deletions(-) create mode 100644 solution/frontend/src/api/generated/model/crawlerBotRow.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerBotRowBot.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerBotRowVendor.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerDaily.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerHitRow.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerHitRowBot.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerHitRowVendor.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerPathRow.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerRootRow.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerRootRowBot.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerSiteRow.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerStatsParams.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerSummary.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerSummaryLastAt.ts create mode 100644 solution/frontend/src/api/generated/model/crawlerUaRow.ts create mode 100644 solution/frontend/src/api/generated/model/resCrawlerStats.ts create mode 100644 solution/frontend/src/api/generated/model/resCrawlerStatsDateFrom.ts create mode 100644 solution/frontend/src/api/generated/model/resCrawlerStatsDateTo.ts create mode 100644 solution/frontend/src/api/generated/model/resCrawlerStatsMsg.ts create mode 100644 solution/frontend/src/api/generated/model/siteCrawlerStatsParams.ts create mode 100644 solution/frontend/src/features/ops-stats/CrawlerDailyChart.tsx create mode 100644 solution/frontend/src/features/ops-stats/CrawlerStatsPanel.tsx create mode 100644 solution/frontend/src/features/ops-stats/OverallCrawlerStats.tsx create mode 100644 solution/frontend/src/features/ops-stats/SitesTabs.tsx create mode 100644 solution/frontend/src/features/ops-stats/labels.ts create mode 100644 solution/frontend/src/features/ops-stats/range.ts create mode 100644 solution/frontend/src/pages/OpsSiteStatsPage.tsx diff --git a/package-lock.json b/package-lock.json index 4e350f5..85d60ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,9 +23,6 @@ "admin": { "name": "@o2o/admin", "version": "0.0.0", - "dev": true, - "optional": true, - "peer": true, "dependencies": { "@o2o/shared": "*", "@tailwindcss/vite": "^4.1.14", @@ -176,6 +173,7 @@ "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.7", @@ -637,6 +635,7 @@ "resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz", "integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==", "license": "MIT", + "peer": true, "dependencies": { "@dnd-kit/accessibility": "^3.1.1", "@dnd-kit/utilities": "^3.2.2", @@ -1624,9 +1623,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1963,6 +1959,42 @@ } } }, + "node_modules/@reduxjs/toolkit": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.13.0.tgz", + "integrity": "sha512-f6jwVRfwW30+tnllz4YcsHHpPYYOE7abcHkyUCovD+P7DyhdAI5prz2Fh/8TLhakjpN+7aIEion1s5L/tvlYlA==", + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "@standard-schema/utils": "^0.3.0", + "immer": "^11.0.0", + "redux": "^5.0.1", + "redux-thunk": "^3.1.0", + "reselect": "^5.1.0" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", + "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-redux": { + "optional": true + } + } + }, + "node_modules/@reduxjs/toolkit/node_modules/immer": { + "version": "11.1.21", + "resolved": "https://registry.npmjs.org/immer/-/immer-11.1.21.tgz", + "integrity": "sha512-bZSadeCPGdaY5/qRLgr6mDSH1ra21rD3rqpiWk7+QTr4ayYPTE9qZYdLh/NdPhMe0wSrTvHD/Lk8q5EwhUs0aw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, "node_modules/@remix-run/node-fetch-server": { "version": "0.13.3", "resolved": "https://registry.npmjs.org/@remix-run/node-fetch-server/-/node-fetch-server-0.13.3.tgz", @@ -2062,9 +2094,6 @@ "cpu": [ "arm" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2078,9 +2107,6 @@ "cpu": [ "arm" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2094,9 +2120,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2110,9 +2133,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2126,9 +2146,6 @@ "cpu": [ "loong64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2142,9 +2159,6 @@ "cpu": [ "loong64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2158,9 +2172,6 @@ "cpu": [ "ppc64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2174,9 +2185,6 @@ "cpu": [ "ppc64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2190,9 +2198,6 @@ "cpu": [ "riscv64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2206,9 +2211,6 @@ "cpu": [ "riscv64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2222,9 +2224,6 @@ "cpu": [ "s390x" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2238,9 +2237,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2254,9 +2250,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2402,8 +2395,8 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", - "devOptional": true, - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@standard-schema/utils": { "version": "0.3.0", @@ -2857,9 +2850,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2876,9 +2866,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2895,9 +2882,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -2914,9 +2898,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -3083,6 +3064,69 @@ "assertion-error": "^2.0.1" } }, + "node_modules/@types/d3-array": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz", + "integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==", + "license": "MIT" + }, + "node_modules/@types/d3-color": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz", + "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==", + "license": "MIT" + }, + "node_modules/@types/d3-ease": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz", + "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==", + "license": "MIT" + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz", + "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==", + "license": "MIT", + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz", + "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==", + "license": "MIT" + }, + "node_modules/@types/d3-scale": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz", + "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==", + "license": "MIT", + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-kVd74ta9eof3eJOvbNd1vGKS/XERRyQbT26Og63hIsvDO84cjD5gEOhsXf26w3FSoNlPVz84DOFcKv/oou+fMw==", + "license": "MIT", + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz", + "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==", + "license": "MIT" + }, + "node_modules/@types/d3-timer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz", + "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==", + "license": "MIT" + }, "node_modules/@types/deep-eql": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", @@ -3139,6 +3183,7 @@ "integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "csstype": "^3.2.2" } @@ -3167,6 +3212,12 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/use-sync-external-store": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz", + "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==", + "license": "MIT" + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "8.68.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.68.0.tgz", @@ -3212,6 +3263,7 @@ "integrity": "sha512-fHq2VC1kpyYfvEcbiMjOpySY4WS7voEp89yAThrHRX5sm9j2lzYppCb2umFMEed4fWcyeLjHxrz0mpjNBaBxMQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.68.0", "@typescript-eslint/types": "8.68.0", @@ -3602,6 +3654,7 @@ "integrity": "sha512-lGq+9yr1/GuAWaVYIHRjvvySG5/4VfKIvC8EWxStPdcDh/Ka7FG3twP6v4d5BkravUilhIAsG4Qj83t02LWUPQ==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -3625,6 +3678,7 @@ "integrity": "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -3657,6 +3711,7 @@ "integrity": "sha512-V3wD15YHfHz6y0KdhYFjyy9vWtEVALT9UrxfN3zqlI6dMioHnJrqOYfyPKol3oqrnCM9uwkcdCwkJ0WUcbLMTQ==", "devOptional": true, "license": "MIT", + "peer": true, "peerDependencies": { "ajv": "^8.0.1" } @@ -3667,6 +3722,7 @@ "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "ajv": "^8.0.0" }, @@ -3901,6 +3957,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.11.12", "caniuse-lite": "^1.0.30001809", @@ -4118,6 +4175,7 @@ "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=20" } @@ -4185,6 +4243,127 @@ "devOptional": true, "license": "MIT" }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "license": "ISC", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz", + "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "license": "ISC", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "license": "ISC", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "license": "ISC", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, "node_modules/data-view-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", @@ -4257,6 +4436,12 @@ } } }, + "node_modules/decimal.js-light": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz", + "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==", + "license": "MIT" + }, "node_modules/dedent": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.7.2.tgz", @@ -4373,7 +4558,8 @@ "version": "8.6.0", "resolved": "https://registry.npmjs.org/embla-carousel/-/embla-carousel-8.6.0.tgz", "integrity": "sha512-SjWyZBHJPbqxHOzckOfo8lHisEaJWmwd23XppYFYVh10bU66/Pn5tkVkbkCMZVdbUE5eTCI2nD8OyIP4Z+uwkA==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/embla-carousel-react": { "version": "8.6.0", @@ -4632,6 +4818,18 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-toolkit": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.52.0.tgz", + "integrity": "sha512-XTNEJQh1tY1ZJVcf6ayP/2n4ZPyaHlW2FWs7xvw5ddPuhUVjLD3olQVQS7kf58JbAB48iL0uL/jerTrjtV3lDA==", + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks", + "tests/types", + "tests/browser-compat" + ] + }, "node_modules/es6-promise": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", @@ -4710,6 +4908,7 @@ "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -4912,6 +5111,12 @@ "node": ">=0.10.0" } }, + "node_modules/eventemitter3": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", + "license": "MIT" + }, "node_modules/execa": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", @@ -5629,6 +5834,15 @@ "node": ">= 0.4" } }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, "node_modules/is-array-buffer": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", @@ -6112,6 +6326,7 @@ "integrity": "sha512-B7qPcEVE3NVkmSJbaYxvv4cHkVW7DQsZz13pUMrfS8z8Q/BuShN+gcTXrUlPiGqM2/t/EEaI030bpxMqY8gMlw==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">= 10.16.0" } @@ -6392,9 +6607,6 @@ "cpu": [ "arm64" ], - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -6415,9 +6627,6 @@ "cpu": [ "arm64" ], - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -6438,9 +6647,6 @@ "cpu": [ "x64" ], - "libc": [ - "glibc" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -6461,9 +6667,6 @@ "cpu": [ "x64" ], - "libc": [ - "musl" - ], "license": "MPL-2.0", "optional": true, "os": [ @@ -7489,6 +7692,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz", "integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -7498,6 +7702,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz", "integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==", "license": "MIT", + "peer": true, "dependencies": { "scheduler": "^0.27.0" }, @@ -7510,6 +7715,7 @@ "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.86.0.tgz", "integrity": "sha512-4kbWJrh5jPZt1+YqVcXcGKffGcXV/XVbozknLh0Yjh0KhpoAkus21TAQhzRYqNwFkkObmnSvRlZZ3GT+ehoIrA==", "license": "MIT", + "peer": true, "engines": { "node": ">=18.0.0" }, @@ -7521,6 +7727,37 @@ "react": "^16.8.0 || ^17 || ^18 || ^19" } }, + "node_modules/react-is": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.3.0.tgz", + "integrity": "sha512-UpMYezM4v5/18F28aC66AEsjXIgE02kyEMH6yLdgLXu/UTfa1Ntwck/nNLrbqJsEXW7gPb0coNO9FQse9WTovA==", + "license": "MIT", + "peer": true + }, + "node_modules/react-redux": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.3.0.tgz", + "integrity": "sha512-KQopgqFo/p/fgmAs5qz6p5RWaNAzq40WAu7fJIXnQpYxFPbJYtsJPWvGeF2rOBaY/kEuV77AVsX8TsQzKm+A/g==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/use-sync-external-store": "^0.0.6", + "use-sync-external-store": "^1.4.0" + }, + "peerDependencies": { + "@types/react": "^18.2.25 || ^19", + "react": "^18.0 || ^19", + "redux": "^5.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "redux": { + "optional": true + } + } + }, "node_modules/react-refresh": { "version": "0.18.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.18.0.tgz", @@ -7536,6 +7773,7 @@ "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.18.3.tgz", "integrity": "sha512-gyXgtdr5uACJ5b1Q4udzjVV+tb/rlHIMJKuJ0e89R4Kzgz47z/rgP0dIKxktqIEUhDHluGTPJJH/wRha7CyqsA==", "license": "MIT", + "peer": true, "dependencies": { "cookie": "^1.0.1", "set-cookie-parser": "^2.6.0" @@ -7567,6 +7805,62 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/recharts": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.10.1.tgz", + "integrity": "sha512-QXFrvt6IVcw7eeZCoyXTwkIJAX3Dv1nyVhMicXJ47GsGDDpcN8z6o644DibE9XjpBTThtsomLKnTV6lc+cVFUA==", + "license": "MIT", + "workspaces": [ + "www" + ], + "dependencies": { + "@reduxjs/toolkit": "^1.9.0 || 2.x.x", + "clsx": "^2.1.1", + "decimal.js-light": "^2.5.1", + "es-toolkit": "^1.39.3", + "eventemitter3": "^5.0.1", + "immer": "^11.1.8", + "react-redux": "8.x.x || 9.x.x", + "reselect": "5.2.0", + "tiny-invariant": "^1.3.3", + "use-sync-external-store": "^1.2.2", + "victory-vendor": "^37.0.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/recharts/node_modules/immer": { + "version": "11.1.21", + "resolved": "https://registry.npmjs.org/immer/-/immer-11.1.21.tgz", + "integrity": "sha512-bZSadeCPGdaY5/qRLgr6mDSH1ra21rD3rqpiWk7+QTr4ayYPTE9qZYdLh/NdPhMe0wSrTvHD/Lk8q5EwhUs0aw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", + "license": "MIT", + "peer": true + }, + "node_modules/redux-thunk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", + "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", + "license": "MIT", + "peerDependencies": { + "redux": "^5.0.0" + } + }, "node_modules/reflect.getprototypeof": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", @@ -7641,6 +7935,12 @@ "node": ">=0.10.0" } }, + "node_modules/reselect": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.2.0.tgz", + "integrity": "sha512-AgZ3UOZm3YndfrJ4OYjgrT7bmCm/1iqkjvEfH/oYjzh6PD2qw4QuT3jjnXIrpdt4MTpMXclMT3lXbmRY+XRakw==", + "license": "MIT" + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -8301,6 +8601,12 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/tiny-invariant": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", + "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", + "license": "MIT" + }, "node_modules/tinybench": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", @@ -8356,6 +8662,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -8540,6 +8847,7 @@ "integrity": "sha512-uSKqkh8Cr48vllnEy+jdaAgOeR6Y+QCBW7usgUsKj7gJEfR7stw9U/fE49LBnj2tPRKPY0c0EBJSWe9Appmplg==", "dev": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "@gerrit0/mini-shiki": "^3.23.0", "lunr": "^2.3.9", @@ -8629,6 +8937,7 @@ "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "devOptional": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -8752,6 +9061,15 @@ "dev": true, "license": "MIT" }, + "node_modules/use-sync-external-store": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz", + "integrity": "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/utility-types": { "version": "3.11.0", "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.11.0.tgz", @@ -8768,6 +9086,7 @@ "integrity": "sha512-gjdCvJ6d3RyHAneqxMYMW9QMCwYMb3jpOO0IyHZV1bnRHFBHrX3VkIILt5XYR0WhwHiH7Mty8ovuPZ/O3gamrg==", "devOptional": true, "license": "MIT", + "peer": true, "peerDependencies": { "typescript": ">=5" }, @@ -8787,11 +9106,34 @@ "node": ">= 0.10" } }, + "node_modules/victory-vendor": { + "version": "37.3.6", + "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz", + "integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==", + "license": "MIT AND ISC", + "dependencies": { + "@types/d3-array": "^3.0.3", + "@types/d3-ease": "^3.0.0", + "@types/d3-interpolate": "^3.0.1", + "@types/d3-scale": "^4.0.2", + "@types/d3-shape": "^3.1.0", + "@types/d3-time": "^3.0.0", + "@types/d3-timer": "^3.0.0", + "d3-array": "^3.1.6", + "d3-ease": "^3.0.1", + "d3-interpolate": "^3.0.1", + "d3-scale": "^4.0.2", + "d3-shape": "^3.1.0", + "d3-time": "^3.0.0", + "d3-timer": "^3.0.1" + } + }, "node_modules/vite": { "version": "6.4.3", "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz", "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==", "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.4.4", @@ -8913,6 +9255,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -9271,6 +9614,7 @@ "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } @@ -9338,6 +9682,7 @@ "react-dom": "^19.0.1", "react-hook-form": "^7.79.0", "react-router": "^7.17.0", + "recharts": "^3.10.1", "sonner": "^2.0.7", "tailwind-merge": "^3.6.0", "tw-animate-css": "^1.4.0", diff --git a/solution/frontend/package.json b/solution/frontend/package.json index 01b234a..b3b3129 100644 --- a/solution/frontend/package.json +++ b/solution/frontend/package.json @@ -29,6 +29,7 @@ "react-dom": "^19.0.1", "react-hook-form": "^7.79.0", "react-router": "^7.17.0", + "recharts": "^3.10.1", "sonner": "^2.0.7", "tailwind-merge": "^3.6.0", "tw-animate-css": "^1.4.0", diff --git a/solution/frontend/src/api/generated/model/crawlerBotRow.ts b/solution/frontend/src/api/generated/model/crawlerBotRow.ts new file mode 100644 index 0000000..649ecea --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerBotRow.ts @@ -0,0 +1,16 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ +import type { CrawlerBotRowBot } from "./crawlerBotRowBot"; +import type { CrawlerBotRowVendor } from "./crawlerBotRowVendor"; + +export interface CrawlerBotRow { + bot?: CrawlerBotRowBot; + vendor?: CrawlerBotRowVendor; + purpose: string; + hits: number; + last_at: string; +} diff --git a/solution/frontend/src/api/generated/model/crawlerBotRowBot.ts b/solution/frontend/src/api/generated/model/crawlerBotRowBot.ts new file mode 100644 index 0000000..b0c0e0c --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerBotRowBot.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export type CrawlerBotRowBot = string | null; diff --git a/solution/frontend/src/api/generated/model/crawlerBotRowVendor.ts b/solution/frontend/src/api/generated/model/crawlerBotRowVendor.ts new file mode 100644 index 0000000..9c10534 --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerBotRowVendor.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export type CrawlerBotRowVendor = string | null; diff --git a/solution/frontend/src/api/generated/model/crawlerDaily.ts b/solution/frontend/src/api/generated/model/crawlerDaily.ts new file mode 100644 index 0000000..513028a --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerDaily.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export interface CrawlerDaily { + day: string; + purpose: string; + hits: number; +} diff --git a/solution/frontend/src/api/generated/model/crawlerHitRow.ts b/solution/frontend/src/api/generated/model/crawlerHitRow.ts new file mode 100644 index 0000000..996910c --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerHitRow.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ +import type { CrawlerHitRowBot } from "./crawlerHitRowBot"; +import type { CrawlerHitRowVendor } from "./crawlerHitRowVendor"; + +export interface CrawlerHitRow { + created_at: string; + kind: string; + bot?: CrawlerHitRowBot; + vendor?: CrawlerHitRowVendor; + purpose: string; + path: string; +} diff --git a/solution/frontend/src/api/generated/model/crawlerHitRowBot.ts b/solution/frontend/src/api/generated/model/crawlerHitRowBot.ts new file mode 100644 index 0000000..acae877 --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerHitRowBot.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export type CrawlerHitRowBot = string | null; diff --git a/solution/frontend/src/api/generated/model/crawlerHitRowVendor.ts b/solution/frontend/src/api/generated/model/crawlerHitRowVendor.ts new file mode 100644 index 0000000..4aa428e --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerHitRowVendor.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export type CrawlerHitRowVendor = string | null; diff --git a/solution/frontend/src/api/generated/model/crawlerPathRow.ts b/solution/frontend/src/api/generated/model/crawlerPathRow.ts new file mode 100644 index 0000000..f02d673 --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerPathRow.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export interface CrawlerPathRow { + path: string; + hits: number; + last_at: string; +} diff --git a/solution/frontend/src/api/generated/model/crawlerRootRow.ts b/solution/frontend/src/api/generated/model/crawlerRootRow.ts new file mode 100644 index 0000000..84a2be1 --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerRootRow.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ +import type { CrawlerRootRowBot } from "./crawlerRootRowBot"; + +export interface CrawlerRootRow { + kind: string; + bot?: CrawlerRootRowBot; + purpose: string; + hits: number; + last_at: string; +} diff --git a/solution/frontend/src/api/generated/model/crawlerRootRowBot.ts b/solution/frontend/src/api/generated/model/crawlerRootRowBot.ts new file mode 100644 index 0000000..e9a0033 --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerRootRowBot.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export type CrawlerRootRowBot = string | null; diff --git a/solution/frontend/src/api/generated/model/crawlerSiteRow.ts b/solution/frontend/src/api/generated/model/crawlerSiteRow.ts new file mode 100644 index 0000000..0b5716b --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerSiteRow.ts @@ -0,0 +1,15 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export interface CrawlerSiteRow { + site_id: string; + place_id: string; + name: string; + hits: number; + ai_hits: number; + last_at: string; +} diff --git a/solution/frontend/src/api/generated/model/crawlerStatsParams.ts b/solution/frontend/src/api/generated/model/crawlerStatsParams.ts new file mode 100644 index 0000000..4105d77 --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerStatsParams.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export type CrawlerStatsParams = { + /** + * KST 날짜, 기본 to-6일 + */ + from?: string | null; + /** + * KST 날짜, 기본 오늘 + */ + to?: string | null; +}; diff --git a/solution/frontend/src/api/generated/model/crawlerSummary.ts b/solution/frontend/src/api/generated/model/crawlerSummary.ts new file mode 100644 index 0000000..3187586 --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerSummary.ts @@ -0,0 +1,14 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ +import type { CrawlerSummaryLastAt } from "./crawlerSummaryLastAt"; + +export interface CrawlerSummary { + total?: number; + ai?: number; + bots?: number; + last_at?: CrawlerSummaryLastAt; +} diff --git a/solution/frontend/src/api/generated/model/crawlerSummaryLastAt.ts b/solution/frontend/src/api/generated/model/crawlerSummaryLastAt.ts new file mode 100644 index 0000000..3d84127 --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerSummaryLastAt.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export type CrawlerSummaryLastAt = string | null; diff --git a/solution/frontend/src/api/generated/model/crawlerUaRow.ts b/solution/frontend/src/api/generated/model/crawlerUaRow.ts new file mode 100644 index 0000000..c4fbae4 --- /dev/null +++ b/solution/frontend/src/api/generated/model/crawlerUaRow.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export interface CrawlerUaRow { + user_agent: string; + hits: number; + last_at: string; +} diff --git a/solution/frontend/src/api/generated/model/index.ts b/solution/frontend/src/api/generated/model/index.ts index 0e9c746..28698a6 100644 --- a/solution/frontend/src/api/generated/model/index.ts +++ b/solution/frontend/src/api/generated/model/index.ts @@ -14,6 +14,21 @@ export * from "./buildStatus"; export * from "./checkSlugParams"; export * from "./confirm"; export * from "./confirmArgs"; +export * from "./crawlerBotRow"; +export * from "./crawlerBotRowBot"; +export * from "./crawlerBotRowVendor"; +export * from "./crawlerDaily"; +export * from "./crawlerHitRow"; +export * from "./crawlerHitRowBot"; +export * from "./crawlerHitRowVendor"; +export * from "./crawlerPathRow"; +export * from "./crawlerRootRow"; +export * from "./crawlerRootRowBot"; +export * from "./crawlerSiteRow"; +export * from "./crawlerStatsParams"; +export * from "./crawlerSummary"; +export * from "./crawlerSummaryLastAt"; +export * from "./crawlerUaRow"; export * from "./decision"; export * from "./editRedirectParams"; export * from "./errorInfo"; @@ -258,6 +273,10 @@ export * from "./resCategorySchema"; export * from "./resCategorySchemaCategory"; export * from "./resCategorySchemaLabel"; export * from "./resCategorySchemaMsg"; +export * from "./resCrawlerStats"; +export * from "./resCrawlerStatsDateFrom"; +export * from "./resCrawlerStatsDateTo"; +export * from "./resCrawlerStatsMsg"; export * from "./resExtractFacts"; export * from "./resExtractFactsMsg"; export * from "./resExtractedFact"; @@ -391,6 +410,7 @@ export * from "./searchPlacesPublicParams"; export * from "./showcaseItem"; export * from "./showcaseItemRegion"; export * from "./showcaseItemThumbnailUrl"; +export * from "./siteCrawlerStatsParams"; export * from "./siteData"; export * from "./siteDataCurrentVersionId"; export * from "./siteDataDomain"; diff --git a/solution/frontend/src/api/generated/model/resCrawlerStats.ts b/solution/frontend/src/api/generated/model/resCrawlerStats.ts new file mode 100644 index 0000000..350993f --- /dev/null +++ b/solution/frontend/src/api/generated/model/resCrawlerStats.ts @@ -0,0 +1,36 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ +import type { ErrorInfo } from "./errorInfo"; +import type { ResCrawlerStatsMsg } from "./resCrawlerStatsMsg"; +import type { ResCrawlerStatsDateFrom } from "./resCrawlerStatsDateFrom"; +import type { ResCrawlerStatsDateTo } from "./resCrawlerStatsDateTo"; +import type { CrawlerSummary } from "./crawlerSummary"; +import type { CrawlerDaily } from "./crawlerDaily"; +import type { CrawlerBotRow } from "./crawlerBotRow"; +import type { CrawlerSiteRow } from "./crawlerSiteRow"; +import type { CrawlerRootRow } from "./crawlerRootRow"; +import type { CrawlerUaRow } from "./crawlerUaRow"; +import type { CrawlerPathRow } from "./crawlerPathRow"; +import type { CrawlerHitRow } from "./crawlerHitRow"; + +/** + * 전체(sites·root_files·others)와 사이트별(pages·recent)이 같은 모델을 쓴다 — 해당 없는 칸은 비어 있다. + */ +export interface ResCrawlerStats { + result?: ErrorInfo; + msg?: ResCrawlerStatsMsg; + date_from?: ResCrawlerStatsDateFrom; + date_to?: ResCrawlerStatsDateTo; + summary?: CrawlerSummary; + daily?: CrawlerDaily[]; + bots?: CrawlerBotRow[]; + sites?: CrawlerSiteRow[]; + root_files?: CrawlerRootRow[]; + others?: CrawlerUaRow[]; + pages?: CrawlerPathRow[]; + recent?: CrawlerHitRow[]; +} diff --git a/solution/frontend/src/api/generated/model/resCrawlerStatsDateFrom.ts b/solution/frontend/src/api/generated/model/resCrawlerStatsDateFrom.ts new file mode 100644 index 0000000..f2fcdbb --- /dev/null +++ b/solution/frontend/src/api/generated/model/resCrawlerStatsDateFrom.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export type ResCrawlerStatsDateFrom = string | null; diff --git a/solution/frontend/src/api/generated/model/resCrawlerStatsDateTo.ts b/solution/frontend/src/api/generated/model/resCrawlerStatsDateTo.ts new file mode 100644 index 0000000..ac46239 --- /dev/null +++ b/solution/frontend/src/api/generated/model/resCrawlerStatsDateTo.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export type ResCrawlerStatsDateTo = string | null; diff --git a/solution/frontend/src/api/generated/model/resCrawlerStatsMsg.ts b/solution/frontend/src/api/generated/model/resCrawlerStatsMsg.ts new file mode 100644 index 0000000..d02d41c --- /dev/null +++ b/solution/frontend/src/api/generated/model/resCrawlerStatsMsg.ts @@ -0,0 +1,8 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export type ResCrawlerStatsMsg = string | null; diff --git a/solution/frontend/src/api/generated/model/siteCrawlerStatsParams.ts b/solution/frontend/src/api/generated/model/siteCrawlerStatsParams.ts new file mode 100644 index 0000000..21fbc77 --- /dev/null +++ b/solution/frontend/src/api/generated/model/siteCrawlerStatsParams.ts @@ -0,0 +1,17 @@ +/** + * Generated by orval v7.21.0 🍺 + * Do not edit manually. + * Web4Ai API + * OpenAPI spec version: 0.1.0 + */ + +export type SiteCrawlerStatsParams = { + /** + * KST 날짜, 기본 to-6일 + */ + from?: string | null; + /** + * KST 날짜, 기본 오늘 + */ + to?: string | null; +}; diff --git a/solution/frontend/src/api/generated/ops/ops.ts b/solution/frontend/src/api/generated/ops/ops.ts index e2822c4..8234ab8 100644 --- a/solution/frontend/src/api/generated/ops/ops.ts +++ b/solution/frontend/src/api/generated/ops/ops.ts @@ -18,11 +18,14 @@ import type { } from "@tanstack/react-query"; import type { + CrawlerStatsParams, HTTPValidationError, ListSitesParams, ListUsersParams, + ResCrawlerStats, ResOpsSites, ResOpsUsers, + SiteCrawlerStatsParams, } from ".././model"; import { customFetch } from "../../mutator/custom-fetch"; @@ -312,3 +315,334 @@ export function useListUsers< return query; } + +/** + * @summary 전체 크롤러 통계(개발자 전용) + */ +export const crawlerStats = ( + params?: CrawlerStatsParams, + options?: SecondParameter, + signal?: AbortSignal, +) => { + return customFetch( + { url: `/v1/ops/stats/crawlers`, method: "GET", params, signal }, + options, + ); +}; + +export const getCrawlerStatsQueryKey = (params?: CrawlerStatsParams) => { + return [`/v1/ops/stats/crawlers`, ...(params ? [params] : [])] as const; +}; + +export const getCrawlerStatsQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: CrawlerStatsParams, + options?: { + query?: Partial< + UseQueryOptions>, TError, TData> + >; + request?: SecondParameter; + }, +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getCrawlerStatsQueryKey(params); + + const queryFn: QueryFunction>> = ({ + signal, + }) => crawlerStats(params, requestOptions, signal); + + return { queryKey, queryFn, ...queryOptions } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type CrawlerStatsQueryResult = NonNullable< + Awaited> +>; +export type CrawlerStatsQueryError = HTTPValidationError; + +export function useCrawlerStats< + TData = Awaited>, + TError = HTTPValidationError, +>( + params: undefined | CrawlerStatsParams, + options: { + query: Partial< + UseQueryOptions>, TError, TData> + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useCrawlerStats< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: CrawlerStatsParams, + options?: { + query?: Partial< + UseQueryOptions>, TError, TData> + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useCrawlerStats< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: CrawlerStatsParams, + options?: { + query?: Partial< + UseQueryOptions>, TError, TData> + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary 전체 크롤러 통계(개발자 전용) + */ + +export function useCrawlerStats< + TData = Awaited>, + TError = HTTPValidationError, +>( + params?: CrawlerStatsParams, + options?: { + query?: Partial< + UseQueryOptions>, TError, TData> + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getCrawlerStatsQueryOptions(params, options); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} + +/** + * @summary 사이트별 크롤러 통계(개발자 전용) + */ +export const siteCrawlerStats = ( + placeId: string, + params?: SiteCrawlerStatsParams, + options?: SecondParameter, + signal?: AbortSignal, +) => { + return customFetch( + { + url: `/v1/ops/sites/${placeId}/stats/crawlers`, + method: "GET", + params, + signal, + }, + options, + ); +}; + +export const getSiteCrawlerStatsQueryKey = ( + placeId?: string, + params?: SiteCrawlerStatsParams, +) => { + return [ + `/v1/ops/sites/${placeId}/stats/crawlers`, + ...(params ? [params] : []), + ] as const; +}; + +export const getSiteCrawlerStatsQueryOptions = < + TData = Awaited>, + TError = HTTPValidationError, +>( + placeId: string, + params?: SiteCrawlerStatsParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, +) => { + const { query: queryOptions, request: requestOptions } = options ?? {}; + + const queryKey = + queryOptions?.queryKey ?? getSiteCrawlerStatsQueryKey(placeId, params); + + const queryFn: QueryFunction< + Awaited> + > = ({ signal }) => siteCrawlerStats(placeId, params, requestOptions, signal); + + return { + queryKey, + queryFn, + enabled: !!placeId, + ...queryOptions, + } as UseQueryOptions< + Awaited>, + TError, + TData + > & { queryKey: DataTag }; +}; + +export type SiteCrawlerStatsQueryResult = NonNullable< + Awaited> +>; +export type SiteCrawlerStatsQueryError = HTTPValidationError; + +export function useSiteCrawlerStats< + TData = Awaited>, + TError = HTTPValidationError, +>( + placeId: string, + params: undefined | SiteCrawlerStatsParams, + options: { + query: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): DefinedUseQueryResult & { + queryKey: DataTag; +}; +export function useSiteCrawlerStats< + TData = Awaited>, + TError = HTTPValidationError, +>( + placeId: string, + params?: SiteCrawlerStatsParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + > & + Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + >, + "initialData" + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +export function useSiteCrawlerStats< + TData = Awaited>, + TError = HTTPValidationError, +>( + placeId: string, + params?: SiteCrawlerStatsParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +}; +/** + * @summary 사이트별 크롤러 통계(개발자 전용) + */ + +export function useSiteCrawlerStats< + TData = Awaited>, + TError = HTTPValidationError, +>( + placeId: string, + params?: SiteCrawlerStatsParams, + options?: { + query?: Partial< + UseQueryOptions< + Awaited>, + TError, + TData + > + >; + request?: SecondParameter; + }, + queryClient?: QueryClient, +): UseQueryResult & { + queryKey: DataTag; +} { + const queryOptions = getSiteCrawlerStatsQueryOptions( + placeId, + params, + options, + ); + + const query = useQuery(queryOptions, queryClient) as UseQueryResult< + TData, + TError + > & { queryKey: DataTag }; + + query.queryKey = queryOptions.queryKey; + + return query; +} diff --git a/solution/frontend/src/features/ops-stats/CrawlerDailyChart.tsx b/solution/frontend/src/features/ops-stats/CrawlerDailyChart.tsx new file mode 100644 index 0000000..2323756 --- /dev/null +++ b/solution/frontend/src/features/ops-stats/CrawlerDailyChart.tsx @@ -0,0 +1,34 @@ +import {Bar, BarChart, CartesianGrid, Legend, ResponsiveContainer, Tooltip, XAxis, YAxis} from 'recharts'; +import type {CrawlerDaily} from '@/api'; +import {PURPOSE_COLOR, PURPOSES, purposeLabel} from './labels'; +import {daysBetween} from './range'; + +// recharts 는 행 하나를 {day, search: n, training: n, …} 로 받는다. +type Row = Record; + +function pivot(daily: CrawlerDaily[], from: string, to: string): Row[] { + const rows = new Map(daysBetween(from, to).map((day) => [day, {day}])); + for (const {day, purpose, hits} of daily) { + const row = rows.get(day); + if (row) row[purpose] = Number(row[purpose] ?? 0) + hits; + } + return [...rows.values()]; +} + +/** recharts 를 이 파일에만 둔다 — CrawlerStatsPanel 이 lazy() 로 불러 사장님 화면 번들에 안 들어간다. */ +export default function CrawlerDailyChart({daily, from, to}: {daily: CrawlerDaily[]; from: string; to: string}) { + return ( + + + + day.slice(5)} fontSize={11} /> + + [value, purposeLabel(String(name))]} /> + purposeLabel(String(value))} wrapperStyle={{fontSize: 11}} /> + {PURPOSES.map((purpose) => ( + + ))} + + + ); +} diff --git a/solution/frontend/src/features/ops-stats/CrawlerStatsPanel.tsx b/solution/frontend/src/features/ops-stats/CrawlerStatsPanel.tsx new file mode 100644 index 0000000..4d7567d --- /dev/null +++ b/solution/frontend/src/features/ops-stats/CrawlerStatsPanel.tsx @@ -0,0 +1,195 @@ +import {lazy, Suspense, type ReactNode} from 'react'; +import {Link} from 'react-router'; +import {Bot, Loader2} from 'lucide-react'; +import type {ResCrawlerStats} from '@/api'; +import {EmptyState} from '@/components/layout/AppShell'; +import {Badge} from '@/components/ui/badge'; +import {Card, CardContent, CardHeader, CardTitle} from '@/components/ui/card'; +import {cn} from '@/lib/utils'; +import {formatKst, purposeLabel} from './labels'; +import {RANGE_DAYS, type RangeDays} from './range'; + +const CrawlerDailyChart = lazy(() => import('./CrawlerDailyChart')); + +export function RangeTabs({value, onChange}: {value: RangeDays; onChange: (days: RangeDays) => void}) { + return ( +
+ {RANGE_DAYS.map((days) => ( + + ))} +
+ ); +} + +function Stat({label, value}: {label: string; value: ReactNode}) { + return ( + + +

{label}

+

{value}

+
+
+ ); +} + +function Section({title, children}: {title: string; children: ReactNode}) { + return ( + + + {title} + + {children} + + ); +} + +function Table({head, rows}: {head: string[]; rows: ReactNode[][]}) { + if (rows.length === 0) return

기록이 없습니다.

; + return ( +
+ + + + {head.map((h) => ( + + ))} + + + + {rows.map((cells, i) => ( + + {cells.map((cell, j) => ( + + ))} + + ))} + +
+ {h} +
+ {cell} +
+
+ ); +} + +/** 크롤링 탭 본문. scope 에 따라 아래쪽 표가 갈린다 — 전체: 사이트 순위·공용 파일·기타 UA / 사이트: 페이지·최근 기록. */ +export function CrawlerStatsPanel({data, scope}: {data: ResCrawlerStats; scope: 'overall' | 'site'}) { + const summary = data.summary; + if (!summary?.total) { + return ; + } + return ( +
+
+ + + + {formatKst(summary.last_at)}} /> +
+ +
+ {data.date_from && data.date_to && ( + }> + + + )} +
+ +
+ [ + b.bot, + b.vendor ?? '—', + + {purposeLabel(b.purpose)} + , + b.hits, + formatKst(b.last_at), + ])} + /> + + + {scope === 'overall' ? ( + <> +
+
[ + + {s.name} + , + s.hits, + s.ai_hits, + formatKst(s.last_at), + ])} + /> + +
+
[ + r.kind === 'robots' ? 'robots.txt' : 'sitemap.xml', + r.bot ?? '기타', + purposeLabel(r.purpose), + r.hits, + formatKst(r.last_at), + ])} + /> + +
+
[ + + {o.user_agent} + , + o.hits, + formatKst(o.last_at), + ])} + /> + + + ) : ( + <> +
+
[ + + {p.path} + , + p.hits, + formatKst(p.last_at), + ])} + /> + +
+
[ + formatKst(r.created_at), + r.bot ?? '기타', + purposeLabel(r.purpose), + + {r.path} + , + ])} + /> + + + )} + + ); +} diff --git a/solution/frontend/src/features/ops-stats/OverallCrawlerStats.tsx b/solution/frontend/src/features/ops-stats/OverallCrawlerStats.tsx new file mode 100644 index 0000000..50ee7a7 --- /dev/null +++ b/solution/frontend/src/features/ops-stats/OverallCrawlerStats.tsx @@ -0,0 +1,35 @@ +import {useState} from 'react'; +import {keepPreviousData} from '@tanstack/react-query'; +import {Loader2} from 'lucide-react'; +import {useCrawlerStats} from '@/api'; +import {EmptyState} from '@/components/layout/AppShell'; +import {CrawlerStatsPanel, RangeTabs} from './CrawlerStatsPanel'; +import {rangeParams, type RangeDays} from './range'; + +export function OverallCrawlerStats() { + const [days, setDays] = useState(7); + const {data, isLoading, isError, error} = useCrawlerStats(rangeParams(days), { + query: {placeholderData: keepPreviousData}, + }); + + return ( +
+
+

크롤링 (전체 사이트)

+ +
+ {isLoading && ( +
+ +
+ )} + {(isError || data?.result?.success === false) && ( + + )} + {data?.result?.success && } +
+ ); +} diff --git a/solution/frontend/src/features/ops-stats/SitesTabs.tsx b/solution/frontend/src/features/ops-stats/SitesTabs.tsx new file mode 100644 index 0000000..b1757ad --- /dev/null +++ b/solution/frontend/src/features/ops-stats/SitesTabs.tsx @@ -0,0 +1,31 @@ +import {cn} from '@/lib/utils'; + +export type SitesTab = 'list' | 'stats'; + +const TABS: ReadonlyArray = [ + ['list', '목록'], + ['stats', '전체 통계'], +]; + +/** 사이트관리 상단 탭 — 현재 탭은 URL(?tab=)이 들고 있다. */ +export function SitesTabs({tab, onChange}: {tab: SitesTab; onChange: (tab: SitesTab) => void}) { + return ( +
+ {TABS.map(([value, label]) => ( + + ))} +
+ ); +} diff --git a/solution/frontend/src/features/ops-stats/labels.ts b/solution/frontend/src/features/ops-stats/labels.ts new file mode 100644 index 0000000..fc6d90e --- /dev/null +++ b/solution/frontend/src/features/ops-stats/labels.ts @@ -0,0 +1,35 @@ +/** 용도 순서 — 누적 막대의 아래→위, 표의 정렬 기준. AI 쪽을 아래에 깐다(이 화면이 보려는 것). */ +export const PURPOSES = ['search', 'user-fetch', 'training', 'search-engine', 'other'] as const; +export type Purpose = (typeof PURPOSES)[number]; + +export const PURPOSE_LABEL: Record = { + search: 'AI 검색 색인', + 'user-fetch': 'AI 실시간 조회', + training: 'AI 학습', + 'search-engine': '검색엔진', + other: '기타', +}; + +export const PURPOSE_COLOR: Record = { + search: '#2563eb', + 'user-fetch': '#7c3aed', + training: '#0d9488', + 'search-engine': '#f59e0b', + other: '#9ca3af', +}; + +export function purposeLabel(value: string): string { + return PURPOSE_LABEL[value as Purpose] ?? value; +} + +/** 서버 시각(UTC ISO)을 KST 로 읽는다 — 운영자가 한국에 있지 않아도 같은 숫자를 본다. */ +export function formatKst(iso?: string | null): string { + if (!iso) return '—'; + return new Date(iso).toLocaleString('ko-KR', { + timeZone: 'Asia/Seoul', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + }); +} diff --git a/solution/frontend/src/features/ops-stats/range.ts b/solution/frontend/src/features/ops-stats/range.ts new file mode 100644 index 0000000..b0e5a58 --- /dev/null +++ b/solution/frontend/src/features/ops-stats/range.ts @@ -0,0 +1,22 @@ +export const RANGE_DAYS = [7, 30, 90] as const; +export type RangeDays = (typeof RANGE_DAYS)[number]; + +const DAY_MS = 86_400_000; +const KST_OFFSET_MS = 9 * 3_600_000; + +/** 서버가 KST 날짜로 자르므로 KST 오늘을 기준으로 만든다(브라우저 시간대와 무관하게). */ +export function rangeParams(days: RangeDays): {from: string; to: string} { + const kstNow = Date.now() + KST_OFFSET_MS; + const to = new Date(kstNow).toISOString().slice(0, 10); + const from = new Date(kstNow - (days - 1) * DAY_MS).toISOString().slice(0, 10); + return {from, to}; +} + +/** from~to 의 모든 날짜 — 요청이 없던 날도 막대 자리를 비워 둬야 추이가 왜곡되지 않는다. */ +export function daysBetween(from: string, to: string): string[] { + const out: string[] = []; + for (let t = Date.parse(`${from}T00:00:00Z`); t <= Date.parse(`${to}T00:00:00Z`); t += DAY_MS) { + out.push(new Date(t).toISOString().slice(0, 10)); + } + return out; +} diff --git a/solution/frontend/src/pages/OpsSiteStatsPage.tsx b/solution/frontend/src/pages/OpsSiteStatsPage.tsx new file mode 100644 index 0000000..4ca36fc --- /dev/null +++ b/solution/frontend/src/pages/OpsSiteStatsPage.tsx @@ -0,0 +1,62 @@ +import {useState} from 'react'; +import {Link, Navigate, useParams} from 'react-router'; +import {keepPreviousData} from '@tanstack/react-query'; +import {ArrowLeft, Loader2} from 'lucide-react'; +import {UserRole, useSiteCrawlerStats} from '@/api'; +import {AppShell, EmptyState, PageContainer} from '@/components/layout/AppShell'; +import {CrawlerStatsPanel, RangeTabs} from '@/features/ops-stats/CrawlerStatsPanel'; +import {rangeParams, type RangeDays} from '@/features/ops-stats/range'; +import {useAuthStore} from '@/stores/auth'; + +/** 사이트별 통계 — 개발자(DEVELOPER) 전용. 2단계에서 "방문" 탭이 붙는다. */ +export function OpsSiteStatsPage() { + const {placeId = ''} = useParams(); + const isRestoring = useAuthStore((s) => s.isRestoring); + const role = useAuthStore((s) => s.user?.role); + const [days, setDays] = useState(7); + // enabled: OpsSitesPage 와 같은 이유 — role 확정 전 요청이 403 토스트를 먼저 띄운다. + const {data, isLoading, isError, error} = useSiteCrawlerStats(placeId, rangeParams(days), { + query: {placeholderData: keepPreviousData, enabled: role === UserRole.DEVELOPER && !!placeId}, + }); + + if (isRestoring) return null; + if (role !== UserRole.DEVELOPER) return ; + + return ( + + + + 사이트관리 + + } + > +
+

크롤링

+ +
+ {isLoading && ( +
+ +
+ )} + {(isError || data?.result?.success === false) && ( + + )} + {data?.result?.success && } +
+
+ ); +} + +// 라우트 모듈은 default export 를 요구한다(routes.ts 가 이 파일을 가리킨다). +export default OpsSiteStatsPage; diff --git a/solution/frontend/src/pages/OpsSitesPage.tsx b/solution/frontend/src/pages/OpsSitesPage.tsx index a7ced69..80526e4 100644 --- a/solution/frontend/src/pages/OpsSitesPage.tsx +++ b/solution/frontend/src/pages/OpsSitesPage.tsx @@ -1,13 +1,15 @@ import {useState} from 'react'; -import {Link, Navigate} from 'react-router'; +import {Link, Navigate, useSearchParams} from 'react-router'; import {keepPreviousData} from '@tanstack/react-query'; -import {Building2, ChevronLeft, ChevronRight, ExternalLink, Loader2, Newspaper, Pencil, Search, Trash2, X} from 'lucide-react'; +import {BarChart3, Building2, ChevronLeft, ChevronRight, ExternalLink, Loader2, Newspaper, Pencil, Search, Trash2, X} from 'lucide-react'; import {PlaceCategory, publishUrlString, SiteStatus} from '@o2o/shared'; import {changeStatus, deletePlace, PublishAction, UserRole, useListSites, type OpsSiteData} from '@/api'; import {AppShell, EmptyState, PageContainer} from '@/components/layout/AppShell'; import {Badge} from '@/components/ui/badge'; import {Button} from '@/components/ui/button'; import {Input} from '@/components/ui/input'; +import {OverallCrawlerStats} from '@/features/ops-stats/OverallCrawlerStats'; +import {SitesTabs, type SitesTab} from '@/features/ops-stats/SitesTabs'; import {notify, notifyApiError} from '@/lib/notify'; import {PUBLISH_HOST} from '@/lib/site'; import {cn} from '@/lib/utils'; @@ -45,11 +47,15 @@ export function OpsSitesPage() { const [search, setSearch] = useState(''); const [category, setCategory] = useState(null); const [busyId, setBusyId] = useState(null); + // 탭을 URL 에 둔다 — 사이트별 통계에서 뒤로 오면 보던 탭으로 돌아온다. + const [params, setParams] = useSearchParams(); + const tab: SitesTab = params.get('tab') === 'stats' ? 'stats' : 'list'; + const changeTab = (next: SitesTab) => setParams(next === 'list' ? {} : {tab: next}); const size = 20; // enabled: role 이 확정되기 전엔 요청하지 않는다 — 어차피 백엔드가 403 으로 막지만, 사장님 화면에서 실패 토스트가 먼저 뜨는 것과 새로고침 때 잠깐의 오탐 리다이렉트를 막는다. const {data, isLoading, isError, error, refetch} = useListSites( {page, size, search: search || undefined, category: category ?? undefined}, - {query: {placeholderData: keepPreviousData, enabled: role === UserRole.DEVELOPER}}, + {query: {placeholderData: keepPreviousData, enabled: role === UserRole.DEVELOPER && tab === 'list'}}, ); // RequireAuth 와 같은 이유 — 복구가 끝나기 전에 판단하면 새로고침마다 리다이렉트가 한 번 번쩍인다. @@ -85,6 +91,17 @@ export function OpsSitesPage() { if (isRestoring) return null; if (role !== UserRole.DEVELOPER) return ; + if (tab === 'stats') { + return ( + + + + + + + ); + } + const rows = data?.sites ?? []; const total = data?.total ?? 0; const lastPage = Math.max(1, Math.ceil(total / size)); @@ -121,6 +138,7 @@ export function OpsSitesPage() { } > +
{[null, ...Object.keys(CATEGORY_LABEL).map(Number)].map((value) => (