Skip to content

Commit f924466

Browse files
authored
chore(admin-ui): migrate invoices table to RQL (#1042)
* chore: generate new api client * chore: update flex props * fix: css variables typo * feat: create new invoices page * chore: add columns to invoice table * feat: add filter and search to invoices table * chore: delete old invoices files * fix: PR issues and update amount component
1 parent 2971b5a commit f924466

File tree

26 files changed

+2360
-734
lines changed

26 files changed

+2360
-734
lines changed

ui/package-lock.json

Lines changed: 2024 additions & 481 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"@hookform/resolvers": "^3.0.1",
1515
"@radix-ui/react-form": "^0.0.2",
1616
"@radix-ui/react-icons": "^1.3.0",
17-
"@raystack/apsara": "0.46.0-rc.4",
18-
"@raystack/frontier": "^0.49.0",
17+
"@raystack/apsara": "0.47.0",
18+
"@raystack/frontier": "^0.65.0",
1919
"@stitches/react": "^1.2.8",
2020
"@tanstack/react-table": "^8.9.3",
2121
"@tanstack/table-core": "^8.21.3",

ui/src/api/frontier.ts

Lines changed: 75 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,35 @@ export interface ApiHttpBody {
278278
extensions?: ProtobufAny[];
279279
}
280280

281+
export interface Frontierv1Beta1Invoice {
282+
id?: string;
283+
customer_id?: string;
284+
provider_id?: string;
285+
state?: string;
286+
currency?: string;
287+
/** @format int64 */
288+
amount?: string;
289+
hosted_url?: string;
290+
/**
291+
* The date on which payment for this invoice is due
292+
* @format date-time
293+
*/
294+
due_date?: string;
295+
/**
296+
* The date when this invoice is in effect.
297+
* @format date-time
298+
*/
299+
effective_at?: string;
300+
/** @format date-time */
301+
period_start_at?: string;
302+
/** @format date-time */
303+
period_end_at?: string;
304+
metadata?: object;
305+
/** @format date-time */
306+
created_at?: string;
307+
customer?: V1Beta1BillingAccount;
308+
}
309+
281310
export interface Frontierv1Beta1OrganizationRequestBody {
282311
/** The name of the organization. The name must be unique within the entire Frontier instance. The name can contain only alphanumeric characters, dashes and underscores.<br/>*Example:*`"frontier-org1-acme"` */
283312
name: string;
@@ -1222,7 +1251,7 @@ export interface V1Beta1GetSubscriptionResponse {
12221251

12231252
export interface V1Beta1GetUpcomingInvoiceResponse {
12241253
/** Upcoming invoice */
1225-
invoice?: V1Beta1Invoice;
1254+
invoice?: Frontierv1Beta1Invoice;
12261255
}
12271256

12281257
export interface V1Beta1GetUserResponse {
@@ -1315,35 +1344,6 @@ export interface V1Beta1Invitation {
13151344
role_ids?: string[];
13161345
}
13171346

1318-
export interface V1Beta1Invoice {
1319-
id?: string;
1320-
customer_id?: string;
1321-
provider_id?: string;
1322-
state?: string;
1323-
currency?: string;
1324-
/** @format int64 */
1325-
amount?: string;
1326-
hosted_url?: string;
1327-
/**
1328-
* The date on which payment for this invoice is due
1329-
* @format date-time
1330-
*/
1331-
due_date?: string;
1332-
/**
1333-
* The date when this invoice is in effect.
1334-
* @format date-time
1335-
*/
1336-
effective_at?: string;
1337-
/** @format date-time */
1338-
period_start_at?: string;
1339-
/** @format date-time */
1340-
period_end_at?: string;
1341-
metadata?: object;
1342-
/** @format date-time */
1343-
created_at?: string;
1344-
customer?: V1Beta1BillingAccount;
1345-
}
1346-
13471347
/** JSON Web Key as specified in RFC 7517 */
13481348
export interface V1Beta1JSONWebKey {
13491349
/** Key Type. */
@@ -1381,7 +1381,7 @@ export interface V1Beta1ListAllBillingAccountsResponse {
13811381
}
13821382

13831383
export interface V1Beta1ListAllInvoicesResponse {
1384-
invoices?: V1Beta1Invoice[];
1384+
invoices?: Frontierv1Beta1Invoice[];
13851385
/**
13861386
* Total number of records present
13871387
* @format int32
@@ -1466,7 +1466,7 @@ export interface V1Beta1ListGroupsResponse {
14661466

14671467
export interface V1Beta1ListInvoicesResponse {
14681468
/** List of invoices */
1469-
invoices?: V1Beta1Invoice[];
1469+
invoices?: Frontierv1Beta1Invoice[];
14701470
}
14711471

14721472
export interface V1Beta1ListMetaSchemasResponse {
@@ -2271,6 +2271,26 @@ export interface V1Beta1RoleRequestBody {
22712271
scopes?: string[];
22722272
}
22732273

2274+
export interface V1Beta1SearchInvoicesResponse {
2275+
invoices?: V1Beta1SearchInvoicesResponseInvoice[];
2276+
pagination?: V1Beta1RQLQueryPaginationResponse;
2277+
group?: V1Beta1RQLQueryGroupResponse;
2278+
}
2279+
2280+
export interface V1Beta1SearchInvoicesResponseInvoice {
2281+
id?: string;
2282+
/** @format int64 */
2283+
amount?: string;
2284+
currency?: string;
2285+
state?: string;
2286+
invoice_link?: string;
2287+
/** @format date-time */
2288+
created_at?: string;
2289+
org_id?: string;
2290+
org_name?: string;
2291+
org_title?: string;
2292+
}
2293+
22742294
export interface V1Beta1SearchOrganizationInvoicesResponse {
22752295
organization_invoices?: SearchOrganizationInvoicesResponseOrganizationInvoice[];
22762296
pagination?: V1Beta1RQLQueryPaginationResponse;
@@ -2979,6 +2999,29 @@ export class Api<
29792999
...params,
29803000
}),
29813001

3002+
/**
3003+
* No description
3004+
*
3005+
* @tags invoice
3006+
* @name AdminServiceSearchInvoices
3007+
* @summary Search invoices across all organizations
3008+
* @request POST:/v1beta1/admin/invoices/search
3009+
* @secure
3010+
*/
3011+
adminServiceSearchInvoices: (
3012+
query: V1Beta1RQLRequest,
3013+
params: RequestParams = {},
3014+
) =>
3015+
this.request<V1Beta1SearchInvoicesResponse, GooglerpcStatus>({
3016+
path: `/v1beta1/admin/invoices/search`,
3017+
method: "POST",
3018+
body: query,
3019+
secure: true,
3020+
type: ContentType.Json,
3021+
format: "json",
3022+
...params,
3023+
}),
3024+
29823025
/**
29833026
* @description Lists all the organizations in a Frontier instance. It can be filtered by user and state.
29843027
*

ui/src/containers/billingplans.list/details.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ export default function PlanDetails() {
44
const { plan } = usePlan();
55

66
return (
7-
<Flex direction="column" gap="large">
7+
<Flex direction="column" gap={9}>
88
<Text size={4}>{plan?.name}</Text>
9-
<Flex direction="column" gap="large">
9+
<Flex direction="column" gap={9}>
1010
<Grid columns={2} gap="small">
1111
<Text size={1}>Name</Text>
1212
<Text size={1}>{plan?.name}</Text>

ui/src/containers/invoices.list/columns.tsx

Lines changed: 0 additions & 82 deletions
This file was deleted.

ui/src/containers/invoices.list/header.tsx

Lines changed: 0 additions & 15 deletions
This file was deleted.

ui/src/containers/invoices.list/index.tsx

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)