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

Rafiki Admin UI feature #969

Merged
merged 108 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
f37d451
feat: first commit for the Rafiki Admin UI feature
JoblersTune Jan 12, 2023
be62ed9
fix: node-sass version 8 is compatible with Node version 19. Removing…
JoblersTune Jan 13, 2023
d35737a
fix: introducing automatic type generation and using Apollo client to…
JoblersTune Jan 16, 2023
3966cff
fix: using existing generated types file in Rafiki backend
JoblersTune Jan 16, 2023
2101251
fix: introducing automatic type generation and using Apollo client to…
JoblersTune Jan 16, 2023
d306579
fix: added automatic type generation and using Apollo client to view/…
JoblersTune Jan 17, 2023
60ae1f1
fix: consolidated unneccessary component files back into the their ro…
JoblersTune Jan 17, 2023
78a3c1d
fix: refactoring files to get rid of nested routing
JoblersTune Jan 17, 2023
221cd2a
fix: using CodeGen to generate a type file in the admin UI project
JoblersTune Jan 17, 2023
fa6a252
fix: formatting date in the loader rather than on the frontend
JoblersTune Jan 18, 2023
641ba23
fix: progress on fixing the update peer form
JoblersTune Jan 18, 2023
64345ea
fix: using same node version in admin UI as the rest of the repo
JoblersTune Jan 18, 2023
45a6cf0
fix: removed the generated types from the .gitignore file
JoblersTune Jan 18, 2023
d906b07
fix: downgraded node-sass dependency
JoblersTune Jan 18, 2023
7e0e17b
fix: creating a single instance of Apollo Client
JoblersTune Jan 19, 2023
42c4d3e
fix: removed unused setting when intantialising the inMemoryCache
JoblersTune Jan 19, 2023
43fe330
chore: resolved merge conflicts with main
JoblersTune Jan 22, 2023
a3b2f22
fix: upgraded update page UI
JoblersTune Jan 22, 2023
24cf70c
fix: if ID is incorrect on update forms then the tooltip should disap…
JoblersTune Jan 23, 2023
baeef57
fix: removed input border and tooltip from fixed update form elements
JoblersTune Jan 27, 2023
ba896ab
chore: added a favicon suggestion
JoblersTune Jan 27, 2023
4ff8184
fix: refactoring error messages handling
JoblersTune Jan 27, 2023
6342f9f
fix: re-adding lost CodeGen file updates
JoblersTune Jan 27, 2023
521ad6e
fix: added dropdown asset selection field to peer update form
JoblersTune Jan 31, 2023
2fbf838
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Feb 1, 2023
9c804c4
feat(admin): start migrating to tailwind
raducristianpopa Feb 1, 2023
1c42187
feat(admin): add button component
raducristianpopa Feb 1, 2023
1fa3d3d
new dashboard layout
raducristianpopa Feb 7, 2023
2abf7d5
feat(admin): add/update components & icons
raducristianpopa Feb 10, 2023
699d375
chore: update codegen for admin
raducristianpopa Feb 10, 2023
761c9aa
feat(admin): add services
raducristianpopa Feb 10, 2023
5e2e6d8
chore: update config files and README
raducristianpopa Feb 10, 2023
01066fc
chore(admin): remove scss files
raducristianpopa Feb 10, 2023
8ea4647
feat(admin): update routes
raducristianpopa Feb 10, 2023
f828c35
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Feb 10, 2023
f599f9a
chore: formatting
raducristianpopa Feb 10, 2023
80fe566
fix(admin): fix field errors
raducristianpopa Feb 10, 2023
6b64a2c
feat(admin): address error handling feedback
raducristianpopa Feb 14, 2023
afd5b1e
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Feb 14, 2023
b0d40ae
feat(admin): small changes
raducristianpopa Feb 14, 2023
9c38ac1
feat(admin): add view peer page
raducristianpopa Feb 14, 2023
d993c48
chore(wallet): remove `tiny-invariant` and validation func
raducristianpopa Feb 14, 2023
8498215
chore: pagination fix
raducristianpopa Feb 16, 2023
aade1fc
feat(admin): add peer update page
raducristianpopa Feb 16, 2023
56a0ccc
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Feb 16, 2023
f5fdb53
chore: linting
raducristianpopa Feb 16, 2023
411a6b3
feat(admin): finish peer update page
raducristianpopa Feb 17, 2023
4250128
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Feb 17, 2023
2044f2f
feat(admin): update error and catch boundaries
raducristianpopa Feb 17, 2023
8939109
feat(admin): add asset update page
raducristianpopa Feb 17, 2023
80ba3e3
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Feb 21, 2023
9271af2
chore: update scalar types for admin
raducristianpopa Feb 21, 2023
033eef8
fix(admin): fix serialization issues
raducristianpopa Feb 21, 2023
4185348
fix(admin): disable pagination buttons
raducristianpopa Feb 21, 2023
77107b6
feat(admin): update validations
raducristianpopa Feb 21, 2023
003a8c5
feat(admin): add create asset page
raducristianpopa Feb 21, 2023
b9022a3
fix(admin): fix `bigint` JSON serialization
raducristianpopa Feb 22, 2023
eb620ab
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Feb 23, 2023
fc6c3a8
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Feb 24, 2023
f544af2
feat(admin): include generated operation files
raducristianpopa Feb 24, 2023
5248e8a
feat(admin): add peer deletion option
raducristianpopa Feb 24, 2023
700f3b5
chore(admin): remove unused imports
raducristianpopa Feb 24, 2023
9a7346e
chore: fix `.eslintignore`
raducristianpopa Feb 24, 2023
3554298
feat(admin): add mobile menu
raducristianpopa Feb 24, 2023
68ddeaf
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Feb 24, 2023
400e27b
feat(admin): add assets dropdown
raducristianpopa Feb 24, 2023
320803d
feat(admin): add table empty state
raducristianpopa Feb 24, 2023
50703f5
feat(admin): fix padding
raducristianpopa Feb 24, 2023
0494e40
feat(admin): align elements
raducristianpopa Feb 24, 2023
d952c70
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Mar 3, 2023
8a6ed1b
chore: bump remix version
raducristianpopa Mar 3, 2023
3bfe56f
chore: generate operation types in the same file
raducristianpopa Mar 3, 2023
5c69d4b
feat: refactor api calls
raducristianpopa Mar 3, 2023
96bedfa
fix: typescript-eslint error
raducristianpopa Mar 3, 2023
efc5d7c
chore: global gitignore file
raducristianpopa Mar 3, 2023
071cad1
chore: add readme for styles
raducristianpopa Mar 3, 2023
a061c24
chore: remove dead code
raducristianpopa Mar 3, 2023
316c5cd
fix: use conventional error codes
raducristianpopa Mar 3, 2023
e6b0042
refactor: move icons into a single file
raducristianpopa Mar 3, 2023
6dfac32
refactor: components structure
raducristianpopa Mar 3, 2023
791eb70
chore: update README
raducristianpopa Mar 3, 2023
20dc823
chore: update prettierignore
raducristianpopa Mar 3, 2023
b978bd0
feat: create next/previous page urls in loader
raducristianpopa Mar 3, 2023
9da68f4
chore: update README
raducristianpopa Mar 3, 2023
b7d5c6b
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Mar 10, 2023
66b4e1a
chore: move rafiki admin to `frontend` package
raducristianpopa Mar 10, 2023
9624d0b
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Mar 10, 2023
be5ecc3
chore: update codegen documents
raducristianpopa Mar 10, 2023
37e0d15
chore: remove frontend reference from root tsconfig
raducristianpopa Mar 10, 2023
6be6bca
chore: address comments
raducristianpopa Mar 13, 2023
ae909da
chore: remove apollo from global namespace
raducristianpopa Mar 13, 2023
2f93dcb
chore: add ci check for frontend (build only)
raducristianpopa Mar 13, 2023
6bba354
chore: add rafiki admin to localenv
raducristianpopa Mar 13, 2023
63dfdd2
chore: update localenv README and diagram
raducristianpopa Mar 13, 2023
16edf30
chore: update `frontend` readme and apollo uri
raducristianpopa Mar 13, 2023
7e2f993
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Mar 13, 2023
25feefb
chore: add apollo back to global namespace
raducristianpopa Mar 13, 2023
21c5102
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Mar 13, 2023
bd81ff0
chore: generate
raducristianpopa Mar 13, 2023
34e518e
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Mar 24, 2023
c9c8dc7
chore: typos
raducristianpopa Mar 24, 2023
b79f708
chore: update localenv diagram and readme
raducristianpopa Mar 24, 2023
d510cdd
chore: generate graphql types
raducristianpopa Mar 24, 2023
6b50006
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Apr 3, 2023
5e489bd
chore: fix compose files
raducristianpopa Apr 3, 2023
a5f0613
fix: typo in diagram
raducristianpopa Apr 3, 2023
f032793
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Apr 4, 2023
e894b57
Merge branch 'main' into sj-rafiki-admin-ui
raducristianpopa Apr 4, 2023
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
29 changes: 29 additions & 0 deletions packages/admin/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
env:
browser: true
es2021: true
node: true
extends:
- '@remix-run/eslint-config'
- '@remix-run/eslint-config/node'
- 'eslint:recommended'
- 'plugin:react/recommended'
- 'plugin:@typescript-eslint/recommended'
- 'prettier'
root: true
parser: '@typescript-eslint/parser'
parserOptions:
ecmaFeatures:
jsx: true
ecmaVersion: 2020
sourceType: module
plugins:
- react
- '@typescript-eslint'
rules:
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }]
'react/jsx-uses-react': 'off'
'react/react-in-jsx-scope': 'off'
'@typescript-eslint/quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }]
settings:
react:
version: "detect"
7 changes: 7 additions & 0 deletions packages/admin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules

/.cache
/build
/public/build
app/styles/dist
.env
26 changes: 26 additions & 0 deletions packages/admin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Rafiki Admin UI

## Development

This project assumes that you have a local Rafiki backend instance up and running. See the Environment Setup and Local Development sections in the main [README](../../README.md).

This project is using Node version 19.

To start the project in development mode:

```sh
npm run dev
```

This starts your app in development mode, rebuilding assets on file changes. You can access your app on [http://localhost:3005](http://localhost:3005).


Currently you need to also manually build your CSS assets:
```sh
npm run scss
```

To format and lint code:
```sh
npm run format
```
40 changes: 40 additions & 0 deletions packages/admin/app/components/DisplayAsset.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import styles from '../styles/dist/DisplayItem.css'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably make all your components typescript files so that you can type your props.

type DisplayAssetProps = {
  // Prop types here
  test: string
}

export const DisplayAsset: FC<DisplayAssetProps> = ({
  test
}) => {
  return (
    <div>
      { test }
    </div>
  )
}

import { useLoaderData } from '@remix-run/react'

function DisplayAsset() {
const { asset } = useLoaderData()
JoblersTune marked this conversation as resolved.
Show resolved Hide resolved
return (
<table>
<tbody>
<tr>
<th>ID</th>
<td>{asset.id}</td>
</tr>
<tr>
<th>Code</th>
<td>{asset.code}</td>
</tr>
<tr>
<th>Scale</th>
<td>{asset.scale}</td>
</tr>
<tr>
<th>Withdrawl threshold</th>
<td>
{asset.withdrawalThreshold ? asset.withdrawalThreshold : 'null'}
</td>
</tr>
<tr>
<th>Created at</th>
<td>{new Date(asset.createdAt).toLocaleString()}</td>
JoblersTune marked this conversation as resolved.
Show resolved Hide resolved
</tr>
</tbody>
</table>
)
}

export default DisplayAsset

export function links() {
return [{ rel: 'stylesheet', href: styles }]
}
44 changes: 44 additions & 0 deletions packages/admin/app/components/DisplayAssets.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import styles from '../styles/dist/DisplayItems.css'
import { Link } from '@remix-run/react'
import * as R from 'ramda'

function DisplayAssets({ assets }) {
return (
<table>
<thead>
<tr>
<th>Asset ID</th>
<th>Code</th>
<th>Scale</th>
<th>Withdrawl threshold</th>
</tr>
</thead>
<tbody>
{assets.length
? assets.map((asset) => (
<tr key={R.path(['node', 'id'], asset)}>
<td>
<Link to={R.path(['node', 'id'], asset)}>
{R.path(['node', 'id'], asset)}
</Link>
</td>
<td>{R.path(['node', 'code'], asset)}</td>
<td>{R.path(['node', 'scale'], asset)}</td>
<td>
{R.path(['node', 'withdrawalThreshold'], asset)
? R.path(['node', 'withdrawalThreshold'], asset)
: 'null'}
JoblersTune marked this conversation as resolved.
Show resolved Hide resolved
</td>
</tr>
))
: ''}
</tbody>
</table>
)
}

export default DisplayAssets

export function links() {
return [{ rel: 'stylesheet', href: styles }]
}
48 changes: 48 additions & 0 deletions packages/admin/app/components/DisplayItem.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
@import '../styles/_variables';

table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}

thead {
background-color: $admin-panel-background;
}

td,
th {
border: none;
text-align: left;
padding: 8px;
}

tr:nth-child(odd) {
background-color: $admin-panel-background;
}

ul {
margin: 0;
list-style-type: none;
list-style: none;

li {
padding-top: 8px;
padding-bottom: 8px;
}
}

ul.values {
padding-inline-start: 0;
}

th,
td {
a:link,
a:visited,
a:active,
a:hover {
text-decoration: none;
color: $black;
}
}
32 changes: 32 additions & 0 deletions packages/admin/app/components/DisplayItems.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@import '../styles/_variables';

table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}

thead {
background-color: $admin-panel-background;
}

td,
th {
border: 1px solid $admin-panel-background;
text-align: left;
padding: 8px;
}

tr {
a:link,
a:visited,
a:active,
a:hover {
text-decoration: none;
color: $black;
}
}

tr:nth-child(even) {
background-color: $admin-panel-background;
}
55 changes: 55 additions & 0 deletions packages/admin/app/components/DisplayPeer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import styles from '../styles/dist/DisplayItem.css'
import { useLoaderData, Link } from '@remix-run/react'

function DisplayPeers() {
const { peer } = useLoaderData()

return (
<table>
<tbody>
<tr>
<th>ID</th>
<td>{peer.id}</td>
</tr>
<tr>
<th>Static ILP address</th>
<td>{peer.staticIlpAddress}</td>
</tr>
<tr>
<th>
<Link to={'/assets/' + peer.asset.id}>
Asset
<ul>
<li>Code</li>
<li>Scale</li>
</ul>
</Link>
</th>
<td>
<Link to={'/assets/' + peer.asset.id}>
<br></br>
<ul className='values'>
<li>{peer.asset.code}</li>
<li>{peer.asset.scale}</li>
</ul>
</Link>
</td>
</tr>
<tr>
<th>Outgoing endpoint</th>
<td>{peer.http.outgoing.endpoint}</td>
</tr>
<tr>
<th>Created at</th>
<td>{new Date(peer.createdAt).toLocaleString()}</td>
</tr>
</tbody>
</table>
)
}

export default DisplayPeers

export function links() {
return [{ rel: 'stylesheet', href: styles }]
}
44 changes: 44 additions & 0 deletions packages/admin/app/components/DisplayPeers.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import styles from '../styles/dist/DisplayItems.css'
import { Link } from '@remix-run/react'
import * as R from 'ramda'

function DisplayPeers({ peers }) {
return (
<table>
<thead>
<tr>
<th>Peer ID</th>
<th>Static ILP address</th>
<th>Asset code</th>
<th>Asset scale</th>
<th>Outgoing endpoint</th>
</tr>
</thead>
<tbody>
{peers.length
? peers.map((peer) => (
<tr key={R.path(['node', 'id'], peer)}>
<td>
<Link to={R.path(['node', 'id'], peer)}>
{R.path(['node', 'id'], peer)}
</Link>
</td>
<td>{R.path(['node', 'staticIlpAddress'], peer)}</td>
<td>{R.path(['node', 'asset', 'code'], peer)}</td>
<td>{R.path(['node', 'asset', 'scale'], peer)}</td>
<td>
{R.path(['node', 'http', 'outgoing', 'endpoint'], peer)}
</td>
</tr>
))
: ''}
</tbody>
</table>
)
}

export default DisplayPeers

export function links() {
return [{ rel: 'stylesheet', href: styles }]
}
Loading