Skip to content

Conversation

@joeljoby02
Copy link
Collaborator

Worked on issue #88. Moved fetch calls rom playground.js, tools.js, and sandbox.js into web/js/services/objectService.js. Also moved fetch calls from utilities.js to objectService.js to promote easier maintenance, testability, and better adherence to the DRY principle.

@joeljoby02
Copy link
Collaborator Author

Worked on issue #90. Made the following changes:
generalUtils.js — new: shared helpers (logger, broadcast, thumbnailGenerator) with JSDoc.
utilities.js — refactored to import and re-export shared helpers.
json-utils.js — JSDoc added for exported functions.
toolsCatalog.js — JSDoc header added.

@joeljoby02 joeljoby02 changed the title Issue #88 PR Issue #88 and #90PR Nov 6, 2025
@joeljoby02 joeljoby02 changed the title Issue #88 and #90PR Issue #88 and #90 Nov 6, 2025
@joeljoby02 joeljoby02 changed the title Issue #88 and #90 Issue #88, #90, and #92 Nov 6, 2025
@joeljoby02
Copy link
Collaborator Author

Worked on #92. Made the following changes:

Created two feature modules:
tools-feature.js — imports playground.js and tools.js
sandbox-feature.js — imports playground.js and sandbox.js

Updated HTML files to load a single module script each:
index.html — removed missing ./js/index.js, left one module: playground.js
about.html — removed missing ./js/about.js, left one module: playground.js
sandbox.html — replaced two module scripts with one: ./js/features/sandbox-feature.js
tools.html — replaced two module scripts with one (deferred): ./js/features/tools-feature.js

@Devayani1612
Copy link
Collaborator

Issue #88 :
Verified that all fetch calls are moved to objectService.js. The code is clean, modular, and working fine without errors.
Suggest replacing logger.warn with console.warn or importing it properly. Everything looks good — approved for merge.

@thehabes thehabes requested a review from Copilot November 12, 2025 17:59
Copilot finished reviewing on behalf of thehabes November 12, 2025 18:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the codebase to consolidate fetch calls into a centralized service module (objectService.js) and extract utility functions into a dedicated utils module (generalUtils.js), addressing issues #88, #90, and #92. The changes improve maintainability, testability, and follow the DRY principle by eliminating duplicated code across multiple files.

Key changes:

  • Created web/js/services/objectService.js to centralize all fetch operations (RERUM CRUD operations, manifest fetching, and HTML component fetching)
  • Created web/js/utils/generalUtils.js to house shared utilities (logger, broadcast, thumbnailGenerator)
  • Refactored utilities.js to import and re-export from the new modules instead of containing inline implementations
  • Introduced feature entry files (tools-feature.js, sandbox-feature.js) to consolidate module imports for each HTML page

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
web/js/services/objectService.js New service module centralizing all fetch operations including RERUM API calls, manifest loading, and HTML component fetching
web/js/utils/generalUtils.js New utility module containing logger, broadcast, and thumbnailGenerator functions extracted from utilities.js
web/js/utilities.js Refactored to import and re-export functions from the new service and utils modules, removing inline implementations
web/js/playground.js Updated to use fetchFooter and fetchMenu from objectService instead of inline fetch calls
web/js/tools.js Updated to use fetchManifest from objectService
web/js/sandbox.js Added import of fetchFooter from objectService
web/js/features/tools-feature.js New feature entry point consolidating imports for tools.html
web/js/features/sandbox-feature.js New feature entry point consolidating imports for sandbox.html
web/js/json-utils.js Added JSDoc comments for prettifyJSON and validateJSON functions, minor whitespace fix
web/js/toolsCatalog.js Added JSDoc header comment describing the catalog structure
web/tools.html Updated to load single feature entry script instead of multiple module scripts
web/sandbox.html Updated to load single feature entry script instead of multiple module scripts
web/index.html Removed unused index.js script tag
web/about.html Removed unused about.js script tag
Comments suppressed due to low confidence (1)

web/js/sandbox.js:1

  • Unused import fetchFooter.
import { fetchFooter } from './services/objectService.js';

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

500: "Internal server error",
503: "Server down time",
}
logger.warn(errorMessages[response.status] ?? `Unhandled HTTP Error ${response.status}`)
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The logger object is used but never imported. Add import { logger } from '../utils/generalUtils.js'; at the top of the file.

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +2
import { fetchFooter } from './services/objectService.js';

Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The fetchFooter function is imported but never used in this file. Remove this unused import or add the missing implementation that uses it.

Suggested change
import { fetchFooter } from './services/objectService.js';

Copilot uses AI. Check for mistakes.
@Devayani1612
Copy link
Collaborator

Issue #90
Verified that shared helper functions are cleanly centralized into generalUtils.js under /web/js/utils/. The file includes clear documentation, leveled logging, broadcasting, and reusable thumbnail generation. No duplicated code found, and structure aligns with modular design goals. --Approved for merge.

@Devayani1612
Copy link
Collaborator

Issue #92
Verified new feature modules for Sandbox and Tools. Each page now loads a single module script (sandbox-feature.js, tools-feature.js), improving structure and reducing duplicate imports. Tested locally pages load correctly, no console errors-- Approved for merge.

@Devayani1612 Devayani1612 merged commit 1ffcc12 into dev_devayani Nov 12, 2025
6 checks passed
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.

3 participants