|
53 | 53 | <?php endif; ?> |
54 | 54 | <?php endif; ?> |
55 | 55 |
|
56 | | - <?php if ( ! empty( $webhooks ) ) : ?> |
| 56 | + <?php if ( empty( $webhooks ) ) : ?> |
| 57 | + <div class="webhooks-empty-state"> |
| 58 | + <h2><?php esc_html_e( 'No webhooks yet', 'wp-graphql-headless-webhooks' ); ?></h2> |
| 59 | + <p><?php esc_html_e( 'Create your first webhook to start receiving notifications when events occur.', 'wp-graphql-headless-webhooks' ); ?></p> |
| 60 | + <a href="<?php echo esc_url( $admin->get_admin_url( array( 'action' => 'add' ) ) ); ?>" class="button button-primary"> |
| 61 | + <?php esc_html_e( 'Add New Webhook', 'wp-graphql-headless-webhooks' ); ?> |
| 62 | + </a> |
| 63 | + </div> |
| 64 | + <?php else : ?> |
57 | 65 | <form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>"> |
| 66 | + <input type="hidden" name="action" value="graphql_webhook_bulk_delete" /> |
58 | 67 | <?php wp_nonce_field( 'bulk_delete_webhooks' ); ?> |
59 | | - <input type="hidden" name="action" value="graphql_webhook_bulk_delete"> |
60 | 68 |
|
61 | 69 | <div class="tablenav top"> |
62 | 70 | <div class="alignleft actions bulkactions"> |
|
67 | 75 | </select> |
68 | 76 | <input type="submit" class="button action" value="<?php esc_attr_e( 'Apply', 'wp-graphql-headless-webhooks' ); ?>"> |
69 | 77 | </div> |
| 78 | + <br class="clear"> |
70 | 79 | </div> |
71 | 80 |
|
72 | | - <table class="wp-list-table widefat fixed striped table-view-list"> |
| 81 | + <table class="wp-list-table widefat fixed striped webhooks"> |
73 | 82 | <thead> |
74 | 83 | <tr> |
75 | 84 | <td class="manage-column column-cb check-column"> |
76 | | - <label class="screen-reader-text" for="cb-select-all-1"><?php esc_html_e( 'Select All', 'wp-graphql-headless-webhooks' ); ?></label> |
77 | | - <input id="cb-select-all-1" type="checkbox"> |
| 85 | + <input type="checkbox" id="cb-select-all-1" /> |
78 | 86 | </td> |
79 | | - <th scope="col" class="manage-column column-name column-primary"> |
80 | | - <?php esc_html_e( 'Name', 'wp-graphql-headless-webhooks' ); ?> |
81 | | - </th> |
82 | | - <th scope="col" class="manage-column column-event"> |
83 | | - <?php esc_html_e( 'Event', 'wp-graphql-headless-webhooks' ); ?> |
84 | | - </th> |
85 | | - <th scope="col" class="manage-column column-method"> |
86 | | - <?php esc_html_e( 'Method', 'wp-graphql-headless-webhooks' ); ?> |
87 | | - </th> |
88 | | - <th scope="col" class="manage-column column-url"> |
89 | | - <?php esc_html_e( 'URL', 'wp-graphql-headless-webhooks' ); ?> |
90 | | - </th> |
91 | | - <th scope="col" class="manage-column column-headers"> |
92 | | - <?php esc_html_e( 'Headers', 'wp-graphql-headless-webhooks' ); ?> |
93 | | - </th> |
| 87 | + <th scope="col" class="manage-column column-name"><?php esc_html_e( 'Name', 'wp-graphql-headless-webhooks' ); ?></th> |
| 88 | + <th scope="col" class="manage-column column-event"><?php esc_html_e( 'Event', 'wp-graphql-headless-webhooks' ); ?></th> |
| 89 | + <th scope="col" class="manage-column column-method"><?php esc_html_e( 'Method', 'wp-graphql-headless-webhooks' ); ?></th> |
| 90 | + <th scope="col" class="manage-column column-url"><?php esc_html_e( 'URL', 'wp-graphql-headless-webhooks' ); ?></th> |
| 91 | + <th scope="col" class="manage-column column-headers"><?php esc_html_e( 'Headers', 'wp-graphql-headless-webhooks' ); ?></th> |
94 | 92 | </tr> |
95 | 93 | </thead> |
96 | 94 | <tbody> |
97 | 95 | <?php foreach ( $webhooks as $webhook ) : ?> |
98 | 96 | <tr> |
99 | 97 | <th scope="row" class="check-column"> |
100 | | - <label class="screen-reader-text" for="cb-select-<?php echo esc_attr( $webhook->id ); ?>"> |
101 | | - <?php printf( esc_html__( 'Select %s', 'wp-graphql-headless-webhooks' ), esc_html( $webhook->name ) ); ?> |
102 | | - </label> |
103 | | - <input id="cb-select-<?php echo esc_attr( $webhook->id ); ?>" type="checkbox" name="webhook_ids[]" value="<?php echo esc_attr( $webhook->id ); ?>"> |
| 98 | + <input type="checkbox" name="webhook_ids[]" value="<?php echo esc_attr( $webhook->id ); ?>" /> |
104 | 99 | </th> |
105 | | - <td class="column-name column-primary" data-colname="<?php esc_attr_e( 'Name', 'wp-graphql-headless-webhooks' ); ?>"> |
| 100 | + <td class="name column-name"> |
106 | 101 | <strong> |
107 | 102 | <a href="<?php echo esc_url( $admin->get_admin_url( array( 'action' => 'edit', 'webhook_id' => $webhook->id ) ) ); ?>" class="row-title"> |
108 | 103 | <?php echo esc_html( $webhook->name ); ?> |
|
129 | 124 | <span class="screen-reader-text"><?php esc_html_e( 'Show more details', 'wp-graphql-headless-webhooks' ); ?></span> |
130 | 125 | </button> |
131 | 126 | </td> |
132 | | - <td class="column-event" data-colname="<?php esc_attr_e( 'Event', 'wp-graphql-headless-webhooks' ); ?>"> |
133 | | - <code><?php echo esc_html( $webhook->event ); ?></code> |
134 | | - </td> |
135 | | - <td class="column-method" data-colname="<?php esc_attr_e( 'Method', 'wp-graphql-headless-webhooks' ); ?>"> |
| 127 | + <td class="event column-event"><?php echo esc_html( $webhook->event ); ?></td> |
| 128 | + <td class="method column-method"> |
136 | 129 | <strong><?php echo esc_html( strtoupper( $webhook->method ) ); ?></strong> |
137 | 130 | </td> |
138 | | - <td class="column-url" data-colname="<?php esc_attr_e( 'URL', 'wp-graphql-headless-webhooks' ); ?>"> |
139 | | - <code><?php echo esc_html( $webhook->url ); ?></code> |
| 131 | + <td class="url column-url"> |
| 132 | + <code title="<?php echo esc_attr( $webhook->url ); ?>"><?php echo esc_html( $webhook->url ); ?></code> |
140 | 133 | </td> |
141 | | - <td class="column-headers" data-colname="<?php esc_attr_e( 'Headers', 'wp-graphql-headless-webhooks' ); ?>"> |
| 134 | + <td class="headers column-headers"> |
142 | 135 | <?php if ( ! empty( $webhook->headers ) ) : ?> |
143 | | - <?php foreach ( $webhook->headers as $key => $value ) : ?> |
144 | | - <div><code><?php echo esc_html( $key ); ?></code></div> |
| 136 | + <?php foreach ( $webhook->headers as $header => $value ) : ?> |
| 137 | + <code><?php echo esc_html( $header ); ?></code><br> |
145 | 138 | <?php endforeach; ?> |
146 | 139 | <?php else : ?> |
147 | | - <span class="description"><?php esc_html_e( 'None', 'wp-graphql-headless-webhooks' ); ?></span> |
| 140 | + <span class="no-headers"><?php esc_html_e( 'None', 'wp-graphql-headless-webhooks' ); ?></span> |
148 | 141 | <?php endif; ?> |
149 | 142 | </td> |
150 | 143 | </tr> |
|
153 | 146 | <tfoot> |
154 | 147 | <tr> |
155 | 148 | <td class="manage-column column-cb check-column"> |
156 | | - <label class="screen-reader-text" for="cb-select-all-2"><?php esc_html_e( 'Select All', 'wp-graphql-headless-webhooks' ); ?></label> |
157 | | - <input id="cb-select-all-2" type="checkbox"> |
| 149 | + <input type="checkbox" id="cb-select-all-2" /> |
158 | 150 | </td> |
159 | | - <th scope="col" class="manage-column column-name column-primary"> |
160 | | - <?php esc_html_e( 'Name', 'wp-graphql-headless-webhooks' ); ?> |
161 | | - </th> |
162 | | - <th scope="col" class="manage-column column-event"> |
163 | | - <?php esc_html_e( 'Event', 'wp-graphql-headless-webhooks' ); ?> |
164 | | - </th> |
165 | | - <th scope="col" class="manage-column column-method"> |
166 | | - <?php esc_html_e( 'Method', 'wp-graphql-headless-webhooks' ); ?> |
167 | | - </th> |
168 | | - <th scope="col" class="manage-column column-url"> |
169 | | - <?php esc_html_e( 'URL', 'wp-graphql-headless-webhooks' ); ?> |
170 | | - </th> |
171 | | - <th scope="col" class="manage-column column-headers"> |
172 | | - <?php esc_html_e( 'Headers', 'wp-graphql-headless-webhooks' ); ?> |
173 | | - </th> |
| 151 | + <th scope="col" class="manage-column column-name"><?php esc_html_e( 'Name', 'wp-graphql-headless-webhooks' ); ?></th> |
| 152 | + <th scope="col" class="manage-column column-event"><?php esc_html_e( 'Event', 'wp-graphql-headless-webhooks' ); ?></th> |
| 153 | + <th scope="col" class="manage-column column-method"><?php esc_html_e( 'Method', 'wp-graphql-headless-webhooks' ); ?></th> |
| 154 | + <th scope="col" class="manage-column column-url"><?php esc_html_e( 'URL', 'wp-graphql-headless-webhooks' ); ?></th> |
| 155 | + <th scope="col" class="manage-column column-headers"><?php esc_html_e( 'Headers', 'wp-graphql-headless-webhooks' ); ?></th> |
174 | 156 | </tr> |
175 | 157 | </tfoot> |
176 | 158 | </table> |
|
184 | 166 | </select> |
185 | 167 | <input type="submit" class="button action" value="<?php esc_attr_e( 'Apply', 'wp-graphql-headless-webhooks' ); ?>"> |
186 | 168 | </div> |
187 | | - <div class="alignleft actions"> |
188 | | - <p class="description"> |
189 | | - <?php |
190 | | - printf( |
191 | | - esc_html__( '%d webhooks configured', 'wp-graphql-headless-webhooks' ), |
192 | | - count( $webhooks ) |
193 | | - ); |
194 | | - ?> |
195 | | - </p> |
196 | | - </div> |
| 169 | + <br class="clear"> |
197 | 170 | </div> |
198 | 171 | </form> |
199 | | - <?php else : ?> |
200 | | - <div class="webhooks-empty-state"> |
201 | | - <p><?php esc_html_e( 'No webhooks configured yet.', 'wp-graphql-headless-webhooks' ); ?></p> |
202 | | - <p> |
203 | | - <a href="<?php echo esc_url( $admin->get_admin_url( array( 'action' => 'add' ) ) ); ?>" class="button button-primary"> |
204 | | - <?php esc_html_e( 'Add Your First Webhook', 'wp-graphql-headless-webhooks' ); ?> |
205 | | - </a> |
206 | | - </p> |
207 | | - </div> |
208 | 172 | <?php endif; ?> |
209 | 173 | </div> |
0 commit comments