Skip to content

Commit

Permalink
Remove old nav ui
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodearnest committed Feb 27, 2024
1 parent e57e890 commit 692d76e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 64 deletions.
3 changes: 0 additions & 3 deletions airlock/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,6 @@ def run_connection_init_queries(*, connection, **kwargs):
messages.ERROR: "alert-danger",
}

# Temporary UI featureflag
TREE = True


class MissingVariableErrorFilter(logging.Filter):
"""
Expand Down
28 changes: 3 additions & 25 deletions airlock/templates/file_browser/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,33 +110,11 @@
<div class="flex flex-row">

<div style="flex-basis: 25%">

{% #card %}
{% if tree %}
<ul class="tree root">
{% include "file_browser/tree.html" with path=root %}
</ul>
{% else %}
{% #list_group %}
{% if not path_item.parent %}
{% list_group_empty icon=True title=context|title|add:" Root" %}
{% else %}
{% #list_group_item href=path_item.parent.url %}
↰ ..
{% /list_group_item %}
{% for entry in path_item.siblings %}
{% #list_group_item href=entry.url %}
{{ entry.name}}
{% if entry.is_directory %}
{% icon_folder_outline class="h-6 w-6 text-slate-600 inline" %}
{% endif %}
{% /list_group_item %}
{% endfor %}
{% endif %}
{% /list_group %}
{% endif %}
<ul class="tree root">
{% include "file_browser/tree.html" with path=root %}
</ul>
{% /card %}

</div>

<div style="flex-basis: 75%; max-width: 75%">
Expand Down
13 changes: 0 additions & 13 deletions airlock/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,6 @@ def workspace_index(request):
return TemplateResponse(request, "workspaces.html", {"workspaces": workspaces})


def use_tree_ui(request):
"""Quick hack to be able to dynamically switch ui options."""
tree = request.session.get("tree", settings.TREE)
# hack to switch UI dynamically
if "tree" in request.GET: # pragma: nocover
tree = request.GET["tree"].lower() == "true"

request.session["tree"] = tree
return tree


def workspace_view(request, workspace_name: str, path: str = ""):
workspace = validate_workspace(request.user, workspace_name)

Expand Down Expand Up @@ -171,7 +160,6 @@ def workspace_view(request, workspace_name: str, path: str = ""):
),
"current_request": current_request,
"form": form,
"tree": use_tree_ui(request),
},
)

Expand Down Expand Up @@ -268,7 +256,6 @@ def request_view(request, request_id: str, path: str = ""):
"request_submit_url": request_submit_url,
"request_reject_url": request_reject_url,
"release_files_url": release_files_url,
"tree": use_tree_ui(request),
}

return TemplateResponse(request, "file_browser/index.html", context)
Expand Down
9 changes: 0 additions & 9 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,3 @@ def release_files(request, jobserver_id="jobserver-id", body=None):
return responses

return release_files


# temporary fixture to test both UI options until we decide on one.
@pytest.fixture(params=["tree", "dir"])
def ui_options(request, settings):
if request.param == "tree":
settings.TREE = True
else:
settings.TREE = False
6 changes: 2 additions & 4 deletions tests/functional/test_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ def login_as(live_server, page, username):
expect(page.locator("body")).to_contain_text(f"Logged in as: {username}")


def test_e2e_release_files(
page, live_server, dev_users, ui_options, release_files_stubber
):
def test_e2e_release_files(page, live_server, dev_users, release_files_stubber):
"""
Test full Airlock process to create, submit and release files
"""
Expand Down Expand Up @@ -179,7 +177,7 @@ def test_e2e_release_files(
expect(page.locator("body")).not_to_contain_text("test-workspace by researcher")


def test_e2e_reject_request(page, live_server, dev_users, ui_options):
def test_e2e_reject_request(page, live_server, dev_users):
"""
Test output-checker rejects a release request
"""
Expand Down
20 changes: 10 additions & 10 deletions tests/integration/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def client_with_permission(client_with_user):
yield client_with_user(output_checker)


def test_workspace_view(client_with_permission, ui_options):
def test_workspace_view(client_with_permission):
factories.write_workspace_file("workspace", "file.txt")

response = client_with_permission.get("/workspaces/view/workspace/")
Expand All @@ -45,7 +45,7 @@ def test_workspace_view(client_with_permission, ui_options):


def test_workspace_view_with_existing_request_for_user(
client_with_permission, ui_options
client_with_permission,
):
user = User.from_session(client_with_permission.session)
factories.write_workspace_file("workspace", "file.txt")
Expand All @@ -62,21 +62,21 @@ def test_workspace_does_not_exist(client_with_permission):
assert response.status_code == 404


def test_workspace_view_with_directory(client_with_permission, ui_options):
def test_workspace_view_with_directory(client_with_permission):
factories.write_workspace_file("workspace", "some_dir/file.txt")
response = client_with_permission.get("/workspaces/view/workspace/some_dir/")
assert response.status_code == 200
assert "file.txt" in response.rendered_content


def test_workspace_view_with_file(client_with_permission, ui_options):
def test_workspace_view_with_file(client_with_permission):
factories.write_workspace_file("workspace", "file.txt", "foobar")
response = client_with_permission.get("/workspaces/view/workspace/file.txt")
assert response.status_code == 200
assert "foobar" in response.rendered_content


def test_workspace_view_with_html_file(client_with_permission, ui_options):
def test_workspace_view_with_html_file(client_with_permission):
factories.write_workspace_file(
"workspace", "file.html", "<html><body>foobar</body></html>"
)
Expand Down Expand Up @@ -303,7 +303,7 @@ def test_request_index_no_user(client):
assert response.status_code == 302


def test_request_view_index(client_with_permission, ui_options):
def test_request_view_index(client_with_permission):
release_request = factories.create_release_request(
"workspace", client_with_permission.user
)
Expand All @@ -322,7 +322,7 @@ def test_request_id_does_not_exist(client_with_permission):
assert response.status_code == 404


def test_request_view_with_directory(client_with_permission, ui_options):
def test_request_view_with_directory(client_with_permission):
release_request = factories.create_release_request("workspace")
factories.write_request_file(release_request, "group", "some_dir/file.txt")
response = client_with_permission.get(
Expand All @@ -332,7 +332,7 @@ def test_request_view_with_directory(client_with_permission, ui_options):
assert "file.txt" in response.rendered_content


def test_request_view_with_file(client_with_permission, ui_options):
def test_request_view_with_file(client_with_permission):
release_request = factories.create_release_request("workspace")
factories.write_request_file(release_request, "group", "file.txt", "foobar")
response = client_with_permission.get(
Expand All @@ -342,7 +342,7 @@ def test_request_view_with_file(client_with_permission, ui_options):
assert "group" in response.rendered_content


def test_request_view_with_submitted_request(client_with_permission, ui_options):
def test_request_view_with_submitted_request(client_with_permission):
release_request = factories.create_release_request(
"workspace", status=Status.SUBMITTED
)
Expand All @@ -353,7 +353,7 @@ def test_request_view_with_submitted_request(client_with_permission, ui_options)
assert "Release Files" in response.rendered_content


def test_request_view_with_authored_request_file(client_with_permission, ui_options):
def test_request_view_with_authored_request_file(client_with_permission):
release_request = factories.create_release_request(
"workspace",
user=User.from_session(client_with_permission.session),
Expand Down

0 comments on commit 692d76e

Please sign in to comment.