locust-ui 1.0.0-beta

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.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +169 -0
  3. package/lib/assets/favicon.png +0 -0
  4. package/lib/types/App.d.ts +2 -0
  5. package/lib/types/HtmlReport.d.ts +1 -0
  6. package/lib/types/assets/Logo.d.ts +4 -0
  7. package/lib/types/components/DataTable/DataTable.d.ts +13 -0
  8. package/lib/types/components/ExceptionsTable/ExceptionsTable.d.ts +10 -0
  9. package/lib/types/components/FailuresTable/FailuresTable.d.ts +10 -0
  10. package/lib/types/components/FallbackRender/FallbackRender.d.ts +6 -0
  11. package/lib/types/components/Form/Form.d.ts +9 -0
  12. package/lib/types/components/Form/Select.d.ts +13 -0
  13. package/lib/types/components/Layout/Footer/About.d.ts +2 -0
  14. package/lib/types/components/Layout/Footer/Footer.d.ts +2 -0
  15. package/lib/types/components/Layout/Layout.d.ts +7 -0
  16. package/lib/types/components/Layout/Navbar/DarkLightToggle.d.ts +2 -0
  17. package/lib/types/components/Layout/Navbar/Navbar.d.ts +2 -0
  18. package/lib/types/components/Layout/Navbar/SwarmMonitor.d.ts +11 -0
  19. package/lib/types/components/LineChart/LineChart.constants.d.ts +14 -0
  20. package/lib/types/components/LineChart/LineChart.d.ts +7 -0
  21. package/lib/types/components/LineChart/LineChart.types.d.ts +37 -0
  22. package/lib/types/components/LineChart/LineChart.utils.d.ts +69 -0
  23. package/lib/types/components/LogViewer/LogDisplay.d.ts +4 -0
  24. package/lib/types/components/LogViewer/LogViewer.d.ts +2 -0
  25. package/lib/types/components/LogViewer/LogViewer.utils.d.ts +1 -0
  26. package/lib/types/components/LogViewer/WorkerLogs.d.ts +5 -0
  27. package/lib/types/components/LogViewer/useLogViewer.d.ts +4 -0
  28. package/lib/types/components/Modal/Modal.d.ts +8 -0
  29. package/lib/types/components/Reports/Reports.d.ts +8 -0
  30. package/lib/types/components/ResponseTimeTable/ResponseTimeTable.d.ts +7 -0
  31. package/lib/types/components/StateButtons/EditButton.d.ts +2 -0
  32. package/lib/types/components/StateButtons/NewTestButton.d.ts +2 -0
  33. package/lib/types/components/StateButtons/ResetButton.d.ts +2 -0
  34. package/lib/types/components/StateButtons/StateButtons.d.ts +2 -0
  35. package/lib/types/components/StateButtons/StopButton.d.ts +2 -0
  36. package/lib/types/components/StatsTable/StatsTable.d.ts +23 -0
  37. package/lib/types/components/SwarmCharts/SwarmCharts.d.ts +10 -0
  38. package/lib/types/components/SwarmForm/SwarmCustomParameters.d.ts +7 -0
  39. package/lib/types/components/SwarmForm/SwarmEditForm.d.ts +14 -0
  40. package/lib/types/components/SwarmForm/SwarmForm.d.ts +13 -0
  41. package/lib/types/components/SwarmForm/SwarmUserClassPicker.d.ts +18 -0
  42. package/lib/types/components/SwarmRatios/SwarmRatios.d.ts +10 -0
  43. package/lib/types/components/Table/Table.d.ts +23 -0
  44. package/lib/types/components/Tabs/Tabs.constants.d.ts +72 -0
  45. package/lib/types/components/Tabs/Tabs.d.ts +23 -0
  46. package/lib/types/components/ViewColumnSelector/ViewColumnSelector.d.ts +10 -0
  47. package/lib/types/components/WorkersTable/WorkersTable.d.ts +10 -0
  48. package/lib/types/constants/auth.d.ts +3 -0
  49. package/lib/types/constants/logs.d.ts +1 -0
  50. package/lib/types/constants/swarm.d.ts +14 -0
  51. package/lib/types/constants/theme.d.ts +6 -0
  52. package/lib/types/hooks/useCreateTheme.d.ts +1 -0
  53. package/lib/types/hooks/useFetchExceptions.d.ts +1 -0
  54. package/lib/types/hooks/useFetchStats.d.ts +1 -0
  55. package/lib/types/hooks/useFetchTasks.d.ts +1 -0
  56. package/lib/types/hooks/useInterval.d.ts +4 -0
  57. package/lib/types/hooks/useNotifications.d.ts +4 -0
  58. package/lib/types/hooks/useSelectViewColumns.d.ts +8 -0
  59. package/lib/types/hooks/useSortByField.d.ts +9 -0
  60. package/lib/types/index.d.ts +1 -0
  61. package/lib/types/lib.d.ts +51 -0
  62. package/lib/types/pages/Auth.d.ts +3 -0
  63. package/lib/types/pages/Dashboard.d.ts +18 -0
  64. package/lib/types/pages/HtmlReport.d.ts +3 -0
  65. package/lib/types/redux/api/swarm.d.ts +11 -0
  66. package/lib/types/redux/hooks.d.ts +7 -0
  67. package/lib/types/redux/slice/logViewer.slice.d.ts +17 -0
  68. package/lib/types/redux/slice/notification.slice.d.ts +14 -0
  69. package/lib/types/redux/slice/root.slice.d.ts +87 -0
  70. package/lib/types/redux/slice/swarm.slice.d.ts +52 -0
  71. package/lib/types/redux/slice/theme.slice.d.ts +18 -0
  72. package/lib/types/redux/slice/ui.slice.d.ts +90 -0
  73. package/lib/types/redux/slice/url.slice.d.ts +20 -0
  74. package/lib/types/redux/store.d.ts +75 -0
  75. package/lib/types/redux/utils.d.ts +3 -0
  76. package/lib/types/styles/theme.d.ts +4 -0
  77. package/lib/types/types/auth.types.d.ts +10 -0
  78. package/lib/types/types/swarm.types.d.ts +46 -0
  79. package/lib/types/types/tab.types.d.ts +9 -0
  80. package/lib/types/types/table.types.d.ts +6 -0
  81. package/lib/types/types/ui.types.d.ts +96 -0
  82. package/lib/types/utils/array.d.ts +1 -0
  83. package/lib/types/utils/date.d.ts +1 -0
  84. package/lib/types/utils/number.d.ts +2 -0
  85. package/lib/types/utils/object.d.ts +6 -0
  86. package/lib/types/utils/string.d.ts +8 -0
  87. package/lib/types/utils/url.d.ts +6 -0
  88. package/lib/webui.js +60304 -0
  89. package/package.json +85 -0
