@meyicloud/meyi-cost-ui 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +259 -0
- package/dist/CostPage.d.ts +12 -0
- package/dist/api.d.ts +3 -0
- package/dist/components/cost-line-chart.d.ts +13 -0
- package/dist/components/cur-readiness.d.ts +5 -0
- package/dist/components/stacked-cost-trend.d.ts +6 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/features/analysis/components/analysis-results.d.ts +4 -0
- package/dist/features/analysis/hooks/use-cost-analysis.d.ts +21 -0
- package/dist/features/analysis/index.d.ts +1 -0
- package/dist/features/budgets/components/budget-form.d.ts +12 -0
- package/dist/features/budgets/components/budget-list.d.ts +7 -0
- package/dist/features/budgets/hooks/use-cost-budgets.d.ts +21 -0
- package/dist/features/budgets/index.d.ts +1 -0
- package/dist/features/cur-discovery/index.d.ts +1 -0
- package/dist/features/overview/components/breakdown-bar-chart.d.ts +6 -0
- package/dist/features/overview/components/overview-widgets.d.ts +14 -0
- package/dist/features/overview/hooks/use-cost-overview.d.ts +16 -0
- package/dist/features/overview/index.d.ts +1 -0
- package/dist/features/reports/components/comparison-overview.d.ts +5 -0
- package/dist/features/reports/components/report-common.d.ts +15 -0
- package/dist/features/reports/components/report-sidebar.d.ts +32 -0
- package/dist/features/reports/components/report-tables.d.ts +12 -0
- package/dist/features/reports/hooks/use-cost-reports.d.ts +36 -0
- package/dist/features/reports/index.d.ts +1 -0
- package/dist/features/reports/report-export.d.ts +15 -0
- package/dist/features/reports/report-model.d.ts +49 -0
- package/dist/features/sources/index.d.ts +1 -0
- package/dist/html2canvas.esm-B5qzocYs.cjs +5 -0
- package/dist/html2canvas.esm-BWVIUcAF.js +4802 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.es-CUlzdq_P.cjs +5 -0
- package/dist/index.es-GAd5Tgul.js +6682 -0
- package/dist/index.js +21 -0
- package/dist/index.mjs +11453 -0
- package/dist/jspdf.es.min-6LRJ71fx.js +9860 -0
- package/dist/jspdf.es.min-C10id8ME.cjs +78 -0
- package/dist/jspdf.plugin.autotable-CogKBV4l.js +1087 -0
- package/dist/jspdf.plugin.autotable-CvTok6mL.cjs +2 -0
- package/dist/lib/utils.d.ts +4 -0
- package/dist/purify.es-BrrCv_hE.js +864 -0
- package/dist/purify.es-DCvfCVUO.cjs +3 -0
- package/dist/router.d.ts +2 -0
- package/dist/services/cost.d.ts +57 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +217 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
# Meyi Insight Cost UI
|
|
2
|
+
|
|
3
|
+
Reusable React UI package for AWS cost overview, monthly/yearly trends,
|
|
4
|
+
service/account/region breakdowns, standard and comparison reports, CSV/PDF
|
|
5
|
+
exports, budgets, and budget status.
|
|
6
|
+
|
|
7
|
+
The package is intended to run inside an authenticated host application. It
|
|
8
|
+
does not contain AWS credentials, query AWS directly, perform login, or decide
|
|
9
|
+
whether a plugin is enabled for a tenant. Those responsibilities remain with
|
|
10
|
+
the host and `@meyicloud/meyi-cost-server`.
|
|
11
|
+
|
|
12
|
+
## Package contract
|
|
13
|
+
|
|
14
|
+
- Package name: `@meyicloud/meyi-cost-ui`
|
|
15
|
+
- Runtime: React 19 and React DOM 19, supplied by the consuming application
|
|
16
|
+
- Module outputs: ESM, CommonJS, TypeScript declarations, and CSS
|
|
17
|
+
- Default UI route: `/cost`
|
|
18
|
+
- Expected server route: `${apiBase}/cost`, normally `/api/v1/cost`
|
|
19
|
+
|
|
20
|
+
## Architecture
|
|
21
|
+
|
|
22
|
+
```mermaid
|
|
23
|
+
flowchart LR
|
|
24
|
+
Host[External React application] --> Route[Authenticated /cost/* route]
|
|
25
|
+
Route --> Page[CostPage]
|
|
26
|
+
Page --> Router[Package router]
|
|
27
|
+
Router --> Features[Overview / Reports / Budgets]
|
|
28
|
+
Features --> Hooks[Feature hooks]
|
|
29
|
+
Hooks --> Service[costService]
|
|
30
|
+
Service --> API[Configured Axios client]
|
|
31
|
+
API --> Backend[/api/v1/cost]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
The source follows a feature-oriented structure:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
src/
|
|
38
|
+
|-- components/ Shared charts and UI primitives
|
|
39
|
+
|-- features/
|
|
40
|
+
| |-- overview/ Dashboard, cards, charts, and loading state
|
|
41
|
+
| |-- reports/ Filters, standard/compare reports, tables, export
|
|
42
|
+
| `-- budgets/ Budget form, list, and hooks
|
|
43
|
+
|-- services/cost.ts Backend API boundary
|
|
44
|
+
|-- api.ts Axios configuration and auth interceptor helper
|
|
45
|
+
|-- CostPage.tsx Public embeddable component
|
|
46
|
+
|-- router.tsx Internal routes and navigation metadata
|
|
47
|
+
|-- types.ts Public and internal cost types
|
|
48
|
+
|-- styles/index.css Package styles
|
|
49
|
+
`-- index.tsx Public exports
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Local development and build
|
|
53
|
+
|
|
54
|
+
Requirements:
|
|
55
|
+
|
|
56
|
+
- Node.js 20 or newer
|
|
57
|
+
- npm
|
|
58
|
+
|
|
59
|
+
From `insight-cost-ui`:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install
|
|
63
|
+
npm run dev
|
|
64
|
+
npm run build
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`npm run dev` starts the Vite development server. `npm run build` creates:
|
|
68
|
+
|
|
69
|
+
```text
|
|
70
|
+
dist/index.mjs ESM bundle
|
|
71
|
+
dist/index.js CommonJS bundle
|
|
72
|
+
dist/index.d.ts TypeScript declarations
|
|
73
|
+
dist/style.css Styles imported by the consuming application
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Do not manually edit `dist`; rebuild it from `src`.
|
|
77
|
+
|
|
78
|
+
## Validate the npm package
|
|
79
|
+
|
|
80
|
+
Run a packaging dry-run before publishing:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm pack --dry-run
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The archive should contain `dist`, `README.md`, `AGENTS.md`, and `package.json`.
|
|
87
|
+
It must not contain `.env` files, tokens, AWS credentials, or host application
|
|
88
|
+
source.
|
|
89
|
+
|
|
90
|
+
For a local package installation test:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npm pack
|
|
94
|
+
npm install /path/to/meyicloud-meyi-cost-ui-1.2.2.tgz
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Publish to npm
|
|
98
|
+
|
|
99
|
+
Publishing changes the external registry. Run these commands only from the
|
|
100
|
+
package folder and only after obtaining release authorization:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm login
|
|
104
|
+
npm whoami
|
|
105
|
+
npm version patch
|
|
106
|
+
npm pack --dry-run
|
|
107
|
+
npm publish --access public
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Use `npm version minor` or `npm version major` instead when the release requires
|
|
111
|
+
that semantic-version change. The `prepublishOnly` script automatically runs
|
|
112
|
+
`npm run build`; a build failure prevents publishing.
|
|
113
|
+
|
|
114
|
+
After publishing, verify from a clean consumer project:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
npm view @meyicloud/meyi-cost-ui version
|
|
118
|
+
npm install @meyicloud/meyi-cost-ui@<published-version>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Integrate with an external React application
|
|
122
|
+
|
|
123
|
+
Install the published package:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npm install @meyicloud/meyi-cost-ui
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
For local development before publishing, add a file dependency:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"dependencies": {
|
|
134
|
+
"@meyicloud/meyi-cost-ui": "file:../../meyi-market-places/insight-cost-ui"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Build the UI package before building the host when using a file dependency.
|
|
140
|
+
|
|
141
|
+
### 1. Add an authenticated wildcard route
|
|
142
|
+
|
|
143
|
+
The route must accept child paths such as `/cost/reports` and `/cost/budgets`.
|
|
144
|
+
The exact wildcard syntax depends on the host router.
|
|
145
|
+
|
|
146
|
+
```tsx
|
|
147
|
+
import { CostPage } from "@meyicloud/meyi-cost-ui";
|
|
148
|
+
import "@meyicloud/meyi-cost-ui/style.css";
|
|
149
|
+
|
|
150
|
+
export function CostPluginRoute() {
|
|
151
|
+
const token = getCurrentAccessToken();
|
|
152
|
+
const role = getCurrentUserRole();
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<CostPage
|
|
156
|
+
apiBase="/api/v1"
|
|
157
|
+
basePath="/cost"
|
|
158
|
+
token={token}
|
|
159
|
+
userRole={role}
|
|
160
|
+
/>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 2. Attach the host's token refresh flow when needed
|
|
166
|
+
|
|
167
|
+
Passing `token` is sufficient for a fixed bearer token. If the host refreshes
|
|
168
|
+
tokens dynamically, attach its normal Axios interceptors to the exported API,
|
|
169
|
+
or use the included local-storage helper:
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
import {
|
|
173
|
+
api as costApi,
|
|
174
|
+
attachAuthInterceptors,
|
|
175
|
+
} from "@meyicloud/meyi-cost-ui";
|
|
176
|
+
|
|
177
|
+
attachAuthInterceptors(costApi);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
The included helper reads `access_token` from browser local storage. A host
|
|
181
|
+
using cookies, another storage key, or token refresh should attach its own
|
|
182
|
+
request/response interceptors instead.
|
|
183
|
+
|
|
184
|
+
### 3. Route backend requests
|
|
185
|
+
|
|
186
|
+
With `apiBase="/api/v1"`, the package requests `/api/v1/cost/*`. The host or
|
|
187
|
+
reverse proxy must route those requests to an installed cost server and must
|
|
188
|
+
apply authentication and tenant resolution before the cost endpoints.
|
|
189
|
+
|
|
190
|
+
### 4. Add navigation and plugin enablement
|
|
191
|
+
|
|
192
|
+
The package exports `costNavItems` for Overview, Reports, and Budgets. The host
|
|
193
|
+
may map these entries into its sidebar. Tenant-level installation, role checks,
|
|
194
|
+
and dynamic menu visibility remain host responsibilities.
|
|
195
|
+
|
|
196
|
+
## `CostPage` properties
|
|
197
|
+
|
|
198
|
+
| Property | Required | Default | Purpose |
|
|
199
|
+
| --- | --- | --- | --- |
|
|
200
|
+
| `apiBase` | Yes | None | Base API prefix. `/cost` is appended automatically. |
|
|
201
|
+
| `basePath` | No | `/cost` | Router base path where the host mounts the UI. |
|
|
202
|
+
| `token` | No | None | Bearer token added to cost API requests. |
|
|
203
|
+
| `userRole` | No | `admin` | Compatibility property for the current host role. The present package does not use it for authorization; the host must enforce access and menu visibility. |
|
|
204
|
+
|
|
205
|
+
## Environment variables
|
|
206
|
+
|
|
207
|
+
The UI package does **not** read `process.env`, `import.meta.env`, or any
|
|
208
|
+
`VITE_*` variable directly. This is deliberate: a published browser package
|
|
209
|
+
cannot safely contain tenant secrets or AWS credentials.
|
|
210
|
+
|
|
211
|
+
Configure deployment-specific values in the host application and pass the
|
|
212
|
+
result to `CostPage`. For example, a Vite host may use:
|
|
213
|
+
|
|
214
|
+
```env
|
|
215
|
+
VITE_API_BASE=/api/v1
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
<CostPage apiBase={import.meta.env.VITE_API_BASE} basePath="/cost" />
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
`VITE_API_BASE` is only an example host variable; it is not consumed by
|
|
223
|
+
`@meyicloud/meyi-cost-ui` itself. Never define `AWS_ACCESS_KEY_ID`,
|
|
224
|
+
`AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`, database credentials, or other
|
|
225
|
+
secrets in the frontend environment because browser build variables are
|
|
226
|
+
visible to users.
|
|
227
|
+
|
|
228
|
+
## Server API expected by the UI
|
|
229
|
+
|
|
230
|
+
The UI consumes these routes below `${apiBase}/cost`:
|
|
231
|
+
|
|
232
|
+
- `GET /accounts`
|
|
233
|
+
- `GET /overview`
|
|
234
|
+
- `GET /data-status`
|
|
235
|
+
- `GET /filter-options`
|
|
236
|
+
- `GET /reports`
|
|
237
|
+
- `GET /tags`
|
|
238
|
+
- `GET /analysis/status`, `GET /analysis/latest`, and `POST /analysis`
|
|
239
|
+
- `GET /budgets`, `POST /budgets`, and `DELETE /budgets/:id`
|
|
240
|
+
- `GET /budget-alert-dismissals` and `POST /budget-alert-dismissals`
|
|
241
|
+
|
|
242
|
+
Use the matching cost server version whenever API response contracts change.
|
|
243
|
+
|
|
244
|
+
## Reference Meyi Connect integration
|
|
245
|
+
|
|
246
|
+
- Frontend route: `meyi-connect/frontend-v2/src/routes/_authenticated/cost/$.tsx`
|
|
247
|
+
- Sidebar integration: `meyi-connect/frontend-v2/src/components/layout/sidebar.tsx`
|
|
248
|
+
- Backend adapter: `meyi-connect/backend/src/plugins/cost/index.mjs`
|
|
249
|
+
|
|
250
|
+
## Consumer validation checklist
|
|
251
|
+
|
|
252
|
+
1. Build `@meyicloud/meyi-cost-ui`.
|
|
253
|
+
2. Install or refresh the package in the host.
|
|
254
|
+
3. Build the host frontend.
|
|
255
|
+
4. Verify direct navigation and refresh for `/cost`, `/cost/reports`, and
|
|
256
|
+
`/cost/budgets`.
|
|
257
|
+
5. Verify authenticated requests reach `/api/v1/cost` with the correct tenant.
|
|
258
|
+
6. Test loading, empty, error, monthly/yearly, graph/list, report filters,
|
|
259
|
+
compare mode, pagination, and PDF/CSV export states.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CostPageProps {
|
|
3
|
+
/** Base URL for the cost API, e.g. "/api/v1" */
|
|
4
|
+
apiBase: string;
|
|
5
|
+
/** Bearer token for authenticated requests */
|
|
6
|
+
token?: string;
|
|
7
|
+
/** Base path for the router, defaults to "/cost" */
|
|
8
|
+
basePath?: string;
|
|
9
|
+
/** The current user's role */
|
|
10
|
+
userRole?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function CostPage({ apiBase, token, basePath, userRole }: CostPageProps): React.JSX.Element;
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface CostLinePoint {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
value: number;
|
|
5
|
+
details?: Array<{
|
|
6
|
+
label: string;
|
|
7
|
+
value: number;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
export declare function CostLineChart({ points, currency }: {
|
|
11
|
+
points: CostLinePoint[];
|
|
12
|
+
currency?: string;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
3
|
+
declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
5
|
+
declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
|
|
6
|
+
declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CostAnalysis, CostAnalysisStatus, CurDataStatus } from '../../../types.js';
|
|
2
|
+
export type AnalysisRangeKey = "current_month" | "last_month" | "last_3_months";
|
|
3
|
+
export declare function resolveAnalysisRange(key: AnalysisRangeKey, now?: Date): {
|
|
4
|
+
start: string;
|
|
5
|
+
end: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function useCostAnalysis(): {
|
|
8
|
+
status: CostAnalysisStatus | null;
|
|
9
|
+
dataStatus: CurDataStatus | null;
|
|
10
|
+
analysis: CostAnalysis | null;
|
|
11
|
+
rangeKey: AnalysisRangeKey;
|
|
12
|
+
setRangeKey: import('react').Dispatch<import('react').SetStateAction<AnalysisRangeKey>>;
|
|
13
|
+
range: {
|
|
14
|
+
start: string;
|
|
15
|
+
end: string;
|
|
16
|
+
};
|
|
17
|
+
initialLoading: boolean;
|
|
18
|
+
generating: boolean;
|
|
19
|
+
error: string | null;
|
|
20
|
+
generate: (force?: boolean) => Promise<void>;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CostAnalysisPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface BudgetFormProps {
|
|
2
|
+
name: string;
|
|
3
|
+
amount: string;
|
|
4
|
+
threshold: string;
|
|
5
|
+
creating: boolean;
|
|
6
|
+
onNameChange: (value: string) => void;
|
|
7
|
+
onAmountChange: (value: string) => void;
|
|
8
|
+
onThresholdChange: (value: string) => void;
|
|
9
|
+
onSubmit: (event: React.FormEvent) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function BudgetForm(props: BudgetFormProps): import("react").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CostBudget } from '../../../types.js';
|
|
2
|
+
export declare function BudgetList({ budgets, loading, deleting, onDelete }: {
|
|
3
|
+
budgets: CostBudget[];
|
|
4
|
+
loading: boolean;
|
|
5
|
+
deleting: string | null;
|
|
6
|
+
onDelete: (id: string) => void;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FormEvent } from 'react';
|
|
2
|
+
import { CostBudget, CurDataStatus } from '../../../types.js';
|
|
3
|
+
export declare function useCostBudgets(): {
|
|
4
|
+
budgets: CostBudget[];
|
|
5
|
+
dataStatus: CurDataStatus | null;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
error: string | null;
|
|
8
|
+
deleting: string | null;
|
|
9
|
+
showForm: boolean;
|
|
10
|
+
creating: boolean;
|
|
11
|
+
name: string;
|
|
12
|
+
amount: string;
|
|
13
|
+
threshold: string;
|
|
14
|
+
setShowForm: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
15
|
+
setName: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
16
|
+
setAmount: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
17
|
+
setThreshold: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
18
|
+
load: () => Promise<void>;
|
|
19
|
+
create: (event: FormEvent) => Promise<void>;
|
|
20
|
+
remove: (id: string) => Promise<void>;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CostBudgetsPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CurDiscoveryPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CostBreakdownItem, CostOverview } from '../../../types.js';
|
|
2
|
+
export declare const dashboardCardClass = "min-h-32 transition-all duration-200 ease-out hover:-translate-y-1 hover:scale-[1.01] hover:border-primary/30 hover:shadow-lg";
|
|
3
|
+
export declare function Breakdown({ title, icon, items, currency }: {
|
|
4
|
+
title: string;
|
|
5
|
+
icon: React.ReactNode;
|
|
6
|
+
items: CostBreakdownItem[];
|
|
7
|
+
currency: string;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
export declare function DashboardSkeleton(): import("react").JSX.Element;
|
|
10
|
+
export declare function OverviewCards({ data, period, selectedMonth }: {
|
|
11
|
+
data: CostOverview;
|
|
12
|
+
period: "monthly" | "yearly";
|
|
13
|
+
selectedMonth: string;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CostOverview, CurDataStatus } from '../../../types.js';
|
|
2
|
+
export declare function useCostOverview(): {
|
|
3
|
+
data: CostOverview | null;
|
|
4
|
+
dataStatus: CurDataStatus | null;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: string | null;
|
|
7
|
+
period: "monthly" | "yearly";
|
|
8
|
+
selectedMonth: string;
|
|
9
|
+
monthOptions: {
|
|
10
|
+
value: string;
|
|
11
|
+
label: string;
|
|
12
|
+
}[];
|
|
13
|
+
changePeriod: (value: "monthly" | "yearly") => void;
|
|
14
|
+
changeMonth: (value: string) => void;
|
|
15
|
+
refresh: () => Promise<void>;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CostOverviewPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CostFilterOption } from '../../../types.js';
|
|
2
|
+
export declare function SummaryCard({ label, value, helper, accent, trend }: {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
helper?: string;
|
|
6
|
+
accent?: boolean;
|
|
7
|
+
trend?: number;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
export declare function MultiSelect({ label, options, selected, onChange }: {
|
|
10
|
+
label: string;
|
|
11
|
+
options: CostFilterOption[];
|
|
12
|
+
selected: string[];
|
|
13
|
+
onChange: (values: string[]) => void;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
15
|
+
export declare function ReportLoader(): import("react").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CostFilterOptions } from '../../../types.js';
|
|
2
|
+
import { Filters, ReportGroup, ReportMode } from '../report-model.js';
|
|
3
|
+
interface ReportSidebarProps {
|
|
4
|
+
mode: ReportMode;
|
|
5
|
+
groupBy: ReportGroup;
|
|
6
|
+
start: string;
|
|
7
|
+
end: string;
|
|
8
|
+
granularity: "daily" | "monthly";
|
|
9
|
+
reportTagKey: string;
|
|
10
|
+
options: CostFilterOptions;
|
|
11
|
+
filters: Filters;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
filtersLoading: boolean;
|
|
14
|
+
comparisonPeriods: {
|
|
15
|
+
currentStart: string;
|
|
16
|
+
currentEnd: string;
|
|
17
|
+
previousStart: string;
|
|
18
|
+
previousEnd: string;
|
|
19
|
+
};
|
|
20
|
+
onModeChange: (mode: ReportMode) => void;
|
|
21
|
+
onStartChange: (value: string) => void;
|
|
22
|
+
onEndChange: (value: string) => void;
|
|
23
|
+
onGranularityChange: (value: "daily" | "monthly") => void;
|
|
24
|
+
onReportTagKeyChange: (value: string) => void;
|
|
25
|
+
onFiltersChange: (updater: (previous: Filters) => Filters) => void;
|
|
26
|
+
onLoadTagValues: (tagKey: string) => void;
|
|
27
|
+
onRun: () => void;
|
|
28
|
+
onApply: () => void;
|
|
29
|
+
onReset: () => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function ReportSidebar(props: ReportSidebarProps): import("react").JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CostReport } from '../../../types.js';
|
|
2
|
+
import { Comparison, ComparisonRow, ReportGroup } from '../report-model.js';
|
|
3
|
+
export declare function DetailsTable({ groupBy, report }: {
|
|
4
|
+
groupBy: ReportGroup;
|
|
5
|
+
report: CostReport;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
export declare function ComparisonDetails({ rows, groupBy, comparison, granularity }: {
|
|
8
|
+
rows: ComparisonRow[];
|
|
9
|
+
groupBy: ReportGroup;
|
|
10
|
+
comparison: Comparison;
|
|
11
|
+
granularity: "daily" | "monthly";
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CostFilterOptions, CostReport, CurDataStatus } from '../../../types.js';
|
|
2
|
+
import { Comparison, Filters, ReportGroup, ReportMode } from '../report-model.js';
|
|
3
|
+
export declare function useCostReports(): {
|
|
4
|
+
groupBy: ReportGroup;
|
|
5
|
+
mode: ReportMode;
|
|
6
|
+
start: string;
|
|
7
|
+
end: string;
|
|
8
|
+
granularity: "monthly" | "daily";
|
|
9
|
+
reportTagKey: string;
|
|
10
|
+
options: CostFilterOptions;
|
|
11
|
+
draftFilters: Filters;
|
|
12
|
+
report: CostReport | null;
|
|
13
|
+
comparison: Comparison | null;
|
|
14
|
+
loading: boolean;
|
|
15
|
+
filtersLoading: boolean;
|
|
16
|
+
error: string | null;
|
|
17
|
+
dataStatus: CurDataStatus | null;
|
|
18
|
+
comparedRows: import('../report-model.js').ComparisonRow[];
|
|
19
|
+
selectedComparisonPeriods: {
|
|
20
|
+
currentStart: string;
|
|
21
|
+
currentEnd: string;
|
|
22
|
+
previousStart: string;
|
|
23
|
+
previousEnd: string;
|
|
24
|
+
};
|
|
25
|
+
setStart: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
26
|
+
setEnd: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
27
|
+
setGranularity: import('react').Dispatch<import('react').SetStateAction<"monthly" | "daily">>;
|
|
28
|
+
setReportTagKey: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
29
|
+
setDraftFilters: import('react').Dispatch<import('react').SetStateAction<Filters>>;
|
|
30
|
+
changeGroup: (value: ReportGroup) => void;
|
|
31
|
+
changeMode: (value: ReportMode) => void;
|
|
32
|
+
applyFilters: () => void;
|
|
33
|
+
resetFilters: () => void;
|
|
34
|
+
runReport: () => void;
|
|
35
|
+
loadOptions: (tagKey?: string) => Promise<void>;
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CostReportsPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CostReport } from '../../types.js';
|
|
2
|
+
import { Comparison, ComparisonRow, ReportGroup } from './report-model.js';
|
|
3
|
+
interface ExportContext {
|
|
4
|
+
report: CostReport;
|
|
5
|
+
comparison: Comparison | null;
|
|
6
|
+
rows: ComparisonRow[];
|
|
7
|
+
groupBy: ReportGroup;
|
|
8
|
+
mode: "standard" | "compare";
|
|
9
|
+
start: string;
|
|
10
|
+
end: string;
|
|
11
|
+
granularity: "daily" | "monthly";
|
|
12
|
+
}
|
|
13
|
+
export declare function exportReportCsv(context: ExportContext): void;
|
|
14
|
+
export declare function exportReportPdf(context: ExportContext): Promise<void>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CostBreakdownItem, CostRelationItem, CostReport } from '../../types.js';
|
|
2
|
+
export type ReportGroup = "service" | "account" | "region" | "resource" | "tag";
|
|
3
|
+
export type ReportMode = "standard" | "compare";
|
|
4
|
+
export type Filters = {
|
|
5
|
+
services: string[];
|
|
6
|
+
regions: string[];
|
|
7
|
+
accountIds: string[];
|
|
8
|
+
tagKey: string;
|
|
9
|
+
tagValues: string[];
|
|
10
|
+
};
|
|
11
|
+
export type Comparison = {
|
|
12
|
+
current: CostReport;
|
|
13
|
+
previous: CostReport;
|
|
14
|
+
currentStart: string;
|
|
15
|
+
currentEnd: string;
|
|
16
|
+
previousStart: string;
|
|
17
|
+
previousEnd: string;
|
|
18
|
+
};
|
|
19
|
+
export type ComparisonRow = {
|
|
20
|
+
key: string;
|
|
21
|
+
label: string;
|
|
22
|
+
current?: CostBreakdownItem;
|
|
23
|
+
previous?: CostBreakdownItem;
|
|
24
|
+
difference: number;
|
|
25
|
+
change: number;
|
|
26
|
+
};
|
|
27
|
+
export declare const PAGE_SIZE = 10;
|
|
28
|
+
export declare const defaultStart: string;
|
|
29
|
+
export declare const defaultEnd: string;
|
|
30
|
+
export declare const emptyFilters: Filters;
|
|
31
|
+
export declare const reportCopy: Record<ReportGroup, {
|
|
32
|
+
tab: string;
|
|
33
|
+
title: string;
|
|
34
|
+
pdfTitle: string;
|
|
35
|
+
top: string;
|
|
36
|
+
count: string;
|
|
37
|
+
item: string;
|
|
38
|
+
empty: string;
|
|
39
|
+
}>;
|
|
40
|
+
export declare function updatedLabel(value?: string): string;
|
|
41
|
+
export declare function comparisonPeriods(end: string, granularity: "daily" | "monthly"): {
|
|
42
|
+
currentStart: string;
|
|
43
|
+
currentEnd: string;
|
|
44
|
+
previousStart: string;
|
|
45
|
+
previousEnd: string;
|
|
46
|
+
};
|
|
47
|
+
export declare function periodLabel(start: string, end: string, granularity: "daily" | "monthly"): string;
|
|
48
|
+
export declare function comparisonRows(comparison: Comparison): ComparisonRow[];
|
|
49
|
+
export declare function relationText(values?: CostRelationItem[]): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function CostSourcesPage(): import("react").JSX.Element;
|