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

Migrate interactive app to JSONForms #30

Merged
merged 31 commits into from
Feb 1, 2024
Merged

Migrate interactive app to JSONForms #30

merged 31 commits into from
Feb 1, 2024

Conversation

nx10
Copy link
Contributor

@nx10 nx10 commented Oct 2, 2023

chrome_9LlDHweCr7
chrome_AtleN6T0Z3
image

This PR migrates the interactive app to JSONForms.

  • Much less code over-all, as the UI is auto-generated)
  • Adapt JSON schema
  • JSON data export & import
  • CSV data export
  • List of Links/URLs can now be added directly
  • Styles (of the app and shield icons) now match the NMIND Proceedings website

edgarmueller and others added 11 commits January 15, 2018 14:56
* Remove redux from react-seed
* Replace initialData with jsonformsData
* Add yalc to gitignore
* Add clear data button
* Replace data attribute with uischema attribute
* Refactor Rating to functional component
* Remove not needed styles
* Clear data instead of reset data
* Update README
* Showcases labels and titles
* Adjust theme to give controls more space
* Remove horizontal scrollbar
* Update to JSON Forms 2.5.0

Co-authored-by: Stefan Dirix <[email protected]>
@effigies
Copy link
Contributor

effigies commented Oct 5, 2023

Starting the development server...

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/home/chris/Projects/nmind/standards-checklist/app/node_modules/webpack/lib/util/createHash.js:90:53)
    at NormalModule._initBuildHash (/home/chris/Projects/nmind/standards-checklist/app/node_modules/webpack/lib/NormalModule.js:401:16)
    at handleParseError (/home/chris/Projects/nmind/standards-checklist/app/node_modules/webpack/lib/NormalModule.js:449:10)
    at /home/chris/Projects/nmind/standards-checklist/app/node_modules/webpack/lib/NormalModule.js:481:5
    at /home/chris/Projects/nmind/standards-checklist/app/node_modules/webpack/lib/NormalModule.js:342:12
    at /home/chris/Projects/nmind/standards-checklist/app/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/home/chris/Projects/nmind/standards-checklist/app/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/home/chris/Projects/nmind/standards-checklist/app/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
    at /home/chris/Projects/nmind/standards-checklist/app/node_modules/loader-runner/lib/LoaderRunner.js:236:3
    at runSyncOrAsync (/home/chris/Projects/nmind/standards-checklist/app/node_modules/loader-runner/lib/LoaderRunner.js:130:11)
    at iterateNormalLoaders (/home/chris/Projects/nmind/standards-checklist/app/node_modules/loader-runner/lib/LoaderRunner.js:232:2)
    at Array.<anonymous> (/home/chris/Projects/nmind/standards-checklist/app/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/home/chris/Projects/nmind/standards-checklist/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /home/chris/Projects/nmind/standards-checklist/app/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
=============

WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.2.1 <3.5.0

YOUR TYPESCRIPT VERSION: 4.9.5

Please only submit bug reports when using the officially supported version.

=============
/home/chris/Projects/nmind/standards-checklist/app/node_modules/react-scripts/scripts/start.js:19
  throw err;
  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:69:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/home/chris/Projects/nmind/standards-checklist/app/node_modules/webpack/lib/util/createHash.js:90:53)
    at NormalModule._initBuildHash (/home/chris/Projects/nmind/standards-checklist/app/node_modules/webpack/lib/NormalModule.js:401:16)
    at /home/chris/Projects/nmind/standards-checklist/app/node_modules/webpack/lib/NormalModule.js:433:10
    at /home/chris/Projects/nmind/standards-checklist/app/node_modules/webpack/lib/NormalModule.js:308:13
    at /home/chris/Projects/nmind/standards-checklist/app/node_modules/loader-runner/lib/LoaderRunner.js:367:11
    at /home/chris/Projects/nmind/standards-checklist/app/node_modules/loader-runner/lib/LoaderRunner.js:233:18
    at context.callback (/home/chris/Projects/nmind/standards-checklist/app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
    at /home/chris/Projects/nmind/standards-checklist/app/node_modules/babel-loader/lib/index.js:51:103
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.17.1

Copy link
Member

@shnizzedy shnizzedy left a comment

Choose a reason for hiding this comment

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

Looks good to me! I'd maybe delete app/src/checklist-schema.json before merging (if that file's really unnecessary like it seems to me), but otherwise, I think all of my suggestions can become issues for future PRs

