@@ -159,6 +159,43 @@ export class ExceptionsTable extends LitElement {
159
159
}
160
160
}
161
161
162
+ /**
163
+ * Get the host from a URL pattern using regex.
164
+ * @param urlPattern The URL pattern to get the host from.
165
+ * @returns The host from the URL pattern.
166
+ */
167
+ private getHostFromUrlPattern ( urlPattern : string ) : string | null {
168
+ const match = urlPattern . match ( / : \/ \/ (?: \* \. ) ? ( [ ^ / * ] + ) / ) ;
169
+
170
+ if ( match ?. length && match . length >= 2 ) {
171
+ return match [ 1 ] ;
172
+ }
173
+
174
+ console . warn ( "Failed to parse host from URL pattern" , urlPattern ) ;
175
+ return null ;
176
+ }
177
+
178
+ /**
179
+ * Renders the URL pattern for an entry.
180
+ * For simplicity we show only the host part.
181
+ * The full pattern is shown on hover.
182
+ * @param urlPattern The URL pattern to render.
183
+ * @returns The rendered URL pattern.
184
+ */
185
+ private renderUrlPattern ( urlPattern ?: string ) {
186
+ if ( ! urlPattern ) {
187
+ return html `-` ;
188
+ }
189
+ let host = this . getHostFromUrlPattern ( urlPattern ) ;
190
+
191
+ // If we can't parse the host, return the original URL pattern.
192
+ if ( host == null ) {
193
+ return urlPattern ;
194
+ }
195
+
196
+ return html `< span title =${ urlPattern } > ${ host } </ span > ` ;
197
+ }
198
+
162
199
private renderTable ( ) {
163
200
return html `
164
201
< div class ="table-container ">
@@ -193,9 +230,9 @@ export class ExceptionsTable extends LitElement {
193
230
: "" }
194
231
</ td >
195
232
< td class ="${ this . hasGlobalRules ? "" : "hidden-col" } ">
196
- ${ entry . topLevelUrlPattern ?? "" }
233
+ ${ this . renderUrlPattern ( entry . topLevelUrlPattern ) }
197
234
</ td >
198
- < td > ${ entry . urlPattern ?? "" } </ td >
235
+ < td > ${ this . renderUrlPattern ( entry . urlPattern ) } </ td >
199
236
< td >
200
237
< span class ="badges ">
201
238
${ Array . isArray ( entry . classifierFeatures )
0 commit comments