Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add created/modified to registry tables #21494

Merged
merged 3 commits into from
Jul 30, 2024
Merged

Add created/modified to registry tables #21494

merged 3 commits into from
Jul 30, 2024

Conversation

bramkragten
Copy link
Member

@bramkragten bramkragten commented Jul 29, 2024

Proposed change

  • Adds 2 by default hidden columns to devices/entities/labels tables.
  • Changes the logic of sizing columns
  • Allows table to scroll horizontally if it doesn't fit

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

Summary by CodeRabbit

  • New Features

    • Added created_at and modified_at properties to various configuration entities, enhancing tracking of creation and modification timestamps.
    • Introduced new columns for created_at and modified_at in data tables across different components.
  • Bug Fixes

    • Removed fixed width properties for certain UI elements, improving responsiveness and layout flexibility.
  • Documentation

    • Updated translation files to include new terms for created_at and modified_at.

@github-actions github-actions bot added Supervisor Related to the supervisor panel Demo Related to frontend demo content Design Related to Home Assistant design gallery labels Jul 29, 2024
Copy link
Contributor

coderabbitai bot commented Jul 29, 2024

Walkthrough

Walkthrough

The recent updates enhance various components by introducing created_at and modified_at properties for better timestamp management across configuration objects. This improvement aids in tracking entity states and facilitates more responsive design layouts. Additionally, multiple files have been refined for layout consistency, improving user experience when managing devices and settings.

Changes

File Path Change Summary
demo/src/ha-demo.ts Added created_at and modified_at properties to configuration objects in the HaDemo class.
gallery/src/pages/components/ha-form.ts Enhanced DEVICES and AREAS arrays with created_at and modified_at properties; explicitly typed as DeviceRegistryEntry[] and AreaRegistryEntry[].
gallery/src/pages/components/ha-selector.ts Modified DEVICES, AREAS, and FLOORS arrays to include new timestamp properties; added type definitions for better clarity.
gallery/src/pages/misc/entity-state.ts Removed width attributes from several properties in DemoEntityState, suggesting a shift towards flexible design.
gallery/src/pages/misc/integration-card.ts Added created_at and modified_at properties to the function signatures of createEntityRegistryEntries and createDeviceRegistryEntries.
hassio/src/backups/hassio-backups.ts Replaced width properties with flex for the main entry, enhancing responsiveness in backup management.
src/components/data-table/ha-data-table.ts Renamed width to minWidth and replaced grows with flex in DataTableColumnData interface; added new method in HaDataTable class.
src/components/ha-area-picker.ts Added created_at and modified_at properties to area entries in the HaAreaPicker class.
src/components/ha-floor-picker.ts Introduced created_at and modified_at properties to the FloorRegistryEntry structure.
src/components/ha-label-picker.ts Added created_at and modified_at properties to object literals in HaLabelPicker.
src/data/area_registry.ts Modified AreaRegistryEntry interface to extend RegistryEntry, inheriting new properties.
src/data/device_registry.ts Updated DeviceRegistryEntry to extend RegistryEntry.
src/data/entity_registry.ts Changed EntityRegistryEntry to inherit from RegistryEntry.
src/data/floor_registry.ts Updated FloorRegistryEntry to extend RegistryEntry.
src/data/label_registry.ts Modified LabelRegistryEntry to inherit from RegistryEntry.
src/data/registry.ts Introduced the RegistryEntry interface with created_at and modified_at properties.
src/panels/config/application_credentials/... Adjusted layout attributes for various fields in HaConfigApplicationCredentials.
src/panels/config/automation/ha-automation-picker.ts Replaced grows with flex property in data table column configuration.
src/panels/config/devices/... Enhanced HaConfigDeviceDashboard with new columns for created_at and modified_at.
src/panels/config/entities/... Added created_at and modified_at properties to entity configurations in HaConfigEntities.
src/panels/config/labels/... Updated _columns method in HaConfigLabels to include new timestamp columns.
src/translations/en.json Introduced new "created_at" and "modified_at" translations under the "generic" section.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant App
    participant DataStore

    User->>App: Interacts with device/area settings
    App->>DataStore: Fetch device/area data
    DataStore->>App: Return data with timestamps
    App->>User: Display updated settings with created_at & modified_at
Loading
sequenceDiagram
    participant User
    participant App
    participant Logger

    User->>App: Updates configurations
    App->>Logger: Log created_at & modified_at
    Logger->>App: Confirmation
    App->>User: Display success message
Loading

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5d52fd1 and f86ea44.

Files selected for processing (40)
  • demo/src/ha-demo.ts (2 hunks)
  • gallery/src/pages/components/ha-form.ts (8 hunks)
  • gallery/src/pages/components/ha-selector.ts (10 hunks)
  • gallery/src/pages/misc/entity-state.ts (2 hunks)
  • gallery/src/pages/misc/integration-card.ts (2 hunks)
  • hassio/src/backups/hassio-backups.ts (2 hunks)
  • src/components/data-table/ha-data-table.ts (11 hunks)
  • src/components/ha-area-picker.ts (4 hunks)
  • src/components/ha-floor-picker.ts (4 hunks)
  • src/components/ha-label-picker.ts (2 hunks)
  • src/data/area_registry.ts (1 hunks)
  • src/data/device_registry.ts (1 hunks)
  • src/data/entity_registry.ts (2 hunks)
  • src/data/floor_registry.ts (1 hunks)
  • src/data/label_registry.ts (1 hunks)
  • src/data/registry.ts (1 hunks)
  • src/panels/config/application_credentials/ha-config-application-credentials.ts (1 hunks)
  • src/panels/config/automation/ha-automation-picker.ts (4 hunks)
  • src/panels/config/backup/ha-config-backup.ts (3 hunks)
  • src/panels/config/blueprint/ha-blueprint-overview.ts (1 hunks)
  • src/panels/config/devices/ha-config-devices-dashboard.ts (9 hunks)
  • src/panels/config/entities/ha-config-entities.ts (7 hunks)
  • src/panels/config/helpers/ha-config-helpers.ts (4 hunks)
  • src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts (1 hunks)
  • src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts (3 hunks)
  • src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts (2 hunks)
  • src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts (2 hunks)
  • src/panels/config/integrations/integration-panels/zwave_js/zwave_js-provisioned.ts (3 hunks)
  • src/panels/config/labels/ha-config-labels.ts (5 hunks)
  • src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts (6 hunks)
  • src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts (2 hunks)
  • src/panels/config/scene/ha-scene-dashboard.ts (4 hunks)
  • src/panels/config/script/ha-script-picker.ts (3 hunks)
  • src/panels/config/tags/ha-config-tags.ts (1 hunks)
  • src/panels/config/users/ha-config-users.ts (6 hunks)
  • src/panels/config/voice-assistants/assist/ha-config-voice-assistants-assist-devices.ts (2 hunks)
  • src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts (4 hunks)
  • src/panels/developer-tools/statistics/developer-tools-statistics.ts (6 hunks)
  • src/panels/lovelace/editor/card-editor/hui-entity-picker-table.ts (3 hunks)
  • src/translations/en.json (1 hunks)
Files skipped from review due to trivial changes (2)
  • demo/src/ha-demo.ts
  • gallery/src/pages/misc/entity-state.ts
Files skipped from review as they are similar to previous changes (38)
  • gallery/src/pages/components/ha-form.ts
  • gallery/src/pages/components/ha-selector.ts
  • gallery/src/pages/misc/integration-card.ts
  • hassio/src/backups/hassio-backups.ts
  • src/components/data-table/ha-data-table.ts
  • src/components/ha-area-picker.ts
  • src/components/ha-floor-picker.ts
  • src/components/ha-label-picker.ts
  • src/data/area_registry.ts
  • src/data/device_registry.ts
  • src/data/entity_registry.ts
  • src/data/floor_registry.ts
  • src/data/label_registry.ts
  • src/data/registry.ts
  • src/panels/config/application_credentials/ha-config-application-credentials.ts
  • src/panels/config/automation/ha-automation-picker.ts
  • src/panels/config/backup/ha-config-backup.ts
  • src/panels/config/blueprint/ha-blueprint-overview.ts
  • src/panels/config/devices/ha-config-devices-dashboard.ts
  • src/panels/config/entities/ha-config-entities.ts
  • src/panels/config/helpers/ha-config-helpers.ts
  • src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts
  • src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts
  • src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts
  • src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts
  • src/panels/config/integrations/integration-panels/zwave_js/zwave_js-provisioned.ts
  • src/panels/config/labels/ha-config-labels.ts
  • src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts
  • src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts
  • src/panels/config/scene/ha-scene-dashboard.ts
  • src/panels/config/script/ha-script-picker.ts
  • src/panels/config/tags/ha-config-tags.ts
  • src/panels/config/users/ha-config-users.ts
  • src/panels/config/voice-assistants/assist/ha-config-voice-assistants-assist-devices.ts
  • src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts
  • src/panels/developer-tools/statistics/developer-tools-statistics.ts
  • src/panels/lovelace/editor/card-editor/hui-entity-picker-table.ts
  • src/translations/en.json

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@silamon
Copy link
Contributor

silamon commented Jul 30, 2024

Let use the "—" again instead of "-", it looks nicer.

image

silamon
silamon previously approved these changes Jul 30, 2024
Copy link
Contributor

@silamon silamon left a comment

Choose a reason for hiding this comment

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

I'm not sure if the year should also be displayed in the created/modified dates.
We do have an open issue for last triggered in automations: #20392
For created/modified, it may not change as much as last triggered, making this issue more visible on these columns.

@silamon
Copy link
Contributor

silamon commented Jul 30, 2024

To fix the CI: Update your prettier to the last version (yarn install) and rerun prettier. It's the removal of ( ) in the ha-data-table that causes it to fail.

@frenck frenck merged commit 4ade395 into dev Jul 30, 2024
13 checks passed
@frenck frenck deleted the created-modified branch July 30, 2024 09:18
@ildar170975
Copy link
Contributor

I'm not sure if the year should also be displayed in the created/modified dates.

Since these values can be from past years - displaying a year will avoid confusions.
#21640

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Demo Related to frontend demo content Design Related to Home Assistant design gallery Supervisor Related to the supervisor panel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants