Skip to content
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

Implement query bar UI #140

Merged
merged 46 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b182963
add lib
nikrooz Jan 3, 2025
8076e5a
add multicombobox
nikrooz Jan 8, 2025
0f4af82
fix import
nikrooz Jan 8, 2025
34016b2
fix styling
nikrooz Jan 8, 2025
fe5ae3d
add query builder
nikrooz Jan 8, 2025
5b3eeec
update styling
nikrooz Jan 8, 2025
10b9c1c
update styling
nikrooz Jan 8, 2025
55d607f
update styling, and spec
nikrooz Jan 9, 2025
a8e8b55
update styling
nikrooz Jan 9, 2025
65e7aa7
update query
nikrooz Jan 9, 2025
7cdeff3
update styling
nikrooz Jan 9, 2025
834ce70
add filters
nikrooz Jan 9, 2025
7e52f21
update labels
nikrooz Jan 9, 2025
257960e
update labels
nikrooz Jan 9, 2025
c15596f
add filters
nikrooz Jan 10, 2025
8ecfd86
update status
nikrooz Jan 10, 2025
d2b4c4b
add help text
nikrooz Jan 10, 2025
153b20a
fix table
nikrooz Jan 10, 2025
402c60c
add useHref
nikrooz Jan 13, 2025
bb4a192
update styles
nikrooz Jan 13, 2025
d3ecaba
update popover trigger
nikrooz Jan 13, 2025
92588b9
add useListServices
nikrooz Jan 13, 2025
981ec12
remove onhover
nikrooz Jan 13, 2025
c7a4a27
add handlers
nikrooz Jan 13, 2025
4ea9948
update styling
nikrooz Jan 13, 2025
3cb02de
update styling
nikrooz Jan 13, 2025
8b73e72
update styling
nikrooz Jan 13, 2025
0265158
fix width
nikrooz Jan 13, 2025
0f183a4
fix style
nikrooz Jan 13, 2025
cc7dc1b
update style
nikrooz Jan 13, 2025
4255bb5
update styles
nikrooz Jan 13, 2025
f2cabeb
add ref
nikrooz Jan 13, 2025
5307655
refactor use
nikrooz Jan 13, 2025
0746ab7
update labels
nikrooz Jan 13, 2025
25e8866
rename journal
nikrooz Jan 13, 2025
b28cbc4
update query
nikrooz Jan 13, 2025
11ab94b
add handler
nikrooz Jan 13, 2025
9384805
add isvalid
nikrooz Jan 13, 2025
993882d
fix options and add ingress filtering
nikrooz Jan 13, 2025
2ca4057
fix keyboard nav
nikrooz Jan 14, 2025
b35c663
update kbd
nikrooz Jan 14, 2025
7ef8b47
fix keyboard
nikrooz Jan 14, 2025
0aafa39
fix focus
nikrooz Jan 14, 2025
1c3291c
fix style
nikrooz Jan 14, 2025
856be3e
fix style
nikrooz Jan 14, 2025
9eabf17
fix lint
nikrooz Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/web-ui/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Path,
Scripts,
ScrollRestoration,
useHref,
useNavigate,
} from 'react-router';
import styles from './tailwind.css?url';
Expand Down Expand Up @@ -90,7 +91,7 @@ export function Layout({ children }: { children: React.ReactNode }) {
<Links />
</head>
<body className="h-full font-sans">
<RouterProvider navigate={navigate}>
<RouterProvider navigate={navigate} useHref={useHref}>
<LayoutProvider>{children}</LayoutProvider>
</RouterProvider>
<ScrollRestoration />
Expand Down
1 change: 1 addition & 0 deletions apps/web-ui/app/routes/invocations.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { invocations } from '@restate/features/invocations-route';

export default invocations.Component;
export const clientLoader = invocations.clientLoader;
4 changes: 4 additions & 0 deletions apps/web-ui/app/tailwind.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
font-family: 'Inter var', 'Helvetica', system-ui, sans-serif;
}
}

