-
Notifications
You must be signed in to change notification settings - Fork 5
Developer Documentation
Shaheem Azmal M MD edited this page Jul 11, 2025
·
1 revision
👋 Welcome to the LicenseDb-UI Wiki developer Documentation page! This wiki provides a step-by-step guide on how to quick-start the development of the application.
To connect to the backend, follow these steps:
-
Setup a Linux VM:
- Install VMWare Workstation (or any other virtualization tool of your choice).
- Create and configure a Linux virtual machine.
-
Backend Setup Instructions:
- Refer to the LicenseDb Backend repository.
- Follow the step-by-step instructions provided in the
README
file to set up the environment.
-
Verify Setup with Swagger:
- Once the installation and setup are complete, navigate to the Swagger documentation at this URL:
http://localhost:8080/swagger/index.html#/ - You’ll find a comprehensive list of available APIs here.
- Once the installation and setup are complete, navigate to the Swagger documentation at this URL:
-
Backend Requirement for UI:
- Ensure that the backend service is running and accessible.
- The UI relies on the backend to connect to the API endpoints.
The APIs are grouped into collections, making them easy to navigate. Below is a summary:
-
Authentication API:
- At the top of the Swagger page, there’s a
GET
API called/apiCollection
. - It provides a list of APIs categorized based on whether they require admin privileges or are available for regular users.
- This is particularly useful for new developers to understand the scope of available APIs.
- Hit the "Authorize" button and provide credentials before trying out the admin APIs.
-
Swagger:
- At the top of the Swagger page, there’s a
-
Audits:
APIs related to audits, such as fetching audit logs, fetch logs by a single user etc. -
Licenses:
APIs for managing licenses, including creating, reading, updating, and deleting license data. -
Obligations:
- APIs to manage obligations, such as retrieving obligation lists and adding new obligations.
- Obligation settings Apis (
obligations/classifications
&obligations/types
) for creating, updating or deleting new classifications and types for obligations.
-
Users:
User management APIs, including registration, login, and role management.
- Some APIs require authorization or admin privileges.
- For example, APIs related to sensitive operations (like user role updates or creating and updating licenses) can only be accessed by registered users with appropriate permissions.
- APIs are largely self-explanatory, with clear descriptions provided in Swagger.
-
Features:
- Create new licenses.
-
Dynamic External Reference Fields: Configured via
externalRef.yaml
(editable and dynamic). - External fields require updates to:
-
externalRef.yaml
(located at the project root). -
componentPathMap.js
(located in theutils
folder, for new input types only).
-
name: "ack_text"
type: "string"
struct_field_name: "AcknowledgementText"
label: "Acknowledgement Text"
formComponentPath: "../components/dynamic/textArea"
componentType: "textarea"
- Update
externalRef.yaml
and provide it to the backend for the changes to take effect. - Currently available input types:
input
,checkbox
,textarea
- For new input types:
- Create the component in
components/dynamic/
. - Update
componentPathMap.js
with the path to the new component.
- Create the component in
-
Framework: Created using
create-react-app
. -
API Handling: Uses
tanstack react query
. All API calls are listed in a single fileapi.js
and called as needed in different components or pages. -
Naming conventions:
- We follow the
camelCase
convention while creating a new.js
or.css
file (also largely for creating new variables). - Function and Class are created following the
PascalCase
convention.
- We follow the
-
Styling:
- Bootstrap is used for styling, but some parts use pure CSS instead of Bootstrap classes or elements.
-
Dropdowns:
react-select
is used instead of HTML<select>
for dropdowns. Additionally, acustomColorSelect
component is available for select boxes with color options.
-
Reusable Functions:
-
handleChange
: A reusableonChange
function for forms. -
toastMessage
: Reusablereact-toastify
component which can be called whereever needed throughout the application. - Custom Hook: A custom hook for API call handling is under development and will be reusable across the app.
-
-
License Comments: Each file (except
.css
) includes license text at the top. Ensure new files include this license text. -
Semicolon Usage: Semicolons (
;
) are not used at the end of lines for consistency. -
Styling Practices:
- Use Bootstrap grid styles and custom class names.
- Prefer Flexbox for efficient layouts.
- Minimal inline styles; styles are kept in separate
.css
files.
-
Error Handling:
- Uses
react-toastify
for displaying errors, with some exceptions (e.g., in the operations page). - An error toast should contain no
autoClose
function (so that the user has to manually close the error toast message) - The
dark
theme is used for theming, so new toasts should also follow this for consistency.
- Uses
-
Forms:
- Normal
<Form>
elements are used. External libraries like Formik or Bootstrap forms are not utilized.
- Normal
-
Buttons:
- Bootstrap buttons are used consistently throughout the application.
- For more detailed coding styles follow this link - Fossology Coding Styles