Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index Page to Groundwork/React #658

Draft
wants to merge 16 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions cwms-data-api/src/main/webapp-src/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
24 changes: 24 additions & 0 deletions cwms-data-api/src/main/webapp-src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
22 changes: 22 additions & 0 deletions cwms-data-api/src/main/webapp-src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# CDA Landing Page Source
*The React+Vite project for CDA*


To run the project in dev:
`npm run dev`

To build the project:
`npm run build`
*NOTE*: Building the project will also deploy it to the required tomcat webapps directory `webapp`

To see the available scripts for this project, including how to run and deploy, look at the `package.json` file.

## Extra Notes
*Paths are relative to project root*
* **Swagger Usage Locally:** Running NPM dev launches a local vite dev server that lets you test the components/web interface locally on your system. Depending on how you setup SwaggerUI in the `./pages/swagger-ui/index.jsx` will change whether or not it is able to grab data on your local test instance. (i.e. you'd need CDA running locally and answering on `./swagger-docs` for this to work)
* **Building WAR with new Web Interface:** In order to add your `npm run build` to the war you will have to:
* Run `npm run build` from `./cwms-data-api/src/main/webapp-src`
* Delete the old contents from the last web deploy i.e. `./cwms-data-api/src/main/webapp/assets`
* Copy the contents of `./cwms-data-api/src/main/webapp-src/dist` to `./cwms-data-api/src/main/webapp`
* Deploy war as normal from here

14 changes: 14 additions & 0 deletions cwms-data-api/src/main/webapp-src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CDA - CWMS Data API</title>
<meta name="Description" content="CDA CWMS Data API" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading
Loading