Skip to content

upcoming: [DPS-42089] - label name update for object storage buckets - #655

Merged
3 commits merged into
ACLPManager:aclp_developfrom
venkymano-akamai:obj_label_fix
Apr 13, 2026
Merged

3 commits merged into
ACLPManager:aclp_developfrom
venkymano-akamai:obj_label_fix

Conversation

@venkymano-akamai

Copy link
Copy Markdown

Description 📝

Highlight the Pull Request's context and intentions.

Changes 🔄

List any change(s) relevant to the reviewer.

  • ...
  • ...

Scope 🚢

Upon production release, changes in this PR will be visible to:

  • All customers
  • Some customers (e.g. in Beta or Limited Availability)
  • No customers / Not applicable

Target release date 🗓️

Please specify a release date (and environment, if applicable) to guarantee timely review of this PR. If exact date is not known, please approximate and update it as needed.

Preview 📷

Include a screenshot <img src="" /> or video <video src="" /> of the change.

🔒 Use the Mask Sensitive Data setting for security.

💡 For changes requiring multiple steps to validate, prefer a video for clarity.

Before After
📷 📷

How to test 🧪

Prerequisites

(How to setup test environment)

  • ...
  • ...

Reproduction steps

(How to reproduce the issue, if applicable)

  • ...
  • ...

Verification steps

(How to verify changes)

  • ...
  • ...
Author Checklists

As an Author, to speed up the review process, I considered 🤔

Check all that apply

  •  Use React components instead of HTML Tags
  • Proper naming conventions like cameCase for variables & Function & snake_case for constants
  • Use appropriate types & avoid using "any"
  • No type casting & non-null assertions
  • Adding a changeset
  • Providing/Improving test coverage
  • Use sx props to pass styles instead of style prop
  • Add JSDoc comments for interface properties & functions
  • Use strict equality (===) instead of double equal (==)
  • Use of named arguments (interfaces) if function argument list exceeds size 2
  • Destructure the props
  • Keep component size small & move big computing functions to separate utility
  • 📱 Providing mobile support

  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All tests and CI checks are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@santoshp210-akamai santoshp210-akamai 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.

Very simple and easy to follow logic. Looks good. But I feel like having UTs would be better.

Approval pending till UTs are added.

Copilot AI 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.

Pull request overview

This PR introduces a shared formatting helper to change how Object Storage resource hostnames are displayed in CloudPulse (e.g., simplifying bucket.region.linodeobjects.com into a shorter label), and applies it in both widget dimension labeling and the resources dropdown for Object Storage.

Changes:

  • Added formatObjectStorageUrl to transform Object Storage hostnames into a more compact label.
  • Applied formatting to Object Storage entity_id labels in widget dimension/legend naming.
  • Applied formatting to Object Storage resource labels in CloudPulseResourcesSelect.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
packages/manager/src/features/CloudPulse/Utils/utils.ts Adds formatObjectStorageUrl helper for Object Storage hostname label formatting.
packages/manager/src/features/CloudPulse/Utils/CloudPulseWidgetUtils.ts Uses the formatter to display Object Storage entity labels in widget dimension names.
packages/manager/src/features/CloudPulse/shared/CloudPulseResourcesSelect.tsx Uses the formatter to display formatted labels for Object Storage resources in the selector.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +774 to +806
export const formatObjectStorageUrl = (url: string): string => {
const parts = url.split('.');

// Need at least 3 parts for a valid object storage URL
// e.g., 'bucket.region.linodeobjects.com' has 4 parts minimum
if (parts.length < 3) {
return url; // Return original if format doesn't match
}

// Remove 'linodeobjects' and 'com' from the end
const withoutDomain = parts.slice(0, -2);

if (withoutDomain.length === 0) {
return url; // Return original if nothing left after removing domain
}

// Get the region (last part after removing domain)
const region = withoutDomain[withoutDomain.length - 1];

if (!region) {
return url; // Return original if no region found
}

// Get everything before the region
const prefix = withoutDomain.slice(0, -1).join('.');

// If there's no prefix, just return the region in brackets
if (!prefix) {
return `[${region}]`;
}

// Combine prefix and region in brackets
return `${prefix}[${region}]`;

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

formatObjectStorageUrl currently formats any string with 3+ dot-separated segments, regardless of whether it actually ends with linodeobjects.com. This can produce incorrect output (e.g., us-east-1.linodeobjects.com becomes [us-east-1], and non-object-storage dotted labels could be mangled). Consider first verifying the hostname ends with .linodeobjects.com and requiring at least 4 segments (bucket.region.linodeobjects.com) before transforming; otherwise return the original input.

Copilot uses AI. Check for mistakes.
Comment on lines +777 to +781
// Need at least 3 parts for a valid object storage URL
// e.g., 'bucket.region.linodeobjects.com' has 4 parts minimum
if (parts.length < 3) {
return url; // Return original if format doesn't match
}

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

The comment says a valid object storage URL like bucket.region.linodeobjects.com has 4 parts minimum, but the guard only checks for < 3. This mismatch makes the function transform 3-part hostnames (endpoints) even though they don’t match the documented bucket format. Align the guard and logic with the documented expected format.

Copilot uses AI. Check for mistakes.
Comment on lines 99 to +115
const getResourcesList = React.useMemo<CloudPulseResources[]>(() => {
return filterUsingDependentFilters(resources, xFilter) ?? [];
}, [resources, xFilter]);
const filteredResources =
filterUsingDependentFilters(resources, xFilter) ?? [];
if (resourceType !== 'objectstorage') {
return filteredResources;
}

return filteredResources.map((resource: CloudPulseResources) => {
if (resource.label) {
return {
...resource,
label: formatObjectStorageUrl(resource.label),
};
}
return resource;
});
}, [resourceType, resources, xFilter]);

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

New object storage label formatting behavior isn’t covered by this component’s existing test suite. Add a test case for resourceType="objectstorage" that verifies bucket/hostname labels are rendered in the formatted form (and that selection still uses the underlying id).

Copilot uses AI. Check for mistakes.
Comment on lines 461 to +472
if (key === 'entity_id') {
const resourceName = mapResourceIdToName(value, resources);
const index = groupBy.indexOf(key);
const formattedName =
serviceType === 'objectstorage'
? formatObjectStorageUrl(resourceName)
: resourceName;

if (index !== -1) {
labels[index] = resourceName;
labels[index] = formattedName;
} else {
labels.push(resourceName);
labels.push(formattedName);

Copilot AI Apr 8, 2026

Copy link

Choose a reason for hiding this comment

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

getDimensionName now formats all entity_id labels when serviceType === 'objectstorage'. Given useResourcesQuery can return object storage endpoints like us-east-1.linodeobjects.com, this will currently display as [us-east-1] due to formatObjectStorageUrl’s broad matching. Once formatObjectStorageUrl is tightened to only transform bucket-style hostnames, this call site should inherit the correct behavior; otherwise consider narrowing when formatting is applied.

Copilot uses AI. Check for mistakes.
@venkymano-akamai

Copy link
Copy Markdown
Author

run_cypress

@agorthi-akamai agorthi-akamai closed this pull request by merging all changes into ACLPManager:aclp_develop in 0925263 Apr 13, 2026
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.

4 participants