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

Initial Commit (Amplication build 5imbu59w) #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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 7 additions & 0 deletions apps/my-service-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/my-service-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/my-service-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*
23 changes: 23 additions & 0 deletions apps/my-service-admin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:18.12.1 AS base

ARG REACT_APP_SERVER_URL

ENV REACT_APP_SERVER_URL=$REACT_APP_SERVER_URL

WORKDIR /app

COPY package.json package-lock.json ./

RUN npm ci

COPY . .

RUN npm run build

FROM nginx:stable-alpine AS prod

COPY --from=base /app/build /usr/share/nginx/html

EXPOSE 80

ENTRYPOINT ["nginx", "-g", "daemon off;"]
47 changes: 47 additions & 0 deletions apps/my-service-admin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Amplication

This app was generated with Amplication.
You can learn more in the [Amplication documentation](https://docs.amplication.com/guides/getting-started).

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), and built with [react-admin](https://marmelab.com/react-admin/)

## Environment Variables

| Environment | Description | Value |
| -------------------- | ------------------------------------------- | --------------------- |
| PORT | The port that the client UI is listening to |
| REACT_APP_SERVER_URL | Amplication Server URL | http://localhost:3000 |

## Available Scripts

In the `admin-ui` subdirectory, you can run:

### `yarn start`

Runs the app in development mode.

Open [http://localhost:3001](http://localhost:3001) to view it in the browser.

### `yarn test`

Runs tests to make sure everything is working correctly.

### `yarn build`

Builds the app for production in the `build` folder.

### `yarn eject`

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

Ejects the Create React App. [Click here for more info](https://create-react-app.dev/docs/available-scripts/#npm-run-eject).

### `docker:build`

Build the Admin-UI Docker image.

## Learn More

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

To learn React, check out the [React documentation](https://reactjs.org/).
60 changes: 60 additions & 0 deletions apps/my-service-admin/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "@my-service/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.13",
"react": "16.14.0",
"react-admin": "3.19.11",
"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",
"docker:build": "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.2.4"
}
}
Binary file added apps/my-service-admin/public/favicon.ico
Binary file not shown.
40 changes: 40 additions & 0 deletions apps/my-service-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>my-service</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/my-service-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/my-service-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/my-service-admin/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "my-service",
"name": "my-service",
"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/my-service-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/my-service-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;
// }
// }
94 changes: 94 additions & 0 deletions apps/my-service-admin/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import React, { useEffect, useState } from "react";
import { Admin, DataProvider, Resource } from "react-admin";
import buildGraphQLProvider from "./data-provider/graphqlDataProvider";
import { theme } from "./theme/theme";
import Login from "./Login";
import "./App.scss";
import Dashboard from "./pages/Dashboard";
import { UserList } from "./user/UserList";
import { UserCreate } from "./user/UserCreate";
import { UserEdit } from "./user/UserEdit";
import { UserShow } from "./user/UserShow";
import { OrderList } from "./order/OrderList";
import { OrderCreate } from "./order/OrderCreate";
import { OrderEdit } from "./order/OrderEdit";
import { OrderShow } from "./order/OrderShow";
import { CustomerList } from "./customer/CustomerList";
import { CustomerCreate } from "./customer/CustomerCreate";
import { CustomerEdit } from "./customer/CustomerEdit";
import { CustomerShow } from "./customer/CustomerShow";
import { AddressList } from "./address/AddressList";
import { AddressCreate } from "./address/AddressCreate";
import { AddressEdit } from "./address/AddressEdit";
import { AddressShow } from "./address/AddressShow";
import { ProductList } from "./product/ProductList";
import { ProductCreate } from "./product/ProductCreate";
import { ProductEdit } from "./product/ProductEdit";
import { ProductShow } from "./product/ProductShow";
import { jwtAuthProvider } from "./auth-provider/ra-auth-jwt";

const App = (): React.ReactElement => {
const [dataProvider, setDataProvider] = useState<DataProvider | null>(null);
useEffect(() => {
buildGraphQLProvider
.then((provider: any) => {
setDataProvider(() => provider);
})
.catch((error: any) => {
console.log(error);
});
}, []);
if (!dataProvider) {
return <div>Loading</div>;
}
return (
<div className="App">
<Admin
title={"my-service"}
dataProvider={dataProvider}
authProvider={jwtAuthProvider}
theme={theme}
dashboard={Dashboard}
loginPage={Login}
>
<Resource
name="User"
list={UserList}
edit={UserEdit}
create={UserCreate}
show={UserShow}
/>
<Resource
name="Order"
list={OrderList}
edit={OrderEdit}
create={OrderCreate}
show={OrderShow}
/>
<Resource
name="Customer"
list={CustomerList}
edit={CustomerEdit}
create={CustomerCreate}
show={CustomerShow}
/>
<Resource
name="Address"
list={AddressList}
edit={AddressEdit}
create={AddressCreate}
show={AddressShow}
/>
<Resource
name="Product"
list={ProductList}
edit={ProductEdit}
create={ProductCreate}
show={ProductShow}
/>
</Admin>
</div>
);
};

export default App;
Loading