Skip to content

Conversation

@jkowalski
Copy link
Contributor

No description provided.

@jkowalski jkowalski requested a review from Copilot June 7, 2025 15:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors UI formatting utilities by extracting them into a separate module, making the formatting logic more modular and reusable.

  • Extract formatting functions (for number, duration, and date formatting) into a new module (formatutils.js).
  • Update imports throughout the codebase to reference the new module for formatting functions while retaining error handling functions in uiutil.jsx.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/utils/uiutil.jsx Removed various formatting functions; retained error handling utilities (redirect, etc.).
src/utils/taskutil.jsx Updated import for formatDuration to use the new module.
src/utils/formatutils.js New module containing formatting utilities (sizeDisplayName, parseQuery, etc.).
src/pages/Task.jsx Updated imports to reference formatDuration and sizeDisplayName from formatutils.js.
src/pages/Snapshots.jsx Updated imports for formatting functions (e.g. ownerName → formatOwnerName) appropriately.
src/pages/SnapshotHistory.jsx Adjusted imports to use formatutils.js for several formatting functions.
src/pages/Policy.jsx Updated parseQuery import to reference the new module.
src/pages/Policies.jsx Refactored owner name formatting to use the new formatOwnerName function from formatutils.js.
src/components/SnapshotEstimation.jsx Adjusted imports to use sizeDisplayName from formatutils.js.
src/components/DirectoryItems.jsx Updated imports for objectLink and rfc3339TimestampForDisplay to the new module.
Comments suppressed due to low confidence (1)

src/utils/uiutil.jsx:1

  • [nitpick] Now that formatting functions have been extracted to formatutils.js, consider reviewing the module boundaries. If uiutil.jsx only handles error-related utilities (such as redirect and errorAlert), it may improve clarity to further separate error handling from general UI utilities.
import { faExclamationTriangle } from "@fortawesome/free-solid-svg-icons";

import { handleChange } from "../forms";
import KopiaTable from "../components/KopiaTable";
import { compare, errorAlert, ownerName, redirect, sizeDisplayName, sizeWithFailures } from "../utils/uiutil";
import { compare, formatOwnerName, sizeDisplayName } from "../utils/formatutils";
Copy link

Copilot AI Jun 7, 2025

Choose a reason for hiding this comment

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

[nitpick] With the refactoring, formatting functions are now split between formatutils.js and uiutil.jsx. For consistency and clarity, consider grouping all formatting utilities together if they share similar usage contexts.

Copilot uses AI. Check for mistakes.
@jkowalski jkowalski merged commit f951773 into kopia:main Jun 7, 2025
2 checks passed
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