Merge pull request #18000 from overleaf/ab-dev-enable-toolbar-default

[web] Enable the dev-toolbar by default in the dev environment

GitOrigin-RevId: 170e59e9b82268e621fe99ffcc82b7d68467e1b3
This commit is contained in:
Alexandre Bourdin 2024-05-24 10:52:00 +02:00 committed by Copybot
parent 418d77522e
commit a0c8cf663a
7 changed files with 43 additions and 19 deletions

View file

@ -237,7 +237,7 @@ async function _getAssignment(
const splitTest = await _getSplitTest(splitTestName)
const currentVersion = SplitTestUtils.getCurrentVersion(splitTest)
if (Settings.splitTest.devToolbar.enabled) {
if (Settings.devToolbar.enabled) {
const override = session?.splitTestOverrides?.[splitTestName]
if (override) {
return _makeAssignment(splitTest, override, currentVersion)
@ -402,7 +402,7 @@ function getPercentile(analyticsId, splitTestName, splitTestPhase) {
}
function setOverrideInSession(session, splitTestName, variantName) {
if (!Settings.splitTest.devToolbar.enabled) {
if (!Settings.devToolbar.enabled) {
return
}
if (!session.splitTestOverrides) {
@ -477,7 +477,7 @@ async function _loadSplitTestInfoInLocals(locals, splitTestName, session) {
const override = session?.splitTestOverrides?.[splitTestName]
const currentVersion = SplitTestUtils.getCurrentVersion(splitTest)
if (!currentVersion.active && !Settings.splitTest.devToolbar.enabled) {
if (!currentVersion.active && !Settings.devToolbar.enabled) {
return
}
@ -486,7 +486,7 @@ async function _loadSplitTestInfoInLocals(locals, splitTestName, session) {
phase,
badgeInfo: splitTest.badgeInfo?.[phase],
}
if (Settings.splitTest.devToolbar.enabled) {
if (Settings.devToolbar.enabled) {
info.active = currentVersion.active
info.variants = currentVersion.variants.map(variant => ({
name: variant.name,
@ -495,7 +495,7 @@ async function _loadSplitTestInfoInLocals(locals, splitTestName, session) {
info.hasOverride = !!override
}
LocalsHelper.setSplitTestInfo(locals, splitTestName, info)
} else if (Settings.splitTest.devToolbar.enabled) {
} else if (Settings.devToolbar.enabled) {
LocalsHelper.setSplitTestInfo(locals, splitTestName, {
missing: true,
})

View file

@ -1,6 +1,6 @@
mixin foot-scripts()
each file in entrypointScripts(entrypoint)
script(type="text/javascript", nonce=scriptNonce, src=file, defer=deferScripts)
if (settings.splitTest.devToolbar.enabled)
if (settings.devToolbar.enabled)
each file in entrypointScripts("devToolbar")
script(type="text/javascript", nonce=scriptNonce, src=file, defer=deferScripts)

View file

@ -80,7 +80,7 @@ html(
block body
if (settings.splitTest.devToolbar.enabled)
if (settings.devToolbar.enabled)
div#dev-toolbar
block foot-scripts

View file

@ -316,10 +316,8 @@ module.exports = {
algorithm: process.env.OT_JWT_AUTH_ALG || 'HS256',
},
splitTest: {
devToolbar: {
enabled: false,
},
devToolbar: {
enabled: false,
},
splitTests: [],

View file

@ -15,6 +15,36 @@
border: none;
text-decoration: none;
}
.collapse-button {
position: absolute;
padding: 0;
margin-top: -2px;
color: @neutral-50;
span {
font-size: 28px;
}
&:hover {
color: @neutral-30;
}
}
}
.dev-tool-bar-open-button {
position: fixed;
bottom: -2px;
left: 6px;
color: @neutral-50;
span {
font-size: 28px;
}
&:hover {
color: @neutral-30;
}
}
.dev-toolbar-tooltip {

View file

@ -260,10 +260,8 @@ module.exports = {
counterInit: 0,
},
splitTest: {
devToolbar: {
enabled: false,
},
devToolbar: {
enabled: false,
},
}

View file

@ -40,10 +40,8 @@ describe('SplitTestHandler', function () {
this.Settings = {
moduleImportSequence: [],
overleaf: {},
splitTest: {
devToolbar: {
enabled: false,
},
devToolbar: {
enabled: false,
},
}
this.AnalyticsManager = {