summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkushalpandya <kushal@gitlab.com>2017-09-04 21:16:07 +0530
committerkushalpandya <kushal@gitlab.com>2017-09-05 13:11:20 +0530
commit446b0340fd2f628007bd372a80da05bb7e143525 (patch)
tree9c027afd6c3db624f0c4e3ed8f58257dfea2f7d0
parent43a27f845a0bf4c12d11cb548a7aff3b857cdd63 (diff)
downloadgitlab-ce-446b0340fd2f628007bd372a80da05bb7e143525.tar.gz
Projects Dropdown App Store
-rw-r--r--app/assets/javascripts/projects_dropdown/store/projects_store.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/app/assets/javascripts/projects_dropdown/store/projects_store.js b/app/assets/javascripts/projects_dropdown/store/projects_store.js
new file mode 100644
index 00000000000..ffefbe693f4
--- /dev/null
+++ b/app/assets/javascripts/projects_dropdown/store/projects_store.js
@@ -0,0 +1,33 @@
+export default class ProjectsStore {
+ constructor() {
+ this.state = {};
+ this.state.frequentProjects = [];
+ this.state.searchedProjects = [];
+ }
+
+ setFrequentProjects(rawProjects) {
+ this.state.frequentProjects = rawProjects;
+ }
+
+ getFrequentProjects() {
+ return this.state.frequentProjects;
+ }
+
+ setSearchedProjects(rawProjects) {
+ this.state.searchedProjects = rawProjects.map(rawProject => ({
+ id: rawProject.id,
+ name: rawProject.name,
+ namespace: rawProject.name_with_namespace,
+ webUrl: rawProject.web_url,
+ avatarUrl: rawProject.avatar_url,
+ }));
+ }
+
+ getSearchedProjects() {
+ return this.state.searchedProjects;
+ }
+
+ clearSearchedProjects() {
+ this.state.searchedProjects = [];
+ }
+}