Skip to content

feat: Add Tpsentinel audit list page#796

Open
Ganapathy-dev wants to merge 1 commit intomainfrom
Add-audit-list
Open

feat: Add Tpsentinel audit list page#796
Ganapathy-dev wants to merge 1 commit intomainfrom
Add-audit-list

Conversation

@Ganapathy-dev
Copy link
Contributor

  • Moved Sentinel design separately from Testpress.
  • Updated sidebar to highlight the current tab.
  • Added a new audit list page.

- Moved Sentinel design separately from testpress
- update side bar to show current tab
- Add new audit list page
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the TPSentinel module by introducing a new, dedicated audit list page. This change involves restructuring the Sentinel design to operate independently, improving the overall modularity of the application. Additionally, the sidebar navigation has been refined to provide clearer visual feedback on the active section, contributing to a more intuitive user interface.

Highlights

  • Sentinel Design Separation: The Sentinel module's design has been decoupled from the main Testpress structure, allowing for independent development and management.
  • Sidebar Navigation Enhancement: The application sidebar was updated to visually indicate the currently active tab, improving user navigation and experience.
  • New Audit List Page: A dedicated audit list page has been introduced for TPSentinel, providing a centralized view for reviewing audit-related data.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/_data/audit_list.json
    • Added a new JSON file containing sample audit data for demonstration purposes.
  • src/index.html
    • Refactored the main index page to remove the old Sentinel integration and re-add it with a new, distinct structure, aligning with the separation of Sentinel design.
  • src/sentinel/audit/list/filters.html
    • Introduced a new HTML file for the audit list filters, including navigation tabs (Needs Review, In Progress, Completed), a search input, a date range filter, and dropdown filters for priority, workspace, and anomaly status.
  • src/sentinel/audit/list/header.html
    • Added a new HTML file defining the header section for the audit list page, displaying the title "Audit Review Queue" and a descriptive subtitle.
  • src/sentinel/audit/list/index.html
    • Created the main HTML page for the TPSentinel audit list, which extends a base layout and incorporates the newly added header, table, and date picker components.
  • src/sentinel/audit/list/table.html
    • Implemented the HTML structure for the audit list table, featuring dynamic data rendering (if audit_list is present), checkboxes, user and workspace details, priority type, anomaly counts, and action buttons, along with an empty state illustration.
  • src/sentinel/audit/list/table_footer.html
    • Added the HTML for the footer section of the audit table, including pagination controls and a display for showing current results.
  • src/sentinel/audit/list/table_header.html
    • Defined the HTML for the audit table's header, including a "select all" checkbox and sortable columns for Candidate, Workspace, Priority, Anomalies, and Sessions.
  • src/sentinel/layout/sidebar.html
    • Modified the Sentinel sidebar to apply active state highlighting to navigation links based on the current page URL and updated the href attributes for the workspace and audit sections.
  • src/sentinel/partials/date_picker.html
    • Added a new HTML file containing a Flatpickr-based date range picker component, complete with cancel and apply buttons for filtering.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new audit list page for TPSentinel, refactors the main index page, and updates the sidebar for better navigation. The changes are a good step forward, but I've identified several issues, including critical security vulnerabilities and bugs in the new audit page functionality. Specifically, there's a hardcoded CSRF token, broken selection logic in the table, and several instances of hardcoded links and non-functional UI elements. Addressing these issues is crucial for the security and functionality of the new page.

<tr class="hover:bg-gray-50 dark:hover:bg-neutral-700/50">
<td class="py-3 ps-4">
<div class="flex items-center h-5">
<input type="checkbox" class="border-gray-200 rounded-sm text-blue-600 focus:ring-blue-500 dark:bg-neutral-700 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500" @change="selectedRows.includes('1') ? selectedRows.splice(selectedRows.indexOf('1'), 1) : selectedRows.push('1')" value="1">

Choose a reason for hiding this comment

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

critical

The checkbox for each row has a hardcoded value="1" and the @change handler is also hardcoded to use the value '1'. This will prevent correct selection of multiple items. The value and the handler should use a unique identifier for each audit record, such as audit.id.

                        <input type="checkbox" class="border-gray-200 rounded-sm text-blue-600 focus:ring-blue-500 dark:bg-neutral-700 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500" @change="selectedRows.includes('{{ audit.id }}') ? selectedRows.splice(selectedRows.indexOf('{{ audit.id }}'), 1) : selectedRows.push('{{ audit.id }}')" value="{{ audit.id }}">



<form method="post" action="#">
<input type="hidden" name="csrfmiddlewaretoken" value="ocF0ev8IosDq7dvSCwaz8axDgGis3fdxuM7q74OWS7rtfk0Q0sjjne7Yjfx2MReV">

Choose a reason for hiding this comment

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

critical

A CSRF token is hardcoded in this form. This is a critical security vulnerability that could expose the application to Cross-Site Request Forgery (CSRF) attacks. CSRF tokens must be unique per user session and should be dynamically generated by the server.

                                    <input type="hidden" name="csrfmiddlewaretoken" value="{{ csrf_token }}">

