mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #13482 from overleaf/ab-group-settings-page
[web] Group settings button and page enabled based on env var GitOrigin-RevId: 77574a3705b3f1301935b72010022af61f7fe552
This commit is contained in:
parent
c4db2fa4ca
commit
39bc601826
9 changed files with 63 additions and 0 deletions
|
@ -24,6 +24,7 @@ const { expressify } = require('../../util/promises')
|
||||||
const OError = require('@overleaf/o-error')
|
const OError = require('@overleaf/o-error')
|
||||||
const SplitTestHandler = require('../SplitTests/SplitTestHandler')
|
const SplitTestHandler = require('../SplitTests/SplitTestHandler')
|
||||||
const SubscriptionHelper = require('./SubscriptionHelper')
|
const SubscriptionHelper = require('./SubscriptionHelper')
|
||||||
|
const ManagedUsersManager = require('../../../../modules/managed-users/app/src/ManagedUsersManager')
|
||||||
|
|
||||||
const groupPlanModalOptions = Settings.groupPlanModalOptions
|
const groupPlanModalOptions = Settings.groupPlanModalOptions
|
||||||
const validGroupPlanModalOptions = {
|
const validGroupPlanModalOptions = {
|
||||||
|
@ -237,6 +238,10 @@ async function userSubscriptionPage(req, res) {
|
||||||
|
|
||||||
const groupPlansDataForDash = formatGroupPlansDataForDash()
|
const groupPlansDataForDash = formatGroupPlansDataForDash()
|
||||||
|
|
||||||
|
const groupSettingsEnabledFor = (managedGroupSubscriptions || [])
|
||||||
|
.map(sub => sub._id.toString())
|
||||||
|
.filter(id => ManagedUsersManager.hasManagedUsersFeature(id))
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
title: 'your_subscription',
|
title: 'your_subscription',
|
||||||
plans: plansData?.plans,
|
plans: plansData?.plans,
|
||||||
|
@ -252,6 +257,7 @@ async function userSubscriptionPage(req, res) {
|
||||||
currentInstitutionsWithLicence,
|
currentInstitutionsWithLicence,
|
||||||
cancelButtonNewCopy,
|
cancelButtonNewCopy,
|
||||||
groupPlans: groupPlansDataForDash,
|
groupPlans: groupPlansDataForDash,
|
||||||
|
groupSettingsEnabledFor,
|
||||||
}
|
}
|
||||||
res.render('subscriptions/dashboard-react', data)
|
res.render('subscriptions/dashboard-react', data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ block append meta
|
||||||
meta(name="ol-hasSubscription" data-type="boolean" content=hasSubscription)
|
meta(name="ol-hasSubscription" data-type="boolean" content=hasSubscription)
|
||||||
meta(name="ol-fromPlansPage" data-type="boolean" content=fromPlansPage)
|
meta(name="ol-fromPlansPage" data-type="boolean" content=fromPlansPage)
|
||||||
meta(name="ol-plans", data-type="json" content=plans)
|
meta(name="ol-plans", data-type="json" content=plans)
|
||||||
|
meta(name="ol-groupSettingsEnabledFor", data-type="json" content=groupSettingsEnabledFor)
|
||||||
if (personalSubscription && personalSubscription.recurly)
|
if (personalSubscription && personalSubscription.recurly)
|
||||||
meta(name="ol-recurlyApiKey" content=settings.apis.recurly.publicKey)
|
meta(name="ol-recurlyApiKey" content=settings.apis.recurly.publicKey)
|
||||||
meta(name="ol-recommendedCurrency" content=personalSubscription.recurly.currency)
|
meta(name="ol-recommendedCurrency" content=personalSubscription.recurly.currency)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"about_to_delete_tag": "",
|
"about_to_delete_tag": "",
|
||||||
"about_to_delete_the_following_project": "",
|
"about_to_delete_the_following_project": "",
|
||||||
"about_to_delete_the_following_projects": "",
|
"about_to_delete_the_following_projects": "",
|
||||||
|
"about_to_enable_managed_users": "",
|
||||||
"about_to_leave_projects": "",
|
"about_to_leave_projects": "",
|
||||||
"about_to_trash_projects": "",
|
"about_to_trash_projects": "",
|
||||||
"accepted_invite": "",
|
"accepted_invite": "",
|
||||||
|
@ -261,6 +262,8 @@
|
||||||
"email_or_password_wrong_try_again": "",
|
"email_or_password_wrong_try_again": "",
|
||||||
"emails_and_affiliations_explanation": "",
|
"emails_and_affiliations_explanation": "",
|
||||||
"emails_and_affiliations_title": "",
|
"emails_and_affiliations_title": "",
|
||||||
|
"enable_managed_users": "",
|
||||||
|
"enabling": "",
|
||||||
"end_of_document": "",
|
"end_of_document": "",
|
||||||
"enter_image_url": "",
|
"enter_image_url": "",
|
||||||
"error": "",
|
"error": "",
|
||||||
|
@ -561,6 +564,8 @@
|
||||||
"manage_files_from_your_dropbox_folder": "",
|
"manage_files_from_your_dropbox_folder": "",
|
||||||
"manage_group_managers": "",
|
"manage_group_managers": "",
|
||||||
"manage_group_members_subtext": "",
|
"manage_group_members_subtext": "",
|
||||||
|
"manage_group_settings": "",
|
||||||
|
"manage_group_settings_subtext": "",
|
||||||
"manage_institution_managers": "",
|
"manage_institution_managers": "",
|
||||||
"manage_labs_program_membership": "",
|
"manage_labs_program_membership": "",
|
||||||
"manage_managers_subtext": "",
|
"manage_managers_subtext": "",
|
||||||
|
@ -569,6 +574,8 @@
|
||||||
"manage_publisher_managers": "",
|
"manage_publisher_managers": "",
|
||||||
"manage_sessions": "",
|
"manage_sessions": "",
|
||||||
"manage_subscription": "",
|
"manage_subscription": "",
|
||||||
|
"managed_users": "",
|
||||||
|
"managed_users_explanation": "",
|
||||||
"managers_management": "",
|
"managers_management": "",
|
||||||
"mark_as_resolved": "",
|
"mark_as_resolved": "",
|
||||||
"math_display": "",
|
"math_display": "",
|
||||||
|
@ -1076,6 +1083,7 @@
|
||||||
"vat": "",
|
"vat": "",
|
||||||
"vat_number": "",
|
"vat_number": "",
|
||||||
"view_all": "",
|
"view_all": "",
|
||||||
|
"view_group_members": "",
|
||||||
"view_hub": "",
|
"view_hub": "",
|
||||||
"view_hub_subtext": "",
|
"view_hub_subtext": "",
|
||||||
"view_in_template_gallery": "",
|
"view_in_template_gallery": "",
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Trans, useTranslation } from 'react-i18next'
|
import { Trans, useTranslation } from 'react-i18next'
|
||||||
|
import getMeta from '../../../../utils/meta'
|
||||||
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
|
import { useSubscriptionDashboardContext } from '../../context/subscription-dashboard-context'
|
||||||
import { RowLink } from './row-link'
|
import { RowLink } from './row-link'
|
||||||
|
|
||||||
|
@ -10,6 +11,8 @@ export default function ManagedGroupSubscriptions() {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const groupSettingsEnabledFor = getMeta('ol-groupSettingsEnabledFor', [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{managedGroupSubscriptions.map(subscription => (
|
{managedGroupSubscriptions.map(subscription => (
|
||||||
|
@ -49,6 +52,14 @@ export default function ManagedGroupSubscriptions() {
|
||||||
subtext={t('manage_managers_subtext')}
|
subtext={t('manage_managers_subtext')}
|
||||||
icon="manage_accounts"
|
icon="manage_accounts"
|
||||||
/>
|
/>
|
||||||
|
{groupSettingsEnabledFor.includes(subscription._id) && (
|
||||||
|
<RowLink
|
||||||
|
href={`/manage/groups/${subscription._id}/settings`}
|
||||||
|
heading={t('manage_group_settings')}
|
||||||
|
subtext={t('manage_group_settings_subtext')}
|
||||||
|
icon="settings"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<RowLink
|
<RowLink
|
||||||
href={`/metrics/groups/${subscription._id}`}
|
href={`/metrics/groups/${subscription._id}`}
|
||||||
heading={t('view_metrics')}
|
heading={t('view_metrics')}
|
||||||
|
|
|
@ -114,5 +114,6 @@
|
||||||
// TODO: find a way for modules to add styles dynamically
|
// TODO: find a way for modules to add styles dynamically
|
||||||
@import 'modules/symbol-palette.less';
|
@import 'modules/symbol-palette.less';
|
||||||
@import 'modules/galileo.less';
|
@import 'modules/galileo.less';
|
||||||
|
@import 'modules/managed-users.less';
|
||||||
|
|
||||||
@import 'modules/admin-panel.less';
|
@import 'modules/admin-panel.less';
|
||||||
|
|
|
@ -147,3 +147,4 @@
|
||||||
@import 'modules/symbol-palette.less';
|
@import 'modules/symbol-palette.less';
|
||||||
@import 'modules/galileo.less';
|
@import 'modules/galileo.less';
|
||||||
@import 'modules/admin-panel.less';
|
@import 'modules/admin-panel.less';
|
||||||
|
@import 'modules/managed-users.less';
|
||||||
|
|
19
services/web/frontend/stylesheets/modules/managed-users.less
Normal file
19
services/web/frontend/stylesheets/modules/managed-users.less
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
.group-settings-title {
|
||||||
|
min-width: 0;
|
||||||
|
color: @content-secondary;
|
||||||
|
font-family: Lato, sans-serif;
|
||||||
|
font-size: @font-size-large;
|
||||||
|
line-height: 28px;
|
||||||
|
font-weight: bold;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.managed-users-enabled {
|
||||||
|
font-family: Lato, sans-serif;
|
||||||
|
color: @ol-green;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,7 @@
|
||||||
"about_to_delete_tag": "You are about to delete the following tag (any projects in them will not be deleted):",
|
"about_to_delete_tag": "You are about to delete the following tag (any projects in them will not be deleted):",
|
||||||
"about_to_delete_the_following_project": "You are about to delete the following project",
|
"about_to_delete_the_following_project": "You are about to delete the following project",
|
||||||
"about_to_delete_the_following_projects": "You are about to delete the following projects",
|
"about_to_delete_the_following_projects": "You are about to delete the following projects",
|
||||||
|
"about_to_enable_managed_users": "You’re about to enable Managed Users for your organization. Once Managed Users is enabled, you can’t disable it.",
|
||||||
"about_to_leave_projects": "You are about to leave the following projects:",
|
"about_to_leave_projects": "You are about to leave the following projects:",
|
||||||
"about_to_trash_projects": "You are about to trash the following projects:",
|
"about_to_trash_projects": "You are about to trash the following projects:",
|
||||||
"abstract": "Abstract",
|
"abstract": "Abstract",
|
||||||
|
@ -440,6 +441,8 @@
|
||||||
"emails_and_affiliations_title": "Emails and Affiliations",
|
"emails_and_affiliations_title": "Emails and Affiliations",
|
||||||
"empty_zip_file": "Zip doesn’t contain any file",
|
"empty_zip_file": "Zip doesn’t contain any file",
|
||||||
"en": "English",
|
"en": "English",
|
||||||
|
"enable_managed_users": "Enable Managed Users",
|
||||||
|
"enabling": "Enabling",
|
||||||
"end_of_document": "End of document",
|
"end_of_document": "End of document",
|
||||||
"enter_image_url": "Enter image URL",
|
"enter_image_url": "Enter image URL",
|
||||||
"enter_institution_email_to_log_in": "Enter your institutional email to log in through your institution.",
|
"enter_institution_email_to_log_in": "Enter your institutional email to log in through your institution.",
|
||||||
|
@ -936,6 +939,8 @@
|
||||||
"manage_files_from_your_dropbox_folder": "Manage files from your Dropbox folder",
|
"manage_files_from_your_dropbox_folder": "Manage files from your Dropbox folder",
|
||||||
"manage_group_managers": "Manage group managers",
|
"manage_group_managers": "Manage group managers",
|
||||||
"manage_group_members_subtext": "Add, edit, or remove members from your group subscription",
|
"manage_group_members_subtext": "Add, edit, or remove members from your group subscription",
|
||||||
|
"manage_group_settings": "Manage group settings",
|
||||||
|
"manage_group_settings_subtext": "Turn on Managed Users",
|
||||||
"manage_institution_managers": "Manage institution managers",
|
"manage_institution_managers": "Manage institution managers",
|
||||||
"manage_labs_program_membership": "Manage Labs Program Membership",
|
"manage_labs_program_membership": "Manage Labs Program Membership",
|
||||||
"manage_managers_subtext": "Assign, edit, or revoke manager privileges",
|
"manage_managers_subtext": "Assign, edit, or revoke manager privileges",
|
||||||
|
@ -944,6 +949,8 @@
|
||||||
"manage_publisher_managers": "Manage publisher managers",
|
"manage_publisher_managers": "Manage publisher managers",
|
||||||
"manage_sessions": "Manage Your Sessions",
|
"manage_sessions": "Manage Your Sessions",
|
||||||
"manage_subscription": "Manage Subscription",
|
"manage_subscription": "Manage Subscription",
|
||||||
|
"managed_users": "Managed Users",
|
||||||
|
"managed_users_explanation": "Managed Users ensures you stay in control of your organization’s projects and who owns them. <0>Read more about Managed Users.</0>",
|
||||||
"managers_cannot_remove_admin": "Admins cannot be removed",
|
"managers_cannot_remove_admin": "Admins cannot be removed",
|
||||||
"managers_cannot_remove_self": "Managers cannot remove themselves",
|
"managers_cannot_remove_self": "Managers cannot remove themselves",
|
||||||
"managers_management": "Managers management",
|
"managers_management": "Managers management",
|
||||||
|
@ -1738,6 +1745,7 @@
|
||||||
"vat_number": "VAT Number",
|
"vat_number": "VAT Number",
|
||||||
"view_all": "View All",
|
"view_all": "View All",
|
||||||
"view_collab_edits": "View collaborator edits ",
|
"view_collab_edits": "View collaborator edits ",
|
||||||
|
"view_group_members": "View group members",
|
||||||
"view_hub": "View hub",
|
"view_hub": "View hub",
|
||||||
"view_hub_subtext": "Access collaboration and usage data from users of your Commons subscription",
|
"view_hub_subtext": "Access collaboration and usage data from users of your Commons subscription",
|
||||||
"view_in_template_gallery": "View it in the template gallery",
|
"view_in_template_gallery": "View it in the template gallery",
|
||||||
|
|
|
@ -158,6 +158,10 @@ describe('SubscriptionController', function () {
|
||||||
recordEventForSession: sinon.stub(),
|
recordEventForSession: sinon.stub(),
|
||||||
setUserPropertyForUser: sinon.stub(),
|
setUserPropertyForUser: sinon.stub(),
|
||||||
}),
|
}),
|
||||||
|
'../../../../modules/managed-users/app/src/ManagedUsersManager':
|
||||||
|
(this.ManagedUsersManager = {
|
||||||
|
hasManagedUsersFeature: sinon.stub(),
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -482,6 +486,10 @@ describe('SubscriptionController', function () {
|
||||||
it('should load the plans', function () {
|
it('should load the plans', function () {
|
||||||
expect(this.data.plans).to.deep.equal(this.plans)
|
expect(this.data.plans).to.deep.equal(this.plans)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should load an empty list of groups with settings available', function () {
|
||||||
|
expect(this.data.groupSettingsEnabledFor).to.deep.equal([])
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('createSubscription', function () {
|
describe('createSubscription', function () {
|
||||||
|
|
Loading…
Reference in a new issue