Skip to content

Instantly share code, notes, and snippets.

@krishna9304
Last active January 29, 2023 14:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krishna9304/3571728fa42a2a1e4b1d2938cd5eed4e to your computer and use it in GitHub Desktop.
Save krishna9304/3571728fa42a2a1e4b1d2938cd5eed4e to your computer and use it in GitHub Desktop.
GSOC'2022 Final Submission @fossology

Google Summer of Code'2022 - Final Report

Organisation 🚩 FOSSOLOGY

Proposal : πŸ‘‰ Click Here

Hello, I am Krishna Mahato, an undergraduate student pursuing B.Tech in Computer Science Engineering at ITER, SOA University, Bhubaneswar. I love developing and working on full stack projects that leverage the power of new technologies and modern methodologies. I’m more aligned towards web technologies and I strongly believe that there is a huge amount of β€œtypes and tech” one can explore on the web. In this GSoC period I worked on a complex web project called fossology. FOSSology is an open-source license compliance software system and toolkit. As a toolkit, it can run license, copyright, and export control scans from the command line, and as a system, it provides a database and web UI to give a compliance workflow.

GSOC-logo-fossology

Summary

Over the summer of 2022, I worked on the development of the FOSSologyUI project and the fossology backend project (in terms of implementing WebAPIs). During the tenure, I exposed the native functionalities of fossology into REST API services and simultaneously integrating these APIs on the UI project by adding the corresponding pages (using React.js's component based architecture).

Project Overiew

The goals of this project included

  • For FOSSologyUI project :

    1. Refactoring existing parts of code and implement better UI approaches wherever possible.
    2. Solve existing issues
    3. Create new pages and implement the APIs.
  • For fossology backend project :

    1. Introduce new REST API endpoints.
    2. Document the APIs in OpenAPI.

Mentors

My Contributions πŸ§‘β€πŸ’»

For the FOSSologyUI project

Bug Fixes

  1. A warning in the console stated an error like below,

    Warning: Select elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled select element and remove one of these props. More info: https://reactjs.org/link/controlled-components
    select
    

    This occured when we used value and defaultValue prop inside a select tag simultaneously.

    Solution : Removing one of the value or defaultValue prop fixed the issue.

  2. Disabled deletion of the "fossy" and "Delete user" by greying out these options from the dropdown.

    ss2.mov

  3. The below error appeared in the console when we navigate to the delete user page. Looking at the error say there is some cors issue.

    Screenshot 2022-05-26 at 9 31 55 PM

    Removing the credentials from the request header fixed the issue.

  4. There were design related bugs in the Navbar and browse page.

    NavBar

    Before:

    The icons were in column alignment which took more space in tablet or mobile view.

    Screenshot 2022-06-06 at 12 03 42 AM

    After:

    Screenshot 2022-06-06 at 12 05 38 AM

    Browse Page

    Before:

    By default the height was 50rem for the folders navigation which gave extra space for no reason and didn't look good from UI perspective

    Screen.Recording.2022-06-06.at.12.09.11.AM.mov

    After:

    This change contains dynamic height value assignment based on number of folders and subfolders which solves this issue.

    Screen.Recording.2022-06-06.at.12.08.42.AM.mov

Pages Introduced

  1. Creation of the Add User page. Below is the full working demo of the add user page which is available at Admin > Users > Add User.

    Screen.Recording.2022-09-04.at.3.29.00.PM.mov

  2. Creation of the Edit User Account page. Below is the full working demo of the Edit user page which is available at Admin > Users > Edit User Account.

    final.mp4

  3. Creation of the Upload Permissions page. Below is the full working demo of the Upload Permissions page which is available at Admin > Upload Permissions.

    final.mp4

  4. In this change, there were two tasks that followed

    • Creation of a new page that will show all the jobs queued for an upload and all other useful information.
    • Reading the main licenses and status parameter from the backend and showing it in the browse table for each upload.

    Below is the working demo,

    Screen.Recording.2022-09-01.at.12.05.32.PM.2.mov

  5. Implemented functionality to import an existing report to an upload from the UI.

    Below is the working demo,

    Screen.Recording.2022-09-14.at.4.14.33.PM.mp4

Pull Requests

PR Brief Description Status
#187 Fix Warning while loading delete user page βœ… Merged
#196 Disabled deletion of default users βœ… Merged
#209 Removed credentials from api request module βœ… Merged
#215 Design related fixes (Navbar and browse page) βœ… Merged
#229 UI and formdata implementation for the add user page βœ… Merged
#236 UI and styling for the edit user page βœ… Merged
#251 Upload permissions page UI and API Implementation done 🟑 In Review
#256 added show jobs page to view all the jobs queued for the upload 🟑 In Review
#265 Added logical components to the report import page and Integrated the API 🟑 In Review

For the fossology backend project

REST APIs Exposed

  1. POST users/ for creating new users. Refer to the below example

    • Request body

      addUserReqBody

    • Response

      addUserRes

  2. PUT users/{id} for modifying user details. Refer to the below example

    • Request body

      editUserReqBody

    • Response

      editUserRes

  3. POST /users/tokens for creating a new REST API Token. Refer to the below example

    • Request body

      createTokenReqBody

    • Response

      createTokenRes

  4. GET /users/tokens/{type} for fetching all the REST API tokens based on the type specified (active | expired). Refer to the example below

    • type = active

      activeTokensRes

    • type = expired

      expiredTokensRes

  5. PUT /uploads/{id}/permissions for setting permissions for a upload for different groups. Refer to the example below

    • Request body

      uploadPermsReqBody

    • Response

      uploadPermsRes

  6. GET /uploads/{id}/perm-groups for fetching all the groups with their respective permissions for a upload along with the respective public permission. Refer to the example below

    • Response

      permGroupsRes

  7. GET /jobs/history?upload={id} for fetching the history of all the jobs queued based on an upload. Refer to the example below

    • Response
    [
     {
         "jobId": 8,
         "jobName": "hotels.json",
         "jobQueue": [
             {
                 "jobQueueId": 16,
                 "jobQueueType": "ununpack",
                 "startTime": "2022-08-22 14:17:48",
                 "endTime": "2022-08-22 14:17:48",
                 "status": "Completed",
                 "itemsProcessed": 1,
                 "dependencies": [
                     null
                 ],
                 "itemsPerSec": 1,
                 "canDoActions": true,
                 "isInProgress": false,
                 "isReady": true,
                 "download": ""
             },....
             ....
             ..
         ],
         "upload": {
             "uploadName": "hotels.json",
             "uploadId": "4",
             "uploadDesc": "",
             "uploadItem": "91",
             "uploadEta": ""
         }
     },....
     ....
     ..
     ]
    
  8. POST /report/import?upload={id} for importing an existing report and initiating a reportImport job for a given upload. Refer to the example below

    • Request body (Note: Request body should be multipart/form-data)

      reportImportReqBody

    • Response

      reportImportRes

Pull Requests

PR Brief Description Status
#2256 POST users/ route for adding a new user βœ… Merged
#2262 Added PUT users/{id} route to modify user details βœ… Merged
#2266 Added POST /users/tokens Route and GET /users/tokens/{type} Route βœ… Merged
#2275 PUT api to Set permissions for a upload and GET API to fetch respective permissions of groups βœ… Merged
#2307 GET /jobs/history?upload={id} route to get the history of all the jobs queued based on an upload 🟑 In Review
#2317 POST report/import?upload={id} route to import an existing report to an upload 🟑 In Review

Weekly Progress Tracker πŸƒβ€β™€οΈ

Community bonding period

(21st May - 12th June)

Timeline Link
N/A https://fossology.github.io/gsoc/docs/2022/ui/updates/krishna/2022-06-02

Conclusion and Acknowledgements πŸ€—

First I need to give a big shout out to my mentors Gaurav Mishra and Shaheem Azmal M MD, who have been extremely passionate and supportive mentors. They have been continuously providing assistance to me from high level architectural design to the lower level bug fixes suggestions, I would also like to thank the FOSSology team for arranging the program and the assistance provided!

Moreover, It was only possible because of FOSSology that I witnessed the power of open-source softwares for the first time. In this GSoC, due to limited time span there were tasks that I couldn't accomplish but planned initially. I'll be trying to complete those milestones past the GSoC period as it would also be good way to remain connected with the community by being an active contributor to the project.

Connect with meπŸ‘‡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment