Skip to content

upcoming: [DI-26678] - Alert Firewall dimension filters customization - #12789

Closed
santoshp210-akamai wants to merge 18 commits into
linode:developfrom
santoshp210-akamai:feature/firewall-dimension-filters
Closed

upcoming: [DI-26678] - Alert Firewall dimension filters customization#12789
santoshp210-akamai wants to merge 18 commits into
linode:developfrom
santoshp210-akamai:feature/firewall-dimension-filters

Conversation

@santoshp210-akamai

@santoshp210-akamai santoshp210-akamai commented Sep 2, 2025

Copy link
Copy Markdown
Contributor

Description 📝

Firewall dimension filters customization for Create/Edit/Show-details in Alerts

Changes 🔄

  • Custom validation for Interface IDs
  • Fetching different queries and transforming options for Linode, Linode Region, VPC-subnet dimension filters
  • Transforming linode_ids, subnet_ids to labels in show-details
  • Enhanced useFetchOptions to send Loading and Error states along with values
  • Add config map entries for Linode ID, Linode Region, VPC-Subnet filter, Interface ID filter
  • Relevant unit tests to test the functionalities
  • Mock responses to test the features

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 🗓️

Sept 9th

Preview 📷

Linode ID translation in Show-details

Before After
image image
interface_id_customisation.mp4
vpc_subnet_dimension.mp4
firewall-linode-id-region-filter.mp4

How to test 🧪

Prerequisites

(How to setup test environment)

  • In Mock environment , please choose Legacy MSW Handlers for Base Preset
  • Under Monitor, click on Alerts
  • For Create : Click on Create Alert button, choose the Firewall service. Please select all entities for the Linode and Linode Region values to be available. In VPC_Subnet for 'in' operator it is showing multiple values even though selected id's are 1 or 2. I suspect that it is due to the repeated id's for subnets across multiple VPC's.
  • For Show-Details: In the Alerts Page, Find 'Firewall - testing' alert and in action menu click on Show Details
  • For Edit: In the Alerts Page, Find 'Firewall - testing' alert and in action menu click on Edit. Please select all entites for the Linode and Linode Region values to be available.In VPC_Subnet for 'in' operator it is showing multiple values even though only 2 id's are passed. I suspect that it is due to the repeated id's for subnets across multiple VPC's.

Verification steps

(How to verify changes)

  • Linode dimension filter is filtering the parent linode entity from the selected entities and the supportedRegion of the account and showing the relevant options.
  • Linode Region dimension filter is filtering the parent linode entity from the selected entities and the supportedRegion of the account and showing the relevant options.
  • VPC Subnet dimension filter is transforming the values and displaying similarly as shown in the preview
  • Interface dimension filter is validation the inputs properly. (Similar to configuration dimension filter validation from nodebalancer service)
  • The translation of linode_id, subnet_id to the relevant labels in Show-details
Author Checklists

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

👀 Doing a self review
❔ Our contribution guidelines
🤏 Splitting feature into small PRs
➕ Adding a changeset
🧪 Providing/improving test coverage
🔐 Removing all sensitive information from the code and PR description
🚩 Using a feature flag to protect the release
👣 Providing comprehensive reproduction steps
📑 Providing or updating our documentation
🕛 Scheduling a pair reviewing session
📱 Providing mobile support
♿ Providing accessibility 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 requested a review from a team as a code owner September 2, 2025 12:35
@santoshp210-akamai
santoshp210-akamai requested review from bnussman-akamai and harsh-akamai and removed request for a team September 2, 2025 12:35
@santoshp210-akamai santoshp210-akamai changed the title upcoming: [DI-26678] - Mocks for testing upcoming: [DI-26678] - Alert Firewall dimension filters customization Sep 2, 2025
@santoshp210-akamai santoshp210-akamai self-assigned this Sep 2, 2025
@santoshp210-akamai
santoshp210-akamai requested review from a team, coliu-akamai, dwiley-akamai, nikhagra-akamai and venkymano-akamai and removed request for a team September 2, 2025 12:36
@santoshp210-akamai

santoshp210-akamai commented Sep 2, 2025

Copy link
Copy Markdown
Contributor Author

Few changes from ValueSchema.ts included in this PR are already part of a previous PR: #12771.

Around 250+ lines of code changes are for mock testing, utils and tests.

@santoshp210-akamai

santoshp210-akamai commented Sep 2, 2025

Copy link
Copy Markdown
Contributor Author

Although I have not directly changed anything related to the AlertReusableComponent, the UT is failing. Will work on it and fix the fix for that UT failure.

I have pushed the fix