app/public/manifest.json Outdated Show resolved Hide resolved
app/src/schema.json Outdated Show resolved Hide resolved
app/src/schema.json Show resolved Hide resolved
app/src/schema.json Show resolved Hide resolved
app/src/schema.json Show resolved Hide resolved
app/public/index.html Outdated Show resolved Hide resolved
app/README.md Outdated Show resolved Hide resolved
app/src/App.test.tsx Outdated Show resolved Hide resolved
interactive/src/nmind.orgExcerpts.css Outdated Show resolved Hide resolved
app/src/schema.json Show resolved Hide resolved
Copy link
Member

@shnizzedy shnizzedy left a comment

Choose a reason for hiding this comment

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

Changing from 'approve' to 'request changes' after seeing Chris' comment

@shnizzedy
Copy link
Member

I had to npm ci --force to get it to install (

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @jsonforms/[email protected]
npm ERR! Found: @mui/[email protected]
npm ERR! node_modules/@mui/icons-material
npm ERR!   @mui/icons-material@"^5.14.9" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @mui/icons-material@"~5.11.16" from @jsonforms/[email protected]
npm ERR! node_modules/@jsonforms/material-renderers
npm ERR!   @jsonforms/material-renderers@"^3.1.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: @mui/[email protected]
npm ERR! node_modules/@mui/icons-material
npm ERR!   peer @mui/icons-material@"~5.11.16" from @jsonforms/[email protected]
npm ERR!   node_modules/@jsonforms/material-renderers
npm ERR!     @jsonforms/material-renderers@"^3.1.0" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution

), but it does work for me locally
localhost:3000

@effigies
Copy link
Contributor

effigies commented Oct 6, 2023

Could you change interactive to app in the GHA workflow?

cd interactive
npm install
npm run build
- name: Deploy
uses: JamesIves/[email protected]
with:
branch: ghpages
folder: interactive/build

@shnizzedy shnizzedy dismissed their stale review October 9, 2023 14:49

Changes made, haven't re-reviewed

@effigies
Copy link
Contributor

Do we have a deployment somewhere to test? I tried pushing to my fork and this is what I get: https://effigies.github.io/standards-checklist/

@shnizzedy
Copy link
Member

Do we have a deployment somewhere to test? I tried pushing to my fork and this is what I get: https://effigies.github.io/standards-checklist/

nx10#1 should fix deployment

Copy link
Member

@shnizzedy shnizzedy left a comment