</span>
</td>
<td class="py-3 px-5 whitespace-nowrap">
<a class="text-sm text-foreground decoration-2 truncate hover:text-primary hover:underline focus:outline-none focus:text-primary focus:underline dark:text-foreground dark:hover:text-primary dark:focus:text-primary" href="/workspaces/1/">{{ audit.workspace_name }}</a>

Choose a reason for hiding this comment

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

high

The link to the workspace is hardcoded to /workspaces/1/. It should be dynamic and use the workspace_id from the audit data to link to the correct workspace.

                        <a class="text-sm text-foreground decoration-2 truncate hover:text-primary hover:underline focus:outline-none focus:text-primary focus:underline dark:text-foreground dark:hover:text-primary dark:focus:text-primary" href="/workspaces/{{ audit.workspace_id }}/">{{ audit.workspace_name }}</a>

Comment on lines +26 to +32
function createApplyButton(instance, selectedDates) {
const btn = document.createElement("button");
btn.textContent = "Apply";
btn.className =
"py-2 px-3 text-xs rounded-lg border-transparent bg-blue-600 text-white";
return btn;
}

Choose a reason for hiding this comment

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

high

The createApplyButton function is not fully implemented. It accepts a selectedDates parameter that is not used. More importantly, the 'Apply' button it creates has no onclick handler, making it non-functional. The button should trigger the filtering logic and close the date picker. You can access the selected dates via instance.selectedDates within the click handler. Remember to also update the call to this function in createFooter to pass only instance.

Suggested change
function createApplyButton(instance, selectedDates) {
const btn = document.createElement("button");
btn.textContent = "Apply";
btn.className =
"py-2 px-3 text-xs rounded-lg border-transparent bg-blue-600 text-white";
return btn;
}
function createApplyButton(instance) {
const btn = document.createElement("button");
btn.textContent = "Apply";
btn.className =
"py-2 px-3 text-xs rounded-lg border-transparent bg-blue-600 text-white";
btn.onclick = () => {
// TODO: Add logic to apply date range filter using instance.selectedDates
instance.close();
};
return btn;
}

<!-- End Header -->
<div>
<div class="py-4 px-5 flex flex-wrap justify-between items-center gap-y-2 gap-x-5">
<div class="w-1/2">

Choose a reason for hiding this comment

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

medium

The container for the search input is missing position: relative. This is necessary because the search icon inside it is absolutely positioned. Without a relative parent, the icon will be positioned relative to the nearest positioned ancestor, which could lead to incorrect layout.

Suggested change
<div class="w-1/2">
<div class="w-1/2 relative">

<!-- End Search Input -->
</div>
<div class="flex justify-end items-center gap-x-2">
<div class="p-2 inline-flex items-center text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-2xs hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-hidden focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800">

Choose a reason for hiding this comment

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

medium

This element, and the filter button on line 70, use focus:outline-hidden. This removes the browser's default focus indicator without providing an alternative, which is an accessibility issue for keyboard users. Please ensure all interactive elements have a visible focus state.

</button>
<div x-show="open" x-transition:enter="transition ease-out duration-200" x-transition:enter-start="opacity-0 scale-95" x-transition:enter-end="opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 scale-95" class="absolute top-0 left-0 mt-10 w-40 z-10 bg-white rounded-xl shadow-xl dark:bg-neutral-900" role="menu" aria-orientation="vertical" style="display: none;">
<div class="p-1">
<a href="#"open = false" class="w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] font-normal text-gray-800 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-300 focus:outline-hidden focus:bg-gray-100 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800">

Choose a reason for hiding this comment

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

medium

There appears to be a syntax error in this anchor tag: href="#"open = false". It seems you intended to use an event handler like @click="open = false" to close the dropdown menu. This error is repeated for all sortable column headers in this file.

Suggested change
<a href="#"open = false" class="w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] font-normal text-gray-800 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-300 focus:outline-hidden focus:bg-gray-100 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800">
<a href="#" @click="open = false" class="w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] font-normal text-gray-800 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-300 focus:outline-hidden focus:bg-gray-100 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800">

<span class="truncate">English</span>
</button>
<div x-show="dropdownOpen === 'lang'" x-cloak x-transition x-on:click="$event.stopPropagation()"
<div x-cloak x-show="dropdownOpen === 'lang'" x-cloak x-transition x-on:click="$event.stopPropagation()"

Choose a reason for hiding this comment

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

medium

The x-cloak attribute is duplicated on this div element. While this doesn't cause a functional issue, it's redundant and should be cleaned up for better code quality.

          <div x-cloak x-show="dropdownOpen === 'lang'" x-transition x-on:click="$event.stopPropagation()"

Comment on lines +6 to +12
const enableTime = false

function formatDateParam(date) {
const pad = v => String(v).padStart(2, "0");
return `${pad(date.getMonth() + 1)}/${pad(date.getDate())}/${date.getFullYear()} ` +
`${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
}

Choose a reason for hiding this comment

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

medium

The constant enableTime (line 6) and the function formatDateParam (lines 8-12) are declared but never used. This dead code should be removed to improve code clarity and maintainability.

@github-actions
Copy link

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://testpress.github.io/design/pr-preview/pr-796/

Built to branch gh-pages at 2026-03-13 14:01 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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.

1 participant