feat: Added React Demo webApp and deployment workflow#73
feat: Added React Demo webApp and deployment workflow#73rockyRaccoon13 wants to merge 188 commits intoni:mainfrom
Conversation
| @@ -0,0 +1,46 @@ | |||
| @use "@ni/nimble-react/styles/tokens" as *; | |||
There was a problem hiding this comment.
Minor styling feedback: when I hover over the buttons at the top, the border that appears on hover is causing the entire page layout to shift (see video below).
hover.shift.mov
| <div className="header"> | ||
| <a | ||
| className="github" | ||
| href="https://github.com/Samuelsotogit/systemlink-enterprise-examples-fork" |
There was a problem hiding this comment.
We should update this URL to the NI repo
|
|
||
| <a | ||
| className="Swagger" | ||
| href="https://test-api.lifecyclesolutions.ni.com/niapis/" |
There was a problem hiding this comment.
This is an NI internal environment so won't make sense for external customers. This page might be a little better, it's in the user manual and explains how to get to the niapis documentation: https://www.ni.com/docs/en-US/bundle/systemlink-api/page/http-api-reference.html
| @@ -0,0 +1,46 @@ | |||
| @use "@ni/nimble-react/styles/tokens" as *; | |||
There was a problem hiding this comment.
The fonts still aren't loading correctly for me. I think you need this line from the Nimble React example app.
@use '@ni/nimble-react/styles/fonts' as *;
In that app it's in an app-wide SCSS file index.scss which is imported from the top level index.html. This app doesn't have that file yet so you'll have to add it or put that import somewhere else.
| return data; | ||
| }) | ||
| .then(data => { | ||
| setApiResponse(JSON.stringify(data, null, 2)); |
There was a problem hiding this comment.
Could we do some processing on the response to make it more user friendly? Right now it's a huge wall of text and hard to tell what it's saying.
Some ideas:
- parse out a few key pieces of information and display them as the primary text. Maybe just the user's name and then display a string like "Welcome, Firstname Lastname"
- include the full response JSON in a collapsed details disclosure element
- see if there's anything more you can do to pretty print the JSON. I see you're following this guidance from Stack Overflow but I'm not seeing any line breaks when I run it locally (macOS Firefox after applying my font change suggested in another thread)
Justification
Added a React demo web application using Vite to demonstrate how a customer might create a webApp and deploy it to SystemLink. The webApp demos how to call SystemLink APIs both in development (locally) and in production (within a SystemLink website).
The github actions webApp workflow automates building, linting, and deployment to the SystemLink website. The workflow also outputs a .nipkg artifact of the webApp to github. See
/.github/workflows/webapp_deploy.ymlImplementation
Webapp Design
examples/web_apps/Framework_Examples/React/ApiKeyAuthAppRunning in Development (locally) vs Production (hosted in SystemLink website)
.env.developmentand.env.production) files allow variable domain for fetches (dev will fetch from the local proxy server, prod will fetch from the hosting website)ApiServiceProxy -- Required to run web app locally
token authentication when the web app is hosted in the SystemLink website
ApiServiceProxy/README.mdProduction -- Running inside SystemLink Website
ApiKeyAuthApp/README.md./deployDev.shWorkflow -- Building, Linting, Deployment to SystemLink website
package.json(npm ci, npm lint, npm build).SystemLink CLI (SL CLI) integration in Workflow
SL_API_URLSL_API_KEYSL_WEBSITE_URLSL_WORKSPACETesting
Local env
Within SystemLink website
Workflow
Checklist