Skip to content

Commit

Permalink
Merge pull request #114 from cloud-bulldozer/revamp
Browse files Browse the repository at this point in the history
Merging revamp into main
  • Loading branch information
vishnuchalla authored Sep 3, 2024
2 parents 8379169 + e9d79cb commit 36d6a32
Show file tree
Hide file tree
Showing 140 changed files with 16,812 additions and 2,457 deletions.
21 changes: 21 additions & 0 deletions frontend/.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 },
],
},
}
128 changes: 17 additions & 111 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,129 +1,35 @@
yarn.lock

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
package-lock.json
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/
package-lock.json

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist
dist-ssr
*.local

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
81 changes: 38 additions & 43 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,67 @@
# frontend

## Development in a container
# Openshift Performance Dashbaord

## Dashboard directory structure

### [`src`](src/)

## Available Scripts
The CPT Dashboard Javascript source plus additional CSS/LESS and artifacts.

In the project directory, you can run:
#### [`src/assets`](src/assets/)

### `yarn start`
Assets placed in the `src/assets/images` directory are only referenced within component or layout definitions and are packaged in the generated `***.js` file during the build process.

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
#### [`src/modules`](src/modules/)

The page will reload if you make edits.\
You will also see any lint errors in the console.
`modules` directory has all containers (patent layouts) and components (react components).

### `yarn test`
#### [`src/utils`](src/utils/)

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
The `utils` directory has all helper/utility scripts.

### `yarn build`
#### [`src/reducers`](src/reducers)

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.
Contains functions that manage store via actions

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!
## Cloning and Running the Application Locally

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
- Install [Node.js](https://nodejs.org)
- Clone the [CPT Dashboard code](https://github.com/cloud-bulldozer/cpt-dashboard) to a local file system
- Install all the npm packages

### `yarn eject`
Type the following command to install all npm packages

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
```bash
$ npm install
```

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
In order to run the application use the following command

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
```bash
$ npm run dev
```

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
The application runs on http://localhost:3000 in the default browser.

## Learn More
## Build

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To build the application run the following command

To learn React, check out the [React documentation](https://reactjs.org/).
```bash
$ npm run build
```
This will generate the `build` folder in the root directory, which contains packaged files such as `***.js`, `***.css`, and `index.html`.

### Code Splitting
Then, copy the `build` folder to the proper place on the server for deployment.

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
## Template

### Analyzing the Bundle Size
This application is based on v5 of PatternFly which is a production-ready UI solution for admin interfaces. For more information regarding the foundation and template of the application, please visit [PatternFly](https://www.patternfly.org/get-started/develop)

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
## Resources

### Making a Progressive Web App
- [Vite](https://vitejs.dev/guide/)

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
- [ReactJS](https://reactjs.org/)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `yarn build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
- [React-Redux](https://github.com/reduxjs/react-redux)
31 changes: 12 additions & 19 deletions frontend/frontend.containerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
# pull official base image
FROM docker.io/library/node:16.20.2-alpine3.18

RUN mkdir /app


COPY . /app
WORKDIR /app

RUN yarn install
RUN yarn add react-scripts
ENV PATH="${PATH}:/app/node_modules/.bin/react-scripts"

FROM node:18
# Create app directory
WORKDIR /usr/src/cpt-dashboard
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
RUN npm install
#To bundle your app’s source code inside the Docker image, use the COPY instruction:
COPY . .
#Your app binds to port 3000 so you’ll use the EXPOSE instruction to have it mapped by the docker daemon:
EXPOSE 3000

RUN chown -R node /app
USER node

# start app
CMD ["yarn", "run", "start"]
CMD ["npm", "run", "dev"]
16 changes: 16 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">

<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OpenShift Performance and Scale - CI Dashboard</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>

</html>
11 changes: 11 additions & 0 deletions frontend/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"baseUrl": "src",
"paths": {
"*": [
"src/*"
]
}
}
}

Loading

0 comments on commit 36d6a32

Please sign in to comment.