mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-31 22:43:11 +02:00
Show gRPC requests in sidebar
This commit is contained in:
@@ -9,6 +9,7 @@ export function trackEvent(
|
||||
| 'Workspace'
|
||||
| 'Environment'
|
||||
| 'Folder'
|
||||
| 'GrpcRequest'
|
||||
| 'HttpRequest'
|
||||
| 'HttpResponse'
|
||||
| 'KeyValue',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { HttpRequest } from './models';
|
||||
import type { GrpcRequest, HttpRequest } from './models';
|
||||
|
||||
export function fallbackRequestName(r: HttpRequest | null): string {
|
||||
export function fallbackRequestName(r: HttpRequest | GrpcRequest | null): string {
|
||||
if (r == null) return '';
|
||||
|
||||
if (r.name) {
|
||||
@@ -9,7 +9,7 @@ export function fallbackRequestName(r: HttpRequest | null): string {
|
||||
|
||||
const withoutVariables = r.url.replace(/\$\{\[[^\]]+]}/g, '');
|
||||
if (withoutVariables.trim() === '') {
|
||||
return 'New Request';
|
||||
return r.model === 'http_request' ? 'New HTTP Request' : 'new gRPC Request';
|
||||
}
|
||||
|
||||
const fixedUrl = r.url.match(/^https?:\/\//) ? r.url : 'http://' + r.url;
|
||||
|
||||
@@ -12,6 +12,7 @@ export const AUTH_TYPE_BEARER = 'bearer';
|
||||
export type Model =
|
||||
| Settings
|
||||
| Workspace
|
||||
| GrpcRequest
|
||||
| HttpRequest
|
||||
| HttpResponse
|
||||
| KeyValue
|
||||
@@ -101,6 +102,18 @@ export interface HttpUrlParameter {
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export interface GrpcRequest extends BaseModel {
|
||||
readonly workspaceId: string;
|
||||
readonly model: 'grpc_request';
|
||||
folderId: string | null;
|
||||
sortPriority: number;
|
||||
name: string;
|
||||
url: string;
|
||||
service: string | null;
|
||||
method: string | null;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface HttpRequest extends BaseModel {
|
||||
readonly workspaceId: string;
|
||||
readonly model: 'http_request';
|
||||
|
||||
@@ -7,7 +7,7 @@ export async function getSettings(): Promise<Settings> {
|
||||
|
||||
export async function getRequest(id: string | null): Promise<HttpRequest | null> {
|
||||
if (id === null) return null;
|
||||
const request: HttpRequest = (await invoke('cmd_get_request', { id })) ?? null;
|
||||
const request: HttpRequest = (await invoke('cmd_get_http_request', { id })) ?? null;
|
||||
if (request == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user