|
1 | 1 | # parser |
2 | | -The HTML Parser helps parse claim.json files generated by the CNF suite of tests |
| 2 | +The HTML Parser helps parse claim.json files generated by the CNF suite of |
| 3 | +tests. The HTML parser does the following: |
| 4 | +- display results in a human readable way. Decoding failure reasons |
| 5 | +- annotate test results and download a shareable HTML page |
| 6 | +- save annotations to a file to be reused with other claim files |
| 7 | +- load claim files and annotation(feedback) files from local disk, uploaded by user or passed on the URL (HTML server only) |
| 8 | + |
| 9 | +## Relationship between the claim format and parser release versions |
| 10 | +### The claim format version |
| 11 | + |
| 12 | +A given parser release can only decode a single claim format version. The claim format version is defined as follows: |
| 13 | +- `v0.0.1` is the initial claim format version. It is used by the previous code before creating this repository |
| 14 | +- For newer versions, the minor version is incremented by 1 for each new claim format versions. The patch version is always zero. |
| 15 | +- The Major version is set to zero. The first claim format version supported by the parser in this repo is:`v0.1.0` |
| 16 | + |
| 17 | +### The parser release version |
| 18 | + |
| 19 | +The release version of the parser is based on the claim format version. The patch version is incremented by one for each new parser release supporting the same claim format version. For instance, a parser with a `v0.1.4` release version supports claim format `v0.1.0` and so is a release `v0.1.34`. A parser release 'v0.2.1' supports claim format `v0.2.0`. |
| 20 | + |
| 21 | +## Project directory structure |
| 22 | +``` |
| 23 | +├── doc |
| 24 | +├── html |
| 25 | +│ ├── build.js |
| 26 | +│ ├── index.js |
| 27 | +│ ├── results.html |
| 28 | +│ └── style.css |
| 29 | +├── LICENSE |
| 30 | +├── Makefile |
| 31 | +└── README.md |
| 32 | +``` |
| 33 | + |
| 34 | +`doc`: documentation |
| 35 | + |
| 36 | +`html`: directory contains the HTML artifacts |
| 37 | + |
| 38 | +`html/build.js`: nodejs script to merger HTML artifacts and minify |
| 39 | + |
| 40 | +`html/index.js`: javascript component of the HTML page |
| 41 | + |
| 42 | +`html/style.css`: CSS component of the HTML page |
| 43 | + |
| 44 | +`LICENSE`: license file |
| 45 | + |
| 46 | +`Makefile`: Makefile |
| 47 | + |
| 48 | +`README.md`: README |
| 49 | + |
| 50 | +## Uploading a previous feedback to the html parser page |
| 51 | + |
| 52 | +Users can write notes or feedback about their test run in the HTML parser. |
| 53 | +This displayed results and feedback can be downloaded as a static HTML page to be shared. |
| 54 | +Users can also save their feedback as a json file for later use. |
| 55 | +To load a file containing previouly entered feedback, users can |
| 56 | +upload their `feedback.json` file to the parser HTML page via the `Upload Feedback File` button. Alternatively, |
| 57 | +users can convert their `feedback.json` to `feedback.js` and place it in the same folder as the result.html page. |
| 58 | +The feedback will be loaded automatically. |
| 59 | + |
| 60 | +to convert a feedback.json to feedback.js, rename the file to `feedback.js` and prepend `var feedback=` to the `feedback.json file` from: |
| 61 | +``` |
| 62 | +{"source-all-access-control-cluster-role-bindings":"test2","so |
| 63 | +``` |
| 64 | +to: |
| 65 | +``` |
| 66 | +var feedback={"source-all-access-control-cluster-role-bindings":"test2","so ... |
| 67 | +``` |
| 68 | + |
| 69 | +similarly the `claim.json` file can be automatically loaded, but first needs to be converted to a `claimjson.js` file. |
| 70 | +To do this first rename the `claim.json` file to `claimjson.js` then prepend `var initialjson=` to the renamed file: |
| 71 | +``` |
| 72 | +{ |
| 73 | + "claim": { |
| 74 | + "configurations": { |
| 75 | +``` |
| 76 | +to |
| 77 | +``` |
| 78 | +var initialjson = { |
| 79 | + "claim": { |
| 80 | + "configurations": { |
| 81 | +``` |
| 82 | +## HTML Page modes |
| 83 | + |
| 84 | +### Manually uploading claim and feedback files via the webpage |
| 85 | + |
| 86 | +load the result.html or result-embed.html files locally and click on the "Choose File" button to pick the claim file to load: |
| 87 | + |
| 88 | + |
| 89 | + |
| 90 | +Click on the "Upload Feedback File: Choose File" button to pick the feedback file to upload: |
| 91 | + |
| 92 | + |
| 93 | + |
| 94 | +### Load local claimjson.js and feedback.js files |
| 95 | + |
| 96 | +When it is loaded, the webpage also looks for the following properly formatted javascript files: claimjson.js and feedback.js. |
| 97 | +If present in the same directory as the webpage, both files are loaded to update the webpage content without user interaction. Delete the files to prevent auto-loading the results and feedback. Works for hosted pages and local pages. |
| 98 | + |
| 99 | +### Load claim and feedback files via URL parameters |
| 100 | + |
| 101 | +When the result.html or result-embed.html are hosted it is also possible to pass the url of a claim and a feedback file as follows: |
| 102 | +http://localhost/results-embed.html?claimfile=claim.json&feedback=feedback3.json |
| 103 | + |
| 104 | +* the `claimfile=` parameter indicates the claim file to load |
| 105 | +* the `feedback=` parameter indicates the feedback file to load |
| 106 | + |
| 107 | +Both files are loaded without user interaction. |
0 commit comments