New Guide Available -- How to Contribute Code to TrueNAS WebUI!

Hey TrueNAS Community!

We’re excited to announce a new resource for anyone interested in contributing to the TrueNAS WebUI project: our Contributing Code Guide! This short guide is everything you need to get started with WebUI code contributions, whether you’re fixing bugs or just exploring open-source development. This should cover everything you’ll need, from setting up your development environment to submitting pull requests.

We’re thrilled to have you join us in making TrueNAS even better. Every contribution counts, and contributors will receive a beautiful #FFD700-plated forum badge recognizing your contribution, as our thanks to you!

Have a look!

4 Likes

Eager and waiting to award our first badge and group membership to contributors here on the forums. Get those pull-requests going! :slight_smile:

2 Likes

I am eager to read it a well.

Dumb question:

For my question/example: I just took the first wanted item in the list and in answering the ticket, I’d have to make the following assumptions and build a PR something like below (NOTE: I saw the class but I used a function for this swag-reply on purpose. Also note, I don’t know typescript so, this is essentially typed blind).

Basically, a new developer may not know what a typecast is and/or what floating-point mitigation is but developers (new and old, I guess) need a bit of guidance on best practices for the things project dev’s take for granted; like style, mitigations, hooks, etc… Do you have a style guide you can share? Another possible suggestion would be to develop the commit stds for these issues (not so they match the current style but to simplify the review process).

Do you want this style (and what should I be using if you do)?

// calculateProgressValue --
// @brief Calculates a progress value in whole numbers.
//
// @param current The current progress percent.
// @param total The total percent to calculate for.
//
// @return integer
//
// @example calculateProgressValue(job.progress.percent, 100);
function calculateProgressValue(current: number, total: number): number {
   // XXX: Cleanup logic; toss error vs return 0 (adopt a proj std method).
   const progress = 0;
   
   if (current > 0) {
      progress = (current / total) * 100;
   }
   
   return Math.round(progress);
}

...

// XXX: "if percent"? Should this conditional exist?
if (job.progress.percent) {
   // PR:### @john &03.19.25 - changed float to int.
    this.progressTotalPercent = calculateProgressValue(job.progress.percent, 100);
}

// XXX: What is this?
this.hideProgressValue = job.progress.percent === null;
...

Or something like:

// -This is not how a developer (sh/w)ould do this but let's roll with
//  it for now.
this.progressTotalPercent = (job.progress.percent / 100) * 100;

Is this specific to the WebUI Help Wanted tickets? I’ve got some low hanging fruit that I’ve noticed but never bothered me enough to raise a ticket

For example, the broken widget timestamps:

Which is a very easy fix:

If there is an issue we’ve already got a fix for, but no existing ticket, what is the process then? (I’d assume raise a ticket, but where that then goes to triage team, etc, not sure if it would be okay to raise a ticket and then immediately follow up with a PR)

Nice fix/find! Go ahead and open the PR and we can work on getting a NAS ticket created and assigned.