-
Notifications
You must be signed in to change notification settings - Fork 33
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
EVA-157 Conditional Endpoint Disabling #2101
EVA-157 Conditional Endpoint Disabling #2101
Conversation
src/Common/Event_Automator/Integrations/REST/V1/Endpoints/Queue/Integration_REST_Endpoint.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Zapier/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Zapier/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Zapier/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Zapier/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Zapier/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Endpoints/Queue/Integration_REST_Endpoint.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Endpoints/Queue/Integration_REST_Endpoint.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Endpoints/Queue/Integration_REST_Endpoint.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Endpoints/Queue/Integration_REST_Endpoint.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Endpoints/Queue/Integration_REST_Endpoint.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Endpoints/Queue/Integration_REST_Endpoint.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Integrations/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Zapier/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
src/Common/Event_Automator/Zapier/REST/V1/Utilities/Action_Endpoints.php
Outdated
Show resolved
Hide resolved
* | ||
* @since TBD Migrated to Common from Event Automator | ||
* | ||
* @param array<string,array> $endpoint An array of the integration endpoint details. | ||
* @param Abstract_REST_Endpoint $this An instance of the endpoint. | ||
*/ | ||
return apply_filters( "tec_event_automator_{$api_id}_queue_endpoint_details", $endpoint, $this ); | ||
return apply_filters( "tec_event_automator_{$api_id}_endpoint_details", $endpoint, $this ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to deprecate the old filter in case of 3rd party usage? cc @jesseeproductions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being that the @since
is TBD
doesn't that mean this is a new filter. Not in production, yet?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff. A few nit picky things I saw.
* @param WP_REST_Server $handler ResponseHandler instance (usually WP_REST_Server). | ||
* @param WP_REST_Request $request Request used to generate the response. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit pick:
* @param WP_REST_Server $handler ResponseHandler instance (usually WP_REST_Server). | |
* @param WP_REST_Request $request Request used to generate the response. | |
* @param WP_REST_Server $handler ResponseHandler instance (usually WP_REST_Server). | |
* @param WP_REST_Request $request Request used to generate the response. |
$this->template( | ||
'components/read-only', | ||
[ | ||
'classes_wrap' => [ 'tec-automator-grid-item', 'tec-settings-connection-endpoint-dashboard-details__name-wrap', ! $endpoint['enabled'] || $endpoint['missing_dependency'] ? 'disabled' : '' ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super long. It might be better to do this:
'classes_wrap' => [ 'tec-automator-grid-item', 'tec-settings-connection-endpoint-dashboard-details__name-wrap', ! $endpoint['enabled'] || $endpoint['missing_dependency'] ? 'disabled' : '' ], | |
'classes_wrap' => [ | |
'tec-automator-grid-item', | |
'tec-settings-connection-endpoint-dashboard-details__name-wrap', | |
! $endpoint['enabled'] || $endpoint['missing_dependency'] ? 'disabled' : '', | |
], |
if ( $endpoint['missing_dependency'] ) { | ||
$this->template( | ||
'dashboard/components/missing-dependency', | ||
[ | ||
'endpoint' => $endpoint, | ||
'manager' => $manager, | ||
'url' => $url, | ||
] ); | ||
} | ||
] | ||
); | ||
} else { | ||
$this->template( | ||
'dashboard/components/clear-button', | ||
[ | ||
'endpoint' => $endpoint, | ||
'manager' => $manager, | ||
'url' => $url, | ||
] | ||
); | ||
$this->template( | ||
'dashboard/components/status-button', | ||
[ | ||
'endpoint' => $endpoint, | ||
'manager' => $manager, | ||
'url' => $url, | ||
] | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're sending the same args into the template, it might be simpler to store them in a variable to pass them along:
$template_args = [
'endpoint' => $endpoint,
'manager' => $manager,
'url' => $url,
];
That way, the template lines are on one line:
$this->template( 'dashboard/components/missing-dependency', $template_args );
if ( $endpoint['missing_dependency'] ) { | ||
$this->template( | ||
'zapier/dashboard/components/missing-dependency', | ||
[ | ||
'endpoint' => $endpoint, | ||
'manager' => $manager, | ||
'url' => $url, | ||
] ); | ||
} | ||
] | ||
); | ||
} else { | ||
$this->template( | ||
'zapier/dashboard/components/clear-button', | ||
[ | ||
'endpoint' => $endpoint, | ||
'manager' => $manager, | ||
'url' => $url, | ||
] | ||
); | ||
$this->template( | ||
'zapier/dashboard/components/status-button', | ||
[ | ||
'endpoint' => $endpoint, | ||
'manager' => $manager, | ||
'url' => $url, | ||
] | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here from above about putting the template args into a variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codingmusician thanks. To give you some context, this is a file from EVA that was merged in Common recently. I did not make these changes; all these additions you see are because of the PHPCS formating to satisfy the @tec-bot review.
I had different commits for my changes and for the code formatting to help the reviewers.
The actual change in this file was at line 97 of the original, where it had a
if ( $endpoint['missing_dependency'] ) {
I moved that higher to also exclude the action buttons from showing. Everything else is from the phpcbf.
🎫 Ticket
EVA-157
EVA-158
🗒️ Description
✔️ Checklist
readme.txt
file.wpunit
orintegration
tests.wpunit
orintegration
tests.