Commit 8b72bcfa authored by Tim Zallmann's avatar Tim Zallmann

Added Utility Function for WebIDE URL

parent 8f7cf2ed
import project from '../../ide/stores/mutations/project';
// Returns an array containing the value(s) of the
// of the key passed as an argument
export function getParameterValues(sParam) {
......@@ -51,7 +53,7 @@ export function removeParams(params) {
const url = document.createElement('a');
url.href = window.location.href;
params.forEach((param) => {
params.forEach(param => {
url.search = removeParamQueryString(url.search, param);
});
......@@ -83,3 +85,11 @@ export function refreshCurrentPage() {
export function redirectTo(url) {
return window.location.assign(url);
}
export function webIDEUrl(projectUrl = undefined) {
let returnUrl = `${gon.relative_url_root}/-/ide/`;
if (projectUrl) {
returnUrl += `project${projectUrl}`;
}
return returnUrl;
}
<script>
import tooltip from '~/vue_shared/directives/tooltip';
import { n__ } from '~/locale';
import { webIDEUrl } from '~/lib/utils/url_utility';
import icon from '~/vue_shared/components/icon.vue';
import clipboardButton from '~/vue_shared/components/clipboard_button.vue';
......@@ -42,7 +43,7 @@ export default {
return this.isBranchTitleLong(this.mr.targetBranch);
},
webIdePath() {
return `${gon.relative_url_root}/-/ide/project${this.mr.statusPath.replace('.json', '')}`;
return webIDEUrl(this.mr.statusPath.replace('.json', ''));
},
},
methods: {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment