-
Notifications
You must be signed in to change notification settings - Fork 81
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
Conversation
This is a work in progress. Looking for initial feedback so long @cairin. See Figma designs here https://www.figma.com/file/0ditBzfQRxx3LW258NJbWZ/Rafiki-Admin-UI?node-id=0%3A1&t=jaqV3tB4HZqaflTJ-1 I'd appreciate some feedback on these specific points as well as general feedback:
To give a sense of the outstanding TODO's:
Peer TODO's:
Asset TODO's:
|
… CSS build assets from repo
This is looking good so far @SarahCoilAccount I will go through the code and provide specific feedback there, but to answer some of your general questions:
Yes, definitely use tailwindcss. There are alternative utility based css frameworks, but this one has the biggest community, and has the most stable API out of the ones I've used. Tailwind also works well with headless UI component libraries like headlessui or radix-ui.
What you're trying to achieve with input validation is end-to-end type safety. Basically put, if you're expecting a string value in the backend, you want to ensure that you're sending a string input from the frontend. https://www.epicweb.dev/fully-typed-web-apps - This should help you get the right idea of what you're trying to achieve. To start you'll probably want generated typings of the graphql api. This is already done for you in the backend using codegen. You could probably just get it to generate the same output directly into the admin project. You'll then at least know what types you're expecting, and if the backend changes, the admin code will change too. You can then use the apollo graphql client to type your responses too: rafiki/packages/mock-account-provider/app/lib/webhooks.server.ts Lines 83 to 105 in 483e794
I think apart from providing the correct types, you shouldn't need to. The backend should be sanitising input and responding with validation errors as necessary. It's easier to rely on the backend for this, because if you're sanitising on the frontend, you could over/under sanitise and you'll have to handle validation responses from the backend anyway. For things like search you might want to do some basic sanitisation in an action.
Answered in brief above. You can use the backend as a reference for setting up the generation and graphql client.
I wouldn't worry about this just yet. It's fairly easy to do this later, and we don't know what translations we'll need yet.
Comma separated list is fine. You can just provide a hint under this input. You can also convert this to an array fairly easily by removing any whitespace, and splitting the string on the
If they're public tokens, then you can show them. If they're private tehn probably not. You could show the first few charaters or something so that users can at least identify the token.
If you use a remix layout this should be fairly easy to make it global. Tailwind UI have some fairly nice examples for a good UX: https://tailwindui.com/components/application-ui/navigation/command-palettes#component-540bdf1e4a0e2ec2f667a2c7c123ff0f
Tailwind's responsive variants make this fairly trivial. You'll probably just want to do the designs first.
Jest is currently used elsewhere in rafiki for unit tests - so probably best to stick with that if you're writing unit tests. It's probably more effective to write integrations tests though, playwright is fantastic for this. |
This comment was marked as resolved.
This comment was marked as resolved.
@@ -0,0 +1,40 @@ | |||
import styles from '../styles/dist/DisplayItem.css' |
There was a problem hiding this comment.
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>
)
}
* fix: removed useLoaderData from the DisplayPeer component * fix: converted all components to tsx files * fix: added asset ID field to peer creation form as an interim measure before using a dropdown * chore: added a hint for the incoming auth tokens field in peer creation
…create/update assets/peers
* fix: added the index.tsx file back into the routes folder
* fix: the update peer page was named incorrectly * chore: added name field to all peer functionality * fix: moved generated folder outside of app folder so it doesn't get formatted and linted
* fix: updated the README
* fix: disabling caching on the Apollo Client for queries and mutations * fix: renamed update pages to access ID param correctly * fix: created first working draft of the update peer page
2c50eab
to
42c4d3e
Compare
Updates:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After merging in the change from main (#1248) to fix the tigerbeetle docker compose entry point, both of the admin UIs were working for me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final pass
admin: | ||
hostname: cloud-nine-wallet-admin | ||
build: | ||
context: ../../.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context: ../../.. | |
context: ../.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For localenv
to work properly
admin: | ||
hostname: happy-life-bank-admin | ||
build: | ||
context: ../../.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context: ../../.. | |
context: ../.. |
localenv/local-dev.drawio
Outdated
<mxfile host="app.diagrams.net" modified="2023-03-24T12:18:56.167Z" agent="5.0 (Macintosh)" etag="NNfc1Mz1IK_Rlivegw_w" version="21.0.6" type="device"><diagram id="G7K_4BS86Fn3U5dKpeIK" name="Page-1">7VzbkuI2EP0aqjYPUL4bP85lN0nVpjI1k63MPqU0tgDtGJsYMcB+fSR8lwWYBbc8bOZlrEa+9VGfbnVLHph3882vCVrM/ogDHA4MLdgMzPuBYehjw2X/uGSbSuyxlwqmCQmyTqXgiXzHmVDLpCsS4GWtI43jkJJFXejHUYR9WpOhJInX9W6TOKzfdYGmuCF48lHYlP5NAjpLpWNbK+W/YTKd5XfWteyXOco7Z4LlDAXxuiIyPw7MuySOaXo039zhkCsv10t63qc9vxYPluCItjnh89P9cPE5eNRnj77zz/MbvsE3Qz2DZ0m3+RvjgCkga0ZxxP7dJvEqCjC/jsZacUJn8TSOUPg5jhdMqDPhN0zpNoMPrWjMRDM6D7Nf8YbQZ376yM5aX7OL8eP7TbWxrTQecELmmOIkl0XBDQeVNeM3FKaSTyTM75O+DH+DvUrKRMt4lfj4kGa8AiM2uHHMHiPZshMTHCJK3uo3QNkomxb9ilMfYsJubWiZRViGPjIrf4aTXiEzDysfPvkVKUqmmGYXKdFlB5WnKkU7zE/BfwyD/zXgVgfKAwYqo02mvVX2Dg/xkk4TRo4igkuaxK8FXRl1KBgNLXi/+WbKGXs0CeO1P0MJHQWIohe05ICvZ4TipwXaaXrN+hUYveGE4s1hlJrKz04wx3tG+7qkVjcTzSqs6mr74aop+lSt5txc0epfZIqTF4wp0+a7Vaw+bip2DKpYvaHYRxyQdzxWDYlKYceqAUTV7GGfC3/LGl9Lx82bpbfetbbV1gF/nT1fyfvaZXnfsNKOKQ936SDOQ9G8NoebKv7iDregsNxX2LAONx9PF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4QstW4b1nl4uidndQ7bKdFst5YaOo5poJWRRFuoii+omI8igqx78CyYc513/5yRHtCSfsrU/Qtc/UwfMj+7XNLky+o5fdpbhuF5xdd+9m3w7se34t5p6Wqae6EHVZwpI9y7ObyjdBld+cEsvsAXE8viw5BNrvXLMTPkr5MEn7viSlPVzFXEPwyLoMKFgraTcNn8qBujhK/eAyp3cotZukY6l70W52q/Wu1KLM+pTGMiVYWaBYNb+5IcNqkruiOeJwPVUC4Z8DKVtXjlRz+i5D6hXUqnrJgFKrgg0omlsnZFiFgFbVS6SkVgWLFNRuDbD0zNn7bPdkL4VsnCnWJDtOzzjN9ILk41Bp0kBxbqaItsQddspyM067CX/A+egRTcgrGewyMNHVuvdiUUWOka3av+f29HMnl89egSZnL1c0SWD2cpsZhsYupV5wlyPSvHLuctvN+b+J3EW6IK9eRFGuMDeRcteFoijWLL+XnlpD+dV58+N/</diagram></mxfile> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the diagram, can you fix the png
to have (d) Rafiki Admn
-> (d) Rafiki Admin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
worked for me with the Dockerfile path changes @mkurapov mentioned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
* feat: first commit for the Rafiki Admin UI feature * fix: node-sass version 8 is compatible with Node version 19. Removing CSS build assets from repo * fix: introducing automatic type generation and using Apollo client to view a peer * fix: using existing generated types file in Rafiki backend * fix: removed useLoaderData from the DisplayPeer component * fix: converted all components to tsx files * fix: added asset ID field to peer creation form as an interim measure before using a dropdown * chore: added a hint for the incoming auth tokens field in peer creation * fix: introducing automatic type generation and using Apollo client to view all peers * fix: added automatic type generation and using Apollo client to view/create/update assets/peers * fix: consolidated unneccessary component files back into the their route files * fix: refactoring files to get rid of nested routing * fix: using CodeGen to generate a type file in the admin UI project * fix: formatting date in the loader rather than on the frontend * fix: added the index.tsx file back into the routes folder * fix: progress on fixing the update peer form * fix: the update peer page was named incorrectly * chore: added name field to all peer functionality * fix: moved generated folder outside of app folder so it doesn't get formatted and linted * fix: using same node version in admin UI as the rest of the repo * fix: removed the generated types from the .gitignore file * fix: updated the README * fix: downgraded node-sass dependency * fix: creating a single instance of Apollo Client * fix: disabling caching on the Apollo Client for queries and mutations * fix: renamed update pages to access ID param correctly * fix: created first working draft of the update peer page * fix: removed unused setting when intantialising the inMemoryCache * fix: upgraded update page UI * fix: using readOnly property on fixed inputs for update pages * fix: added tooltip helper text for fixed input fields in the update pages * fix: gray style for disabled form fields * fix: added asterisks for required form fields * fix: peer update form makes a query on the backend action function so users never have to enter duplicate data * fix: added maxPacketAmount field for the Display Peer Page * fix: fixed header-row alignment for small screen * fix: added helper text hint for search bar * fix: improved small screen view * fix: if ID is incorrect on update forms then the tooltip should disappear * fix: improving TypeScript typing * fix: peers. page was not querying the asset ID in the loader which is needed to make the asset row clickable * fix: added an Error heading for ErrorBoundary components * fix: removed input border and tooltip from fixed update form elements * fix: typing fixes * chore: added a favicon suggestion * fix: refactoring error messages handling * fix: re-adding lost CodeGen file updates * fix: added dropdown asset selection field to peer update form * feat(admin): start migrating to tailwind * feat(admin): add button component * new dashboard layout * feat(admin): add/update components & icons * chore: update codegen for admin * feat(admin): add services * chore: update config files and README * chore(admin): remove scss files * feat(admin): update routes * chore: formatting * fix(admin): fix field errors * feat(admin): address error handling feedback * feat(admin): small changes * feat(admin): add view peer page * chore(wallet): remove `tiny-invariant` and validation func * chore: pagination fix * feat(admin): add peer update page * chore: linting * feat(admin): finish peer update page * feat(admin): update error and catch boundaries * feat(admin): add asset update page * chore: update scalar types for admin * fix(admin): fix serialization issues * fix(admin): disable pagination buttons * feat(admin): update validations * feat(admin): add create asset page * fix(admin): fix `bigint` JSON serialization * feat(admin): include generated operation files * feat(admin): add peer deletion option * chore(admin): remove unused imports * chore: fix `.eslintignore` * feat(admin): add mobile menu * feat(admin): add assets dropdown * feat(admin): add table empty state * feat(admin): fix padding * feat(admin): align elements * chore: bump remix version * chore: generate operation types in the same file * feat: refactor api calls * fix: typescript-eslint error * chore: global gitignore file * chore: add readme for styles * chore: remove dead code * fix: use conventional error codes * refactor: move icons into a single file * refactor: components structure * chore: update README * chore: update prettierignore * feat: create next/previous page urls in loader * chore: update README * chore: move rafiki admin to `frontend` package * chore: update codegen documents * chore: remove frontend reference from root tsconfig * chore: address comments * chore: remove apollo from global namespace * chore: add ci check for frontend (build only) * chore: add rafiki admin to localenv * chore: update localenv README and diagram * chore: update `frontend` readme and apollo uri * chore: add apollo back to global namespace * chore: generate * chore: typos * chore: update localenv diagram and readme * chore: generate graphql types * chore: fix compose files * fix: typo in diagram --------- Co-authored-by: Radu-Cristian Popa <radu.popa@breakpointit.eu>
* fix(token-introspection): implicit any index error * fix(auth): implicit any index error * chore(backend): wip: implicit any index error * chore(backend): implicit any index error * test(backend): make disparate asset test(s) consistent (#1289) * chore(docs): move admin api docs to rafiki.dev (#1287) * chore(docs): move admin api docs to rafiki.dev * chore(deps): update dependency eslint to ^8.37.0 (#1284) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update terraform hashicorp/terraform to >= 1.4.4 (#1291) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(dockerbuild): architectures (#1255) * fix(dockerbuild): architectures * feat(docker): try using platform in dockerfiles * feat(docker): tagging * chore(deps): update dependency @apollo/client to ^3.7.11 (#1292) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Notify rafiki.dev on schema changes (#1286) * feat: add CI step for trigger PR on rafiki.dev * chore: remove paths for now * chore: add step permissions * chore: fix typo in permission * chore: fix typo? * chore: try setting GH token directly * chore: fix github action * chore: try again * chore: update naming * chore: test on rafiki.dev branch * chore: update file name for .dev workflow * chore: fix typo * chore: update file path * chore: update action name * chore: revert testing changes * chore(deps): update remix monorepo to ^1.15.0 (#1293) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency ts-jest to ^29.1.0 (#1295) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency @types/react to ^18.0.32 (#1294) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/github-script action to v6 (#1296) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: pin ubuntu version in GH actions (#1288) * docs: key registry documentation (#1290) * docs: key registry documentation * docs: add sequence diagram to key registry docs * docs: comments * docs: add excalidraw source * chore(deps): update dependency @types/luxon to ^3.2.2 (#1299) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Mk/remove swc core (#1298) * chore(deps): update dependency @swc/core to v1.3.44 * chore: remove @swc/core test --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Rafiki Admin UI feature (#969) * feat: first commit for the Rafiki Admin UI feature * fix: node-sass version 8 is compatible with Node version 19. Removing CSS build assets from repo * fix: introducing automatic type generation and using Apollo client to view a peer * fix: using existing generated types file in Rafiki backend * fix: removed useLoaderData from the DisplayPeer component * fix: converted all components to tsx files * fix: added asset ID field to peer creation form as an interim measure before using a dropdown * chore: added a hint for the incoming auth tokens field in peer creation * fix: introducing automatic type generation and using Apollo client to view all peers * fix: added automatic type generation and using Apollo client to view/create/update assets/peers * fix: consolidated unneccessary component files back into the their route files * fix: refactoring files to get rid of nested routing * fix: using CodeGen to generate a type file in the admin UI project * fix: formatting date in the loader rather than on the frontend * fix: added the index.tsx file back into the routes folder * fix: progress on fixing the update peer form * fix: the update peer page was named incorrectly * chore: added name field to all peer functionality * fix: moved generated folder outside of app folder so it doesn't get formatted and linted * fix: using same node version in admin UI as the rest of the repo * fix: removed the generated types from the .gitignore file * fix: updated the README * fix: downgraded node-sass dependency * fix: creating a single instance of Apollo Client * fix: disabling caching on the Apollo Client for queries and mutations * fix: renamed update pages to access ID param correctly * fix: created first working draft of the update peer page * fix: removed unused setting when intantialising the inMemoryCache * fix: upgraded update page UI * fix: using readOnly property on fixed inputs for update pages * fix: added tooltip helper text for fixed input fields in the update pages * fix: gray style for disabled form fields * fix: added asterisks for required form fields * fix: peer update form makes a query on the backend action function so users never have to enter duplicate data * fix: added maxPacketAmount field for the Display Peer Page * fix: fixed header-row alignment for small screen * fix: added helper text hint for search bar * fix: improved small screen view * fix: if ID is incorrect on update forms then the tooltip should disappear * fix: improving TypeScript typing * fix: peers. page was not querying the asset ID in the loader which is needed to make the asset row clickable * fix: added an Error heading for ErrorBoundary components * fix: removed input border and tooltip from fixed update form elements * fix: typing fixes * chore: added a favicon suggestion * fix: refactoring error messages handling * fix: re-adding lost CodeGen file updates * fix: added dropdown asset selection field to peer update form * feat(admin): start migrating to tailwind * feat(admin): add button component * new dashboard layout * feat(admin): add/update components & icons * chore: update codegen for admin * feat(admin): add services * chore: update config files and README * chore(admin): remove scss files * feat(admin): update routes * chore: formatting * fix(admin): fix field errors * feat(admin): address error handling feedback * feat(admin): small changes * feat(admin): add view peer page * chore(wallet): remove `tiny-invariant` and validation func * chore: pagination fix * feat(admin): add peer update page * chore: linting * feat(admin): finish peer update page * feat(admin): update error and catch boundaries * feat(admin): add asset update page * chore: update scalar types for admin * fix(admin): fix serialization issues * fix(admin): disable pagination buttons * feat(admin): update validations * feat(admin): add create asset page * fix(admin): fix `bigint` JSON serialization * feat(admin): include generated operation files * feat(admin): add peer deletion option * chore(admin): remove unused imports * chore: fix `.eslintignore` * feat(admin): add mobile menu * feat(admin): add assets dropdown * feat(admin): add table empty state * feat(admin): fix padding * feat(admin): align elements * chore: bump remix version * chore: generate operation types in the same file * feat: refactor api calls * fix: typescript-eslint error * chore: global gitignore file * chore: add readme for styles * chore: remove dead code * fix: use conventional error codes * refactor: move icons into a single file * refactor: components structure * chore: update README * chore: update prettierignore * feat: create next/previous page urls in loader * chore: update README * chore: move rafiki admin to `frontend` package * chore: update codegen documents * chore: remove frontend reference from root tsconfig * chore: address comments * chore: remove apollo from global namespace * chore: add ci check for frontend (build only) * chore: add rafiki admin to localenv * chore: update localenv README and diagram * chore: update `frontend` readme and apollo uri * chore: add apollo back to global namespace * chore: generate * chore: typos * chore: update localenv diagram and readme * chore: generate graphql types * chore: fix compose files * fix: typo in diagram --------- Co-authored-by: Radu-Cristian Popa <radu.popa@breakpointit.eu> * chore(deps): update dependency @types/react to ^18.0.33 (#1300) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: update call details (#1301) * fix(backend): auth middleware * chore(auth): don't ts-ignore tests * fix: formatting --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Raphael Luckom <104906921+rluckom-coil@users.noreply.github.com> Co-authored-by: Max Kurapov <max@interledger.org> Co-authored-by: Nathan Lie <lie4nathan@gmail.com> Co-authored-by: Sarah Jones <SarahJaneJonesWork@gmail.com> Co-authored-by: Radu-Cristian Popa <radu.popa@breakpointit.eu> Co-authored-by: Alex Lakatos <alex.lakatos.qa@gmail.com>
Changes proposed in this pull request
Useful resources:
The next version of this should also include:
Context
Checklist
fixes #number