You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace single-page viewer with multi-page web application for better
organization and navigation.
Changes:
- Create templates/ directory with 6 HTML page templates and 2 shared components
- index.html: Dashboard with overview stats and charts
- controls.html: Controls browser with advanced filtering
- control-detail.html: Individual control details with OSCAL metadata and TODO management
- gaps.html: Gap analysis by priority and family
- statistics.html: Detailed metrics and cross-product comparison
- family.html: Control family breakdown and family-specific views
- _shared_styles.html: Common CSS for all pages
- _shared_header.html: Navigation header and product selector
- Update generate_nist_viewer.py to generate multiple HTML files instead of single file
- Embed data in all pages for offline access (no CORS issues)
- Pages communicate via URL parameters and localStorage
- Update VIEWER_README.md with multi-page architecture documentation
Benefits:
- Better separation of concerns (each page has focused functionality)
- Easier to maintain and extend (modify individual pages without affecting others)
- Clearer navigation with dedicated pages for each view
- Improved user experience with logical page organization
The published version updates automatically when changes are pushed to the master branch.
118
+
The published version updates automatically when changes are pushed to the master branch. Navigate to the dashboard (index.html) to start browsing.
72
119
73
120
## Data Structure
74
121
75
-
The viewer has all control data embedded directly in the HTML file (as `EMBEDDED_DATA` JavaScript constant). This allows the viewer to work when opened directly as a local file without CORS issues.
122
+
The viewer embeds all control data directly in each HTML file (as `EMBEDDED_DATA` JavaScript constant). This allows the viewer to work when opened directly as local files without CORS issues or requiring a web server.
123
+
124
+
Data is embedded in all pages identically, allowing each page to function independently. Pages communicate via URL parameters (e.g., `control-detail.html?id=ac-2`) and localStorage (for product selection and TODOs).
76
125
77
126
A separate `nist-controls-data.json` file is also generated for reference and debugging purposes.
78
127
@@ -150,11 +199,18 @@ TODOs are stored in browser localStorage, so they persist across sessions but ar
150
199
151
200
## Customization
152
201
153
-
### Modifying the Template
154
-
Edit `utils/nist_sync/nist_viewer_template.html` to customize:
155
-
- Styling (CSS in `<style>` section)
156
-
- Layout (HTML structure)
157
-
- Behavior (JavaScript functions)
202
+
### Modifying the Templates
203
+
Edit files in `utils/nist_sync/templates/` to customize:
204
+
-**_shared_styles.html** - Common CSS used across all pages
205
+
-**_shared_header.html** - Navigation header and product selector
206
+
-**index.html** - Dashboard page
207
+
-**controls.html** - Controls browser page
208
+
-**control-detail.html** - Individual control detail page
209
+
-**gaps.html** - Gap analysis page
210
+
-**statistics.html** - Statistics page
211
+
-**family.html** - Control families page
212
+
213
+
Each template can have its own page-specific styles and JavaScript in addition to the shared components.
158
214
159
215
### Adding New Statistics
160
216
Modify `generate_nist_viewer.py`:
@@ -192,33 +248,62 @@ No external dependencies - all functionality is self-contained in a single HTML
192
248
## Troubleshooting
193
249
194
250
### "Error loading data"
195
-
- The data should be embedded in the HTML file - regenerate the viewer with `ninja nist-viewer`
196
-
- If you modified the template, ensure the `/* DATA_PLACEHOLDER */` comment exists in the script section
251
+
- The data should be embedded in each HTML file - regenerate the viewer with `ninja nist-viewer`
252
+
- If you modified a template, ensure the `/* DATA_PLACEHOLDER */` comment exists in the script section
197
253
- Check browser console for specific error messages
198
-
- The HTML file should be around 7MB - if it's much smaller, the data wasn't embedded properly
254
+
- Each HTML file should be several MB in size - if much smaller, the data wasn't embedded properly
199
255
200
256
### Controls not showing
201
-
- Check filter settings - try resetting all filters
202
-
- Verify the data file contains controls for the selected product
257
+
- Check filter settings on controls.html - try resetting all filters
258
+
- Verify the data is embedded (open browser console and check for `EMBEDDED_DATA`)
259
+
- Try switching products using the product selector
203
260
204
261
### TODOs not persisting
205
262
- localStorage must be enabled in your browser
206
263
- Check browser privacy settings
207
-
- TODOs are per-browser and per-domain
264
+
- TODOs are per-browser, per-domain, and per-control
265
+
- Clearing browser data will erase TODOs
208
266
209
-
### Dashboard not rendering
267
+
### Dashboard not rendering / Page not loading
210
268
- Check browser console for JavaScript errors
211
-
- Ensure the JSON data loaded successfully
269
+
- Ensure the EMBEDDED_DATA constant is defined
212
270
- Try refreshing the page
271
+
- Verify you're using a modern browser (Chrome 90+, Firefox 88+, Safari 14+, Edge 90+)
272
+
273
+
### Navigation not working
274
+
- Ensure all 6 HTML files are in the same directory
275
+
- Check that file paths are relative (not absolute)
276
+
- If hosting on a web server, verify all files are accessible
277
+
278
+
### Product selection not persisting
279
+
- Check that localStorage is enabled
280
+
- The product selection is stored in localStorage key `selected-product`
281
+
- Clearing browser data will reset to default (rhel9)
213
282
214
283
## Development
215
284
216
285
To develop new features:
217
286
218
-
1. Edit `nist_viewer_template.html`
219
-
2. Test locally by opening the generated HTML file
220
-
3. Regenerate after changes: `ninja nist-viewer`
221
-
4. Commit both the template and updated CMake files
287
+
1. Edit templates in `utils/nist_sync/templates/`:
288
+
- For styling changes: edit `_shared_styles.html`
289
+
- For navigation changes: edit `_shared_header.html`
290
+
- For page-specific changes: edit the corresponding page template
291
+
2. Test locally by opening the generated HTML files in a browser
292
+
3. Regenerate after changes: `ninja nist-viewer`(from build directory)
293
+
4. Commit template changes
294
+
295
+
### Adding a New Page
296
+
297
+
1. Create a new template file in `utils/nist_sync/templates/` (e.g., `new-page.html`)
298
+
2. Include placeholders for shared components:
299
+
```html
300
+
<!-- SHARED_STYLES_PLACEHOLDER -->
301
+
<!-- SHARED_HEADER_PLACEHOLDER -->
302
+
/* DATA_PLACEHOLDER */
303
+
```
304
+
3. Add the page to the `pages` list in `generate_nist_viewer.py`
0 commit comments