Skip to content

Commit

Permalink
Set modern-ui as default
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbaldwin44 committed Jan 29, 2024
1 parent 1844320 commit 008b189
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 42 deletions.
26 changes: 1 addition & 25 deletions docs/developing-locust.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,30 +88,6 @@ Then the documentation should be build and available at ``docs/_build/index.html
Making changes to Locust's Web UI
=================================

The CSS styling for Locust's user interface is written in `SASS <https://sass-lang.com/>`_.
In order to make changes to the CSS rules, you need to have SASS `installed <https://sass-lang.com/install>`_
and available on your ``PATH``.

Once you have SASS installed you can have the command line sass program compile the Locust ``.sass`` files
by running the following in the locust project's root path:

.. code-block:: console
$ make sass_build
Or you can make sass watch for changes to the ``.sass`` files and automatically generate new CSS files by running:

.. code-block:: console
$ make sass_watch
The CSS files that are generated by SASS should be checked into version control.


Making changes to Locust's Modern Web UI
========================================

The modern Web UI is built using React and Typescript

Setup
Expand Down Expand Up @@ -160,7 +136,7 @@ Developing

To develop the frontend, run ``yarn dev``. This will start the Vite dev server and allow for viewing and editing the frontend, without needing to a run a locust web server

To develop while running a locust instance, run ``yarn dev:watch``. This will output the static files to the ``dist`` directory. Then simply a locust instance using the ``--modern-ui`` flag. Vite will automatically detect any changed files and re-build as needed. Simply refresh the page to view the changes
To develop while running a locust instance, run ``yarn dev:watch``. This will output the static files to the ``dist`` directory. Vite will automatically detect any changed files and re-build as needed. Simply refresh the page to view the changes

To compile the webui, run ``yarn build``

Expand Down
Binary file removed docs/images/modern-webui-splash-screenshot.png
Binary file not shown.
Binary file modified docs/images/number_of_users.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/response_times.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/total_requests_per_second.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/userclass_picker_example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/webui-running-statistics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/webui-splash-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 3 additions & 7 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ Change ``/hello`` and ``/world`` to some actual paths on the web site/service yo
[2021-07-24 09:58:46,285] .../INFO/locust.main: Starting Locust |version|
Locust's web interface
==============================
======================

Open http://localhost:8089

.. image:: images/webui-splash-screenshot.png

| Provide the host name of your server and try it out!
The following screenshots show what it might look like when running this test using 40 concurrent users, with a ramp up rate of 0.5 users/s, against a server with somewhat poor performance.
The following screenshots show what it might look like when running this test using 50 concurrent users, with a ramp up rate of 1 users/s

.. image:: images/webui-running-statistics.png

Expand All @@ -58,13 +58,9 @@ The following screenshots show what it might look like when running this test us

If you need some help digging into server side problems, or you're having trouble generating enough load to saturate your system, have a look at the `Locust FAQ <https://github.com/locustio/locust/wiki/FAQ#increase-my-request-raterps>`_.

There is now a modern version of the Web UI available! Try it out by setting the ``--modern-ui`` flag.

.. image:: images/modern-webui-splash-screenshot.png

.. note::

This feature is experimental and you may experience breaking changes.
Things looking a little different? We've updated the U! If for whatever reason you need to use the old version, you can always revert back to it using the ``--legacy-ui`` flag.

Direct command line usage / headless
====================================
Expand Down
6 changes: 3 additions & 3 deletions locust/argument_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,11 +397,11 @@ def setup_parser_arguments(parser):
env_var="LOCUST_USERCLASS_PICKER",
)
web_ui_group.add_argument(
"--modern-ui",
"--legacy-ui",
default=False,
action="store_true",
help="Use the new React-based frontend for the web UI",
env_var="LOCUST_MODERN_UI",
help="Use the legacy frontend for the web UI",
env_var="LOCUST_LEGACY_UI",
)

master_group = parser.add_argument_group(
Expand Down
6 changes: 3 additions & 3 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def ensure_user_class_name(config):
stats_csv_writer=stats_csv_writer,
delayed_start=True,
userclass_picker_is_active=options.class_picker,
modern_ui=options.modern_ui,
modern_ui=not options.legacy_ui,
)
else:
web_ui = None
Expand Down Expand Up @@ -682,10 +682,10 @@ def save_html_report(use_modern_ui=False):

main_greenlet.join()
if options.html_file:
save_html_report(options.modern_ui)
save_html_report(not options.legacy_ui)
except KeyboardInterrupt:
if options.html_file:
save_html_report(options.modern_ui)
save_html_report(not options.legacy_ui)
except Exception:
raise
shutdown()
2 changes: 1 addition & 1 deletion locust/test/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def my_task(self):
)
) as file_path:
proc = subprocess.Popen(
["locust", "-f", file_path, "--web-port", str(port), "--autostart", "--modern-ui"],
["locust", "-f", file_path, "--web-port", str(port), "--autostart"],
stdout=PIPE,
stderr=PIPE,
text=True,
Expand Down
3 changes: 1 addition & 2 deletions locust/test/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ def setUp(self):
super().setUp()

parser = get_parser(default_config_files=[])
self.environment.parsed_options = parser.parse_args(["--modern-ui", "--web-login"])
self.environment.parsed_options = parser.parse_args(["--web-login"])

self.web_ui = self.environment.create_web_ui("127.0.0.1", 0, modern_ui=True, web_login=True)

Expand Down Expand Up @@ -1291,7 +1291,6 @@ def setUp(self):
super().setUp()

parser = get_parser(default_config_files=[])
self.environment.parsed_options = parser.parse_args(["--modern-ui"])
self.stats = self.environment.stats

self.web_ui = self.environment.create_web_ui("127.0.0.1", 0, modern_ui=True)
Expand Down
2 changes: 1 addition & 1 deletion locust/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def login():
auth_args=self.auth_args,
)
else:
return "Web Auth is only available on the modern web ui. Enable it with the --modern-ui flag"
return "Web Auth is only available on the modern web ui."

@app.route("/user", methods=["POST"])
def update_user():
Expand Down

0 comments on commit 008b189

Please sign in to comment.