diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-17 00:08:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-17 00:08:30 +0300 |
commit | af11eb63cf4eaab8801416cc4a65f0bd4fad8817 (patch) | |
tree | 1159645ca9b4034aaac935c4b62752ff3f28b7e8 /app/assets/javascripts/ide | |
parent | 0122d00cac3c058508a2fcb258f12ecfb7bc9055 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/ide')
-rw-r--r-- | app/assets/javascripts/ide/init_gitlab_web_ide.js | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/app/assets/javascripts/ide/init_gitlab_web_ide.js b/app/assets/javascripts/ide/init_gitlab_web_ide.js index 5e25aa6de21..d3c64754e8a 100644 --- a/app/assets/javascripts/ide/init_gitlab_web_ide.js +++ b/app/assets/javascripts/ide/init_gitlab_web_ide.js @@ -22,11 +22,26 @@ const buildRemoteIdeURL = (ideRemotePath, remoteHost, remotePathArg) => { }); }; +const getMRTargetProject = () => { + const url = new URL(window.location.href); + + return url.searchParams.get('target_project') || ''; +}; + export const initGitlabWebIDE = async (el) => { // what: Pull what we need from the element. We will replace it soon. - const { cspNonce: nonce, branchName: ref, projectPath, ideRemotePath } = el.dataset; + const { + cspNonce: nonce, + branchName: ref, + projectPath, + ideRemotePath, + filePath, + mergeRequest: mrId, + forkInfo: forkInfoJSON, + } = el.dataset; const rootEl = setupRootElement(el); + const forkInfo = forkInfoJSON ? JSON.parse(forkInfoJSON) : null; // See ClientOnlyConfig https://gitlab.com/gitlab-org/gitlab-web-ide/-/blob/main/packages/web-ide-types/src/config.ts#L17 start(rootEl, { @@ -39,6 +54,12 @@ export const initGitlabWebIDE = async (el) => { }, projectPath, ref, + filePath, + mrId, + mrTargetProject: getMRTargetProject(), + // note: At the time of writing this, forkInfo isn't expected by `@gitlab/web-ide`, + // but it will be soon. + forkInfo, links: { feedbackIssue: GITLAB_WEB_IDE_FEEDBACK_ISSUE, userPreferences: el.dataset.userPreferencesPath, |