Skip to content

Feat: Add screenshots to site#9532

Merged
Meldiron merged 1 commit intofeat-sitesfrom
feat-site-deployment-details
Mar 18, 2025
Merged

Feat: Add screenshots to site#9532
Meldiron merged 1 commit intofeat-sitesfrom
feat-site-deployment-details

Conversation

@Meldiron
Copy link
Copy Markdown
Contributor

@Meldiron Meldiron commented Mar 18, 2025

What does this PR do?

Adds screenshot details of active deployment on site, to prevent need for subqueries from frontend in site list view

Test Plan

Tests updated

Related PRs and Issues

x

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Summary by CodeRabbit

  • New Features
    • Added support for themed deployment screenshots. Deployments now include options for both light and dark mode visuals, offering clearer and more tailored deployment displays across site updates and management operations.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 18, 2025

Walkthrough

This pull request expands the deployment configuration and processing by introducing two new attributes—deploymentScreenshotLight and deploymentScreenshotDark—into several components. These changes are applied in the configuration file, functions handling deployments, site update and delete operations, the Site response model, and corresponding tests. The new attributes are defined as optional strings with a size limit of 32 characters and are injected into deployment-related operations in the system.

Changes

File(s) Change Summary
app/config/collections/projects.php Added deploymentScreenshotLight and deploymentScreenshotDark attributes (type string, size 32, optional) to the deployments collection.
src/Appwrite/Platform/Modules/Functions/Workers/Builds.php Updated buildDeployment to fetch and set new screenshot attributes using getAttribute (defaulting to an empty string); removed an extra blank line.
src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php
src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php
Modified document operations to incorporate the new deployment screenshot attributes during update/reset actions.
src/Appwrite/Utopia/Response/Model/Site.php Extended the Site model constructor with rules for deploymentScreenshotLight and deploymentScreenshotDark including descriptions, defaults, and examples.
tests/e2e/Services/Sites/SitesCustomServerTest.php Introduced assertions in the testSiteScreenshot method to verify that the site response contains the expected screenshot data from the deployment.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant DeployAPI as Deployment API
    participant Builds as Builds Module
    participant DB as Database
    participant Sites as Sites API
    participant Response as Response Model

    User->>DeployAPI: Initiate deployment
    DeployAPI->>Builds: Call buildDeployment()
    Builds->>DB: Retrieve attributes (Light & Dark)
    DB-->>Builds: Return attribute values
    Builds->>DB: Update resource with new screenshot attributes
    Note over Builds,DB: Deployment process continues...
    User->>Sites: Request site update/getSite()
    Sites->>DB: Update & retrieve site document
    DB-->>Sites: Return document with new screenshot fields
    Sites->>Response: Prepare site response
    Response-->>User: Return site details including screenshots
Loading

Possibly related PRs

  • Feat: totalSize attribute #9524: Involves similar modifications to deployment attributes, particularly focusing on adding and managing screenshot-related information in deployment documents.

Suggested reviewers

  • vermakhushboo

Poem

I’m a rabbit leaping through lines of code,
Hopping on changes in this new deploy mode.
With light and dark screenshots tucked in neat,
I nibble on bugs 'til no errors repeat.
Carrots and commits, joy in a hop,
Celebrating these changes that make our code pop!

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a0d4e47 and ef163e8.

📒 Files selected for processing (6)
  • app/config/collections/projects.php (1 hunks)
  • src/Appwrite/Platform/Modules/Functions/Workers/Builds.php (2 hunks)
  • src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php (1 hunks)
  • src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php (1 hunks)
  • src/Appwrite/Utopia/Response/Model/Site.php (1 hunks)
  • tests/e2e/Services/Sites/SitesCustomServerTest.php (1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
tests/e2e/Services/Sites/SitesCustomServerTest.php (1)
tests/e2e/Services/Sites/SitesBase.php (1) (1)
  • getSite (161:169)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: scan
🔇 Additional comments (6)
src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php (1)

103-104: Added screenshot field reset logic.

These new fields properly reset the deployment screenshot references when a site's active deployment is deleted, maintaining consistency with how other deployment fields are handled.

src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php (1)

93-94: Added screenshot attributes to site deployment updates.

The implementation correctly transfers the screenshot references from the deployment to the site document, defaulting to empty strings if not present.

src/Appwrite/Platform/Modules/Functions/Workers/Builds.php (1)

901-902: Added screenshot attributes to automatic deployment activation.

This change ensures that screenshot references are properly transferred to the site document when a deployment is automatically activated, consistent with the deployment update logic.

tests/e2e/Services/Sites/SitesCustomServerTest.php (1)

1823-1826: Added assertions for site screenshot attributes.

These test assertions verify that the screenshot references are correctly transferred from the deployment to the site document, ensuring the feature works as expected.

src/Appwrite/Utopia/Response/Model/Site.php (1)

61-72: LGTM! The screenshot attributes are clearly defined and well-documented.

The two new fields for site deployments enhance the model by storing screenshot file IDs for both light and dark themes. These attributes are properly documented with clear descriptions, and the approach aligns well with the PR objective to eliminate subqueries by including screenshot details directly in the site model.

app/config/collections/projects.php (1)

1006-1028: LGTM! Database schema updates align with model changes.

The database schema correctly defines the new deploymentScreenshotLight and deploymentScreenshotDark attributes with appropriate properties:

  • 32 character size limitation is sufficient for file IDs
  • Fields are properly marked as optional with null defaults
  • Helpful comments clarify that these are file IDs from the 'screenshots' Console bucket

This implementation correctly matches the model changes made in the Site.php file and supports the PR objective to store screenshot details directly with the site.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.

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.

@github-actions
Copy link
Copy Markdown

Security Scan Results for PR

Docker Image Scan Results

Package Version Vulnerability Severity
binutils 2.42-r0 CVE-2025-0840 HIGH
libexpat 2.6.4-r0 CVE-2024-8176 HIGH
libxml2 2.12.7-r0 CVE-2024-56171 HIGH
libxml2 2.12.7-r0 CVE-2025-24928 HIGH
libxml2 2.12.7-r0 CVE-2025-27113 HIGH

Source Code Scan Results

🎉 No vulnerabilities found!

@github-actions
Copy link
Copy Markdown

✨ Benchmark results

  • Requests per second: 889
  • Requests with 200 status code: 160,107
  • P99 latency: 0.207463309

⚡ Benchmark Comparison

Metric This PR Latest version
RPS 889 1,133
200 160,107 203,973
P99 0.207463309 0.164681758

@Meldiron Meldiron merged commit 20d90e0 into feat-sites Mar 18, 2025
31 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Mar 20, 2025
3 tasks
@coderabbitai coderabbitai bot mentioned this pull request Oct 30, 2025
2 tasks
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.

2 participants