diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json
index 0218e4adf4..ce299d26c8 100644
--- a/services/web/frontend/extracted-translations.json
+++ b/services/web/frontend/extracted-translations.json
@@ -349,7 +349,12 @@
"git_authentication_token": "",
"git_authentication_token_create_modal_info_1": "",
"git_authentication_token_create_modal_info_2": "",
+ "git_bridge_modal_click_generate": "",
"git_bridge_modal_description": "",
+ "git_bridge_modal_enter_authentication_token": "",
+ "git_bridge_modal_see_once": "",
+ "git_bridge_modal_tokens_description": "",
+ "git_bridge_modal_use_previous_token": "",
"git_integration": "",
"git_integration_info": "",
"github_commit_message_placeholder": "",
@@ -381,6 +386,7 @@
"go_prev_page": "",
"go_to_code_location_in_pdf": "",
"go_to_pdf_location_in_code": "",
+ "go_to_settings": "",
"group_plan_tooltip": "",
"group_plan_with_name_tooltip": "",
"group_subscription": "",
diff --git a/services/web/frontend/stories/git-bridge-modal.stories.js b/services/web/frontend/stories/git-bridge-modal.stories.js
index 247605d743..7ee5b53187 100644
--- a/services/web/frontend/stories/git-bridge-modal.stories.js
+++ b/services/web/frontend/stories/git-bridge-modal.stories.js
@@ -1,5 +1,7 @@
import importOverleafModules from '../macros/import-overleaf-module.macro'
import { ScopeDecorator } from './decorators/scope'
+import GitBridgeModalTokens from '../../modules/git-bridge/frontend/js/components/git-bridge-modal-tokens'
+import useFetchMock from './hooks/use-fetch-mock'
const [
{
@@ -7,12 +9,19 @@ const [
},
] = importOverleafModules('gitBridge')
-export const GitBridgeUrlModal = args =>
+function renderModal(args, newModal = false) {
+ window.metaAttributesCache = new Map()
+ window.metaAttributesCache.set('ol-showPersonalAccessToken', newModal)
+ window.metaAttributesCache.set('ol-personalAccessTokens', [])
+ return
+}
+
+export const GitBridgeUrlModal = args => renderModal(args)
GitBridgeUrlModal.args = {
type: 'show_url',
}
-export const CollaboratorModal = args =>
+export const CollaboratorModal = args => renderModal(args)
CollaboratorModal.args = {
type: 'collaborator',
}
@@ -23,12 +32,58 @@ export const TeaserModal = args => {
// fetchMock.post('express:/event/:key', 202)
// })
- return
+ return renderModal(args)
}
TeaserModal.args = {
type: 'teaser',
}
+export const AccessTokensWithNoTokens = args => {
+ useFetchMock(fetchMock =>
+ fetchMock.get('/oauth/personal-access-tokens', [], { delay: 500 })
+ )
+ useFetchMock(fetchMock =>
+ fetchMock.post(
+ '/oauth/personal-access-tokens',
+ {
+ accessToken: 'olp_2fvP3amgiJRJk2JWP6nxZqGHKRVwMvcgo9mk',
+ },
+ { delay: 1000 }
+ )
+ )
+ return renderModal(args, true)
+}
+
+export const AccessTokensWithTokens = args => {
+ useFetchMock(fetchMock =>
+ fetchMock.get('/oauth/personal-access-tokens', [{}], { delay: 500 })
+ )
+ return
+}
+
+export const AccessTokensGetTokensError = args => {
+ useFetchMock(fetchMock =>
+ fetchMock.get(
+ '/oauth/personal-access-tokens',
+ { status: 403 },
+ { delay: 1000 }
+ )
+ )
+ return
+}
+
+export const AccessTokensCreateTokensError = args => {
+ useFetchMock(fetchMock => fetchMock.get('/oauth/personal-access-tokens', []))
+ useFetchMock(fetchMock =>
+ fetchMock.post(
+ '/oauth/personal-access-tokens',
+ { status: 403 },
+ { delay: 1000 }
+ )
+ )
+ return
+}
+
export default {
title: 'Editor / Modals / Git Bridge',
component: GitBridgeModal,
diff --git a/services/web/locales/en.json b/services/web/locales/en.json
index 5d1e48d1f4..7266a620df 100644
--- a/services/web/locales/en.json
+++ b/services/web/locales/en.json
@@ -606,7 +606,12 @@
"git_authentication_token": "Git authentication token",
"git_authentication_token_create_modal_info_1": "This is your Git authentication token. You should enter this when prompted for a password.",
"git_authentication_token_create_modal_info_2": "<0>You will only see this authentication token once so please copy it and keep it safe0>. For full instructions on using authentication tokens, visit our <1>help page1>.",
+ "git_bridge_modal_click_generate": "Click Generate token to generate your authentication token now. Or do this later in your Account Settings.",
"git_bridge_modal_description": "You can git clone your project using the link displayed below.",
+ "git_bridge_modal_enter_authentication_token": "When prompted for a password, enter your new authentication token:",
+ "git_bridge_modal_see_once": "You’ll only see this token once. To delete it or generate a new one, visit Account Settings. For detailed instructions and troubleshooting, read our <0>help page0>.",
+ "git_bridge_modal_tokens_description": "To git clone your project you’ll need the link below and a Git authentication token.",
+ "git_bridge_modal_use_previous_token": "If you’re prompted for a password, you can use a previously generated Git authentication token. Or you can generate a new one in Account Settings. For more support, read our <0>help page0>.",
"git_integration": "Git Integration",
"git_integration_info": "With Git integration, you can clone your Overleaf projects with Git. For full instructions on how to do this, read <0>our help page0>.",
"git_integration_lowercase": "Git integration",
@@ -649,6 +654,7 @@
"go_to_account_settings": "Go to Account Settings",
"go_to_code_location_in_pdf": "Go to code location in PDF",
"go_to_pdf_location_in_code": "Go to PDF location in code (Tip: double click on the PDF for best results)",
+ "go_to_settings": "Go to settings",
"group_admins_get_access_to": "Group admins get access to",
"group_admins_get_access_to_info": "Special features available only on group plans.",
"group_full": "This group is already full",
diff --git a/services/web/test/frontend/helpers/editor-providers.js b/services/web/test/frontend/helpers/editor-providers.js
index 68584b9b52..bfcc2ea20a 100644
--- a/services/web/test/frontend/helpers/editor-providers.js
+++ b/services/web/test/frontend/helpers/editor-providers.js
@@ -72,7 +72,7 @@ export function EditorProviders({
},
}) {
window.user = user || window.user
- window.gitBridgePublicBaseUrl = 'git.overleaf.test'
+ window.gitBridgePublicBaseUrl = 'https://git.overleaf.test'
window.project_id = projectId != null ? projectId : window.project_id
window.isRestrictedTokenMember = isRestrictedTokenMember