Skip to content

Commit

Permalink
Protect: Add WAF StatCards (#35739)
Browse files Browse the repository at this point in the history
* Add waf stats class blocked requests stats actions, and apply stat card components to firewall header

* Adjust approach for storing and retrieving stats

* changelog

* Fix phpcs enables

* Remove FirewallHeader stories edits

* Use options over an additional table

* Reorg and fix spacing

* Fix dynamic/static calls

* Make update_daily_summary public for tests

* use deprecated setMethods over onlyMethods to bypass PHP 7.0 project test failures

* Fix up project versions

* Disable summary updates if share data is disabled, and add conditions to stat card display

* Remove TODOs

* Improve changelog entries

* Restructuring, improvements, storybook fixes

* Make use of static methods consistent

* Add standalone mode handling for update_daily_summary

* Fix tests

* Add integration tests

* Revert unit test removal

* Fix naming

* Fix project versions

* Fix versions

* Remove IDC package

* Remove duplicate changelog entries

* Revert vscode settings.json changes

* changelog

* Undo wpcomsh plugin updates

* Revert prior changes to wpcomsh

* Fix versions

* Optimize FirewallStatCards

* Fix share data option check

* Fix styling

* Fix translation strings

* Ensure no duplicated code and extra debug data is logged appropriately

* Fix tests

* Fix phan errors

* Use supported phpunit method

* Use supported phpunit method

* Final test fixes

* Remove unused code, add plan check for new stats

* Fix method naming

* Add method for retrieving all time stats

* Make direct db connection persistent, add/fix tests

* Close db connection if initialized

* Add standalone mode direct db handling

* Fix project versions

* Ignore phpcs rules, data needs to be current

* Remove error_log

* Address phan errors

* Use standard approach

* Add update flag to initialization method so we aren't duplicating the action

* Fix initialization method calls

* Manually update phan baselines

* Revert versions updates

* Remove duplicate changelog entries

* Remove FirewallHeader stories from broken dir

* Update stories

* Updates to Blocklog Manager class

* Fix prop name

* Minor enhancements and compatibility improvements

* Statcard adjustments

* Revert phan baselines changes

* Reapply phan baseline changes

* Apply naming consistency, update FirewallSubheading to use IconTooltip

* Fixes

---------

Co-authored-by: Nate Weller <[email protected]>
  • Loading branch information
dkmyta and nateweller authored Sep 23, 2024
1 parent 89f7812 commit 9bc7ce4
Show file tree
Hide file tree
Showing 20 changed files with 956 additions and 317 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Added StatCard component export
1 change: 1 addition & 0 deletions projects/js-packages/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@ export { default as ProgressBar } from './components/progress-bar';
export { default as UpsellBanner } from './components/upsell-banner';
export { getUserLocale, cleanLocale } from './lib/locale';
export { default as RadioControl } from './components/radio-control';
export { default as StatCard } from './components/stat-card';
export * from './components/global-notices';
3 changes: 1 addition & 2 deletions projects/packages/waf/.phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@
'src/class-waf-constants.php' => ['PhanCoalescingNeverNull', 'PhanUndeclaredConstant'],
'src/class-waf-operators.php' => ['PhanTypeMismatchReturn'],
'src/class-waf-rules-manager.php' => ['PhanTypeMismatchArgument'],
'src/class-waf-runtime.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspiciousNullable', 'PhanUndeclaredConstant'],
'src/class-waf-runtime.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanTypeArraySuspiciousNullable'],
'src/class-waf-transforms.php' => ['PhanPluginInvalidPregRegex', 'PhanTypeInvalidDimOffset'],
'tests/php/integration/test-waf-compatibility.php' => ['PhanParamTooMany'],
'tests/php/unit/functions-wordpress.php' => ['PhanRedefineFunction'],
'tests/php/unit/test-waf-operators.php' => ['PhanTypeMismatchArgumentInternal'],
'tests/php/unit/test-waf-runtime-targets.php' => ['PhanPluginRedundantAssignment'],
'tests/php/unit/test-waf-runtime.php' => ['PhanImpossibleTypeComparison', 'PhanTypeMismatchArgument'],
'tests/php/unit/test-waf-standalone-bootstrap.php' => ['PhanDeprecatedFunction', 'PhanNoopNew'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Added Waf_Blocklog_Manager class
Loading

0 comments on commit 9bc7ce4

Please sign in to comment.