mirror of
https://github.com/apache/superset.git
synced 2026-04-27 03:55:47 +00:00
fix(log): Update recent_activity by event name (#32681)
This commit is contained in:
@@ -171,8 +171,18 @@ class TestLogApi(SupersetTestCase):
|
||||
admin_user = self.get_user("admin")
|
||||
self.login(ADMIN_USERNAME)
|
||||
dash = create_dashboard("dash_slug", "dash_title", "{}", [])
|
||||
log1 = self.insert_log("dashboard", admin_user, dashboard_id=dash.id)
|
||||
log2 = self.insert_log("dashboard", admin_user, dashboard_id=dash.id)
|
||||
log1 = self.insert_log(
|
||||
"log",
|
||||
admin_user,
|
||||
dashboard_id=dash.id,
|
||||
json='{"event_name": "mount_dashboard"}',
|
||||
)
|
||||
log2 = self.insert_log(
|
||||
"log",
|
||||
admin_user,
|
||||
dashboard_id=dash.id,
|
||||
json='{"event_name": "mount_dashboard"}',
|
||||
)
|
||||
|
||||
uri = f"api/v1/log/recent_activity/" # noqa: F541
|
||||
rv = self.client.get(uri)
|
||||
@@ -187,7 +197,7 @@ class TestLogApi(SupersetTestCase):
|
||||
assert response == {
|
||||
"result": [
|
||||
{
|
||||
"action": "dashboard",
|
||||
"action": "log",
|
||||
"item_type": "dashboard",
|
||||
"item_url": "/superset/dashboard/dash_slug/",
|
||||
"item_title": "dash_title",
|
||||
@@ -204,10 +214,20 @@ class TestLogApi(SupersetTestCase):
|
||||
admin_user = self.get_user("admin")
|
||||
self.login(ADMIN_USERNAME)
|
||||
dash = create_dashboard("dash_slug", "dash_title", "{}", [])
|
||||
log = self.insert_log("dashboard", admin_user, dashboard_id=dash.id)
|
||||
log2 = self.insert_log("explore", admin_user, dashboard_id=dash.id)
|
||||
log = self.insert_log(
|
||||
"log",
|
||||
admin_user,
|
||||
dashboard_id=dash.id,
|
||||
json='{"event_name": "mount_dashboard"}',
|
||||
)
|
||||
log2 = self.insert_log(
|
||||
"log",
|
||||
admin_user,
|
||||
dashboard_id=dash.id,
|
||||
json='{"event_name": "mount_explorer"}',
|
||||
)
|
||||
|
||||
arguments = {"actions": ["dashboard"]}
|
||||
arguments = {"actions": ["mount_dashboard"]}
|
||||
uri = f"api/v1/log/recent_activity/?q={prison.dumps(arguments)}"
|
||||
rv = self.client.get(uri)
|
||||
|
||||
@@ -229,8 +249,18 @@ class TestLogApi(SupersetTestCase):
|
||||
admin_user = self.get_user("admin")
|
||||
self.login(ADMIN_USERNAME)
|
||||
dash = create_dashboard("dash_slug", "dash_title", "{}", [])
|
||||
log = self.insert_log("dashboard", admin_user, dashboard_id=dash.id)
|
||||
log2 = self.insert_log("dashboard", admin_user, dashboard_id=dash.id)
|
||||
log = self.insert_log(
|
||||
"log",
|
||||
admin_user,
|
||||
dashboard_id=dash.id,
|
||||
json='{"event_name": "mount_dashboard"}',
|
||||
)
|
||||
log2 = self.insert_log(
|
||||
"log",
|
||||
admin_user,
|
||||
dashboard_id=dash.id,
|
||||
json='{"event_name": "mount_dashboard"}',
|
||||
)
|
||||
|
||||
arguments = {"distinct": False}
|
||||
uri = f"api/v1/log/recent_activity/?q={prison.dumps(arguments)}"
|
||||
@@ -253,9 +283,24 @@ class TestLogApi(SupersetTestCase):
|
||||
dash = create_dashboard("dash_slug", "dash_title", "{}", [])
|
||||
dash2 = create_dashboard("dash2_slug", "dash2_title", "{}", [])
|
||||
dash3 = create_dashboard("dash3_slug", "dash3_title", "{}", [])
|
||||
log = self.insert_log("dashboard", admin_user, dashboard_id=dash.id)
|
||||
log2 = self.insert_log("dashboard", admin_user, dashboard_id=dash2.id)
|
||||
log3 = self.insert_log("dashboard", admin_user, dashboard_id=dash3.id)
|
||||
log = self.insert_log(
|
||||
"log",
|
||||
admin_user,
|
||||
dashboard_id=dash.id,
|
||||
json='{"event_name": "mount_dashboard"}',
|
||||
)
|
||||
log2 = self.insert_log(
|
||||
"log",
|
||||
admin_user,
|
||||
dashboard_id=dash2.id,
|
||||
json='{"event_name": "mount_dashboard"}',
|
||||
)
|
||||
log3 = self.insert_log(
|
||||
"log",
|
||||
admin_user,
|
||||
dashboard_id=dash3.id,
|
||||
json='{"event_name": "mount_dashboard"}',
|
||||
)
|
||||
|
||||
now = datetime.now()
|
||||
log3.dttm = now
|
||||
@@ -271,7 +316,7 @@ class TestLogApi(SupersetTestCase):
|
||||
assert response == {
|
||||
"result": [
|
||||
{
|
||||
"action": "dashboard",
|
||||
"action": "log",
|
||||
"item_type": "dashboard",
|
||||
"item_url": "/superset/dashboard/dash3_slug/",
|
||||
"item_title": "dash3_title",
|
||||
@@ -279,7 +324,7 @@ class TestLogApi(SupersetTestCase):
|
||||
"time_delta_humanized": ANY,
|
||||
},
|
||||
{
|
||||
"action": "dashboard",
|
||||
"action": "log",
|
||||
"item_type": "dashboard",
|
||||
"item_url": "/superset/dashboard/dash2_slug/",
|
||||
"item_title": "dash2_title",
|
||||
@@ -306,7 +351,7 @@ class TestLogApi(SupersetTestCase):
|
||||
assert response == {
|
||||
"result": [
|
||||
{
|
||||
"action": "dashboard",
|
||||
"action": "log",
|
||||
"item_type": "dashboard",
|
||||
"item_url": "/superset/dashboard/dash_slug/",
|
||||
"item_title": "dash_title",
|
||||
|
||||
Reference in New Issue
Block a user