*[data-testid='underlay'] {
pointer-events: none;
}
2 changes: 1 addition & 1 deletion libs/data-access/admin-api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './lib/api/client';
export * from './lib/api/hooks';
export type * from './lib/api/type';
export * from './lib/api/type';
export * from './lib/AdminBaseUrlProvider';
45 changes: 42 additions & 3 deletions libs/data-access/admin-api/src/lib/api/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { paths, components } from './index'; // generated by openapi-typescript
import { useMutation, useQuery } from '@tanstack/react-query';
import { useMutation, useQueries, useQuery } from '@tanstack/react-query';
import {
adminApi,
MutationOptions,
Expand All @@ -15,6 +15,7 @@ import type {
ServiceName,
Deployment,
FilterItem,
Service,
} from './type';

type HookQueryOptions<
Expand Down Expand Up @@ -104,12 +105,18 @@ export function useListDeployments(
options?: HookQueryOptions<'/deployments', 'get'>
) {
const baseUrl = useAdminBaseUrl();
const queryOptions = adminApi('query', '/deployments', 'get', { baseUrl });

return useQuery({
...adminApi('query', '/deployments', 'get', { baseUrl }),
const results = useQuery({
...queryOptions,
...options,
select: listDeploymentsSelector,
});

return {
...results,
queryKey: queryOptions.queryKey,
};
}

export function useHealth(options?: HookQueryOptions<'/health', 'get'>) {
Expand Down Expand Up @@ -169,6 +176,38 @@ export function useServiceDetails(
return { ...results, queryKey: queryOptions.queryKey };
}

export function useListServices(
services: string[] = [],
options?: HookQueryOptions<'/services/{service}', 'get'>
) {
const baseUrl = useAdminBaseUrl();

const results = useQueries({
queries: services.map((service) => ({
...adminApi('query', '/services/{service}', 'get', {
baseUrl,
parameters: { path: { service } },
}),
staleTime: 0,
...options,
})),
combine: (results) => {
return {
data: results.reduce((result, service) => {
if (service.data) {
result.set(service.data?.name, service.data);
}
return result;
}, new Map<string, Service>()),
isPending: results.some((result) => result.isPending),
promise: Promise.all(results.map(({ promise }) => promise)),
};
},
});

return results;
}

export function useDeploymentDetails(
deployment: string,
options?: HookQueryOptions<'/deployments/{deployment}', 'get'>
Expand Down
22 changes: 14 additions & 8 deletions libs/data-access/admin-api/src/lib/api/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -849,14 +849,20 @@ export interface components {
/** @enum {string} */
type: 'NUMBER';
/** @enum {string} */
operation: 'EQUALS' | 'NOT_EQUALS' | 'GREATER_THAN' | 'LESS_THAN';
operation:
| 'EQUALS'
| 'NOT_EQUALS'
| 'GREATER_THAN'
| 'LESS_THAN'
| 'GREATER_THAN_OR_EQUAL'
| 'LESS_THAN_OR_EQUAL';
value?: number;
};
FilterStringItem: {
/** @enum {string} */
type: 'STRING';
/** @enum {string} */
operation: 'EQUALS' | 'NOT_EQUALS' | 'CONTAINS';
operation: 'EQUALS' | 'NOT_EQUALS' | 'CONTAINS' | 'NOT_CONTAINS';
value?: string;
};
FilterStringListItem: {
Expand Down Expand Up @@ -1130,7 +1136,8 @@ export interface components {
/** Format: date-time */
next_retry_at?: string;
id: string;
invoked_by: string;
/** @enum {string} */
invoked_by: 'ingress' | 'service';
/** @enum {string} */
status:
| 'succeeded'
Expand All @@ -1145,8 +1152,7 @@ export interface components {
| 'ready';
target: string;
target_handler_name: string;
/** @enum {string} */
target_service_key?: 'ingress' | 'service';
target_service_key?: string;
target_service_name: string;
/** @enum {string} */
target_service_ty: 'service' | 'virtual_object' | 'workflow';
Expand Down Expand Up @@ -1190,7 +1196,8 @@ export interface components {
/** Format: date-time */
next_retry_at?: string;
id: string;
invoked_by: string;
/** @enum {string} */
invoked_by: 'ingress' | 'service';
/** @enum {string} */
status:
| 'pending'
Expand All @@ -1202,8 +1209,7 @@ export interface components {
| 'completed';
target: string;
target_handler_name: string;
/** @enum {string} */
target_service_key?: 'ingress' | 'service';
target_service_key?: string;
target_service_name: string;
/** @enum {string} */
target_service_ty: 'service' | 'virtual_object' | 'workflow';
Expand Down
23 changes: 15 additions & 8 deletions libs/data-access/admin-api/src/lib/api/output.json
Original file line number Diff line number Diff line change
Expand Up @@ -2792,7 +2792,14 @@
},
"operation": {
"type": "string",
"enum": ["EQUALS", "NOT_EQUALS", "GREATER_THAN", "LESS_THAN"]
"enum": [
"EQUALS",
"NOT_EQUALS",
"GREATER_THAN",
"LESS_THAN",
"GREATER_THAN_OR_EQUAL",
"LESS_THAN_OR_EQUAL"
]
},
"value": {
"type": "number"
Expand All @@ -2809,7 +2816,7 @@
},
"operation": {
"type": "string",
"enum": ["EQUALS", "NOT_EQUALS", "CONTAINS"]
"enum": ["EQUALS", "NOT_EQUALS", "CONTAINS", "NOT_CONTAINS"]
},
"value": {
"type": "string"
Expand Down Expand Up @@ -3693,7 +3700,8 @@
"type": "string"
},
"invoked_by": {
"type": "string"
"type": "string",
"enum": ["ingress", "service"]
},
"status": {
"type": "string",
Expand All @@ -3717,8 +3725,7 @@
"type": "string"
},
"target_service_key": {
"type": "string",
"enum": ["ingress", "service"]
"type": "string"
},
"target_service_name": {
"type": "string"
Expand Down Expand Up @@ -3835,7 +3842,8 @@
"type": "string"
},
"invoked_by": {
"type": "string"
"type": "string",
"enum": ["ingress", "service"]
},
"status": {
"type": "string",
Expand All @@ -3856,8 +3864,7 @@
"type": "string"
},
"target_service_key": {
"type": "string",
"enum": ["ingress", "service"]
"type": "string"
},
"target_service_name": {
"type": "string"
Expand Down
23 changes: 15 additions & 8 deletions libs/data-access/admin-api/src/lib/api/query.json
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,14 @@
},
"operation": {
"type": "string",
"enum": ["EQUALS", "NOT_EQUALS", "GREATER_THAN", "LESS_THAN"]
"enum": [
"EQUALS",
"NOT_EQUALS",
"GREATER_THAN",
"LESS_THAN",
"GREATER_THAN_OR_EQUAL",
"LESS_THAN_OR_EQUAL"
]
},
"value": {
"type": "number"
Expand All @@ -862,7 +869,7 @@
},
"operation": {
"type": "string",
"enum": ["EQUALS", "NOT_EQUALS", "CONTAINS"]
"enum": ["EQUALS", "NOT_EQUALS", "CONTAINS", "NOT_CONTAINS"]
},
"value": {
"type": "string"
Expand Down Expand Up @@ -1617,7 +1624,8 @@
"type": "string"
},
"invoked_by": {
"type": "string"
"type": "string",
"enum": ["ingress", "service"]
},
"status": {
"type": "string",
Expand All @@ -1641,8 +1649,7 @@
"type": "string"
},
"target_service_key": {
"type": "string",
"enum": ["ingress", "service"]
"type": "string"
},
"target_service_name": {
"type": "string"
Expand Down Expand Up @@ -1759,7 +1766,8 @@
"type": "string"
},
"invoked_by": {
"type": "string"
"type": "string",
"enum": ["ingress", "service"]
},
"status": {
"type": "string",
Expand All @@ -1780,8 +1788,7 @@
"type": "string"
},
"target_service_key": {
"type": "string",
"enum": ["ingress", "service"]
"type": "string"
},
"target_service_name": {
"type": "string"
Expand Down
24 changes: 24 additions & 0 deletions libs/data-access/admin-api/src/lib/api/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,27 @@ export type FilterNumberItem = components['schemas']['FilterNumberItem'];
export type FilterStringListItem =
components['schemas']['FilterStringListItem'];
export type FilterStringItem = components['schemas']['FilterStringItem'];

export type HTTPDeployment = Exclude<Deployment, { arn: string }>;
export type LambdaDeployment = Exclude<Deployment, { uri: string }>;
export type DeploymentType = 'uri' | 'arn';
export function isHttpDeployment(
deployment: Deployment
): deployment is HTTPDeployment {
return 'uri' in deployment;
}
export function isLambdaDeployment(
deployment: Deployment
): deployment is LambdaDeployment {
return 'arn' in deployment;
}
export function getEndpoint(deployment?: Deployment) {
if (!deployment) {
return undefined;
}
if (isHttpDeployment(deployment)) {
return deployment.uri;
} else {
return deployment.arn;
}
}
Loading
Loading