Skip to content

Commit

Permalink
Fix: hostname is not updated in swarm state
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Baldwin committed Oct 27, 2023
1 parent 711e9fd commit d1433ef
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.

Large diffs are not rendered by default.

20 changes: 6 additions & 14 deletions 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-f6041128.js"></script>
<script type="module" crossorigin src="/assets/index-c6f9a6e2.js"></script>
</head>
<body>
<div id="root"></div>
Expand All @@ -17,19 +17,11 @@
// The server sets timestamps in UTC
// We need to convert these timestamps to locale time
window.templateArgs.history =
window.templateArgs.history.length ? window.templateArgs.history.map(({ time: serverTime, ...history }) => ({
...history,
time: new Date(new Date().setUTCHours(...(serverTime.split(":")))).toLocaleTimeString()
})) : []
window.templateArgs.history.length ? window.templateArgs.history.map(({ time: serverTime, ...history }) => ({
...history,
time: new Date(new Date().setUTCHours(...(serverTime.split(":")))).toLocaleTimeString()
})) : []
</script>


{% if static_js %}
<script>
{{ static_js|safe }}
</script>
{% else %}

{% endif %}

</body>
</html>
4 changes: 2 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,7 @@ function SwarmForm({
const [startSwarm] = useStartSwarmMutation();

const onStartSwarm = (inputData: ISwarmFormInput) => {
setSwarm({ state: SWARM_STATE.RUNNING });
setSwarm({ state: SWARM_STATE.RUNNING, host: inputData.host || host });

startSwarm(inputData);
};
Expand Down Expand Up @@ -100,7 +100,7 @@ function SwarmForm({
title='Disabled for tests using LoadTestShape class'
/>
<TextField
defaultValue={host}
defaultValue={Array.isArray(host) ? '' : host}
label={`Host ${
overrideHostWarning
? '(setting this will override the host for the User classes)'
Expand Down

0 comments on commit d1433ef

Please sign in to comment.