diff --git a/admin-ui/.dockerignore b/admin-ui/.dockerignore deleted file mode 100644 index 1194b4f..0000000 --- a/admin-ui/.dockerignore +++ /dev/null @@ -1,7 +0,0 @@ -.dockerignore -docker-compose.yml -Dockerfile -build/ -node_modules -.env -.gitignore diff --git a/admin-ui/.env b/admin-ui/.env deleted file mode 100644 index 4eef91c..0000000 --- a/admin-ui/.env +++ /dev/null @@ -1,2 +0,0 @@ -PORT=3001 -REACT_APP_SERVER_URL=http://localhost:3000 \ No newline at end of file diff --git a/admin-ui/.gitignore b/admin-ui/.gitignore deleted file mode 100644 index 590b2e0..0000000 --- a/admin-ui/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -# 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* diff --git a/admin-ui/Dockerfile b/admin-ui/Dockerfile deleted file mode 100644 index 9c43e40..0000000 --- a/admin-ui/Dockerfile +++ /dev/null @@ -1,51 +0,0 @@ -# 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;" ] diff --git a/admin-ui/README.md b/admin-ui/README.md deleted file mode 100644 index 03abb2a..0000000 --- a/admin-ui/README.md +++ /dev/null @@ -1,47 +0,0 @@ -

- - amplication-logo - -

- -# 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/). - - -

- -

