diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-03-23 21:33:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-23 21:33:13 +0100 |
commit | 67baef47414e15de9fd11c83275b8f30e8e21250 (patch) | |
tree | 2a68867468ca56db3e08a3eda4bc63a5e933203f /src/views | |
parent | 8a04db5cdb1fad22ddc0764cb60b2e5a9822a417 (diff) | |
parent | 9bbff6134c7068567a7a38b2de13472bff4c73e9 (diff) |
Merge pull request #10 from gico-net/feat/search-commit
Search commit page
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/Commit.vue | 2 | ||||
-rw-r--r-- | src/views/Search.vue | 46 |
2 files changed, 47 insertions, 1 deletions
diff --git a/src/views/Commit.vue b/src/views/Commit.vue index 234fc88..5fbeb13 100644 --- a/src/views/Commit.vue +++ b/src/views/Commit.vue @@ -4,7 +4,7 @@ b-container(v-if="loading") b-overlay(:show="true" spinner-large) b-container(v-else) - .commi(v-if="error404") + .commit(v-if="error404") h2 Commit not found commit-card( :data="commit" diff --git a/src/views/Search.vue b/src/views/Search.vue new file mode 100644 index 0000000..c173567 --- /dev/null +++ b/src/views/Search.vue @@ -0,0 +1,46 @@ +<template lang="pug"> + main + header-blue + b-container(v-if="loading") + b-overlay(:show="true" spinner-large) + b-container(v-else) + .commit + h2 Commits found {{ commits.length }} + .commit(style="padding: 50px" v-if="loading") + b-overlay(:show="true" spinner-large) + commit-card( + v-else + v-for="i in commits" :key="i.hash" :data="i" + :author="emails[i.author_email]" + :committer="emails[i.committer_email]" + ) +</template> + +<script> +import HeaderBlue from '@/components/HeaderBlue'; +import Commit from '@/components/Commit'; + +export default { + name: "Commit", + props: ["hash"], + components: { + 'header-blue': HeaderBlue, + 'commit-card': Commit, + }, + mounted() { + this.$store.dispatch('get_commits', this.$route.query.q); + this.$store.dispatch('get_emails'); + }, + computed: { + loading: function() { + return this.$store.getters.loading; + }, + commits: function() { + return this.$store.getters.commits; + }, + emails: function() { + return this.$store.getters.emails; + }, + }, +} +</script> |