diff --git a/ClientApp/.dockerignore b/ClientApp/.dockerignore new file mode 100644 index 00000000..da37b7f8 --- /dev/null +++ b/ClientApp/.dockerignore @@ -0,0 +1,57 @@ +# Dependencies +node_modules/ +.npm +.yarn + +# Production build +build/ +dist/ + +# Development +.env.local +.env.development.local +.env.test.local +.env.production.local + +# IDE +.vscode/ +.idea/ +*.swp +*.swo + +# OS +.DS_Store +Thumbs.db + +# Logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Git +.git/ +.gitignore + +# Docker +Dockerfile* +docker-compose* +.dockerignore + +# Coverage +coverage/ + +# ESLint cache +.eslintcache + +# TypeScript build info +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ diff --git a/aspnetapp/WINGS/ClientApp/.gitignore b/ClientApp/.gitignore similarity index 100% rename from aspnetapp/WINGS/ClientApp/.gitignore rename to ClientApp/.gitignore diff --git a/ClientApp/Dockerfile b/ClientApp/Dockerfile new file mode 100644 index 00000000..bdfb8594 --- /dev/null +++ b/ClientApp/Dockerfile @@ -0,0 +1,19 @@ +FROM node:18-alpine + +WORKDIR /app + +# package.json と package-lock.json をコピー +COPY package*.json ./ + +# 依存関係をインストール +RUN npm ci + +# ソースコードをコピー +COPY . . + + +# ポート3000を公開 +EXPOSE 3000 + +# React開発サーバーを起動 +CMD ["npm", "run", "start"] diff --git a/aspnetapp/WINGS/ClientApp/README.md b/ClientApp/README.md similarity index 100% rename from aspnetapp/WINGS/ClientApp/README.md rename to ClientApp/README.md diff --git a/aspnetapp/WINGS/ClientApp/package-lock.json b/ClientApp/package-lock.json similarity index 99% rename from aspnetapp/WINGS/ClientApp/package-lock.json rename to ClientApp/package-lock.json index 4272be48..e137de34 100644 --- a/aspnetapp/WINGS/ClientApp/package-lock.json +++ b/ClientApp/package-lock.json @@ -21,6 +21,7 @@ "@rollup/plugin-terser": "^0.4.4", "browserslist": "^4.16.6", "chart.js": "^4.4.3", + "dotenv": "^17.2.1", "file-saver": "^2.0.5", "font-awesome": "^4.7.0", "glob": "^10.4.2", @@ -47,6 +48,7 @@ "devDependencies": { "@redux-devtools/app": "^6.1.0", "@types/file-saver": "^2.0.1", + "@types/node": "^24.1.0", "@types/react-dom": "^18.3.0", "@types/react-redux": "^7.1.33", "@types/react-router": "^5.1.20", @@ -5716,11 +5718,11 @@ "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==" }, "node_modules/@types/node": { - "version": "20.14.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.9.tgz", - "integrity": "sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==", + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz", + "integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~7.8.0" } }, "node_modules/@types/node-forge": { @@ -9371,11 +9373,14 @@ } }, "node_modules/dotenv": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", - "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "version": "17.2.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.1.tgz", + "integrity": "sha512-kQhDYKZecqnM0fCnzI5eIv5L4cAe/iRI+HqMbO/hbRdTAeXDG+M9FjipUxNfbARuEg4iHIbhnhs78BCHNbSxEQ==", "engines": { - "node": ">=10" + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" } }, "node_modules/dotenv-expand": { @@ -18026,6 +18031,14 @@ } } }, + "node_modules/react-scripts/node_modules/dotenv": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==", + "engines": { + "node": ">=10" + } + }, "node_modules/react-scripts/node_modules/semver": { "version": "7.6.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", @@ -20470,9 +20483,9 @@ "integrity": "sha512-hEQt0+ZLDVUMhebKxL4x1BTtDY7bavVofhZ9KZ4aI26X9SRaE+Y3m83XUL1UP2jn8ynjndwCCpEHdUG+9pP1Tw==" }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", + "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==" }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", diff --git a/aspnetapp/WINGS/ClientApp/package.json b/ClientApp/package.json similarity index 89% rename from aspnetapp/WINGS/ClientApp/package.json rename to ClientApp/package.json index 4817be3b..6597b38d 100644 --- a/aspnetapp/WINGS/ClientApp/package.json +++ b/ClientApp/package.json @@ -16,6 +16,7 @@ "@rollup/plugin-terser": "^0.4.4", "browserslist": "^4.16.6", "chart.js": "^4.4.3", + "dotenv": "^17.2.1", "file-saver": "^2.0.5", "font-awesome": "^4.7.0", "glob": "^10.4.2", @@ -42,6 +43,7 @@ "devDependencies": { "@redux-devtools/app": "^6.1.0", "@types/file-saver": "^2.0.1", + "@types/node": "^24.1.0", "@types/react-dom": "^18.3.0", "@types/react-redux": "^7.1.33", "@types/react-router": "^5.1.20", @@ -62,8 +64,7 @@ "eslintConfig": { "extends": [ "react-app", - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-requiring-type-checking" + "plugin:@typescript-eslint/recommended" ], "parser": "@typescript-eslint/parser", "parserOptions": { @@ -71,7 +72,12 @@ }, "plugins": [ "@typescript-eslint" - ] + ], + "rules": { + "@typescript-eslint/no-unsafe-assignment": "warn", + "@typescript-eslint/no-unsafe-member-access": "warn", + "@typescript-eslint/no-unsafe-call": "warn" + } }, "scripts": { "start": "rimraf ./build && react-scripts start", diff --git a/aspnetapp/WINGS/ClientApp/public/favicon.ico b/ClientApp/public/favicon.ico similarity index 100% rename from aspnetapp/WINGS/ClientApp/public/favicon.ico rename to ClientApp/public/favicon.ico diff --git a/aspnetapp/WINGS/ClientApp/public/index.html b/ClientApp/public/index.html similarity index 100% rename from aspnetapp/WINGS/ClientApp/public/index.html rename to ClientApp/public/index.html diff --git a/aspnetapp/WINGS/ClientApp/public/manifest.json b/ClientApp/public/manifest.json similarity index 100% rename from aspnetapp/WINGS/ClientApp/public/manifest.json rename to ClientApp/public/manifest.json diff --git a/aspnetapp/WINGS/ClientApp/src/App.tsx b/ClientApp/src/App.tsx similarity index 93% rename from aspnetapp/WINGS/ClientApp/src/App.tsx rename to ClientApp/src/App.tsx index 1da3ca9b..5df256e6 100644 --- a/aspnetapp/WINGS/ClientApp/src/App.tsx +++ b/ClientApp/src/App.tsx @@ -9,6 +9,7 @@ import { RootState } from './redux/store/RootState'; import { updateLatestTelemetriesAction, addTelemetryHistoriesAction } from './redux/telemetries/actions'; import "./assets/style.css"; import { TelemetryPacketJson } from './models'; +import { apiFetch } from './lib/fetch'; export function useValueRef(val: T) { const ref = React.useRef(val); @@ -27,7 +28,7 @@ const App = () => { const fetchTelemetry = async () => { if (opid === "") return; - const res = await fetch(`/api/operations/${opid}/tlm?refTlmTime=${refTime.current}`, { + const res = await apiFetch(`/api/operations/${opid}/tlm?refTlmTime=${refTime.current}`, { method: 'GET' }); if (res.status == 200) { diff --git a/aspnetapp/WINGS/ClientApp/src/Router.tsx b/ClientApp/src/Router.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/Router.tsx rename to ClientApp/src/Router.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/assets/img/logo.png b/ClientApp/src/assets/img/logo.png similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/assets/img/logo.png rename to ClientApp/src/assets/img/logo.png diff --git a/aspnetapp/WINGS/ClientApp/src/assets/style.css b/ClientApp/src/assets/style.css similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/assets/style.css rename to ClientApp/src/assets/style.css diff --git a/aspnetapp/WINGS/ClientApp/src/assets/theme.ts b/ClientApp/src/assets/theme.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/assets/theme.ts rename to ClientApp/src/assets/theme.ts diff --git a/aspnetapp/WINGS/ClientApp/src/assets/tlm/telemetryColor.json b/ClientApp/src/assets/tlm/telemetryColor.json similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/assets/tlm/telemetryColor.json rename to ClientApp/src/assets/tlm/telemetryColor.json diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/CommandLog.tsx b/ClientApp/src/components/command/CommandLog.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/command/CommandLog.tsx rename to ClientApp/src/components/command/CommandLog.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/CommandSender.tsx b/ClientApp/src/components/command/CommandSender.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/command/CommandSender.tsx rename to ClientApp/src/components/command/CommandSender.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/log_display/CmdLogDisplayArea.tsx b/ClientApp/src/components/command/log_display/CmdLogDisplayArea.tsx similarity index 91% rename from aspnetapp/WINGS/ClientApp/src/components/command/log_display/CmdLogDisplayArea.tsx rename to ClientApp/src/components/command/log_display/CmdLogDisplayArea.tsx index c270dd3b..063f1594 100644 --- a/aspnetapp/WINGS/ClientApp/src/components/command/log_display/CmdLogDisplayArea.tsx +++ b/ClientApp/src/components/command/log_display/CmdLogDisplayArea.tsx @@ -7,6 +7,7 @@ import Button from '@mui/material/Button'; import { getOpid } from '../../../redux/operations/selectors'; import { updateCommandLogAction } from '../../../redux/commands/actions'; import { CommandLogsJson } from '../../../models'; +import { apiFetch } from '../../../lib/fetch'; const CmdLogDisplayArea = () => { const dispatch = useDispatch(); @@ -16,7 +17,7 @@ const CmdLogDisplayArea = () => { const handleOk = async () => { if (opid === "") return; - const res = await fetch(`/api/operations/${opid}/cmd_fileline/log`, { + const res = await apiFetch(`/api/operations/${opid}/cmd_fileline/log`, { method: 'GET' }); const json = await res.json() as CommandLogsJson; diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/log_display/CmdLogTabPanel.tsx b/ClientApp/src/components/command/log_display/CmdLogTabPanel.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/command/log_display/CmdLogTabPanel.tsx rename to ClientApp/src/components/command/log_display/CmdLogTabPanel.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/log_display/CmdLogTableRow.tsx b/ClientApp/src/components/command/log_display/CmdLogTableRow.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/command/log_display/CmdLogTableRow.tsx rename to ClientApp/src/components/command/log_display/CmdLogTableRow.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/plan_display/OpenPlanDialog.tsx b/ClientApp/src/components/command/plan_display/OpenPlanDialog.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/command/plan_display/OpenPlanDialog.tsx rename to ClientApp/src/components/command/plan_display/OpenPlanDialog.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/plan_display/PlanDisplayArea.tsx b/ClientApp/src/components/command/plan_display/PlanDisplayArea.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/command/plan_display/PlanDisplayArea.tsx rename to ClientApp/src/components/command/plan_display/PlanDisplayArea.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/plan_display/PlanTabPanel.tsx b/ClientApp/src/components/command/plan_display/PlanTabPanel.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/command/plan_display/PlanTabPanel.tsx rename to ClientApp/src/components/command/plan_display/PlanTabPanel.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/plan_display/RequestTableRow.tsx b/ClientApp/src/components/command/plan_display/RequestTableRow.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/command/plan_display/RequestTableRow.tsx rename to ClientApp/src/components/command/plan_display/RequestTableRow.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/plan_edit/CommandSelectArea.tsx b/ClientApp/src/components/command/plan_edit/CommandSelectArea.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/command/plan_edit/CommandSelectArea.tsx rename to ClientApp/src/components/command/plan_edit/CommandSelectArea.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/command/plan_edit/SetParamTable.tsx b/ClientApp/src/components/command/plan_edit/SetParamTable.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/command/plan_edit/SetParamTable.tsx rename to ClientApp/src/components/command/plan_edit/SetParamTable.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/CheckBox.tsx b/ClientApp/src/components/common/CheckBox.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/CheckBox.tsx rename to ClientApp/src/components/common/CheckBox.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/ConfirmationDialog.tsx b/ClientApp/src/components/common/ConfirmationDialog.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/ConfirmationDialog.tsx rename to ClientApp/src/components/common/ConfirmationDialog.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/EditableInputTableCell.tsx b/ClientApp/src/components/common/EditableInputTableCell.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/EditableInputTableCell.tsx rename to ClientApp/src/components/common/EditableInputTableCell.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/EditableSelectTableCell.tsx b/ClientApp/src/components/common/EditableSelectTableCell.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/EditableSelectTableCell.tsx rename to ClientApp/src/components/common/EditableSelectTableCell.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/ErrorDialog.tsx b/ClientApp/src/components/common/ErrorDialog.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/ErrorDialog.tsx rename to ClientApp/src/components/common/ErrorDialog.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/FileTreeMultiView.tsx b/ClientApp/src/components/common/FileTreeMultiView.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/FileTreeMultiView.tsx rename to ClientApp/src/components/common/FileTreeMultiView.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/FileTreeView.tsx b/ClientApp/src/components/common/FileTreeView.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/FileTreeView.tsx rename to ClientApp/src/components/common/FileTreeView.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/IconButtonInTabs.tsx b/ClientApp/src/components/common/IconButtonInTabs.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/IconButtonInTabs.tsx rename to ClientApp/src/components/common/IconButtonInTabs.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/LoadingBackDrop.tsx b/ClientApp/src/components/common/LoadingBackDrop.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/LoadingBackDrop.tsx rename to ClientApp/src/components/common/LoadingBackDrop.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/RadioBox.tsx b/ClientApp/src/components/common/RadioBox.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/RadioBox.tsx rename to ClientApp/src/components/common/RadioBox.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/SelectBox.tsx b/ClientApp/src/components/common/SelectBox.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/SelectBox.tsx rename to ClientApp/src/components/common/SelectBox.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/common/TransferList.tsx b/ClientApp/src/components/common/TransferList.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/common/TransferList.tsx rename to ClientApp/src/components/common/TransferList.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/compo/ComponentList.tsx b/ClientApp/src/components/compo/ComponentList.tsx similarity index 97% rename from aspnetapp/WINGS/ClientApp/src/components/compo/ComponentList.tsx rename to ClientApp/src/components/compo/ComponentList.tsx index bf2e966e..59c92c54 100644 --- a/aspnetapp/WINGS/ClientApp/src/components/compo/ComponentList.tsx +++ b/ClientApp/src/components/compo/ComponentList.tsx @@ -19,6 +19,7 @@ import { openErrorDialogAction } from '../../redux/ui/actions'; import ConfirmationDialog from '../common/ConfirmationDialog'; import EditableInputTableCell from '../common/EditableInputTableCell'; import EditableSelectTableCell from '../common/EditableSelectTableCell'; +import { apiFetch } from '../../lib/fetch'; const initialValues = { name: "", @@ -53,7 +54,7 @@ const ComponentList = (props: ComponentListProps) => { const handleOkClick = async () => { if (deleteCompo === null) return; try { - await fetch(`/api/components/${deleteCompo.id}`, { + await apiFetch(`/api/components/${deleteCompo.id}`, { method: 'DELETE' }); updateState(); @@ -93,7 +94,7 @@ const ComponentList = (props: ComponentListProps) => { const updateComponent = async (i: number) => { try { const compo = compos[i]; - const res = await fetch(`/api/components/${compo.id}`, { + const res = await apiFetch(`/api/components/${compo.id}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', @@ -128,7 +129,7 @@ const ComponentList = (props: ComponentListProps) => { const createComponent = async () => { try { - const res = await fetch(`/api/components`, { + const res = await apiFetch(`/api/components`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/aspnetapp/WINGS/ClientApp/src/components/compo/ComponentManage.tsx b/ClientApp/src/components/compo/ComponentManage.tsx similarity index 90% rename from aspnetapp/WINGS/ClientApp/src/components/compo/ComponentManage.tsx rename to ClientApp/src/components/compo/ComponentManage.tsx index ce5c548e..0f3cda11 100644 --- a/aspnetapp/WINGS/ClientApp/src/components/compo/ComponentManage.tsx +++ b/ClientApp/src/components/compo/ComponentManage.tsx @@ -1,13 +1,14 @@ import React, { useEffect, useState } from 'react'; import { Component, ComponentJson } from '../../models'; import ComponentList from './ComponentList'; +import { apiFetch } from '../../lib/fetch'; const ComponentManage = () => { const [compos, setCompos] = useState([]); const fetchData = async () => { try { - const response_compo = await fetch('/api/components', { + const response_compo = await apiFetch('/api/components', { method: 'GET' }); if (response_compo.status === 200) { diff --git a/aspnetapp/WINGS/ClientApp/src/components/header/DrawerMenus.tsx b/ClientApp/src/components/header/DrawerMenus.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/header/DrawerMenus.tsx rename to ClientApp/src/components/header/DrawerMenus.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/header/Header.tsx b/ClientApp/src/components/header/Header.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/header/Header.tsx rename to ClientApp/src/components/header/Header.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/header/HeaderMenus.tsx b/ClientApp/src/components/header/HeaderMenus.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/header/HeaderMenus.tsx rename to ClientApp/src/components/header/HeaderMenus.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/history/HistoryDetail.tsx b/ClientApp/src/components/history/HistoryDetail.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/history/HistoryDetail.tsx rename to ClientApp/src/components/history/HistoryDetail.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/history/LogExportArea.tsx b/ClientApp/src/components/history/LogExportArea.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/history/LogExportArea.tsx rename to ClientApp/src/components/history/LogExportArea.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/history/OperationHistory.tsx b/ClientApp/src/components/history/OperationHistory.tsx similarity index 96% rename from aspnetapp/WINGS/ClientApp/src/components/history/OperationHistory.tsx rename to ClientApp/src/components/history/OperationHistory.tsx index 2a21542c..804cf06a 100644 --- a/aspnetapp/WINGS/ClientApp/src/components/history/OperationHistory.tsx +++ b/ClientApp/src/components/history/OperationHistory.tsx @@ -16,6 +16,7 @@ import DeleteIcon from '@mui/icons-material/Delete'; import SearchIcon from '@mui/icons-material/Search'; import { Operation, PaginationMeta } from '../../models'; import ConfirmationDialog from '../common/ConfirmationDialog'; +import { apiFetch } from '../../lib/fetch'; const sizePerPage = 12; @@ -34,7 +35,7 @@ const OperationHistory = () => { const fetchOperations = async () => { try { - const response = await fetch(`/api/operations/history?page=${page}&size=${sizePerPage}&search=${search}`, { + const response = await apiFetch(`/api/operations/history?page=${page}&size=${sizePerPage}&search=${search}`, { method: 'GET' }); if (response.status == 200) { @@ -80,7 +81,7 @@ const OperationHistory = () => { const handleOkClick = async () => { if (deleteOperation === null) return; try { - const response = await fetch(`/api/operations/${deleteOperation.id}/history`, { + const response = await apiFetch(`/api/operations/${deleteOperation.id}/history`, { method: 'DELETE' }); if (response.ok) { diff --git a/aspnetapp/WINGS/ClientApp/src/components/home/Home.tsx b/ClientApp/src/components/home/Home.tsx similarity index 95% rename from aspnetapp/WINGS/ClientApp/src/components/home/Home.tsx rename to ClientApp/src/components/home/Home.tsx index f9e75339..aeea7bc7 100644 --- a/aspnetapp/WINGS/ClientApp/src/components/home/Home.tsx +++ b/ClientApp/src/components/home/Home.tsx @@ -6,6 +6,7 @@ import { Operation } from '../../models'; import { RootState } from '../../redux/store/RootState'; import { getOpid } from '../../redux/operations/selectors'; import { leaveOperationAction } from '../../redux/operations/actions'; +import { apiFetch } from '../../lib/fetch'; const Home = () => { const dispatch = useDispatch(); @@ -16,7 +17,7 @@ const Home = () => { const fetchOperations = async () => { try { - const res = await fetch('/api/operations', { + const res = await apiFetch('/api/operations', { method: 'GET' }); if (res.status === 200) { diff --git a/aspnetapp/WINGS/ClientApp/src/components/home/OperationList.tsx b/ClientApp/src/components/home/OperationList.tsx similarity index 97% rename from aspnetapp/WINGS/ClientApp/src/components/home/OperationList.tsx rename to ClientApp/src/components/home/OperationList.tsx index 3358a98d..c7055f87 100644 --- a/aspnetapp/WINGS/ClientApp/src/components/home/OperationList.tsx +++ b/ClientApp/src/components/home/OperationList.tsx @@ -21,6 +21,7 @@ import { cyan } from "@mui/material/colors"; import ConfirmationDialog from '../common/ConfirmationDialog'; import { openErrorDialogAction } from '../../redux/ui/actions'; import { AppDispatch } from '../../redux/store/store'; +import { apiFetch } from '../../lib/fetch'; export interface OperationListProps { operations: Operation[], @@ -48,7 +49,7 @@ const OperationList = (props: OperationListProps) => { const handleOk = async () => { if (stopOperation === null) return; - const res = await fetch(`/api/operations/${stopOperation.id}`, { + const res = await apiFetch(`/api/operations/${stopOperation.id}`, { method: 'DELETE' }) if (res.status === 204) { diff --git a/aspnetapp/WINGS/ClientApp/src/components/home/StartOperationArea.tsx b/ClientApp/src/components/home/StartOperationArea.tsx similarity index 97% rename from aspnetapp/WINGS/ClientApp/src/components/home/StartOperationArea.tsx rename to ClientApp/src/components/home/StartOperationArea.tsx index a8b368e6..cb560d8c 100644 --- a/aspnetapp/WINGS/ClientApp/src/components/home/StartOperationArea.tsx +++ b/ClientApp/src/components/home/StartOperationArea.tsx @@ -5,6 +5,7 @@ import RadioBox from '../common/RadioBox'; import { Component, ComponentJson } from '../../models'; import { useDispatch } from 'react-redux'; import { openErrorDialogAction, startLoadingAction, endLoadingAction } from '../../redux/ui/actions'; +import { apiFetch } from '../../lib/fetch'; const getDefaultPathNumber = () => { const dt = new Date(); @@ -48,7 +49,7 @@ const StartOperationArea = (props: StartOperationAreaProps) => { const fetchComponents = async () => { try { - const res = await fetch('/api/components', { + const res = await apiFetch('/api/components', { method: 'GET' }); if (res.status === 200) { @@ -72,7 +73,7 @@ const StartOperationArea = (props: StartOperationAreaProps) => { const startOperation = async () => { dispatch(startLoadingAction()); - const res = await fetch(`/api/operations`, { + const res = await apiFetch(`/api/operations`, { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/aspnetapp/WINGS/ClientApp/src/components/telemetry/TelemetryViewer.tsx b/ClientApp/src/components/telemetry/TelemetryViewer.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/telemetry/TelemetryViewer.tsx rename to ClientApp/src/components/telemetry/TelemetryViewer.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/GraphTabPanel.tsx b/ClientApp/src/components/telemetry/view_display/GraphTabPanel.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/GraphTabPanel.tsx rename to ClientApp/src/components/telemetry/view_display/GraphTabPanel.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/OpenGraphTabDialog.tsx b/ClientApp/src/components/telemetry/view_display/OpenGraphTabDialog.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/OpenGraphTabDialog.tsx rename to ClientApp/src/components/telemetry/view_display/OpenGraphTabDialog.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/OpenLayoutDialog.tsx b/ClientApp/src/components/telemetry/view_display/OpenLayoutDialog.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/OpenLayoutDialog.tsx rename to ClientApp/src/components/telemetry/view_display/OpenLayoutDialog.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/OpenPacketTabDialog.tsx b/ClientApp/src/components/telemetry/view_display/OpenPacketTabDialog.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/OpenPacketTabDialog.tsx rename to ClientApp/src/components/telemetry/view_display/OpenPacketTabDialog.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/OpenViewDialog.tsx b/ClientApp/src/components/telemetry/view_display/OpenViewDialog.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/OpenViewDialog.tsx rename to ClientApp/src/components/telemetry/view_display/OpenViewDialog.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/PacketTabPanel.tsx b/ClientApp/src/components/telemetry/view_display/PacketTabPanel.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/PacketTabPanel.tsx rename to ClientApp/src/components/telemetry/view_display/PacketTabPanel.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/ViewDisplayBlock.tsx b/ClientApp/src/components/telemetry/view_display/ViewDisplayBlock.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/ViewDisplayBlock.tsx rename to ClientApp/src/components/telemetry/view_display/ViewDisplayBlock.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/ViewTabPanel.tsx b/ClientApp/src/components/telemetry/view_display/ViewTabPanel.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/components/telemetry/view_display/ViewTabPanel.tsx rename to ClientApp/src/components/telemetry/view_display/ViewTabPanel.tsx diff --git a/aspnetapp/WINGS/ClientApp/src/constants/index.ts b/ClientApp/src/constants/index.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/constants/index.ts rename to ClientApp/src/constants/index.ts diff --git a/aspnetapp/WINGS/ClientApp/src/index.tsx b/ClientApp/src/index.tsx similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/index.tsx rename to ClientApp/src/index.tsx diff --git a/ClientApp/src/lib/fetch.ts b/ClientApp/src/lib/fetch.ts new file mode 100644 index 00000000..003d39b8 --- /dev/null +++ b/ClientApp/src/lib/fetch.ts @@ -0,0 +1,23 @@ +// API設定 +export const API_CONFIG = { + baseURL: 'http://localhost:5000', +}; + +/** + * APIのURLを構築する関数 + * @param path APIのパス + * @returns 完全なAPIのURL + */ +export const buildApiUrl = (path: string): string => { + return `${API_CONFIG.baseURL}${path.startsWith('/') ? path : `/${path}`}`; +}; + +/** + * fetchのラッパー関数 + * @param path APIのパス + * @param options fetchのオプション + * @returns fetchのPromise + */ +export const apiFetch = (path: string, options?: RequestInit): Promise => { + return fetch(buildApiUrl(path), options); +}; \ No newline at end of file diff --git a/aspnetapp/WINGS/ClientApp/src/models/Command.ts b/ClientApp/src/models/Command.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/Command.ts rename to ClientApp/src/models/Command.ts diff --git a/aspnetapp/WINGS/ClientApp/src/models/CommandPlan.ts b/ClientApp/src/models/CommandPlan.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/CommandPlan.ts rename to ClientApp/src/models/CommandPlan.ts diff --git a/aspnetapp/WINGS/ClientApp/src/models/Component.ts b/ClientApp/src/models/Component.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/Component.ts rename to ClientApp/src/models/Component.ts diff --git a/aspnetapp/WINGS/ClientApp/src/models/ErrorDialogState.ts b/ClientApp/src/models/ErrorDialogState.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/ErrorDialogState.ts rename to ClientApp/src/models/ErrorDialogState.ts diff --git a/aspnetapp/WINGS/ClientApp/src/models/FileIndex.ts b/ClientApp/src/models/FileIndex.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/FileIndex.ts rename to ClientApp/src/models/FileIndex.ts diff --git a/aspnetapp/WINGS/ClientApp/src/models/LocationState.ts b/ClientApp/src/models/LocationState.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/LocationState.ts rename to ClientApp/src/models/LocationState.ts diff --git a/aspnetapp/WINGS/ClientApp/src/models/Operation.ts b/ClientApp/src/models/Operation.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/Operation.ts rename to ClientApp/src/models/Operation.ts diff --git a/aspnetapp/WINGS/ClientApp/src/models/PaginationMeta.ts b/ClientApp/src/models/PaginationMeta.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/PaginationMeta.ts rename to ClientApp/src/models/PaginationMeta.ts diff --git a/aspnetapp/WINGS/ClientApp/src/models/Telemetry.ts b/ClientApp/src/models/Telemetry.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/Telemetry.ts rename to ClientApp/src/models/Telemetry.ts diff --git a/aspnetapp/WINGS/ClientApp/src/models/TelemetryView.ts b/ClientApp/src/models/TelemetryView.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/TelemetryView.ts rename to ClientApp/src/models/TelemetryView.ts diff --git a/aspnetapp/WINGS/ClientApp/src/models/UIState.ts b/ClientApp/src/models/UIState.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/UIState.ts rename to ClientApp/src/models/UIState.ts diff --git a/aspnetapp/WINGS/ClientApp/src/models/index.ts b/ClientApp/src/models/index.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/models/index.ts rename to ClientApp/src/models/index.ts diff --git a/aspnetapp/WINGS/ClientApp/src/react-app-env.d.ts b/ClientApp/src/react-app-env.d.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/react-app-env.d.ts rename to ClientApp/src/react-app-env.d.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/commands/actions.ts b/ClientApp/src/redux/commands/actions.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/commands/actions.ts rename to ClientApp/src/redux/commands/actions.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/commands/reducers.ts b/ClientApp/src/redux/commands/reducers.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/commands/reducers.ts rename to ClientApp/src/redux/commands/reducers.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/commands/selectors.ts b/ClientApp/src/redux/commands/selectors.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/commands/selectors.ts rename to ClientApp/src/redux/commands/selectors.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/operations/actions.ts b/ClientApp/src/redux/operations/actions.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/operations/actions.ts rename to ClientApp/src/redux/operations/actions.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/operations/operations.ts b/ClientApp/src/redux/operations/operations.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/operations/operations.ts rename to ClientApp/src/redux/operations/operations.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/operations/reducers.ts b/ClientApp/src/redux/operations/reducers.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/operations/reducers.ts rename to ClientApp/src/redux/operations/reducers.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/operations/selectors.ts b/ClientApp/src/redux/operations/selectors.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/operations/selectors.ts rename to ClientApp/src/redux/operations/selectors.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/plans/actions.ts b/ClientApp/src/redux/plans/actions.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/plans/actions.ts rename to ClientApp/src/redux/plans/actions.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/plans/operations.ts b/ClientApp/src/redux/plans/operations.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/plans/operations.ts rename to ClientApp/src/redux/plans/operations.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/plans/reducers.ts b/ClientApp/src/redux/plans/reducers.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/plans/reducers.ts rename to ClientApp/src/redux/plans/reducers.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/plans/selectors.ts b/ClientApp/src/redux/plans/selectors.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/plans/selectors.ts rename to ClientApp/src/redux/plans/selectors.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/store/RootState.ts b/ClientApp/src/redux/store/RootState.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/store/RootState.ts rename to ClientApp/src/redux/store/RootState.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/store/initialState.ts b/ClientApp/src/redux/store/initialState.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/store/initialState.ts rename to ClientApp/src/redux/store/initialState.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/store/store.ts b/ClientApp/src/redux/store/store.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/store/store.ts rename to ClientApp/src/redux/store/store.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/telemetries/actions.ts b/ClientApp/src/redux/telemetries/actions.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/telemetries/actions.ts rename to ClientApp/src/redux/telemetries/actions.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/telemetries/reducers.ts b/ClientApp/src/redux/telemetries/reducers.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/telemetries/reducers.ts rename to ClientApp/src/redux/telemetries/reducers.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/telemetries/selectors.ts b/ClientApp/src/redux/telemetries/selectors.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/telemetries/selectors.ts rename to ClientApp/src/redux/telemetries/selectors.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/ui/actions.ts b/ClientApp/src/redux/ui/actions.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/ui/actions.ts rename to ClientApp/src/redux/ui/actions.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/ui/reducers.ts b/ClientApp/src/redux/ui/reducers.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/ui/reducers.ts rename to ClientApp/src/redux/ui/reducers.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/ui/selectors.ts b/ClientApp/src/redux/ui/selectors.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/ui/selectors.ts rename to ClientApp/src/redux/ui/selectors.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/views/actions.ts b/ClientApp/src/redux/views/actions.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/views/actions.ts rename to ClientApp/src/redux/views/actions.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/views/reducers.ts b/ClientApp/src/redux/views/reducers.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/views/reducers.ts rename to ClientApp/src/redux/views/reducers.ts diff --git a/aspnetapp/WINGS/ClientApp/src/redux/views/selectors.ts b/ClientApp/src/redux/views/selectors.ts similarity index 100% rename from aspnetapp/WINGS/ClientApp/src/redux/views/selectors.ts rename to ClientApp/src/redux/views/selectors.ts diff --git a/aspnetapp/WINGS/ClientApp/tsconfig.eslint.json b/ClientApp/tsconfig.eslint.json similarity index 100% rename from aspnetapp/WINGS/ClientApp/tsconfig.eslint.json rename to ClientApp/tsconfig.eslint.json diff --git a/aspnetapp/WINGS/ClientApp/tsconfig.json b/ClientApp/tsconfig.json similarity index 100% rename from aspnetapp/WINGS/ClientApp/tsconfig.json rename to ClientApp/tsconfig.json diff --git a/aspnetapp/.dockerignore b/aspnetapp/.dockerignore new file mode 100644 index 00000000..0091031e --- /dev/null +++ b/aspnetapp/.dockerignore @@ -0,0 +1,67 @@ +# Node.js +node_modules/ +npm-debug.log +yarn-error.log +.npm +.yarn + +# .NET +bin/ +obj/ +.vs/ +.vscode/ +*.user +*.userprefs + +# Git +.git/ +.gitignore +.gitattributes + +# Docker +Dockerfile* +docker-compose* +.dockerignore + +# IDE +.idea/ +*.swp +*.swo + +# Logs +*.log +Logs/ +logs/ + +# OS +.DS_Store +Thumbs.db + +# Build outputs +dist/ +build/ +out/ + +# Dependencies +**/node_modules/ +**/bin/ +**/obj/ + +# Test coverage +coverage/ + +# Environment files +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# Database +*.db +*.sqlite +data/ + +# Temporary files +*.tmp +*.temp diff --git a/aspnetapp/Dockerfile b/aspnetapp/Dockerfile index e3a29f30..7ddb7580 100644 --- a/aspnetapp/Dockerfile +++ b/aspnetapp/Dockerfile @@ -1,16 +1,11 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base WORKDIR /app -EXPOSE 5001 -RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - -RUN apt-get update -RUN apt-get install -y nodejs +EXPOSE 5000 ENV TZ=Asia/Tokyo FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src -RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - -RUN apt-get update -RUN apt-get install -y nodejs + COPY ["WINGS/WINGS.csproj", "WINGS/"] RUN dotnet restore "WINGS/WINGS.csproj" COPY . . diff --git a/aspnetapp/WINGS/Startup.cs b/aspnetapp/WINGS/Startup.cs index 03f50b47..424360e5 100644 --- a/aspnetapp/WINGS/Startup.cs +++ b/aspnetapp/WINGS/Startup.cs @@ -1,7 +1,9 @@ using System.Text.Json.Serialization; +using System; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer; +// SPA統合のusingを削除 +// using Microsoft.AspNetCore.SpaServices.ReactDevelopmentServer; using Microsoft.EntityFrameworkCore; using WINGS.Data; using WINGS.Models; @@ -27,11 +29,28 @@ public void ConfigureServices(IServiceCollection services) { services.AddDbContext(options => options.UseMySql( - Configuration.GetConnectionString("DefaultConnection"),ServerVersion.Parse("8.0"))); - - services.AddControllersWithViews() + Configuration.GetConnectionString("DefaultConnection"), + ServerVersion.Parse("8.0"), + mysqlOptions => mysqlOptions.EnableRetryOnFailure( + maxRetryCount: 5, + maxRetryDelay: TimeSpan.FromSeconds(30), + errorNumbersToAdd: null))); + + services.AddControllers() .AddJsonOptions(options => options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())); - services.AddRazorPages(); + // RazorPagesは不要(SPA分離のため) + // services.AddRazorPages(); + + services.AddCors(options => + { + options.AddPolicy("AllowFrontend", policy => + { + policy.WithOrigins("http://localhost:3000", "http://frontend:3000") + .AllowAnyHeader() + .AllowAnyMethod() + .AllowCredentials(); + }); + }); services.AddGrpc(); @@ -60,13 +79,7 @@ public void ConfigureServices(IServiceCollection services) services.AddScoped(); services.AddScoped(); - ConfigureUserDefinedServices(services); - - // In production, the React files will be served from this directory - services.AddSpaStaticFiles(configuration => - { - configuration.RootPath = "ClientApp/build"; - }); + ConfigureUserDefinedServices(services); } private void ConfigureUserDefinedServices(IServiceCollection services) @@ -93,33 +106,22 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) } else { - app.UseExceptionHandler("/Error"); + app.UseExceptionHandler("/api/error"); app.UseHsts(); } - app.UseHttpsRedirection(); - app.UseStaticFiles(); - app.UseSpaStaticFiles(); + + // If you are configuring HTTPS redirection, ensure that your environment is set up correctly. + // app.UseHttpsRedirection(); + + app.UseCors("AllowFrontend"); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapGrpcService(); - endpoints.MapControllerRoute( - name: "default", - pattern: "{controller}/{action=Index}/{id?}"); - endpoints.MapRazorPages(); - }); - - app.UseSpa(spa => - { - spa.Options.SourcePath = "ClientApp"; - - if (env.IsDevelopment()) - { - spa.UseReactDevelopmentServer(npmScript: "start"); - } + endpoints.MapControllers(); }); } } diff --git a/aspnetapp/WINGS/WINGS.csproj b/aspnetapp/WINGS/WINGS.csproj index d7c0b77d..2d2ddc14 100644 --- a/aspnetapp/WINGS/WINGS.csproj +++ b/aspnetapp/WINGS/WINGS.csproj @@ -1,11 +1,7 @@ net8.0 - true - Latest false - ClientApp\ - $(DefaultItemExcludes);$(SpaRoot)node_modules\** @@ -16,7 +12,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + @@ -30,35 +26,10 @@ - - - - - - - - - - - - - - - - - - - - %(DistFiles.Identity) - PreserveNewest - true - - - \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 62c29a5b..dab8fb9f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,45 @@ -version: "3" services: - aspnetapp: - image: wings-aspnetapp-img - build: ./aspnetapp - container_name: wings-aspnetapp-ctr + backend: + image: wings-backend-img + build: + context: ./aspnetapp + dockerfile: Dockerfile + container_name: wings-backend-ctr volumes: - "./aspnetapp/WINGS/TlmCmd:/app/TlmCmd" - "./aspnetapp/WINGS/Logs:/app/Logs" environment: ConnectionStrings__DefaultConnection: "server=mysql; uid=root; pwd=P@ssw0rd!; database=wings;" - ASPNETCORE_URLS: "https://+;http://+" - ASPNETCORE_HTTPS_PORT: 5001 - ASPNETCORE_Kestrel__Certificates__Default__Password: "P@ssw0rd!" - ASPNETCORE_Kestrel__Certificates__Default__Path: "/app/certificate.pfx" + ASPNETCORE_URLS: "http://+:5000" + ASPNETCORE_ENVIRONMENT: "Development" + HTTP_PORTS: "5000" + HTTPS_PORTS: "" + ASPNETCORE_HTTPS_PORT: "" ports: - - "5001:5001" + - "5000:5000" depends_on: - - mysql + mysql: + condition: service_healthy + networks: + - wings-network + + frontend: + image: wings-frontend-dev-img + build: + context: ./ClientApp + container_name: wings-frontend-ctr + volumes: + - "./ClientApp:/app" + - "/app/node_modules" + environment: + - REACT_APP_API_BASE_URL=http://backend:5000/api + ports: + - "3000:3000" + depends_on: + - backend + networks: + - wings-network + mysql: image: wings-mysql-img build: ./mysql @@ -29,3 +52,15 @@ services: environment: - MYSQL_DATABASE=wings - MYSQL_ROOT_PASSWORD=P@ssw0rd! + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-pP@ssw0rd!"] + timeout: 20s + retries: 10 + interval: 5s + start_period: 30s + networks: + - wings-network + +networks: + wings-network: + driver: bridge