@@ -0,0 +1,20 @@
1
+ import { PayloadAction } from '../../@reduxjs/toolkit';
2
+
3
+ export interface IUrlState {
4
+ query: {
5
+ [key: string]: string;
6
+ } | null;
7
+ }
8
+ export type UrlAction = PayloadAction<Partial<IUrlState>>;
9
+ export declare const urlActions: import('../../@reduxjs/toolkit').CaseReducerActions<{
10
+ setUrl: (state: IUrlState, { payload }: {
11
+ payload: Partial<IUrlState>;
12
+ type: string;
13
+ }) => IUrlState & (boolean | import('../../logViewer.slice').ILogViewerState | import('../../notification.slice').INotificationState | Partial<import('../../swarm.slice').ISwarmState> | Partial<import('../../ui.slice').IUiState> | Partial<IUrlState> | undefined);
14
+ }, "url">;
15
+ declare const _default: import('..').Reducer<{
16
+ query: {
17
+ [key: string]: string;
18
+ } | null;
19
+ }>;
20
+ export default _default;
@@ -0,0 +1,75 @@
1
+ import { configureStore } from '../@reduxjs/toolkit';
2
+
3
+ export declare const store: import('../@reduxjs/toolkit').EnhancedStore<{
4
+ api: import('../@reduxjs/toolkit/query').CombinedState<{
5
+ getStats: import('../@reduxjs/toolkit/query').QueryDefinition<void, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, import('../../types/ui.types').IStatsResponse, "api">;
6
+ getTasks: import('../@reduxjs/toolkit/query').QueryDefinition<void, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, import('../../types/ui.types').ISwarmRatios, "api">;
7
+ getExceptions: import('../@reduxjs/toolkit/query').QueryDefinition<void, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, import('../../types/ui.types').ISwarmExceptionsResponse, "api">;
8
+ getLogs: import('../@reduxjs/toolkit/query').QueryDefinition<void, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, import('../../types/ui.types').ILogsResponse, "api">;
9
+ startSwarm: import('../@reduxjs/toolkit/query').MutationDefinition<any, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, any, "api">;
10
+ updateUserSettings: import('../@reduxjs/toolkit/query').MutationDefinition<any, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, any, "api">;
11
+ }, never, "api">;
12
+ logViewer: {
13
+ master: string[];
14
+ workers: {};
15
+ };
16
+ notification: {};
17
+ swarm: import('../slice/swarm.slice').ISwarmState;
18
+ theme: {
19
+ isDarkMode: boolean;
20
+ };
21
+ ui: {
22
+ totalRps: number;
23
+ failRatio: number;
24
+ startTime: string;
25
+ stats: import('../../types/ui.types').ISwarmStat[];
26
+ errors: import('../../types/ui.types').ISwarmError[];
27
+ exceptions: import('../../types/ui.types').ISwarmException[];
28
+ charts: import('../../types/ui.types').ICharts;
29
+ ratios: import('../../types/ui.types').ISwarmRatios;
30
+ userCount: number;
31
+ };
32
+ url: {
33
+ query: {
34
+ [key: string]: string;
35
+ } | null;
36
+ };
37
+ }, import('.').UnknownAction, import('../@reduxjs/toolkit').Tuple<[import('.').StoreEnhancer<{
38
+ dispatch: import('../redux-thunk').ThunkDispatch<{
39
+ api: import('../@reduxjs/toolkit/query').CombinedState<{
40
+ getStats: import('../@reduxjs/toolkit/query').QueryDefinition<void, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, import('../../types/ui.types').IStatsResponse, "api">;
41
+ getTasks: import('../@reduxjs/toolkit/query').QueryDefinition<void, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, import('../../types/ui.types').ISwarmRatios, "api">;
42
+ getExceptions: import('../@reduxjs/toolkit/query').QueryDefinition<void, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, import('../../types/ui.types').ISwarmExceptionsResponse, "api">;
43
+ getLogs: import('../@reduxjs/toolkit/query').QueryDefinition<void, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, import('../../types/ui.types').ILogsResponse, "api">;
44
+ startSwarm: import('../@reduxjs/toolkit/query').MutationDefinition<any, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, any, "api">;
45
+ updateUserSettings: import('../@reduxjs/toolkit/query').MutationDefinition<any, import('../@reduxjs/toolkit/query').BaseQueryFn<string | import('../@reduxjs/toolkit/query').FetchArgs, unknown, import('../@reduxjs/toolkit/query').FetchBaseQueryError, {}, import('../@reduxjs/toolkit/query').FetchBaseQueryMeta>, never, any, "api">;
46
+ }, never, "api">;
47
+ logViewer: {
48
+ master: string[];
49
+ workers: {};
50
+ };
51
+ notification: {};
52
+ swarm: import('../slice/swarm.slice').ISwarmState;
53
+ theme: {
54
+ isDarkMode: boolean;
55
+ };
56
+ ui: {
57
+ totalRps: number;
58
+ failRatio: number;
59
+ startTime: string;
60
+ stats: import('../../types/ui.types').ISwarmStat[];
61
+ errors: import('../../types/ui.types').ISwarmError[];
62
+ exceptions: import('../../types/ui.types').ISwarmException[];
63
+ charts: import('../../types/ui.types').ICharts;
64
+ ratios: import('../../types/ui.types').ISwarmRatios;
65
+ userCount: number;
66
+ };
67
+ url: {
68
+ query: {
69
+ [key: string]: string;
70
+ } | null;
71
+ };
72
+ }, undefined, import('.').UnknownAction>;
73
+ }>, import('.').StoreEnhancer]>>;
74
+ export type { IRootState, Action } from './slice/root.slice';
75
+ export default configureStore;
@@ -0,0 +1,3 @@
1
+ import { Action } from './store';
2
+
3
+ export declare function updateStateWithPayload<ReducerState, ActionType extends Action = Action>(state: ReducerState, { payload }: ActionType): ReducerState & (boolean | import('../slice/logViewer.slice').ILogViewerState | import('../slice/notification.slice').INotificationState | Partial<import('../slice/swarm.slice').ISwarmState> | Partial<import('../slice/ui.slice').IUiState> | Partial<import('../slice/url.slice').IUrlState> | undefined);
@@ -0,0 +1,4 @@
1
+ import { PaletteMode } from '../@mui/material';
2
+
3
+ declare const createTheme: (mode: PaletteMode) => import('../@mui/material').Theme;
4
+ export default createTheme;
@@ -0,0 +1,10 @@
1
+ export interface IAuthProviders {
2
+ label: string;
3
+ iconUrl: string;
4
+ callbackUrl: string;
5
+ }
6
+ export interface IAuthArgs {
7
+ usernamePasswordCallback?: string;
8
+ error?: string;
9
+ authProviders?: IAuthProviders[];
10
+ }
@@ -0,0 +1,46 @@
1
+ import { ICharts, ISwarmError, ISwarmStat, IResponseTime, ISwarmRatios, ISwarmException } from './ui.types';
2
+
3
+ export interface IExtraOptionParameter {
4
+ choices: string[] | null;
5
+ defaultValue: string | number | boolean | null;
6
+ helpText: string | null;
7
+ isSecret: boolean;
8
+ }
9
+ export interface IExtraOptions {
10
+ [key: string]: IExtraOptionParameter;
11
+ }
12
+ export interface IHistory {
13
+ currentRps: [string, number];
14
+ currentFailPerSec: [string, number];
15
+ userCount: [string, number];
16
+ currentResponseTimePercentiles: {
17
+ [key: `responseTimePercentile${number}`]: [string, number | null];
18
+ };
19
+ totalAvgResponseTime: [string, number];
20
+ time: string;
21
+ }
22
+ export interface IReport {
23
+ locustfile: string;
24
+ showDownloadLink: boolean;
25
+ startTime: string;
26
+ endTime: string;
27
+ host: string;
28
+ charts: ICharts;
29
+ requestsStatistics: ISwarmStat[];
30
+ failuresStatistics: ISwarmError[];
31
+ responseTimeStatistics: IResponseTime[];
32
+ exceptionsStatistics: ISwarmException[];
33
+ tasks: ISwarmRatios;
34
+ }
35
+ export interface IReportTemplateArgs extends Omit<IReport, 'charts'> {
36
+ history: IHistory[];
37
+ isReport?: boolean;
38
+ percentilesToChart: number[];
39
+ percentilesToStatistics: number[];
40
+ }
41
+ export interface ISwarmUser {
42
+ fixedCount: number;
43
+ host: string;
44
+ weight: number;
45
+ tasks: string[];
46
+ }
@@ -0,0 +1,9 @@
1
+ import { ComponentType } from '../react';
2
+ import { IRootState } from '../redux/store';
3
+
4
+ export interface ITab<TabType = string> {
5
+ component?: ComponentType;
6
+ key: TabType;
7
+ title: string;
8
+ shouldDisplayTab?: (state: IRootState) => boolean;
9
+ }
@@ -0,0 +1,6 @@
1
+ export interface ITableStructure {
2
+ key: string;
3
+ title: string;
4
+ round?: number;
5
+ markdown?: boolean;
6
+ }
@@ -0,0 +1,96 @@
1
+ import { ILineChartMarkers } from '../components/LineChart/LineChart.types';
2
+ import { SWARM_STATE } from '../constants/swarm';
3
+
4
+ export type SwarmState = (typeof SWARM_STATE)[keyof typeof SWARM_STATE];
5
+ export interface ISwarmStat {
6
+ avgContentLength: number;
7
+ avgResponseTime: number;
8
+ currentFailPerSec: number;
9
+ currentRps: number;
10
+ maxResponseTime: number;
11
+ medianResponseTime: number;
12
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
13
+ minResponseTime: number;
14
+ name: string;
15
+ [key: `responseTimePercentile${number}`]: number;
16
+ numFailures: number;
17
+ numRequests: number;
18
+ safeName: string;
19
+ }
20
+ export interface ISwarmError {
21
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
22
+ name: string;
23
+ occurrences: number;
24
+ }
25
+ export interface ISwarmException {
26
+ count: number;
27
+ msg: string;
28
+ nodes: string;
29
+ traceback: string;
30
+ }
31
+ export interface IResponseTime {
32
+ method: string;
33
+ name: string;
34
+ [percentile: string]: string | number;
35
+ }
36
+ export interface ISwarmExceptionsResponse {
37
+ exceptions: ISwarmException[];
38
+ }
39
+ export interface ISwarmWorker {
40
+ cpuUsage: number;
41
+ id: string;
42
+ memoryUsage: number;
43
+ state: (typeof SWARM_STATE)[keyof typeof SWARM_STATE];
44
+ userCount: number;
45
+ }
46
+ export interface NullChartValue {
47
+ value: null;
48
+ }
49
+ export interface ICharts extends ILineChartMarkers {
50
+ currentRps: ((string | number)[] | NullChartValue)[];
51
+ currentFailPerSec: ([string, number] | NullChartValue)[];
52
+ [key: `responseTimePercentile${number}`]: ([string, number | null] | NullChartValue)[];
53
+ totalAvgResponseTime: ([string, number] | NullChartValue)[];
54
+ userCount: ([string, number] | NullChartValue)[];
55
+ time: string[];
56
+ }
57
+ export interface IClassRatio {
58
+ [key: string]: {
59
+ ratio: number;
60
+ tasks: IClassRatio;
61
+ };
62
+ }
63
+ export interface ISwarmRatios {
64
+ perClass: IClassRatio;
65
+ total: IClassRatio;
66
+ }
67
+ export interface IExtendedStatData {
68
+ name: string;
69
+ safeName: string;
70
+ [key: string]: number | string;
71
+ }
72
+ export interface IExtendedStat {
73
+ key: string;
74
+ data: IExtendedStatData[];
75
+ }
76
+ export interface IStatsResponse {
77
+ extendedStats: IExtendedStat[];
78
+ state: SwarmState;
79
+ stats: ISwarmStat[];
80
+ errors: ISwarmError[];
81
+ workers: ISwarmWorker[];
82
+ totalRps: number;
83
+ totalFailPerSec: number;
84
+ totalAvgResponseTime: number;
85
+ currentResponseTimePercentiles: {
86
+ [key: `responseTimePercentile${number}`]: number | null;
87
+ };
88
+ failRatio: number;
89
+ userCount: number;
90
+ }
91
+ export interface ILogsResponse {
92
+ master: string[];
93
+ workers: {
94
+ [key: string]: string[];
95
+ };
96
+ }
@@ -0,0 +1 @@
1
+ export declare const flatten: <T>(array: any[]) => T[];
@@ -0,0 +1 @@
1
+ export declare const formatLocaleString: (utcTimestamp: string) => string;
@@ -0,0 +1,2 @@
1
+ export declare const roundToDecimalPlaces: (n: number, decimalPlaces?: number) => number;
2
+ export declare const padStart: (n: number, length?: number, padding?: string) => string;
@@ -0,0 +1,6 @@
1
+ export declare const isEmpty: <T extends any[] | Record<string, any>>(object: T) => boolean;
2
+ export declare function shallowMerge<ObjectA, ObjectB>(objectA: ObjectA, objectB: ObjectB): ObjectA & ObjectB;
3
+ export declare const createFormData: (inputData: {
4
+ [key: string]: string | string[];
5
+ }) => URLSearchParams;
6
+ export declare const updateArraysAtProps: <T extends Record<string, any>>(objectToUpdate: T, propsWithUpdates: { [K in keyof T]: T[K] extends (infer U)[] ? U : T; }) => T;
@@ -0,0 +1,8 @@
1
+ export declare const snakeToCamelCase: (string: string) => string;
2
+ export declare const camelCaseKeys: <ObjectInterface extends Record<string, any>>(object: ObjectInterface) => ObjectInterface;
3
+ export declare const snakeCaseKeys: <ObjectInterface extends Record<string, any>>(object: ObjectInterface) => ObjectInterface;
4
+ export declare const toTitleCase: (string: string) => string;
5
+ export declare const queryStringToObject: (queryString: string) => {
6
+ [k: string]: string;
7
+ };
8
+ export declare const formatBytes: (bytes: number, decimals?: number) => string;
@@ -0,0 +1,6 @@
1
+ export declare const pushQuery: (query: {
2
+ [key: string]: string;
3
+ }) => void;
4
+ export declare const getUrlParams: () => {
5
+ [key: string]: string;
6
+ } | null;