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

Modern UI: Fix Default Values for Edit / Start New Test #2537

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
250 changes: 0 additions & 250 deletions locust/webui/dist/assets/index-01afe4fa.js

This file was deleted.

237 changes: 237 additions & 0 deletions locust/webui/dist/assets/index-d4b87b54.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion locust/webui/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="theme-color" content="#000000" />

<title>Locust</title>
<script type="module" crossorigin src="/assets/index-01afe4fa.js"></script>
<script type="module" crossorigin src="/assets/index-d4b87b54.js"></script>
</head>
<body>
<div id="root"></div>
Expand Down
10 changes: 5 additions & 5 deletions locust/webui/src/components/SwarmForm/SwarmEditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { useStartSwarmMutation } from 'redux/api/swarm';
import { ISwarmState } from 'redux/slice/swarm.slice';
import { IRootState } from 'redux/store';

type ISwarmFormInput = Pick<ISwarmState, 'spawnRate' | 'userCount'>;
type ISwarmFormInput = Pick<ISwarmState, 'spawnRate' | 'numUsers'>;

interface ISwarmForm extends ISwarmFormInput {
onSubmit: () => void;
}

function SwarmEditForm({ onSubmit, spawnRate, userCount }: ISwarmForm) {
function SwarmEditForm({ onSubmit, numUsers, spawnRate }: ISwarmForm) {
const [startSwarm] = useStartSwarmMutation();

const onEditSwarm = (inputData: ISwarmFormInput) => {
Expand All @@ -28,7 +28,7 @@ function SwarmEditForm({ onSubmit, spawnRate, userCount }: ISwarmForm) {
<Form<ISwarmFormInput> onSubmit={onEditSwarm}>
<Box sx={{ my: 2, display: 'flex', flexDirection: 'column', rowGap: 4 }}>
<TextField
defaultValue={userCount || 1}
defaultValue={numUsers || 1}
label='Number of users (peak concurrency)'
name='userCount'
/>
Expand All @@ -48,9 +48,9 @@ function SwarmEditForm({ onSubmit, spawnRate, userCount }: ISwarmForm) {
);
}

const storeConnector = ({ swarm: { spawnRate, userCount } }: IRootState) => ({
const storeConnector = ({ swarm: { spawnRate, numUsers } }: IRootState) => ({
spawnRate,
userCount,
numUsers,
});

export default connect(storeConnector)(SwarmEditForm);
9 changes: 7 additions & 2 deletions locust/webui/src/components/SwarmForm/SwarmForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ function SwarmForm({
const [startSwarm] = useStartSwarmMutation();

const onStartSwarm = (inputData: ISwarmFormInput) => {
setSwarm({ state: SWARM_STATE.RUNNING, host: inputData.host || host });
setSwarm({
state: SWARM_STATE.RUNNING,
host: inputData.host || host,
runTime: inputData.runTime,
spawnRate: Number(inputData.spawnRate) || null,
numUsers: Number(inputData.userCount) || null,
});

startSwarm(inputData);
};
Expand All @@ -85,7 +91,6 @@ function SwarmForm({
<Select label='Shape Class' name='shapeClass' options={availableShapeClasses} />
</>
)}

<TextField
defaultValue={(isShape && '-') || numUsers || 1}
disabled={!!isShape}
Expand Down
2 changes: 1 addition & 1 deletion locust/webui/src/redux/slice/swarm.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface ISwarmState {
numUsers: number | null;
overrideHostWarning: boolean;
percentilesToChart: number[];
runTime?: number;
runTime?: string | number;
showUserclassPicker: boolean;
spawnRate: number | null;
state: string;
Expand Down