From f5baf710f0e7ae24258ccbd572291b72d89bbb83 Mon Sep 17 00:00:00 2001
From: Marcelo Augusto <mekmay@hotmail.com>
Date: May 17 2018 02:02:56 +0000
Subject: [PATCH 1/5] Fixing get for analysis in api.


---

diff --git a/src/api/analysis.js b/src/api/analysis.js
index 3801b1a..69ebf5d 100644
--- a/src/api/analysis.js
+++ b/src/api/analysis.js
@@ -2,12 +2,12 @@ import axios from '.'
 
 export default {
   get: (currentPackage) => {
-    return axios.get(`/analysis/${currentPackage.name}/${currentPackage.versions}`)
+    return axios.get(`/analysis/${currentPackage.name}/${currentPackage.versions[0].number}`)
   },
   getReports: (currentPackage, id) => {
-    return axios.get(`/analysis/${currentPackage.name}/${currentPackage.version}/${id}/reports`)
+    return axios.get(`/analysis/${currentPackage.name}/${currentPackage.versions[0].number}/${id}/reports`)
   },
   getResults: (currentPackage, id) => {
-    return axios.get(`/analysis/${currentPackage.name}/${currentPackage.version}/${id}/results`)
+    return axios.get(`/analysis/${currentPackage.name}/${currentPackage.versions[0].number}/${id}/results`)
   }
 }

From ea53626a5f51ca5082fcd0cd64ccf6e97fbdde63 Mon Sep 17 00:00:00 2001
From: Matheus Bernardo <matheussber@aluno.unb.br>
Date: May 17 2018 19:35:16 +0000
Subject: [PATCH 2/5] Making all fields sortable


Co-authored-by: Matheus Bernardo <matheussber@aluno.unb.br>
Co-authored-by: Marcelo Augusto <mekmay@gmail.com>

---

diff --git a/src/components/package/List.vue b/src/components/package/List.vue
index a310cc6..1c669c3 100644
--- a/src/components/package/List.vue
+++ b/src/components/package/List.vue
@@ -47,9 +47,9 @@ export default {
   data () {
     return {
       fields: [
-        { key: 'name', label: 'Package Name', sortable: false },
-        { key: 'version', label: 'Last Version', sortable: false },
-        { key: 'previous', label: 'Previous Version', sortable: false },
+        { key: 'name', label: 'Package Name', sortable: true },
+        { key: 'version', label: 'Last Version', sortable: true },
+        { key: 'previous', label: 'Previous Version', sortable: true },
         { key: 'ranking', label: 'Ranking', sortable: true }
       ],
       updateData: null,
@@ -71,6 +71,7 @@ export default {
       getterNames.allPackages
     ]),
     formatPackages () {
+      this.allPackages.map(p => console.log(p.name))
       return this.allPackages.map(p => {
         let previous = this.createPrevious(p)
         return {
@@ -89,6 +90,7 @@ export default {
       actionTypes.FETCH_PACKAGES
     ]),
     showPackage (item, index) {
+      console.log('Entrou aqui')
       let p = this.allPackages[index]
       this.$router.push({
         name: 'analysis',

From 04fdfe24c932166bb3d6093e0ada3e771d2ee565 Mon Sep 17 00:00:00 2001
From: Guilherme Sant'Ana <guilherme.sant_ana@outlook.com>
Date: May 17 2018 19:37:39 +0000
Subject: [PATCH 3/5] Fix wrong package selection and package version


---

diff --git a/src/components/package/List.vue b/src/components/package/List.vue
index 1c669c3..4ac53b3 100644
--- a/src/components/package/List.vue
+++ b/src/components/package/List.vue
@@ -91,7 +91,7 @@ export default {
     ]),
     showPackage (item, index) {
       console.log('Entrou aqui')
-      let p = this.allPackages[index]
+      let p = this.allPackages.find(singlePackage => singlePackage.name === item.name)
       this.$router.push({
         name: 'analysis',
         params: {
diff --git a/src/components/package/PackagePage.vue b/src/components/package/PackagePage.vue
index f068459..58fdc8b 100644
--- a/src/components/package/PackagePage.vue
+++ b/src/components/package/PackagePage.vue
@@ -1,6 +1,6 @@
 <template>
   <div class="package-page container">
-    <b-card :title="currentPackage.name" sub-title="1.0.0">
+    <b-card :title="currentPackage.name" :sub-title="lastVersion">
       <div class="row">
         <div class="col-sm-6 description-container">
           <div class="total-container">

From 615bdd13fd8d62546c213863bea0285ea9e0caa2 Mon Sep 17 00:00:00 2001
From: Marcelo Augusto <mekmay@hotmail.com>
Date: May 17 2018 20:02:53 +0000
Subject: [PATCH 4/5] Removing console log.


---

diff --git a/src/components/package/List.vue b/src/components/package/List.vue
index 4ac53b3..d7eaca7 100644
--- a/src/components/package/List.vue
+++ b/src/components/package/List.vue
@@ -90,7 +90,6 @@ export default {
       actionTypes.FETCH_PACKAGES
     ]),
     showPackage (item, index) {
-      console.log('Entrou aqui')
       let p = this.allPackages.find(singlePackage => singlePackage.name === item.name)
       this.$router.push({
         name: 'analysis',

From 31c41237a4cd2b05ccd5c1ce31dc54631ff6ff87 Mon Sep 17 00:00:00 2001
From: Guilherme Sant'Ana <guilherme.sant_ana@outlook.com>
Date: May 28 2018 20:29:31 +0000
Subject: [PATCH 5/5] Add vuex-persistedstate to correct data loss


---

diff --git a/package.json b/package.json
index 169f4e5..604b6ce 100644
--- a/package.json
+++ b/package.json
@@ -90,6 +90,7 @@
     "vue-style-loader": "^3.1.2",
     "vue-template-compiler": "^2.5.13",
     "vuetable-2": "^1.7.5",
+    "vuex-persistedstate": "^2.5.4",
     "webpack": "^2.6.1",
     "webpack-bundle-analyzer": "^2.11.1",
     "webpack-dev-middleware": "^1.12.2",
diff --git a/src/components/package/List.vue b/src/components/package/List.vue
index d7eaca7..3fdbdc5 100644
--- a/src/components/package/List.vue
+++ b/src/components/package/List.vue
@@ -71,7 +71,6 @@ export default {
       getterNames.allPackages
     ]),
     formatPackages () {
-      this.allPackages.map(p => console.log(p.name))
       return this.allPackages.map(p => {
         let previous = this.createPrevious(p)
         return {
diff --git a/src/components/package/PackagePage.vue b/src/components/package/PackagePage.vue
index 58fdc8b..f2f8c39 100644
--- a/src/components/package/PackagePage.vue
+++ b/src/components/package/PackagePage.vue
@@ -144,6 +144,8 @@ export default {
   mounted () {
     if (this.package) {
       this.currentPackage = this.package
+    } else {
+      this.currentPackage = this.currentPackage
     }
     this.selectAnalysisId = (this.analysis || [{id: 0}])[0].id
     this.fetchData()
diff --git a/src/store/index.js b/src/store/index.js
index f3b9238..54d7477 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -3,11 +3,13 @@ import Vuex from 'vuex'
 import packages from './modules/packages'
 import analysis from './modules/analysis'
 import analysisData from './modules/analysisData'
+import createPersistedState from 'vuex-persistedstate'
 
 export default new Vuex.Store({
   modules: {
     packages,
     analysisData,
     analysis
-  }
+  },
+  plugins: [createPersistedState()]
 })

