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

🧪 Create Cypress test for Roles of variables #5614

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
654c81b
set feature flag to true
juliabolt Jun 14, 2024
7b38ef0
add new feature flag as environment variable
juliabolt Jun 14, 2024
4ccdba7
set default value of feature flag in environment to false
juliabolt Jun 14, 2024
3ef2087
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 14, 2024
5d12eac
🤖 Automatically update generated files
pre-commit-ci[bot] Jun 14, 2024
2cbbe27
move function to other file
juliabolt Jun 17, 2024
217f65d
set default value of SHOW_ROLES to false
juliabolt Jun 17, 2024
617d711
check for showRoles in the frontend
juliabolt Jun 17, 2024
371ae1f
🤖 Automatically update generated files
juliabolt Jun 17, 2024
9ad3217
fix supply of env var in the front end (thanks @jpelay )
juliabolt Jun 18, 2024
cfe0fd3
🤖 Automatically update generated files
juliabolt Jun 18, 2024
2bbf795
bug fixes for env var
juliabolt Jun 18, 2024
985af40
🤖 Automatically update generated files
juliabolt Jun 18, 2024
904ea71
make the env var type any (should boolean or string?)
juliabolt Jun 18, 2024
7c5c672
Merge branch 'roles-of-variables' of https://github.com/hedyorg/hedy …
juliabolt Jun 18, 2024
79c4362
🤖 Automatically update generated files
juliabolt Jun 18, 2024
46b7968
send a boolean instead of a string
juliabolt Jun 20, 2024
8bd27c7
Merge branch 'roles-of-variables' of https://github.com/hedyorg/hedy …
juliabolt Jun 20, 2024
9c7324f
Merge branch 'main' into roles-of-variables
jpelay Jun 28, 2024
3e31c63
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 28, 2024
87ce57d
🤖 Automatically update generated files
pre-commit-ci[bot] Jun 28, 2024
ed32219
Merge branch 'main' into roles-of-variables
jpelay Jul 16, 2024
25bb87c
🤖 Automatically update generated files
jpelay Jul 16, 2024
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
1 change: 1 addition & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2918,6 +2918,7 @@ def on_offline_mode():
env_defaults = dict(
BASE_URL=f"http://localhost:{config['port']}/",
ADMIN_USER="admin",
SHOW_ROLES=False,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to change this to "false" or "False" I'm seeing that they require the values of the env variables to be strings.

)
for key, value in env_defaults.items():
if key not in os.environ:
Expand Down
2 changes: 1 addition & 1 deletion static/js/appbundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -103004,7 +103004,7 @@ def note_with_error(value, err):
var theLanguage;
var TRADUCTION2;
var variable_view = true;
var showRoles = false;
var showRoles = true;
var step_debugger = false;
var fullLineCommands = [
"print",
Expand Down
2 changes: 1 addition & 1 deletion static/js/appbundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/js/debugging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let TRADUCTION: Map<string,string>;

//Feature flag for variable and values view
let variable_view = true;
let showRoles = false;
let showRoles = true;
let step_debugger = false;
const fullLineCommands = [
'print',
Expand Down
9 changes: 9 additions & 0 deletions website/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ def forget_current_user():
session.pop("profile_image", None) # Delete profile image id if existing


def show_roles_of_variables():
"""Whether the roles of variables should be shown in the variable view.
(If not, only variable names and values will be shown in the list).
Checks the configuration in the environment variable $SHOW_ROLES
"""
can_show_roles = os.getenv("SHOW_ROLES")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If SHOW_ROLES is not set you can also add a default value:

Suggested change
can_show_roles = os.getenv("SHOW_ROLES")
can_show_roles = os.getenv("SHOW_ROLES", False)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I just noticed this is in auth.py can you move it to utils.py?

return can_show_roles


def is_admin(user):
"""Whether the given user (object) is an admin.

Expand Down
Loading