From 57e1a9e33597f30da0870a9af4d3e9167a7b3367 Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Wed, 24 Mar 2021 20:53:29 +0100
Subject: fix: typo for commits found number

---
 src/views/Repository.vue | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/views/Repository.vue')

diff --git a/src/views/Repository.vue b/src/views/Repository.vue
index ade55d3..0b9e2cf 100644
--- a/src/views/Repository.vue
+++ b/src/views/Repository.vue
@@ -14,7 +14,7 @@
             i.fab.fa-github
       section(v-if="commits.length > 0")
         .commit.no-hover
-          h2 Commits found {{ (commits.length == 1000)?"1000+":commits.length }}
+          h2 Commits found: {{ (commits.length == 1000)?"1000+":commits.length }}
         commit-card(
           v-for="i in commits" :key="i.hash" :data="i"
           :author="emails[i.author_email]"
-- 
cgit v1.2.3-18-g5258


From c2ab16d3a89df2075f2e0047766168e8b711fe86 Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Wed, 24 Mar 2021 21:26:51 +0100
Subject: feat: add new repository

---
 src/views/Repository.vue | 53 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)

(limited to 'src/views/Repository.vue')

diff --git a/src/views/Repository.vue b/src/views/Repository.vue
index 0b9e2cf..abb40a9 100644
--- a/src/views/Repository.vue
+++ b/src/views/Repository.vue
@@ -21,6 +21,20 @@
           :committer="emails[i.committer_email]"
           :expand="true"
         )
+      section(v-else)
+        b-modal#new-repo(
+          @ok="add_new_repo()"
+          ok-title="Add"
+          ok-variant="outline-success"
+          cancel-variant="outline-dark"
+        )
+          <template #modal-title>Add {{ user }}/{{ name }} on Gico!</template>
+          b-form-group(label="Insert the branch name")
+            b-form-input(v-model="form.branch" placeholder="main")
+        .commit.no-hover
+          b-button(variant="outline-success" v-b-modal.new-repo)
+            | Add this repository on Gico 
+            i.fas.fa-plus
 </template>
 
 <script>
@@ -36,7 +50,9 @@ export default {
   },
   data() {
     return {
-      error404: false
+      form: {
+        branch: undefined
+      }
     }
   },
   async mounted() {
@@ -55,5 +71,40 @@ export default {
       return this.$store.getters.emails;
     },
   },
+  methods: {
+    add_new_repo() {
+      this.$store.dispatch('add_repo', {
+        url: `github.com/${this.user}/${this.name}`,
+        branch: this.form.branch || "main"
+      }).then(response => {
+        if(response.detail) {
+          this.$bvToast.toast(response.detail, {
+            title: 'Error!',
+            autoHideDelay: 5000,
+            variant: 'danger',
+            appendToast: true
+          })
+        } else if(response.id) {
+          this.$bvToast.toast(response.url, {
+            title: 'Repository created!',
+            autoHideDelay: 5000,
+            variant: 'success',
+            appendToast: true
+          })
+          window.setTimeout(() => {
+            window.location.href="/repo/"+response.url
+          }, 1000)
+        } else {
+          this.$bvToast.toast("", {
+            title: 'Error!',
+            autoHideDelay: 5000,
+            variant: 'danger',
+            appendToast: true
+          })
+        }
+      })
+
+    }
+  }
 }
 </script>
-- 
cgit v1.2.3-18-g5258

