Skip to content
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 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;"]
47 changes: 47 additions & 0 deletions admin-ui/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/).
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": "@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"
},
"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="" />
<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 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": "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 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;
// }
// }
61 changes: 61 additions & 0 deletions admin-ui/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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 { CommodityList } from "./commodity/CommodityList";
import { CommodityCreate } from "./commodity/CommodityCreate";
import { CommodityEdit } from "./commodity/CommodityEdit";
import { CommodityShow } from "./commodity/CommodityShow";
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="Commodity"
list={CommodityList}
edit={CommodityEdit}
create={CommodityCreate}
show={CommodityShow}
/>
</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