Skip to content

Evidence Page improvements + refactoring packages/data for evidence tasks#174

Merged
Marfuen merged 6 commits into
mainfrom
mariano/portal
Mar 21, 2025
Merged

Evidence Page improvements + refactoring packages/data for evidence tasks#174
Marfuen merged 6 commits into
mainfrom
mariano/portal

Conversation

@Marfuen
Copy link
Copy Markdown
Contributor

@Marfuen Marfuen commented Mar 21, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced dashboard experience with robust session validation that redirects unauthorized users and displays organization-specific frameworks.
    • Updated policy forms with clear status options and localized labels for improved clarity.
  • Refactor

    • Streamlined framework and control views for a more responsive, user-friendly experience.
    • Refined navigation and employee status displays with improved translations for better usability.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app 🛑 Canceled (Inspect) Mar 21, 2025 9:50pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
comp-portal ⬜️ Skipped (Inspect) Mar 21, 2025 9:50pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 21, 2025

Warning

Rate limit exceeded

@Marfuen has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 17 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d5fcb3f and ce145e4.

📒 Files selected for processing (95)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/actions/getFrameworksAction.ts (0 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/actions/selectFrameworksAction.ts (0 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/FrameworksGrid.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/FrameworksOverview.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/hooks/useFrameworks.ts (0 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/[frameworkId]/components/table/FrameworkControlsTableColumns.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/controls/[id]/components/SingleControl.tsx (3 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/controls/[id]/components/table/ControlRequirementsTable.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/controls/[id]/components/table/ControlRequirementsTableColumns.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/controls/[id]/page.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/page.tsx (3 hunks)
  • apps/app/src/auth/config.ts (2 hunks)
  • apps/app/src/components/forms/policies/policy-overview.tsx (6 hunks)
  • apps/app/src/components/tables/people/employee-status.tsx (1 hunks)
  • apps/app/src/jobs/tasks/organization/create-organization.ts (7 hunks)
  • apps/app/src/locales/core/common.ts (4 hunks)
  • apps/app/src/locales/features/people.ts (2 hunks)
  • apps/app/src/locales/features/policies.ts (2 hunks)
  • apps/app/src/locales/settings/settings.ts (5 hunks)
  • packages/data/controls/soc2.json (49 hunks)
  • packages/data/evidence/access_control_records.json (1 hunks)
  • packages/data/evidence/access_logs.json (1 hunks)
  • packages/data/evidence/access_removal_records.json (1 hunks)
  • packages/data/evidence/access_review_records.json (1 hunks)
  • packages/data/evidence/account_management_records.json (1 hunks)
  • packages/data/evidence/authentication_records.json (1 hunks)
  • packages/data/evidence/board_meeting_documentation.json (1 hunks)
  • packages/data/evidence/business_continuity_and_disaster_recovery_testing_records.json (1 hunks)
  • packages/data/evidence/business_continuity_plans.json (1 hunks)
  • packages/data/evidence/capacity_reports.json (1 hunks)
  • packages/data/evidence/change_management_records.json (1 hunks)
  • packages/data/evidence/change_request_logs.json (1 hunks)
  • packages/data/evidence/change_risk_documentation.json (1 hunks)
  • packages/data/evidence/communication_records.json (1 hunks)
  • packages/data/evidence/consent_records.json (1 hunks)
  • packages/data/evidence/control_implementation_records.json (1 hunks)
  • packages/data/evidence/control_testing_documentation.json (1 hunks)
  • packages/data/evidence/data_classification_records.json (1 hunks)
  • packages/data/evidence/data_processing_logs.json (1 hunks)
  • packages/data/evidence/data_quality_documentation.json (1 hunks)
  • packages/data/evidence/data_validation_records.json (1 hunks)
  • packages/data/evidence/deficiency_management_records.json (1 hunks)
  • packages/data/evidence/disposal_records.json (1 hunks)
  • packages/data/evidence/ethics_compliance_documentation.json (1 hunks)
  • packages/data/evidence/exception_logs.json (1 hunks)
  • packages/data/evidence/external_communication_records.json (1 hunks)
  • packages/data/evidence/fraud_risk_documentation.json (1 hunks)
  • packages/data/evidence/hr_documentation.json (1 hunks)
  • packages/data/evidence/incident_analysis_records.json (1 hunks)
  • packages/data/evidence/incident_communication_records.json (1 hunks)
  • packages/data/evidence/incident_recovery_records.json (1 hunks)
  • packages/data/evidence/incident_response_records.json (1 hunks)
  • packages/data/evidence/infrastructure_monitoring_records.json (1 hunks)
  • packages/data/evidence/malware_prevention_records.json (1 hunks)
  • packages/data/evidence/management_structure_documentation.json (1 hunks)
  • packages/data/evidence/personnel_compliance_documentation.json (1 hunks)
  • packages/data/evidence/physical_access_records.json (1 hunks)
  • packages/data/evidence/policy_implementation_records.json (1 hunks)
  • packages/data/evidence/privacy_notice.json (1 hunks)
  • packages/data/evidence/recovery_records.json (1 hunks)
  • packages/data/evidence/retention_schedules.json (1 hunks)
  • packages/data/evidence/risk_assessment_documentation.json (1 hunks)
  • packages/data/evidence/risk_identification_records.json (1 hunks)
  • packages/data/evidence/technology_control_records.json (1 hunks)
  • packages/data/evidence/uptime_reports.json (1 hunks)
  • packages/data/evidence/vendor_risk_assessment_records.json (1 hunks)
  • packages/data/policies/access_control.json (1 hunks)
  • packages/data/policies/application_security.json (1 hunks)
  • packages/data/policies/availability.json (1 hunks)
  • packages/data/policies/business_continuity.json (1 hunks)
  • packages/data/policies/change_management.json (1 hunks)
  • packages/data/policies/classification.json (1 hunks)
  • packages/data/policies/code_of_conduct.json (1 hunks)
  • packages/data/policies/confidentiality.json (1 hunks)
  • packages/data/policies/corporate_governance.json (1 hunks)
  • packages/data/policies/cyber_risk.json (1 hunks)
  • packages/data/policies/data_center.json (1 hunks)
  • packages/data/policies/data_classification.json (1 hunks)
  • packages/data/policies/disaster_recovery.json (1 hunks)
  • packages/data/policies/human_resources.json (1 hunks)
  • packages/data/policies/incident_response.json (1 hunks)
  • packages/data/policies/information_security.json (1 hunks)
  • packages/data/policies/password_policy.json (1 hunks)
  • packages/data/policies/privacy.json (2 hunks)
  • packages/data/policies/risk_assessment.json (1 hunks)
  • packages/data/policies/risk_management.json (2 hunks)
  • packages/data/policies/software_development.json (1 hunks)
  • packages/data/policies/system_change.json (1 hunks)
  • packages/data/policies/thirdparty.json (5 hunks)
  • packages/data/policies/vendor_risk_management.json (1 hunks)
  • packages/data/policies/workstation.json (1 hunks)
  • packages/db/prisma/migrations/20250321211335_add_frequency_to_policy_table/migration.sql (1 hunks)
  • packages/db/prisma/schema/policy.prisma (1 hunks)
  • packages/db/prisma/seed.ts (8 hunks)
  • packages/db/prisma/seedTypes.ts (3 hunks)

Walkthrough

This pull request removes several obsolete server actions and a custom hook for framework management while refactoring UI components to simplify data handling. It updates authentication and redirection logic on dashboard and control pages, revises link routing in table components, and adjusts form and localization details. In addition, many new JSON files have been added for evidence and policy metadata with associated departmental information, and the database schema and seeding scripts have been updated accordingly.

Changes

File(s) Change Summary
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/actions/getFrameworksAction.ts
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/actions/selectFrameworksAction.ts
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/hooks/useFrameworks.ts
Removed obsolete server actions and custom hook for retrieving/selecting frameworks along with associated types.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/FrameworksGrid.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/FrameworksOverview.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/controls/[id]/components/SingleControl.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/[frameworkId]/components/table/FrameworkControlsTableColumns.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/controls/[id]/components/table/ControlRequirementsTable.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/controls/[id]/components/table/ControlRequirementsTableColumns.tsx
Modified UI components: updated function signatures (e.g., changing onSubmit return type), simplified data handling (e.g., consolidating control data in SingleControl), adjusted routing links, and added logging in table components.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/controls/[id]/page.tsx
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/page.tsx
Added authentication, redirect logic, and new async functions (getControl, getFrameworks) to fetch organization-specific data before rendering pages.
apps/app/src/auth/config.ts Updated admin status logic by conditionally counting organization members to set the isAdmin flag.
apps/app/src/components/forms/policies/policy-overview.tsx
apps/app/src/locales/core/common.ts
apps/app/src/locales/features/people.ts
apps/app/src/locales/features/policies.ts
apps/app/src/locales/settings/settings.ts
Adjusted localization and form logic by adding new constants, updating translation keys, and modifying placeholder texts.
apps/app/src/components/tables/people/employee-status.tsx Updated translation key from common.status.${status} to people.status.${status}.
packages/data/evidence/*.json Introduced numerous new JSON files (e.g., access_control_records.json, access_logs.json, etc.) containing metadata for various evidence records with defined fields: id, name, description, frequency, and department.
packages/data/policies/*.json Updated policy JSON files by adding a new "department" field to metadata for clear ownership (e.g., "it", "gov", "hr", "admin").
packages/db/prisma/migrations/*
packages/db/prisma/schema/policy.prisma
packages/db/prisma/seed.ts
packages/db/prisma/seedTypes.ts
Added a new database column (department) in the Policy table, updated the Prisma schema accordingly, and reworked seed scripts to include new functions for seeding evidence records and updating links in control requirements and policies.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant DP as DashboardPage
    participant Auth as auth()
    participant GF as getFrameworks()
    participant FO as FrameworksOverview

    U->>DP: Request Dashboard Page
    DP->>Auth: Execute auth()
    Auth-->>DP: Return user session (with organizationId)
    alt organizationId exists
      DP->>GF: Call getFrameworks(organizationId)
      GF-->>DP: Return frameworks data
      DP->>FO: Render FrameworksOverview(frameworks)
    else No organizationId
      DP->>U: Redirect to Home ("/")
    end
Loading
sequenceDiagram
    participant U as User
    participant SCP as SingleControlPage
    participant Auth as auth()
    participant GC as getControl()
    participant SC as SingleControl

    U->>SCP: Request Single Control Page (with control id)
    SCP->>Auth: Perform user authentication
    Auth-->>SCP: Return session with organizationId
    SCP->>GC: Call getControl(controlId, organizationId)
    alt Control found
      GC-->>SCP: Return control data (organizationControl)
      SCP->>SC: Render SingleControl(organizationControl)
    else Control not found
      SCP->>U: Redirect to Home
    end
Loading

Possibly related PRs

  • fix evidence statuses across app #80: Modifies the selectFrameworksAction logic to enhance evidence handling, closely aligning with the removal of framework actions and the restructuring of evidence-related operations in this PR.

Poem

I’m a rabbit with a hop and a twist,
Celebrating changes that cannot be missed.
Code refined and data aligned,
New JSON treasures perfectly designed.
With a twitch of my nose and a happy little leap,
I cheer on these improvements—so fresh and deep! 🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vercel vercel Bot temporarily deployed to Preview – comp-portal March 21, 2025 21:44 Inactive
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