Skip to content

Commit

Permalink
Merge pull request #2914 from fletelli42/url-in-template-arg
Browse files Browse the repository at this point in the history
Url in template arg
  • Loading branch information
andrewbaldwin44 authored Sep 26, 2024
2 parents 3313016 + f685339 commit 1c1d907
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
4 changes: 3 additions & 1 deletion locust/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ def update_template_args(self):
else None
)

self.template_args = {
new_template_args = {
"locustfile": self.environment.locustfile,
"state": self.environment.runner.state,
"is_distributed": is_distributed,
Expand Down Expand Up @@ -658,6 +658,8 @@ def update_template_args(self):
"percentiles_to_statistics": stats_module.PERCENTILES_TO_STATISTICS,
}

self.template_args = {**self.template_args, **new_template_args}

def _update_shape_class(self, shape_class_name):
if shape_class_name:
shape_class = self.environment.available_shape_classes[shape_class_name]
Expand Down
12 changes: 2 additions & 10 deletions locust/webui/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { PaletteMode } from '@mui/material';

import type { ISwarmState } from 'redux/slice/swarm.slice';
import { IAuthArgs } from 'types/auth.types';
import { IReportTemplateArgs } from 'types/swarm.types';
import { IWindow } from 'types/window.types';

declare global {
interface Window {
templateArgs: IReportTemplateArgs | ISwarmState;
authArgs: IAuthArgs;
theme?: PaletteMode;
}
interface Window extends IWindow {}
}
2 changes: 1 addition & 1 deletion locust/webui/src/lib.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export { tabConfig } from 'components/Tabs/Tabs.constants';
export { store as locustStore } from 'redux/store';

export type { IRootState } from 'redux/store';

export type { IWindow } from 'types/window.types';
export type { ITab } from 'types/tab.types';

export interface IExtendedTableStructure<StatKey> {
Expand Down
11 changes: 11 additions & 0 deletions locust/webui/src/types/window.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { PaletteMode } from '@mui/material';

import type { ISwarmState } from 'redux/slice/swarm.slice';
import { IAuthArgs } from 'types/auth.types';
import { IReportTemplateArgs } from 'types/swarm.types';

export interface IWindow {
templateArgs: IReportTemplateArgs | ISwarmState;
authArgs: IAuthArgs;
theme?: PaletteMode;
}

0 comments on commit 1c1d907

Please sign in to comment.