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

chore(Amplication): Update Generated Code #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions apps/titiksha-agrawal-admin/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.dockerignore
docker-compose.yml
Dockerfile
build/
node_modules
.env
.gitignore
2 changes: 2 additions & 0 deletions apps/titiksha-agrawal-admin/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PORT=3001
REACT_APP_SERVER_URL=http://localhost:3000
23 changes: 23 additions & 0 deletions apps/titiksha-agrawal-admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
51 changes: 51 additions & 0 deletions apps/titiksha-agrawal-admin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# multi-stage: base (build)
FROM node:18.13.0-slim AS base

# instantiate environment variable
ARG REACT_APP_SERVER_URL=http://localhost:3000

# set the environment variable that points to the server
ENV REACT_APP_SERVER_URL=$REACT_APP_SERVER_URL

# create directory where the application will be built
WORKDIR /app

# copy over the dependency manifests, both the package.json
# and the package-lock.json are copied over
COPY package*.json ./

# installs packages and their dependencies
RUN npm install

# copy over the code base
COPY . .

# create the bundle of the application
RUN npm run build

# multi-stage: production (runtime)
FROM nginx:1.22-alpine AS production

# copy over the bundled code from the build stage
COPY --from=base /app/build /usr/share/nginx/html
COPY --from=base /app/configuration/nginx.conf /etc/nginx/conf.d/default.conf

# create a new process indication file
RUN touch /var/run/nginx.pid

# change ownership of nginx related directories and files
RUN chown -R nginx:nginx /var/run/nginx.pid \
/usr/share/nginx/html \
/var/cache/nginx \
/var/log/nginx \
/etc/nginx/conf.d

# set user to the created non-privileged user
USER nginx

# expose a specific port on the docker container
ENV PORT=80
EXPOSE ${PORT}

# start the server using the previously build application
ENTRYPOINT [ "nginx", "-g", "daemon off;" ]
47 changes: 47 additions & 0 deletions apps/titiksha-agrawal-admin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<p align="right">
<a href="https://amplication.com" target="_blank">
<img alt="amplication-logo" height="70" alt="Amplication Logo" src="https://amplication.com/images/amplication-logo-purple.svg"/>
</a>
</p>

# Introduction

This service was generated with Amplication. It serves as the client-side for the generated server component. The client-side consist of a React application with ready-made forms for creating and editing the different data models of the application. It is pre-conffigured to work with the server and comes with the boilerplate and foundation for the client - i.e., routing, navigation, authentication, permissions, menu, breadcrumbs, error handling and much more. Additional information about the admin component and the architecture around it, can be found on the [documentation](https://docs.amplication.com/guides/getting-started) site. This side of the generated project was bootstrapped with [create-react-app](https://github.com/facebook/create-react-app) and built with [react-admin](https://marmelab.com/react-admin/).


<p align="center">
<img src="https://d33wubrfki0l68.cloudfront.net/2615bedd21c48089ab38a099bad9638b28879511/091b4/assets/images/admin-ui-9b6590728393d532ad798e9dc14138ac.png" width="700px">
</p>

# Getting started

## Step 1: Configuration

Configuration for the client component can be provided through the use of environment variables. These can be passed to the application via the use of the `.env` file in the base directory of the generated service. Below a table can be found which show the different variables that can be passed. These values are provided default values after generation, change them to the desired values.

| Variable | Description | Value |
| -------------------- | ------------------------------------------------ | ------------------------------ |
| PORT | the port on which to run the client | 3001 |
| REACT_APP_SERVER_URL | the url on which the server component is running | http://localhost:[server-port] |

> **Note**
> Amplication generates default values and stores them under the .env file. It is advised to use some form of secrets manager/vault solution when using in production.


## Step 2: Scripts

After configuration of the client the next step would be to run the application. Before running the client side of the component, make sure that the different pre-requisites are met - i.e., npm, docker. Make sure that the server-side of the application is running.

```sh
# installation of the dependencies
$ npm install

# starts the application in development mode - available by default under http://localhost:3001 with a pre-configured user with the username "admin" and password "admin"
$ npm run start

# builds the application in production mode - available under 'build'
$ npm run build

# removes the single build dependency from the project
$ npm run eject
```
11 changes: 11 additions & 0 deletions apps/titiksha-agrawal-admin/configuration/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
server_tokens off;

server {
listen 8080;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}
}
60 changes: 60 additions & 0 deletions apps/titiksha-agrawal-admin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "@titiksha-agrawal/admin",
"private": true,
"dependencies": {
"@apollo/client": "3.6.9",
"@material-ui/core": "4.12.4",
"graphql": "15.6.1",
"lodash": "4.17.21",
"pluralize": "8.0.0",
"ra-data-graphql-amplication": "0.0.14",
"react": "16.14.0",
"react-admin": "3.19.12",
"react-dom": "16.14.0",
"react-scripts": "5.0.0",
"sass": "^1.39.0",
"web-vitals": "1.1.2"
},
"overrides": {
"react-scripts": {
"@svgr/webpack": "6.5.1"
}
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"package:container": "docker build ."
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@testing-library/jest-dom": "5.14.1",
"@testing-library/react": "11.2.7",
"@testing-library/user-event": "13.2.0",
"@types/jest": "26.0.16",
"@types/lodash": "4.14.178",
"@types/node": "12.20.16",
"@types/react": "16.14.11",
"@types/react-dom": "17.0.0",
"type-fest": "0.13.1",
"typescript": "4.3.5"
}
}
Binary file added apps/titiksha-agrawal-admin/public/favicon.ico
Binary file not shown.
40 changes: 40 additions & 0 deletions apps/titiksha-agrawal-admin/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Sample service for e-commerce" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>TitikshaAgrawal</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file added apps/titiksha-agrawal-admin/public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/titiksha-agrawal-admin/public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions apps/titiksha-agrawal-admin/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "TitikshaAgrawal",
"name": "TitikshaAgrawal",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
3 changes: 3 additions & 0 deletions apps/titiksha-agrawal-admin/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
59 changes: 59 additions & 0 deletions apps/titiksha-agrawal-admin/src/App.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// .App {
// .MuiAppBar-colorSecondary {
// background-color: black;

// .RaAppBar-menuButton-13 {
// background-color: yellow;
// }
// }

// .MuiDrawer-paper {
// background-color: red;

// .MuiListItemIcon-root {
// color: white;
// }
// }

// .MuiButton-textPrimary {
// background-color: purple;
// margin: 0 0.5rem;
// color: white;
// padding: 0.5rem 1rem;

// &:hover {
// background-color: blue;
// }
// }

// .MuiTableRow-head {
// .MuiTableCell-head {
// background-color: black;
// color: white;
// }

// .MuiTableSortLabel-root {
// &:hover {
// color: red;

// .MuiTableSortLabel-icon {
// color: red !important;
// }
// }
// .MuiTableSortLabel-icon {
// color: white !important;
// }
// }
// .MuiTableSortLabel-active {
// color: green;

// .MuiTableSortLabel-icon {
// color: green !important;
// }
// }
// }

// .MuiFormLabel-root {
// color: magenta;
// }
// }
Loading