mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-23 09:51:10 +01:00
Refactor model emit, and recent conn dropdown
This commit is contained in:
@@ -14,12 +14,17 @@ export function fallbackRequestName(r: HttpRequest | GrpcRequest | null): string
|
||||
|
||||
const fixedUrl = r.url.match(/^https?:\/\//) ? r.url : 'http://' + r.url;
|
||||
|
||||
try {
|
||||
const url = new URL(fixedUrl);
|
||||
const pathname = url.pathname === '/' ? '' : url.pathname;
|
||||
return `${url.host}${pathname}`;
|
||||
} catch (_) {
|
||||
// Nothing
|
||||
if (r.model === 'grpc_request' && r.service != null && r.method != null) {
|
||||
const shortService = r.service.split('.').pop();
|
||||
return `${shortService}/${r.method}`;
|
||||
} else {
|
||||
try {
|
||||
const url = new URL(fixedUrl);
|
||||
const pathname = url.pathname === '/' ? '' : url.pathname;
|
||||
return `${url.host}${pathname}`;
|
||||
} catch (_) {
|
||||
// Nothing
|
||||
}
|
||||
}
|
||||
|
||||
return r.url;
|
||||
|
||||
Reference in New Issue
Block a user