summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/stores/getters.js
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-04-13 15:35:03 +0100
committerPhil Hughes <me@iamphill.com>2018-04-18 14:34:49 +0100
commitbdc437fc7620c285784d532d907811dc4ea378da (patch)
tree2ce5d93e3b4523b15f0ce4c939bc42177d757b49 /app/assets/javascripts/ide/stores/getters.js
parentd8dd75ca775f66fd756e43ddd73ac75d39fc3e64 (diff)
downloadgitlab-ce-bdc437fc7620c285784d532d907811dc4ea378da.tar.gz
Add left links sidebar to IDE
[ci skip]
Diffstat (limited to 'app/assets/javascripts/ide/stores/getters.js')
-rw-r--r--app/assets/javascripts/ide/stores/getters.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/assets/javascripts/ide/stores/getters.js b/app/assets/javascripts/ide/stores/getters.js
index a77cdbc13c8..1a61a26e088 100644
--- a/app/assets/javascripts/ide/stores/getters.js
+++ b/app/assets/javascripts/ide/stores/getters.js
@@ -1,3 +1,5 @@
+import { ActivityBarViews } from './state';
+
export const activeFile = state => state.openFiles.find(file => file.active) || null;
export const addedFiles = state => state.changedFiles.filter(f => f.tempFile);
@@ -21,6 +23,18 @@ export const projectsWithTrees = state =>
};
});
+export const currentProjectWithTree = state => ({
+ ...state.projects[state.currentProjectId],
+ branches: Object.keys(state.projects[state.currentProjectId].branches).map(branchId => {
+ const branch = state.projects[state.currentProjectId].branches[branchId];
+
+ return {
+ ...branch,
+ tree: state.trees[branch.treeId],
+ };
+ }),
+});
+
export const currentMergeRequest = state => {
if (state.projects[state.currentProjectId]) {
return state.projects[state.currentProjectId].mergeRequests[state.currentMergeRequestId];
@@ -28,6 +42,8 @@ export const currentMergeRequest = state => {
return null;
};
+export const currentProject = state => state.projects[state.currentProjectId];
+
// eslint-disable-next-line no-confusing-arrow
export const currentIcon = state =>
state.rightPanelCollapsed ? 'angle-double-left' : 'angle-double-right';
@@ -35,3 +51,12 @@ export const currentIcon = state =>
export const hasChanges = state => !!state.changedFiles.length;
export const hasMergeRequest = state => !!state.currentMergeRequestId;
+
+export const activityBarComponent = state => {
+ switch (state.currentActivityView) {
+ case ActivityBarViews.edit:
+ return 'project-tree';
+ default:
+ return null;
+ }
+};