1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
import { visitUrl, constructWebIDEPath } from '~/lib/utils/url_utility';
import findAndFollowLink from '~/lib/utils/navigation_utility';
import {
GO_TO_PROJECT_OVERVIEW,
GO_TO_PROJECT_ACTIVITY_FEED,
GO_TO_PROJECT_RELEASES,
GO_TO_PROJECT_FILES,
GO_TO_PROJECT_COMMITS,
GO_TO_PROJECT_JOBS,
GO_TO_PROJECT_REPO_GRAPH,
GO_TO_PROJECT_REPO_CHARTS,
GO_TO_PROJECT_ISSUES,
GO_TO_PROJECT_ISSUE_BOARDS,
GO_TO_PROJECT_MERGE_REQUESTS,
GO_TO_PROJECT_WIKI,
GO_TO_PROJECT_SNIPPETS,
GO_TO_PROJECT_KUBERNETES,
GO_TO_PROJECT_ENVIRONMENTS,
GO_TO_PROJECT_METRICS,
GO_TO_PROJECT_WEBIDE,
NEW_ISSUE,
} from './keybindings';
import Shortcuts from './shortcuts';
export default class ShortcutsNavigation extends Shortcuts {
constructor() {
super();
this.bindCommands([
[GO_TO_PROJECT_OVERVIEW, () => findAndFollowLink('.shortcuts-project')],
[GO_TO_PROJECT_ACTIVITY_FEED, () => findAndFollowLink('.shortcuts-project-activity')],
[GO_TO_PROJECT_RELEASES, () => findAndFollowLink('.shortcuts-deployments-releases')],
[GO_TO_PROJECT_FILES, () => findAndFollowLink('.shortcuts-tree')],
[GO_TO_PROJECT_COMMITS, () => findAndFollowLink('.shortcuts-commits')],
[GO_TO_PROJECT_JOBS, () => findAndFollowLink('.shortcuts-builds')],
[GO_TO_PROJECT_REPO_GRAPH, () => findAndFollowLink('.shortcuts-network')],
[GO_TO_PROJECT_REPO_CHARTS, () => findAndFollowLink('.shortcuts-repository-charts')],
[GO_TO_PROJECT_ISSUES, () => findAndFollowLink('.shortcuts-issues')],
[GO_TO_PROJECT_ISSUE_BOARDS, () => findAndFollowLink('.shortcuts-issue-boards')],
[GO_TO_PROJECT_MERGE_REQUESTS, () => findAndFollowLink('.shortcuts-merge_requests')],
[GO_TO_PROJECT_WIKI, () => findAndFollowLink('.shortcuts-wiki')],
[GO_TO_PROJECT_SNIPPETS, () => findAndFollowLink('.shortcuts-snippets')],
[GO_TO_PROJECT_KUBERNETES, () => findAndFollowLink('.shortcuts-kubernetes')],
[GO_TO_PROJECT_ENVIRONMENTS, () => findAndFollowLink('.shortcuts-environments')],
[GO_TO_PROJECT_METRICS, () => findAndFollowLink('.shortcuts-metrics')],
[GO_TO_PROJECT_WEBIDE, ShortcutsNavigation.navigateToWebIDE],
[NEW_ISSUE, () => findAndFollowLink('.shortcuts-new-issue')],
]);
}
static navigateToWebIDE() {
const path = constructWebIDEPath({
sourceProjectFullPath: window.gl.mrWidgetData?.source_project_full_path,
targetProjectFullPath: window.gl.mrWidgetData?.target_project_full_path,
iid: window.gl.mrWidgetData?.iid,
});
if (path) {
visitUrl(path, true);
}
}
}
|