Choose a reason for hiding this comment

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

  1. I didn't notice in my initial review, but these changes lose the clarifications from the UI. E.g,

    before after
    bronze_doc_5 & bronze_doc_6 before bronze_doc_5 & bronze_doc_6 after
  2. I think re: "List of Links/URLs can now be added directly" / ✨ Add metadata to form #23 (this PR should close ✨ Add metadata to form #23 if merged) that we want to include a timestamp from when the review was completed and some record of who completed the review. These can be separate PRs, especially since I don't think we ever decided how we want to authenticate / credit reviewers.

  3. This PR doesn't include UI for comments, but this PR should close ✨ Add comment boxes to checklist items #22 if merged (UI for comments can also be a separate PR)

  4. I think we want the bronze sections to start out expanded for a new checklist and for sections to automatically collapse when completed and subsequent sections to expand (but ♻️ Autocollapse completed sections #21 was opened over a year ago, so maybe we don't care? Either way, this PR should also close ♻️ Autocollapse completed sections #21). The initial clicks to open the checklists seem like unnecessary user friction to me.

  5. Do we want to address this in this PR or later?

    Do we need one more level of depth for the items, to include the boolean and 💄 Add UI for comments #18?

    Exactly, it would look something like this:

    "2": {
      "type": "object",
      "title": "Documentation is up to date with version of software",
      "properties": {
        "value": {
          "type": "boolean",
          "default": false
        }
        "comment": {
          "type": "string",
          "default": ""
        }
      }
    },

    To avoid repetition this could be $def-ined once and then used for every item.

  6. Do we want to address this in this PR or later?

    For some items, like this one, where the answer could be "not applicable", I think we'll need

    "anyOf": [
      { "type": "boolean" },
      { "type": "string", "enum": ["not applicable"] }
    ]

    Makes sense!
    Not applicable could also be a boolean

  7. These questions / comments are still relevant

    1. Is the idea to move away from the JSON-LD encoding in checklists/checklist.json or to have it also encoded in JSON schema?

    2. The current directory structure is with the idea that the checklist content will be versioned separately from the checklist interface. I think that's the right design, but I don't know how to do that without housing the schema in a sibling directory tree with its own package.json.

@nx10
Copy link
Contributor Author

nx10 commented Nov 8, 2023

Regarding 1: I have added the clarifications to the JSONSchema and wrote a custom checkbox renderer to make them look just like they were before:

image

Regarding the other points I am waiting for judgement / decisions.

@gkiar
Copy link
Member

gkiar commented Nov 22, 2023

@shnizzedy thanks for the thoughtful comments!

  1. Looks like it's been taken care of
  2. agree to kick the can
  3. @nx10 am I understanding correctly that the schema now supports comments, but the UI does not? Would it be a lot to add that to the UI, or should we kick the can on this and do it in a follow-up PR? I'm happy to kick the can
  4. I don't mind either way — I agree it seems like unnecessary friction, if trivial to address, let's, otherwise, let's open an issue and resolve downstream once this is live
  5. This is related to 3, or am I missing something? happy to kick the can
  6. Same as 5
  7. i) I think we could move this towards JSON-LD while still being JSON schema, but for now we wanted to be able to build and validate a form from the schema, so that was the tug towards the latter standard. ii) good question, not sure either; can we agree to resolve/further decouple later?

Would love if we could get this "live" soon, and then there are certainly kinks that will need to be ironed out as we use it more!

@nx10
Copy link
Contributor Author

nx10 commented Nov 22, 2023

  1. This PR does not add user comment support for items in any way. It just reimplements the currently public version with jsonschema + jsonforms and minor additions.

Of course this is easy to add, but I assume opening separate PRs for this and Jon's other points would make them easier for you all to review.

@effigies
Copy link
Contributor

I've poked around on a rendered site, and things overall look good, but haven't had the spare cycles to really do critique. If Jon and Greg are happy, I say let's merge.

@shnizzedy
Copy link
Member

Yeah, I'm happy with merging and opening issues for the open threads here.

To answer a few questions / clarify a couple points:

  1. This is related to 3, or am I missing something? happy to kick the can

3 is adding comment support to the UI, 5 is adding comment support to the schema

  1. Same as 5

6 is adding "n/a" as a specific selectable option where relevant

  1. i) I think we could move this towards JSON-LD while still being JSON schema, but for now we wanted to be able to build and validate a form from the schema, so that was the tug towards the latter standard. ii) good question, not sure either; can we agree to resolve/further decouple later?

The current schema is already JSON-LD

flowchart LR
LD["JSON-LD"] --> UI
Loading

; this PR introduces a JSON Schema document as a separate, parallel source of truth.

flowchart LR
LD["JSON-LD"]
Schema["JSON Schema"] --> UI
Loading

I'm suggesting we keep the JSON-LD as the source of truth and autogenerate the JSON Schema for the UI from the JSON-LD

flowchart LR
LD["JSON-LD"] --automation--> Schema["JSON Schema"] --> UI
Loading

All that said, I agree these are all issues to open / cans to kick once this PR is merged in.

Copy link
Contributor

@mgxd mgxd left a comment

Choose a reason for hiding this comment

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

Haven't had the time to do a deep review, but overall this looks great, and fulfills the goal of actually being able to use the checklist while reviewing a project - I'm also in favor of kicking the can on the rest of the missing pieces. thanks @nx10 !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants