Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-01-26 03:08:44 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-01-26 03:08:44 +0300
commite5fec17b5823511bda9bb1ac0dc64ab9c84a2a2f (patch)
tree5d1600d4e9cbbdf42c21978e4c52cec831c1aec8 /app/assets/javascripts/pages
parent23e3a19888835a5a7fc68a081ba1e050e9baf681 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/pages')
-rw-r--r--app/assets/javascripts/pages/projects/network/show/index.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/assets/javascripts/pages/projects/network/show/index.js b/app/assets/javascripts/pages/projects/network/show/index.js
index 2dabcfadfab..414636f0a74 100644
--- a/app/assets/javascripts/pages/projects/network/show/index.js
+++ b/app/assets/javascripts/pages/projects/network/show/index.js
@@ -1,7 +1,39 @@
import $ from 'jquery';
+import Vue from 'vue';
+import { visitUrl, joinPaths } from '~/lib/utils/url_utility';
import ShortcutsNetwork from '~/behaviors/shortcuts/shortcuts_network';
+import RefSelector from '~/ref/components/ref_selector.vue';
import Network from '../network';
+const initRefSwitcher = () => {
+ const refSwitcherEl = document.getElementById('js-graph-ref-switcher');
+ const NETWORK_PATH_REGEX = /^(.*?)\/-\/network/g;
+
+ if (!refSwitcherEl) return false;
+
+ const { projectId, ref, networkPath } = refSwitcherEl.dataset;
+ const networkRootPath = networkPath.match(NETWORK_PATH_REGEX)?.[0]; // gets the network path without the ref
+
+ return new Vue({
+ el: refSwitcherEl,
+ render(createElement) {
+ return createElement(RefSelector, {
+ props: {
+ projectId,
+ value: ref,
+ },
+ on: {
+ input(selectedRef) {
+ visitUrl(joinPaths(networkRootPath, selectedRef));
+ },
+ },
+ });
+ },
+ });
+};
+
+initRefSwitcher();
+
(() => {
if (!$('.network-graph').length) return;