Skip to content

Simplify and compact curation log table#2400

Open
luistoptal wants to merge 5 commits into
gigascience:developfrom
luistoptal:new-feautre/2331-adjust-the-curation-log-view-for-a-better-user-experience
Open

Simplify and compact curation log table#2400
luistoptal wants to merge 5 commits into
gigascience:developfrom
luistoptal:new-feautre/2331-adjust-the-curation-log-view-for-a-better-user-experience

Conversation

@luistoptal

@luistoptal luistoptal commented Jul 7, 2025

Copy link
Copy Markdown
Collaborator

Pull request for issue: #2331

Updated curator log table in dataset forms
image
image

  • removed all columns except date / comments / actions
  • 'action' prepended to 'comment' column
  • hovering the log shows a tooltip with the content of the removed columns
  • minimized spacing for compact layout, ignoring aesthetics
  • slightly darken the text to enhance readability

How to test?

  • navigate to http://gigadb.gigasciencejournal.com/adminDataset/update/id/5
  • click on 'mint doi'
  • observe the newly generated curation logs at the bottom of the page
  • create a new log
  • visualize the new log in the form
  • hover with the mouse over the logs to check that a tooltip with 'created by', 'modified by, 'modified date' are displayed
  • docker-compose run --rm codecept run --no-redirect -g issue-2331 acceptance -vv should pass

How have functionalities been implemented?

  • see comments in PR diff

Any issues with implementation?

--

Any changes to automated tests?

Updated a breaking acceptance test

Summary by CodeRabbit

  • New Features

    • Added new table styling options for compact layout and improved text visibility on non-white backgrounds.
    • Tooltips now display detailed curation log information, including creator, last modifier, and modification date, with enhanced HTML formatting.
  • Enhancements

    • Improved tooltip functionality to support HTML content and consistent placement.
    • Refined curation log display with clearer column formatting and more informative comments.
    • Updated acceptance tests to check for more precise UI text.
  • Tests

    • Added a new test step for verifying specific text in the page source.

@coderabbitai

coderabbitai Bot commented Jul 7, 2025

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes update table styling for compactness and dark text, enhance Bootstrap tooltip initialization, add a tooltip method to the curation log model, restructure the curation log grid view to use tooltips and condensed columns, and update acceptance tests and step definitions to match the new UI and tooltip content.

Changes

File(s) Change Summary
less/modules/tables.less Added .table--black-text and .table-compact classes for alternative table styling.
protected/js/bootstrap-tooltip-init.js Modified tooltip initialization to allow HTML content and attach tooltips to the body element.
protected/models/CurationLog.php Added getTooltip() method to return encoded HTML tooltip with creator and modification info.
protected/views/adminDataset/curationLog.php Updated grid view: added compact and dark text classes, attached tooltips, restructured columns, and changed comment/action logic.
tests/_support/AcceptanceTester.php Added iShouldSeeInTheSource() step for verifying text in page source.
tests/acceptance/AdminDatasetCurationLog.feature Adjusted scenario to check for specific tooltip label and tagged with @issue-2331.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant View (curationLog.php)
    participant Model (CurationLog)
    participant Tooltip (Bootstrap)
    
    User->>View (curationLog.php): Loads curation log page
    View (curationLog.php)->>Model (CurationLog): Calls getTooltip() for each row
    Model (CurationLog)-->>View (curationLog.php): Returns encoded tooltip HTML
    View (curationLog.php)-->>Tooltip (Bootstrap): Initializes tooltip with HTML content
    User-->>Tooltip (Bootstrap): Hovers over table row
    Tooltip (Bootstrap)-->>User: Displays tooltip with creator/modification info
Loading

Possibly related issues

Suggested labels

pr:has-ui


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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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.

Comment thread less/modules/tables.less
color: @color-darker-gray;
}
// use if table background color is not white
table.table--black-text td {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this style helps darken the text of tables with gray background

Comment thread less/modules/tables.less
}
}

table.table-compact {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

styles for a compact table that removes as much spacing a possible

$(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="tooltip"]').tooltip({
html: true,

@luistoptal luistoptal Jul 7, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

html: true parses tooltip content as html, allowing to show <br/>
container: body appends tooltip as direct child of the body. This is necessary to prevent breaking table layout as tooltip would be appended in between rows, creating table styling issues

Adding these options to all tooltips seems like an improvement. If tooltip content is plain text, nothign changes. Appending tooltip to body does not change its position (bootstrap handles positioning)

'value' => function($data) {
if (preg_match('/^<\?xml/', $data->comments)) {
return LogCurationFormatter::getDisplayXmlAttr($data->id, $data->comments);
$commentOutput = $data->comments;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this extended logic takes care of prepending action label if it exists, and also takes into account whether a comment exists, to properly format the output as follows:

i.e. case: output

  • comment with no action: [comment]
  • comment + action: [action]: [comment]
  • action, no comment: [action]

Then I am on "/adminDataset/update/id/8"
And I wait "3" seconds
And I should see "Joe Bloggs"
And I should see "Created by: Joe Bloggs" in the source

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

look into the source directly, because the tooltip is not displayed by default

@luistoptal

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 7, 2025

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
protected/models/CurationLog.php (1)

198-208: Remove unused variables for cleaner code.

The method works correctly but contains unused variables flagged by static analysis.

Apply this diff to remove the unused variables:

 public function getTooltip(): string
 {
-    $fmt = Yii::app()->format;
-
-    $action        = CHtml::encode($this->action);
     $createdBy     = CHtml::encode($this->created_by);
     $modifiedBy    = CHtml::encode($this->last_modified_by ?? '-');
     $modifiedDate  = CHtml::encode($this->last_modified_date ?? '-');

     return "Created by: {$createdBy}<br/>Modified by: {$modifiedBy}<br/>Modified date: {$modifiedDate}";
 }
protected/views/adminDataset/curationLog.php (1)

26-43: Approve with minor suggestion for robustness

The logic correctly implements the requirements to prepend action text to comments. The XML detection and formatting using LogCurationFormatter::getDisplayXmlAttr is appropriate.

Consider adding null safety for the action text:

-        $actionText = $data->action;
+        $actionText = $data->action ?? '';

This prevents potential issues if the action field is null, though it may not be necessary depending on your data model constraints.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ee58669 and e09dbed.

📒 Files selected for processing (6)
  • less/modules/tables.less (2 hunks)
  • protected/js/bootstrap-tooltip-init.js (1 hunks)
  • protected/models/CurationLog.php (1 hunks)
  • protected/views/adminDataset/curationLog.php (1 hunks)
  • tests/_support/AcceptanceTester.php (1 hunks)
  • tests/acceptance/AdminDatasetCurationLog.feature (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
`**/*`: - Focus on code smells, logic errors, edge cases, missing test cases, se...

**/*: - Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues

  • Avoid commenting on minor issues such as linting, formatting and style issues
  • Never commit secrets, PII, passwords or API keys—use env-vars and .env files.
  • Flag any file >300 lines or function >30 lines and suggest refactoring.
  • Every new feature or bug-fix must arrive with automated tests; warn if none are touched.
  • If the PR includes changes to the UI, the style guide should be updated too; warn if not.

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • protected/js/bootstrap-tooltip-init.js
  • tests/_support/AcceptanceTester.php
  • tests/acceptance/AdminDatasetCurationLog.feature
  • less/modules/tables.less
  • protected/models/CurationLog.php
  • protected/views/adminDataset/curationLog.php
`**/*.js`: - New JavaScript must live in `giga/app/client/js/` (not in `protecte...

**/*.js: - New JavaScript must live in giga/app/client/js/ (not in protected/js/).

  • Write ES-module code (import…export) only—no global scripts.
  • Functions needing >2 logical params must take a single options object.
  • Rely on jQuery 3 or Vue for DOM work; avoid direct DOM APIs unless impossible.
  • No Console.log

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • protected/js/bootstrap-tooltip-init.js
`**/*.php`: - HTML follows web accessibility WCAG 2 standards

**/*.php: - HTML follows web accessibility WCAG 2 standards

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • tests/_support/AcceptanceTester.php
  • protected/models/CurationLog.php
  • protected/views/adminDataset/curationLog.php
`**/*.less`: - Follow SMACSS: - Base: Default element styles - Layout: `.l-*...

**/*.less: - Follow SMACSS:

  • Base: Default element styles
  • Layout: .l-* classes for page skeleton
  • Modules: .my-module-* for reusable components
  • State: .is-* for UI states
  • Theme: .theme-* for theme overrides
  • Never hard-code colors, always use color variables defined in less/base/variables.less.
  • Desktop-first: media queries for mobile styles.
  • Limit nesting to three levels; favour flat selectors for maintainability.

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • less/modules/tables.less
🧠 Learnings (2)
📓 Common learnings
Learnt from: rija
PR: gigascience/gigadb-website#2157
File: CHANGELOG.md:7-7
Timestamp: 2025-05-26T17:52:49.544Z
Learning: In the GigaDB project, textual changes to website content should be categorized as "Feat" (feature) entries in the CHANGELOG.md, not as "Docs" (documentation) entries, even when the changes involve updating guidance or instructional text on web pages.
Learnt from: alli83
PR: gigascience/gigadb-website#2301
File: protected/views/user/_form.php:179-187
Timestamp: 2025-05-23T02:02:48.284Z
Learning: The PR "Fix 561 separate admin user page from non admin user page" focuses specifically on separating admin user pages from non-admin user pages, removing terms and captcha requirements on update and change password pages, and adding token generation for activation links. Issues outside this scope should be addressed in separate PRs.
tests/acceptance/AdminDatasetCurationLog.feature (1)
Learnt from: rija
PR: gigascience/gigadb-website#2157
File: CHANGELOG.md:7-7
Timestamp: 2025-05-26T17:52:49.544Z
Learning: In the GigaDB project, textual changes to website content should be categorized as "Feat" (feature) entries in the CHANGELOG.md, not as "Docs" (documentation) entries, even when the changes involve updating guidance or instructional text on web pages.
🧬 Code Graph Analysis (1)
protected/views/adminDataset/curationLog.php (1)
protected/components/LogCurationFormatter.php (2)
  • LogCurationFormatter (5-17)
  • getDisplayXmlAttr (8-16)
🪛 PHPMD (2.15.0)
protected/models/CurationLog.php

200-200: Avoid unused local variables such as '$fmt'. (Unused Code Rules)

(UnusedLocalVariable)


202-202: Avoid unused local variables such as '$action'. (Unused Code Rules)

(UnusedLocalVariable)

🔇 Additional comments (8)
protected/js/bootstrap-tooltip-init.js (1)

2-5: LGTM! Tooltip configuration enhances functionality.

The added configuration options properly support HTML content in tooltips and ensure proper positioning by appending to the body.

less/modules/tables.less (2)

14-16: LGTM! Text color utility for gray backgrounds.

The .table--black-text class appropriately addresses text visibility on non-white table backgrounds.


292-304: LGTM! Compact table styling is well-implemented.

The .table-compact class effectively reduces spacing while maintaining readability with appropriate padding and line-height values.

tests/acceptance/AdminDatasetCurationLog.feature (1)

34-42: LGTM! Test properly validates tooltip content.

The test correctly checks for tooltip content in the page source and includes proper issue tracking with the @issue-2331 tag.

tests/_support/AcceptanceTester.php (1)

455-461: LGTM! Simple and effective step definition.

The new step method properly wraps the existing seeInSource functionality for use in Gherkin scenarios.

protected/views/adminDataset/curationLog.php (3)

14-14: LGTM - CSS classes added for compact styling

The addition of table-compact and table--black-text classes aligns with the PR objective to make the layout more compact and improve text readability.


15-15: LGTM - Bootstrap tooltip configuration

The tooltip configuration correctly implements the hover functionality to display detailed information from the removed columns. The syntax for rowHtmlOptionsExpression is appropriate for Yii framework grid views.


18-21: LGTM - Column structure enhancement

Converting the creation_date column from string to array format with width specification is a valid improvement for better layout control.

@luistoptal luistoptal changed the title feat: simplify and compact curation log table Simplify and compact curation log table Jul 7, 2025
@luistoptal
luistoptal marked this pull request as ready for review July 7, 2025 09:57
@luistoptal luistoptal moved this from Draft to Ready For Review in Backlog: Pull Requests Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready For Review

Development

Successfully merging this pull request may close these issues.

1 participant