Skip to content

Commit 0fa0f4c

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/main' into feat/flex-commitments
# Conflicts: # .github/workflows/lint-and-test.yml
2 parents a981bfa + ec34740 commit 0fa0f4c

File tree

6 files changed

+17
-10
lines changed

6 files changed

+17
-10
lines changed

.github/workflows/lint-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
git fetch --prune --unshallow
3939
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
4040
- name: Upgrade pip
41-
# pinned due to https://github.com/pypa/pip/issues/13636
41+
# Pin due to https://github.com/pypa/pip/issues/13636
4242
run: |
4343
pip3 install --upgrade "pip==25.2"
4444
- name: "Caching for dependencies (.txt) - restore existing or ensure new cache will be made"

documentation/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Bugfixes
3636
* Fix account and assets/owned_by pages rendering, giving them asset icons [see `PR #1772 <https://github.com/FlexMeasures/flexmeasures/pull/1772>`_]
3737
* Allow consultants to view client users [see `PR #1755 <https://www.github.com/FlexMeasures/flexmeasures/pull/1755>`_]
3838
* Fixed bug where removed flexmodel fields didn't show up under the flexoption dropdown, except after a page refresh. [see `PR #1775 <https://www.github.com/FlexMeasures/flexmeasures/pull/1775>`_]
39+
* Fix bug in displaying user audit log (incl. expanding its API schema) [see `PR #1779 <https://github.com/FlexMeasures/flexmeasures/pull/1779>`_]
3940

4041

4142
v0.29.0 | October 14, 2025

flexmeasures/api/v3_0/users.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ class AuthRequestSchema(Schema):
5151
)
5252

5353

54-
class UserPaginationSchema(PaginationSchema):
54+
class UserAuditlogSchema(PaginationSchema):
5555
sort_by = fields.Str(
5656
required=False,
57-
validate=validate.OneOf(["username", "email", "lastLogin", "lastSeen"]),
57+
validate=validate.OneOf(
58+
["username", "email", "event_datetime", "lastLogin", "lastSeen"]
59+
),
5860
)
5961

6062

61-
class UserAPIQuerySchema(UserPaginationSchema):
63+
class UserAPIQuerySchema(PaginationSchema):
6264
sort_by = fields.Str(
6365
required=False,
6466
validate=validate.OneOf(["username", "email", "lastLogin", "lastSeen"]),
@@ -532,7 +534,7 @@ def reset_user_password(self, id: int, user: UserModel):
532534
pass_ctx_to_loader=True,
533535
ctx_loader=AuditLog.user_table_acl,
534536
)
535-
@use_kwargs(UserPaginationSchema, location="query")
537+
@use_kwargs(UserAuditlogSchema, location="query")
536538
@as_json
537539
def auditlog(
538540
self,
@@ -564,7 +566,7 @@ def auditlog(
564566
description: ID of the user to get the audit log for.
565567
- in: query
566568
name: kwargs
567-
schema: UserPaginationSchema
569+
schema: UserAuditlogSchema
568570
security:
569571
- ApiKeyAuth: []
570572
responses:

flexmeasures/ui/templates/accounts/account.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ <h5 class="modal-title pe-2">Create User</h5>
323323
<label for="email" class="form-label">Email</label>
324324
<input type="email" class="form-control" id="email" name="email" required>
325325
<small class="text-muted">
326-
Your email will be used as the initial password. The user can change it after logging in.
326+
The user will receive an email with a URL for setting an initial password.
327327
</small>
328328
</div>
329329

flexmeasures/ui/templates/assets/asset_context.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,4 +1069,4 @@ <h5 class="modal-title pe-2">Edit {{ asset.name }}'s flex-context</h5>
10691069
// ============== Page Events ============== //
10701070
</script>
10711071

1072-
{% endblock %}
1072+
{% endblock %}

flexmeasures/ui/templates/users/user_audit_log.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ <h3>History of actions for user <a href="/users/{{ user.id }}">{{ user.username
6161
callback({"data": clean_response, "recordsTotal": response["num-records"], "recordsFiltered": response["filtered-records"]});
6262
},
6363
error: function (request, status, error) {
64-
console.log("Error: ", error)
64+
const response = JSON.parse(request.responseText); // TODO: show all errors with message. not just 422
65+
const toastMessage = request.status === 422
66+
? "Error calling the audit log endpoint."
67+
+ JSON.stringify(response.message) : "Something went wrong!";
68+
showToast(toastMessage, "error");
6569
}
6670
});
6771
}
6872
});
6973
});
7074
</script>
7175

72-
{% endblock %}
76+
{% endblock %}

0 commit comments

Comments
 (0)