mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 20:31:34 +02:00
[web] Group audit log link in settings (#27390)
* [web] Group audit log link in settings Adds a link to access the `/manage/groups/:subscription_id/audit-logs` endpoint * [web] Add `group-audit-logs` split test for gradual rollout GitOrigin-RevId: 60d6c9917ca54ff5e228996e7454a901f0f3b9ca
This commit is contained in:
@@ -177,6 +177,10 @@ async function userSubscriptionPage(req, res) {
|
||||
premiumSource: aiAssistViaWritefullSource,
|
||||
} = await UserGetter.promises.getWritefullData(user._id)
|
||||
|
||||
// populate splitTestVariants in locals with a value for the split test, so
|
||||
// it's available in meta ol-splitTestVariants in the browser
|
||||
await SplitTestHandler.promises.getAssignment(req, res, 'group-audit-logs')
|
||||
|
||||
const data = {
|
||||
title: 'your_subscription',
|
||||
plans: plansData?.plans,
|
||||
|
||||
@@ -161,6 +161,7 @@
|
||||
"ask_repo_owner_to_reconnect": "",
|
||||
"ask_repo_owner_to_renew_overleaf_subscription": "",
|
||||
"at_most_x_libraries_can_be_selected": "",
|
||||
"audit_logs": "",
|
||||
"auto_close_brackets": "",
|
||||
"auto_compile": "",
|
||||
"auto_complete": "",
|
||||
@@ -2050,6 +2051,7 @@
|
||||
"verify_email_address_before_enabling_managed_users": "",
|
||||
"view": "",
|
||||
"view_all": "",
|
||||
"view_audit_logs_group_subtext": "",
|
||||
"view_billing_details": "",
|
||||
"view_code": "",
|
||||
"view_configuration": "",
|
||||
|
||||
@@ -97,6 +97,10 @@ export default function ManagedGroupSubscriptions() {
|
||||
getMeta('ol-groupSettingsAdvertisedFor') || []
|
||||
const groupSettingsEnabledFor = getMeta('ol-groupSettingsEnabledFor') || []
|
||||
|
||||
const splitTestVariants = getMeta('ol-splitTestVariants')
|
||||
const displayAuditLogsLink =
|
||||
splitTestVariants?.['group-audit-logs'] === 'active'
|
||||
|
||||
return (
|
||||
<>
|
||||
{managedGroupSubscriptions.map(subscription => {
|
||||
@@ -125,6 +129,14 @@ export default function ManagedGroupSubscriptions() {
|
||||
{groupSettingsAdvertisedFor?.includes(subscription._id) && (
|
||||
<GroupSettingsButtonWithAdBadge subscription={subscription} />
|
||||
)}
|
||||
{displayAuditLogsLink && (
|
||||
<RowLink
|
||||
href={`/manage/groups/${subscription._id}/audit-logs`}
|
||||
heading={t('audit_logs')}
|
||||
subtext={t('view_audit_logs_group_subtext')}
|
||||
icon="list"
|
||||
/>
|
||||
)}
|
||||
<RowLink
|
||||
href={`/metrics/groups/${subscription._id}`}
|
||||
heading={t('usage_metrics')}
|
||||
|
||||
@@ -202,6 +202,7 @@
|
||||
"ask_repo_owner_to_reconnect": "Ask the GitHub repository owner (<0>__repoOwnerEmail__</0>) to reconnect the project.",
|
||||
"ask_repo_owner_to_renew_overleaf_subscription": "Ask the GitHub repository owner (<0>__repoOwnerEmail__</0>) to renew their __appName__ subscription and reconnect the project.",
|
||||
"at_most_x_libraries_can_be_selected": "At most __maxCount__ libraries can be selected",
|
||||
"audit_logs": "Audit logs",
|
||||
"august": "August",
|
||||
"author": "Author",
|
||||
"auto_close_brackets": "Auto-close brackets",
|
||||
@@ -2594,6 +2595,7 @@
|
||||
"verify_email_address_before_enabling_managed_users": "You need to verify your email address before enabling managed users.",
|
||||
"view": "View",
|
||||
"view_all": "View all",
|
||||
"view_audit_logs_group_subtext": "View and download audit logs for your group subscription",
|
||||
"view_billing_details": "View billing details",
|
||||
"view_code": "View code",
|
||||
"view_configuration": "View configuration",
|
||||
|
||||
@@ -97,6 +97,10 @@ describe('<ManagedGroupSubscriptions />', function () {
|
||||
value: managedGroupSubscriptions,
|
||||
},
|
||||
{ name: 'ol-usersEmail', value: 'admin@example.com' },
|
||||
{
|
||||
name: 'ol-splitTestVariants',
|
||||
value: { 'group-audit-logs': 'active' },
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
@@ -124,28 +128,31 @@ describe('<ManagedGroupSubscriptions />', function () {
|
||||
expect(links[2].getAttribute('href')).to.equal(
|
||||
'/manage/groups/bcd567/managers'
|
||||
)
|
||||
expect(links[3].getAttribute('href')).to.equal('/metrics/groups/bcd567')
|
||||
expect(links[5].getAttribute('href')).to.equal(
|
||||
expect(links[3].getAttribute('href')).to.equal(
|
||||
'/manage/groups/bcd567/audit-logs'
|
||||
)
|
||||
expect(links[4].getAttribute('href')).to.equal('/metrics/groups/bcd567')
|
||||
expect(links[6].getAttribute('href')).to.equal(
|
||||
'/manage/groups/def456/members'
|
||||
)
|
||||
expect(links[6].getAttribute('href')).to.equal(
|
||||
expect(links[7].getAttribute('href')).to.equal(
|
||||
'/manage/groups/def456/managers'
|
||||
)
|
||||
expect(links[7].getAttribute('href')).to.equal('/metrics/groups/def456')
|
||||
expect(links[9].getAttribute('href')).to.equal(
|
||||
expect(links[9].getAttribute('href')).to.equal('/metrics/groups/def456')
|
||||
expect(links[11].getAttribute('href')).to.equal(
|
||||
'/manage/groups/group2abc/members'
|
||||
)
|
||||
expect(links[10].getAttribute('href')).to.equal(
|
||||
expect(links[12].getAttribute('href')).to.equal(
|
||||
'/manage/groups/group2abc/managers'
|
||||
)
|
||||
expect(links[11].getAttribute('href')).to.equal('/metrics/groups/group2abc')
|
||||
expect(links[13].getAttribute('href')).to.equal(
|
||||
expect(links[14].getAttribute('href')).to.equal('/metrics/groups/group2abc')
|
||||
expect(links[16].getAttribute('href')).to.equal(
|
||||
'/manage/groups/group123abc/members'
|
||||
)
|
||||
expect(links[14].getAttribute('href')).to.equal(
|
||||
expect(links[17].getAttribute('href')).to.equal(
|
||||
'/manage/groups/group123abc/managers'
|
||||
)
|
||||
expect(links[15].getAttribute('href')).to.equal(
|
||||
expect(links[19].getAttribute('href')).to.equal(
|
||||
'/metrics/groups/group123abc'
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user