- -# 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 -``` diff --git a/admin-ui/configuration/nginx.conf b/admin-ui/configuration/nginx.conf deleted file mode 100644 index 88dad6e..0000000 --- a/admin-ui/configuration/nginx.conf +++ /dev/null @@ -1,11 +0,0 @@ -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; - } -} \ No newline at end of file diff --git a/admin-ui/package.json b/admin-ui/package.json deleted file mode 100644 index 576a781..0000000 --- a/admin-ui/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "@record/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" - } -} \ No newline at end of file diff --git a/admin-ui/public/favicon.ico b/admin-ui/public/favicon.ico deleted file mode 100644 index fcbdcf2..0000000 Binary files a/admin-ui/public/favicon.ico and /dev/null differ diff --git a/admin-ui/public/index.html b/admin-ui/public/index.html deleted file mode 100644 index 2bbf9af..0000000 --- a/admin-ui/public/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - Record - - - -
- - - diff --git a/admin-ui/public/logo192.png b/admin-ui/public/logo192.png deleted file mode 100644 index 1918ff2..0000000 Binary files a/admin-ui/public/logo192.png and /dev/null differ diff --git a/admin-ui/public/logo512.png b/admin-ui/public/logo512.png deleted file mode 100644 index 7e7dc74..0000000 Binary files a/admin-ui/public/logo512.png and /dev/null differ diff --git a/admin-ui/public/manifest.json b/admin-ui/public/manifest.json deleted file mode 100644 index a9acc14..0000000 --- a/admin-ui/public/manifest.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "short_name": "Record", - "name": "Record", - "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" -} \ No newline at end of file diff --git a/admin-ui/public/robots.txt b/admin-ui/public/robots.txt deleted file mode 100644 index e9e57dc..0000000 --- a/admin-ui/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# https://www.robotstxt.org/robotstxt.html -User-agent: * -Disallow: diff --git a/admin-ui/src/App.scss b/admin-ui/src/App.scss deleted file mode 100644 index 4c1cbb0..0000000 --- a/admin-ui/src/App.scss +++ /dev/null @@ -1,59 +0,0 @@ -// .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; -// } -// } diff --git a/admin-ui/src/App.tsx b/admin-ui/src/App.tsx deleted file mode 100644 index 9267aa2..0000000 --- a/admin-ui/src/App.tsx +++ /dev/null @@ -1,50 +0,0 @@ -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 { jwtAuthProvider } from "./auth-provider/ra-auth-jwt"; - -const App = (): React.ReactElement => { - const [dataProvider, setDataProvider] = useState(null); - useEffect(() => { - buildGraphQLProvider - .then((provider: any) => { - setDataProvider(() => provider); - }) - .catch((error: any) => { - console.log(error); - }); - }, []); - if (!dataProvider) { - return
Loading
; - } - return ( -
- - - -
- ); -}; - -export default App; diff --git a/admin-ui/src/Components/Pagination.tsx b/admin-ui/src/Components/Pagination.tsx deleted file mode 100644 index 2de2ebf..0000000 --- a/admin-ui/src/Components/Pagination.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from "react"; -import { Pagination as RAPagination, PaginationProps } from "react-admin"; - -const PAGINATION_OPTIONS = [10, 25, 50, 100, 200]; - -const Pagination = (props: PaginationProps) => ( - -); - -export default Pagination; diff --git a/admin-ui/src/Login.tsx b/admin-ui/src/Login.tsx deleted file mode 100644 index f7ec8ed..0000000 --- a/admin-ui/src/Login.tsx +++ /dev/null @@ -1,117 +0,0 @@ -import * as React from "react"; -import { useState } from "react"; -import { useLogin, useNotify, Notification, defaultTheme } from "react-admin"; -import { ThemeProvider } from "@material-ui/styles"; -import { createTheme } from "@material-ui/core/styles"; -import { Button } from "@material-ui/core"; -import "./login.scss"; - -const CLASS_NAME = "login-page"; - -const Login = ({ theme }: any) => { - const [username, setUsername] = useState(""); - const [password, setPassword] = useState(""); - const login = useLogin(); - const notify = useNotify(); - const BASE_URI = process.env.REACT_APP_SERVER_URL; - const submit = (e: any) => { - e.preventDefault(); - login({ username, password }).catch(() => - notify("Invalid username or password") - ); - }; - - return ( - -
-
-
- GraphQL API -

Connect via GraphQL

-
- Connect to the server using GraphQL API with a complete and - understandable description of the data in your API -
- -
-
- React-Admin -

Admin UI

-
- Sign in to a React-Admin client with ready-made forms for creating - and editing all the data models of your application -
-
- - - -
-
-
- REST API -

Connect via REST API

-
- Connect to the server using REST API with a built-in Swagger - documentation -
- -
- - -
-
- Read - - Amplication docs - - to learn more -
-
-
- ); -}; - -export default Login; diff --git a/admin-ui/src/api/user/CreateUserArgs.ts b/admin-ui/src/api/user/CreateUserArgs.ts deleted file mode 100644 index 2a56f0c..0000000 --- a/admin-ui/src/api/user/CreateUserArgs.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { UserCreateInput } from "./UserCreateInput"; - -export type CreateUserArgs = { - data: UserCreateInput; -}; diff --git a/admin-ui/src/api/user/DeleteUserArgs.ts b/admin-ui/src/api/user/DeleteUserArgs.ts deleted file mode 100644 index 5f655b8..0000000 --- a/admin-ui/src/api/user/DeleteUserArgs.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { UserWhereUniqueInput } from "./UserWhereUniqueInput"; - -export type DeleteUserArgs = { - where: UserWhereUniqueInput; -}; diff --git a/admin-ui/src/api/user/UpdateUserArgs.ts b/admin-ui/src/api/user/UpdateUserArgs.ts deleted file mode 100644 index 30e635e..0000000 --- a/admin-ui/src/api/user/UpdateUserArgs.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { UserWhereUniqueInput } from "./UserWhereUniqueInput"; -import { UserUpdateInput } from "./UserUpdateInput"; - -export type UpdateUserArgs = { - where: UserWhereUniqueInput; - data: UserUpdateInput; -}; diff --git a/admin-ui/src/api/user/User.ts b/admin-ui/src/api/user/User.ts deleted file mode 100644 index 9c53564..0000000 --- a/admin-ui/src/api/user/User.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { JsonValue } from "type-fest"; - -export type User = { - createdAt: Date; - firstName: string | null; - id: string; - lastName: string | null; - roles: JsonValue; - updatedAt: Date; - username: string; -}; diff --git a/admin-ui/src/api/user/UserCountArgs.ts b/admin-ui/src/api/user/UserCountArgs.ts deleted file mode 100644 index b300ec3..0000000 --- a/admin-ui/src/api/user/UserCountArgs.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { UserWhereInput } from "./UserWhereInput"; - -export type UserCountArgs = { - where?: UserWhereInput; -}; diff --git a/admin-ui/src/api/user/UserCreateInput.ts b/admin-ui/src/api/user/UserCreateInput.ts deleted file mode 100644 index e53c277..0000000 --- a/admin-ui/src/api/user/UserCreateInput.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { InputJsonValue } from "../../types"; - -export type UserCreateInput = { - firstName?: string | null; - lastName?: string | null; - password: string; - roles: InputJsonValue; - username: string; -}; diff --git a/admin-ui/src/api/user/UserFindManyArgs.ts b/admin-ui/src/api/user/UserFindManyArgs.ts deleted file mode 100644 index b453f3e..0000000 --- a/admin-ui/src/api/user/UserFindManyArgs.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { UserWhereInput } from "./UserWhereInput"; -import { UserOrderByInput } from "./UserOrderByInput"; - -export type UserFindManyArgs = { - where?: UserWhereInput; - orderBy?: Array; - skip?: number; - take?: number; -}; diff --git a/admin-ui/src/api/user/UserFindUniqueArgs.ts b/admin-ui/src/api/user/UserFindUniqueArgs.ts deleted file mode 100644 index 97d18e8..0000000 --- a/admin-ui/src/api/user/UserFindUniqueArgs.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { UserWhereUniqueInput } from "./UserWhereUniqueInput"; - -export type UserFindUniqueArgs = { - where: UserWhereUniqueInput; -}; diff --git a/admin-ui/src/api/user/UserListRelationFilter.ts b/admin-ui/src/api/user/UserListRelationFilter.ts deleted file mode 100644 index 4c4d06e..0000000 --- a/admin-ui/src/api/user/UserListRelationFilter.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { UserWhereInput } from "./UserWhereInput"; - -export type UserListRelationFilter = { - every?: UserWhereInput; - some?: UserWhereInput; - none?: UserWhereInput; -}; diff --git a/admin-ui/src/api/user/UserOrderByInput.ts b/admin-ui/src/api/user/UserOrderByInput.ts deleted file mode 100644 index 36cee1e..0000000 --- a/admin-ui/src/api/user/UserOrderByInput.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { SortOrder } from "../../util/SortOrder"; - -export type UserOrderByInput = { - createdAt?: SortOrder; - firstName?: SortOrder; - id?: SortOrder; - lastName?: SortOrder; - password?: SortOrder; - roles?: SortOrder; - updatedAt?: SortOrder; - username?: SortOrder; -}; diff --git a/admin-ui/src/api/user/UserUpdateInput.ts b/admin-ui/src/api/user/UserUpdateInput.ts deleted file mode 100644 index f5ee977..0000000 --- a/admin-ui/src/api/user/UserUpdateInput.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { InputJsonValue } from "../../types"; - -export type UserUpdateInput = { - firstName?: string | null; - lastName?: string | null; - password?: string; - roles?: InputJsonValue; - username?: string; -}; diff --git a/admin-ui/src/api/user/UserWhereInput.ts b/admin-ui/src/api/user/UserWhereInput.ts deleted file mode 100644 index 22c10cb..0000000 --- a/admin-ui/src/api/user/UserWhereInput.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { StringNullableFilter } from "../../util/StringNullableFilter"; -import { StringFilter } from "../../util/StringFilter"; - -export type UserWhereInput = { - firstName?: StringNullableFilter; - id?: StringFilter; - lastName?: StringNullableFilter; - username?: StringFilter; -}; diff --git a/admin-ui/src/api/user/UserWhereUniqueInput.ts b/admin-ui/src/api/user/UserWhereUniqueInput.ts deleted file mode 100644 index 309d343..0000000 --- a/admin-ui/src/api/user/UserWhereUniqueInput.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type UserWhereUniqueInput = { - id: string; -}; diff --git a/admin-ui/src/auth-provider/ra-auth-http.ts b/admin-ui/src/auth-provider/ra-auth-http.ts deleted file mode 100644 index c6eeba8..0000000 --- a/admin-ui/src/auth-provider/ra-auth-http.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { gql } from "@apollo/client/core"; -import { AuthProvider } from "react-admin"; -import { - CREDENTIALS_LOCAL_STORAGE_ITEM, - USER_DATA_LOCAL_STORAGE_ITEM, -} from "../constants"; -import { Credentials, LoginMutateResult } from "../types"; -import { apolloClient } from "../data-provider/graphqlDataProvider"; - -const LOGIN = gql` - mutation login($username: String!, $password: String!) { - login(credentials: { username: $username, password: $password }) { - username - roles - } - } -`; - -export const httpAuthProvider: AuthProvider = { - login: async (credentials: Credentials) => { - const userData = await apolloClient.mutate({ - mutation: LOGIN, - variables: { - ...credentials, - }, - }); - - if (userData && userData.data?.login.username) { - localStorage.setItem( - CREDENTIALS_LOCAL_STORAGE_ITEM, - createBasicAuthorizationHeader( - credentials.username, - credentials.password - ) - ); - localStorage.setItem( - USER_DATA_LOCAL_STORAGE_ITEM, - JSON.stringify(userData.data) - ); - return Promise.resolve(); - } - return Promise.reject(); - }, - logout: () => { - localStorage.removeItem(CREDENTIALS_LOCAL_STORAGE_ITEM); - return Promise.resolve(); - }, - checkError: ({ status }: any) => { - if (status === 401 || status === 403) { - localStorage.removeItem(CREDENTIALS_LOCAL_STORAGE_ITEM); - return Promise.reject(); - } - return Promise.resolve(); - }, - checkAuth: () => { - return localStorage.getItem(CREDENTIALS_LOCAL_STORAGE_ITEM) - ? Promise.resolve() - : Promise.reject(); - }, - getPermissions: () => Promise.reject("Unknown method"), - getIdentity: () => { - const str = localStorage.getItem(USER_DATA_LOCAL_STORAGE_ITEM); - const userData: LoginMutateResult = JSON.parse(str || ""); - - return Promise.resolve({ - id: userData.login.username, - fullName: userData.login.username, - avatar: undefined, - }); - }, -}; - -function createBasicAuthorizationHeader( - username: string, - password: string -): string { - return `Basic ${btoa(`${username}:${password}`)}`; -} diff --git a/admin-ui/src/auth-provider/ra-auth-jwt.ts b/admin-ui/src/auth-provider/ra-auth-jwt.ts deleted file mode 100644 index c8bcafc..0000000 --- a/admin-ui/src/auth-provider/ra-auth-jwt.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { gql } from "@apollo/client/core"; -import { AuthProvider } from "react-admin"; -import { - CREDENTIALS_LOCAL_STORAGE_ITEM, - USER_DATA_LOCAL_STORAGE_ITEM, -} from "../constants"; -import { Credentials, LoginMutateResult } from "../types"; -import { apolloClient } from "../data-provider/graphqlDataProvider"; - -const LOGIN = gql` - mutation login($username: String!, $password: String!) { - login(credentials: { username: $username, password: $password }) { - username - accessToken - } - } -`; - -export const jwtAuthProvider: AuthProvider = { - login: async (credentials: Credentials) => { - const userData = await apolloClient.mutate({ - mutation: LOGIN, - variables: { - ...credentials, - }, - }); - - if (userData && userData.data?.login.username) { - localStorage.setItem( - CREDENTIALS_LOCAL_STORAGE_ITEM, - createBearerAuthorizationHeader(userData.data.login?.accessToken) - ); - localStorage.setItem( - USER_DATA_LOCAL_STORAGE_ITEM, - JSON.stringify(userData.data) - ); - return Promise.resolve(); - } - return Promise.reject(); - }, - logout: () => { - localStorage.removeItem(CREDENTIALS_LOCAL_STORAGE_ITEM); - return Promise.resolve(); - }, - checkError: ({ status }: any) => { - if (status === 401 || status === 403) { - localStorage.removeItem(CREDENTIALS_LOCAL_STORAGE_ITEM); - return Promise.reject(); - } - return Promise.resolve(); - }, - checkAuth: () => { - return localStorage.getItem(CREDENTIALS_LOCAL_STORAGE_ITEM) - ? Promise.resolve() - : Promise.reject(); - }, - getPermissions: () => Promise.reject("Unknown method"), - getIdentity: () => { - const str = localStorage.getItem(USER_DATA_LOCAL_STORAGE_ITEM); - const userData: LoginMutateResult = JSON.parse(str || ""); - - return Promise.resolve({ - id: userData.login.username, - fullName: userData.login.username, - avatar: undefined, - }); - }, -}; - -export function createBearerAuthorizationHeader(accessToken: string) { - return `Bearer ${accessToken}`; -} diff --git a/admin-ui/src/auth.ts b/admin-ui/src/auth.ts deleted file mode 100644 index 498b026..0000000 --- a/admin-ui/src/auth.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { EventEmitter } from "events"; -import { CREDENTIALS_LOCAL_STORAGE_ITEM } from "./constants"; -import { Credentials } from "./types"; - -const eventEmitter = new EventEmitter(); - -export function isAuthenticated(): boolean { - return Boolean(getCredentials()); -} - -export function listen(listener: (authenticated: boolean) => void): void { - eventEmitter.on("change", () => { - listener(isAuthenticated()); - }); -} - -export function setCredentials(credentials: Credentials) { - localStorage.setItem( - CREDENTIALS_LOCAL_STORAGE_ITEM, - JSON.stringify(credentials) - ); -} - -export function getCredentials(): Credentials | null { - const raw = localStorage.getItem(CREDENTIALS_LOCAL_STORAGE_ITEM); - if (raw === null) { - return null; - } - return JSON.parse(raw); -} - -export function removeCredentials(): void { - localStorage.removeItem(CREDENTIALS_LOCAL_STORAGE_ITEM); -} diff --git a/admin-ui/src/constants.ts b/admin-ui/src/constants.ts deleted file mode 100644 index 4b3ca4b..0000000 --- a/admin-ui/src/constants.ts +++ /dev/null @@ -1,2 +0,0 @@ -export const CREDENTIALS_LOCAL_STORAGE_ITEM = "credentials"; -export const USER_DATA_LOCAL_STORAGE_ITEM = "userData"; diff --git a/admin-ui/src/data-provider/graphqlDataProvider.ts b/admin-ui/src/data-provider/graphqlDataProvider.ts deleted file mode 100644 index 3ec4466..0000000 --- a/admin-ui/src/data-provider/graphqlDataProvider.ts +++ /dev/null @@ -1,28 +0,0 @@ -import buildGraphQLProvider from "ra-data-graphql-amplication"; -import { ApolloClient, InMemoryCache, createHttpLink } from "@apollo/client"; -import { setContext } from "@apollo/client/link/context"; -import { CREDENTIALS_LOCAL_STORAGE_ITEM } from "../constants"; - -const httpLink = createHttpLink({ - uri: `${process.env.REACT_APP_SERVER_URL}/graphql`, -}); - -// eslint-disable-next-line @typescript-eslint/naming-convention -const authLink = setContext((_, { headers }) => { - const token = localStorage.getItem(CREDENTIALS_LOCAL_STORAGE_ITEM); - return { - headers: { - ...headers, - authorization: token ? token : "", - }, - }; -}); - -export const apolloClient = new ApolloClient({ - cache: new InMemoryCache(), - link: authLink.concat(httpLink), -}); - -export default buildGraphQLProvider({ - client: apolloClient, -}); diff --git a/admin-ui/src/index.css b/admin-ui/src/index.css deleted file mode 100644 index 8686848..0000000 --- a/admin-ui/src/index.css +++ /dev/null @@ -1,26 +0,0 @@ -body { - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", - "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", - sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -#root { - height: 100vh; -} - -code { - font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", - monospace; -} - -.amp-breadcrumbs { - padding: var(--default-spacing); -} - -.entity-id { - color: var(--primary); - text-decoration: underline; -} diff --git a/admin-ui/src/index.tsx b/admin-ui/src/index.tsx deleted file mode 100644 index 5e2de69..0000000 --- a/admin-ui/src/index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from "react"; -import ReactDOM from "react-dom"; -import "./index.css"; -// @ts-ignore -// eslint-disable-next-line import/no-unresolved -import App from "./App"; -import reportWebVitals from "./reportWebVitals"; - -ReactDOM.render( - - - , - document.getElementById("root") -); - -// If you want to start measuring performance in your app, pass a function -// to log results (for example: reportWebVitals(console.log)) -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); diff --git a/admin-ui/src/login.scss b/admin-ui/src/login.scss deleted file mode 100644 index 667d8d2..0000000 --- a/admin-ui/src/login.scss +++ /dev/null @@ -1,119 +0,0 @@ -:root { - --surface: #15192c; /*dark: black100 */ - --white: #15192c; /*dark: black100 */ - - --black100: #ffffff; /*dark: white */ - --black90: #b7bac7; /*dark: black10 */ - --black80: #a3a8b8; /*dark: black20 */ - --black60: #80869d; /*dark: black30 */ - --black40: #686f8c; /*dark: black40 */ - --black30: #515873; /*dark: black50 */ - --black20: #444b66; /*dark: black60 */ - --black10: #373d57; /*dark: black70 */ - --black5: #2c3249; /*dark: black80 */ - --black2: #22273c; /*dark: black90 */ - - --primary: #7950ed; -} - -.login-page { - height: 100vh; - width: 100%; - background-color: var(--surface); - color: var(--black100); - display: flex; - justify-content: center; - align-items: center; - flex-direction: column; - - &__wrapper { - display: flex; - align-items: stretch; - justify-content: center; - flex-direction: row; - } - - &__box { - text-align: center; - width: 340px; - background-color: var(--black2); - border-radius: var(--small-border-radius); - margin: 1rem; - padding: 1rem; - border: 1px solid var(--black10); - display: flex; - flex-direction: column; - align-items: center; - justify-content: stretch; - - h2 { - font-size: 18px; - } - img { - width: 48px; - } - - &__message { - color: var(--black80); - font-size: 14px; - line-height: 22px; - } - - button, - .MuiButton-contained { - box-sizing: border-box; - background-color: var(--primary); - width: 300px; - margin-top: 0.5rem; - margin-bottom: 1rem; - margin-top: auto; - &:hover, - &:active, - &:focus { - background-color: var(--primary); - } - } - } - - form { - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: center; - margin-top: 2rem; - - label { - span { - display: block; - text-align: left; - font-size: 12px; - color: var(--black60); - } - } - - input { - box-sizing: border-box; - background-color: var(--white); - border: 1px solid var(--black10); - padding: 0.5rem; - margin-bottom: 1rem; - outline: none; - border-radius: var(--small-border-radius); - width: 300px; - color: var(--black100); - &:hover, - &:active, - &:focus { - border: 1px solid var(--black100); - } - } - } - - &__read-more { - color: var(--black80); - a { - color: var(--black100); - text-decoration: none; - } - } -} diff --git a/admin-ui/src/pages/Dashboard.tsx b/admin-ui/src/pages/Dashboard.tsx deleted file mode 100644 index 39c4d18..0000000 --- a/admin-ui/src/pages/Dashboard.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as React from "react"; -import Card from "@material-ui/core/Card"; -import CardContent from "@material-ui/core/CardContent"; -import { Title } from "react-admin"; -const Dashboard = () => ( - - - <CardContent>Welcome</CardContent> - </Card> -); - -export default Dashboard; diff --git a/admin-ui/src/reportWebVitals.ts b/admin-ui/src/reportWebVitals.ts deleted file mode 100644 index 821a6cd..0000000 --- a/admin-ui/src/reportWebVitals.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ReportHandler } from "web-vitals"; - -const reportWebVitals = (onPerfEntry?: ReportHandler): void => { - if (onPerfEntry && onPerfEntry instanceof Function) { - void import("web-vitals").then( - ({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - } - ); - } -}; - -export default reportWebVitals; diff --git a/admin-ui/src/setupTests.ts b/admin-ui/src/setupTests.ts deleted file mode 100644 index 1dd407a..0000000 --- a/admin-ui/src/setupTests.ts +++ /dev/null @@ -1,5 +0,0 @@ -// jest-dom adds custom jest matchers for asserting on DOM nodes. -// allows you to do things like: -// expect(element).toHaveTextContent(/react/i) -// learn more: https://github.com/testing-library/jest-dom -import "@testing-library/jest-dom"; diff --git a/admin-ui/src/theme/theme.ts b/admin-ui/src/theme/theme.ts deleted file mode 100644 index 56a1153..0000000 --- a/admin-ui/src/theme/theme.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defaultTheme } from "react-admin"; -import { createTheme, ThemeOptions } from "@material-ui/core/styles"; -import { merge } from "lodash"; -import createPalette from "@material-ui/core/styles/createPalette"; - -const palette = createPalette( - merge({}, defaultTheme.palette, { - primary: { - main: "#20a4f3", - }, - secondary: { - main: "#7950ed", - }, - error: { - main: "#e93c51", - }, - warning: { - main: "#f6aa50", - }, - info: { - main: "#144bc1", - }, - success: { - main: "#31c587", - }, - }) -); - -const themeOptions: ThemeOptions = { - palette, -}; - -export const theme = createTheme(merge({}, defaultTheme, themeOptions)); diff --git a/admin-ui/src/types.ts b/admin-ui/src/types.ts deleted file mode 100644 index 45a457d..0000000 --- a/admin-ui/src/types.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { JsonValue } from "type-fest"; - -export type Credentials = { - username: string; - password: string; -}; -export type LoginMutateResult = { - login: { - username: string; - accessToken: string; - }; -}; -export type InputJsonValue = Omit<JsonValue, "null">; diff --git a/admin-ui/src/user/EnumRoles.ts b/admin-ui/src/user/EnumRoles.ts deleted file mode 100644 index 3df7048..0000000 --- a/admin-ui/src/user/EnumRoles.ts +++ /dev/null @@ -1,3 +0,0 @@ -export enum EnumRoles { - User = "user", -} diff --git a/admin-ui/src/user/RolesOptions.ts b/admin-ui/src/user/RolesOptions.ts deleted file mode 100644 index 2f12fcf..0000000 --- a/admin-ui/src/user/RolesOptions.ts +++ /dev/null @@ -1,12 +0,0 @@ -//@ts-ignore -import { ROLES } from "./roles"; - -declare interface Role { - name: string; - displayName: string; -} - -export const ROLES_OPTIONS = ROLES.map((role: Role) => ({ - value: role.name, - label: role.displayName, -})); diff --git a/admin-ui/src/user/UserCreate.tsx b/admin-ui/src/user/UserCreate.tsx deleted file mode 100644 index def7787..0000000 --- a/admin-ui/src/user/UserCreate.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import * as React from "react"; - -import { - Create, - SimpleForm, - CreateProps, - TextInput, - PasswordInput, - SelectArrayInput, -} from "react-admin"; - -import { ROLES_OPTIONS } from "../user/RolesOptions"; - -export const UserCreate = (props: CreateProps): React.ReactElement => { - return ( - <Create {...props}> - <SimpleForm> - <TextInput label="First Name" source="firstName" /> - <TextInput label="Last Name" source="lastName" /> - <PasswordInput label="Password" source="password" /> - <SelectArrayInput - source="roles" - choices={ROLES_OPTIONS} - optionText="label" - optionValue="value" - /> - <TextInput label="Username" source="username" /> - </SimpleForm> - </Create> - ); -}; diff --git a/admin-ui/src/user/UserEdit.tsx b/admin-ui/src/user/UserEdit.tsx deleted file mode 100644 index 8565bf9..0000000 --- a/admin-ui/src/user/UserEdit.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import * as React from "react"; -import { - Edit, - SimpleForm, - EditProps, - TextInput, - PasswordInput, - SelectArrayInput, -} from "react-admin"; -import { ROLES_OPTIONS } from "../user/RolesOptions"; - -export const UserEdit = (props: EditProps): React.ReactElement => { - return ( - <Edit {...props}> - <SimpleForm> - <TextInput label="First Name" source="firstName" /> - <TextInput label="Last Name" source="lastName" /> - <PasswordInput label="Password" source="password" /> - <SelectArrayInput - source="roles" - choices={ROLES_OPTIONS} - optionText="label" - optionValue="value" - /> - <TextInput label="Username" source="username" /> - </SimpleForm> - </Edit> - ); -}; diff --git a/admin-ui/src/user/UserList.tsx b/admin-ui/src/user/UserList.tsx deleted file mode 100644 index aa820f4..0000000 --- a/admin-ui/src/user/UserList.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import * as React from "react"; -import { List, Datagrid, ListProps, DateField, TextField } from "react-admin"; -import Pagination from "../Components/Pagination"; - -export const UserList = (props: ListProps): React.ReactElement => { - return ( - <List - {...props} - bulkActionButtons={false} - title={"Users"} - perPage={50} - pagination={<Pagination />} - > - <Datagrid rowClick="show"> - <DateField source="createdAt" label="Created At" /> - <TextField label="First Name" source="firstName" /> - <TextField label="ID" source="id" /> - <TextField label="Last Name" source="lastName" /> - <TextField label="Roles" source="roles" /> - <DateField source="updatedAt" label="Updated At" /> - <TextField label="Username" source="username" /> - </Datagrid> - </List> - ); -}; diff --git a/admin-ui/src/user/UserShow.tsx b/admin-ui/src/user/UserShow.tsx deleted file mode 100644 index dc33a5b..0000000 --- a/admin-ui/src/user/UserShow.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import * as React from "react"; -import { - Show, - SimpleShowLayout, - ShowProps, - DateField, - TextField, -} from "react-admin"; - -export const UserShow = (props: ShowProps): React.ReactElement => { - return ( - <Show {...props}> - <SimpleShowLayout> - <DateField source="createdAt" label="Created At" /> - <TextField label="First Name" source="firstName" /> - <TextField label="ID" source="id" /> - <TextField label="Last Name" source="lastName" /> - <TextField label="Roles" source="roles" /> - <DateField source="updatedAt" label="Updated At" /> - <TextField label="Username" source="username" /> - </SimpleShowLayout> - </Show> - ); -}; diff --git a/admin-ui/src/user/UserTitle.ts b/admin-ui/src/user/UserTitle.ts deleted file mode 100644 index 336f609..0000000 --- a/admin-ui/src/user/UserTitle.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { User as TUser } from "../api/user/User"; - -export const USER_TITLE_FIELD = "firstName"; - -export const UserTitle = (record: TUser): string => { - return record.firstName?.toString() || String(record.id); -}; diff --git a/admin-ui/src/user/roles.ts b/admin-ui/src/user/roles.ts deleted file mode 100644 index 732870a..0000000 --- a/admin-ui/src/user/roles.ts +++ /dev/null @@ -1,6 +0,0 @@ -export const ROLES = [ - { - name: "user", - displayName: "User", - }, -]; diff --git a/admin-ui/src/util/BooleanFilter.ts b/admin-ui/src/util/BooleanFilter.ts deleted file mode 100644 index a142d58..0000000 --- a/admin-ui/src/util/BooleanFilter.ts +++ /dev/null @@ -1,4 +0,0 @@ -export class BooleanFilter { - equals?: boolean; - not?: boolean; -} diff --git a/admin-ui/src/util/BooleanNullableFilter.ts b/admin-ui/src/util/BooleanNullableFilter.ts deleted file mode 100644 index b94aefc..0000000 --- a/admin-ui/src/util/BooleanNullableFilter.ts +++ /dev/null @@ -1,4 +0,0 @@ -export class BooleanNullableFilter { - equals?: boolean | null; - not?: boolean | null; -} diff --git a/admin-ui/src/util/DateTimeFilter.ts b/admin-ui/src/util/DateTimeFilter.ts deleted file mode 100644 index cd8d213..0000000 --- a/admin-ui/src/util/DateTimeFilter.ts +++ /dev/null @@ -1,10 +0,0 @@ -export class DateTimeFilter { - equals?: Date; - not?: Date; - in?: Date[]; - notIn?: Date[]; - lt?: Date; - lte?: Date; - gt?: Date; - gte?: Date; -} diff --git a/admin-ui/src/util/DateTimeNullableFilter.ts b/admin-ui/src/util/DateTimeNullableFilter.ts deleted file mode 100644 index 2f9c7b3..0000000 --- a/admin-ui/src/util/DateTimeNullableFilter.ts +++ /dev/null @@ -1,10 +0,0 @@ -export class DateTimeNullableFilter { - equals?: Date | null; - in?: Date[] | null; - notIn?: Date[] | null; - lt?: Date; - lte?: Date; - gt?: Date; - gte?: Date; - not?: Date; -} diff --git a/admin-ui/src/util/FloatFilter.ts b/admin-ui/src/util/FloatFilter.ts deleted file mode 100644 index 62aeb14..0000000 --- a/admin-ui/src/util/FloatFilter.ts +++ /dev/null @@ -1,10 +0,0 @@ -export class FloatFilter { - equals?: number; - in?: number[]; - notIn?: number[]; - lt?: number; - lte?: number; - gt?: number; - gte?: number; - not?: number; -} diff --git a/admin-ui/src/util/FloatNullableFilter.ts b/admin-ui/src/util/FloatNullableFilter.ts deleted file mode 100644 index d7bb163..0000000 --- a/admin-ui/src/util/FloatNullableFilter.ts +++ /dev/null @@ -1,10 +0,0 @@ -export class FloatNullableFilter { - equals?: number | null; - in?: number[] | null; - notIn?: number[] | null; - lt?: number; - lte?: number; - gt?: number; - gte?: number; - not?: number; -} diff --git a/admin-ui/src/util/IntFilter.ts b/admin-ui/src/util/IntFilter.ts deleted file mode 100644 index 3dc0221..0000000 --- a/admin-ui/src/util/IntFilter.ts +++ /dev/null @@ -1,10 +0,0 @@ -export class IntFilter { - equals?: number; - in?: number[]; - notIn?: number[]; - lt?: number; - lte?: number; - gt?: number; - gte?: number; - not?: number; -} diff --git a/admin-ui/src/util/IntNullableFilter.ts b/admin-ui/src/util/IntNullableFilter.ts deleted file mode 100644 index 2107cae..0000000 --- a/admin-ui/src/util/IntNullableFilter.ts +++ /dev/null @@ -1,10 +0,0 @@ -export class IntNullableFilter { - equals?: number | null; - in?: number[] | null; - notIn?: number[] | null; - lt?: number; - lte?: number; - gt?: number; - gte?: number; - not?: number; -} diff --git a/admin-ui/src/util/JsonFilter.ts b/admin-ui/src/util/JsonFilter.ts deleted file mode 100644 index cc44763..0000000 --- a/admin-ui/src/util/JsonFilter.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { InputJsonValue } from "../types"; -export class JsonFilter { - equals?: InputJsonValue; - not?: InputJsonValue; -} diff --git a/admin-ui/src/util/JsonNullableFilter.ts b/admin-ui/src/util/JsonNullableFilter.ts deleted file mode 100644 index e6d1506..0000000 --- a/admin-ui/src/util/JsonNullableFilter.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { JsonValue } from "type-fest"; -export class JsonNullableFilter { - equals?: JsonValue | null; - not?: JsonValue | null; -} diff --git a/admin-ui/src/util/MetaQueryPayload.ts b/admin-ui/src/util/MetaQueryPayload.ts deleted file mode 100644 index bc3175b..0000000 --- a/admin-ui/src/util/MetaQueryPayload.ts +++ /dev/null @@ -1,3 +0,0 @@ -export class MetaQueryPayload { - count!: number; -} diff --git a/admin-ui/src/util/QueryMode.ts b/admin-ui/src/util/QueryMode.ts deleted file mode 100644 index 8a2164e..0000000 --- a/admin-ui/src/util/QueryMode.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum QueryMode { - Default = "default", - Insensitive = "insensitive", -} diff --git a/admin-ui/src/util/SortOrder.ts b/admin-ui/src/util/SortOrder.ts deleted file mode 100644 index a5bcdb6..0000000 --- a/admin-ui/src/util/SortOrder.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum SortOrder { - Asc = "asc", - Desc = "desc", -} diff --git a/admin-ui/src/util/StringFilter.ts b/admin-ui/src/util/StringFilter.ts deleted file mode 100644 index c2e26c5..0000000 --- a/admin-ui/src/util/StringFilter.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { QueryMode } from "./QueryMode"; - -export class StringFilter { - equals?: string; - in?: string[]; - notIn?: string[]; - lt?: string; - lte?: string; - gt?: string; - gte?: string; - contains?: string; - startsWith?: string; - endsWith?: string; - mode?: QueryMode; - not?: string; -} diff --git a/admin-ui/src/util/StringNullableFilter.ts b/admin-ui/src/util/StringNullableFilter.ts deleted file mode 100644 index e1e37ec..0000000 --- a/admin-ui/src/util/StringNullableFilter.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { QueryMode } from "./QueryMode"; -export class StringNullableFilter { - equals?: string | null; - in?: string[] | null; - notIn?: string[] | null; - lt?: string; - lte?: string; - gt?: string; - gte?: string; - contains?: string; - startsWith?: string; - endsWith?: string; - mode?: QueryMode; - not?: string; -} diff --git a/admin-ui/tsconfig.json b/admin-ui/tsconfig.json deleted file mode 100644 index 31cc780..0000000 --- a/admin-ui/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx", - "strict": true - }, - "include": ["src"], - "exclude": ["./node_modules"] -}