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

Amplication build h0gi8dfu #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 admin-ui/.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 admin-ui/.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 admin-ui/.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 admin-ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM node:16.16 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;"]
55 changes: 55 additions & 0 deletions admin-ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@sample-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"
},
"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 admin-ui/public/favicon.ico
Binary file not shown.
40 changes: 40 additions & 0 deletions admin-ui/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>Sample 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 admin-ui/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 admin-ui/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 admin-ui/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "Sample service",
"name": "Sample 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 admin-ui/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 admin-ui/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 admin-ui/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={"Sample 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;
10 changes: 10 additions & 0 deletions admin-ui/src/Components/Pagination.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
import { Pagination as RAPagination, PaginationProps } from "react-admin";

const PAGINATION_OPTIONS = [10, 25, 50, 100, 200];

const Pagination = (props: PaginationProps) => (
<RAPagination rowsPerPageOptions={PAGINATION_OPTIONS} {...props} />
);

export default Pagination;
Loading