threshold: 1000,
dimension_filters: [
{
label: 'VPC-Subnet',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
label: 'VPC-Subnet',
label: 'VPC Subnet',

I think we should remove any instances where the dash appears as we don't use "VPC-Subnet" anywhere else in the application

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am using the same labels that we currently receive from the firewall/metric-definitions API call for mocks as well.

Comment on lines +83 to +91
export const getResolvedDimensionValue = (
dimensionFilterKey: string,
dimensionOperator: DimensionFilterOperatorType,
value: null | string | undefined,
serviceType: CloudPulseServiceType,
linodeMap: Record<string, string>,
vpcSubnetMap: Record<string, string>,
transformationAllowedOperators: DimensionFilterOperatorType[]
): string => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With this many parameters, it would be better to have the function accept an object. It will also help prevent the wrong thing from being passed in the wrong slot (which could happen with, for example, linodeMap and vpcSubnetMap in the current implementation).

@santoshp210-akamai santoshp210-akamai Sep 3, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@dwiley-akamai , All of the logic initially was in the RenderAlertsMetricsAndDimensions component directly. Created this separated util to handle logic and keep the component clean and simple.

As of now there are no requirements that will require us to make further use of this component. But if we have to, we will consider this feedback and create a Interface for them in the upcoming PRs.

@coliu-akamai coliu-akamai Sep 4, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fwiw I second this bc it makes the code more readable at first glance. For example re the below image, it might not be clear at first what some of the arguments like 'linode-c, linode-d', 'firewall', etc are for

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@coliu-akamai ,Sure will make it a prop interface and push the change.

@coliu-akamai coliu-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question with Linode Region dimension filter - should we consider using a region select for cases when the filter is equal, not equal, or in?

image

Seeing this error appear some times - I haven't been able to get clear replicating steps, but it once appeared when I changed the Operator type and then backspaced in the Value field
image

@ankita-akamai

Copy link
Copy Markdown
Contributor

@santoshp210-akamai there are some conflicts due to recent merge, they need to be resolved. I also see serverhandler changes being pushed, please remove them.

@santoshp210-akamai

Copy link
Copy Markdown
Contributor Author

@coliu-akamai , For the Linode Region filter we want to provide the functionality of choosing the options currently. We are not sure to make it a RegionFilter as of now and it wasn't in the scope of this particular ticket. If we plan it , it will be part of a future PR.

@linode-gh-bot

Copy link
Copy Markdown

Cloud Manager UI test results

🔺 1 failing test on test run #13 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
1 Failing737 Passing6 Skipped43m 56s

Details

Failing Tests
SpecTest
open-support-ticket.spec.tsCloud Manager Cypress Tests→open support tickets » can create a support ticket with an entity

Troubleshooting

Use this command to re-run the failing tests:

pnpm cy:run -s "cypress/e2e/core/helpAndSupport/open-support-ticket.spec.ts"

@santoshp210-akamai

Copy link
Copy Markdown
Contributor Author

Pushed this commit 0e51a78 which has the following changes

//Previous implementation
const baseValueSchema = string()
  .nullable()
  .required(fieldErrorMessage)
  .test('nonEmpty', fieldErrorMessage, (value) => value !== null);

As @coliu-akamai pointed out, we encountered a special case where when the operator is selected and backspace is pressed it is showing us the default yup schema error message.

And it was happening only when the operator was changed to starts with/ends with because those are the cases where the Value component is a TextField and upon operator change we typically reset the value to null (Because in Autocomplete use-cases we use null when resetting and intializing).

So currently transforming the value to '' if it's null, to test value !== '' .

//Current implementation
 const baseValueSchema = string()
 .nullable()
 .transform((value) => (value === null ? '' : value)) // normalize null to empty string to avoid the empty string case for TextField components
 .required(fieldErrorMessage)
 .test('nonEmpty', fieldErrorMessage, (value) => value !== '');

This transformation is allowing it to display the proper error message.

Will create a ticket to investigate the cause of this further and improve the validation schemas overall in the future PR's

@coliu-akamai coliu-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Confirming that for the filters, things are matching the preview videos

  • Linode dimension filter
  • Linode Region dimension filter
  • VPC Subnet dimension filter
  • Interface dimension filter validates inputs properly as expected
  • translation of linode_id, subnet_id to the relevant labels in Show-details

We spoke async about the validation issue I mentioned earlier + it will be followed up on

@github-project-automation github-project-automation Bot moved this from Review to Approved in Cloud Manager Sep 4, 2025
@coliu-akamai

Copy link
Copy Markdown
Contributor

closing in favor of #12817

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants