Skip to content

Commit

Permalink
Merge branch 'skip-recommendation' of 'https://github.com/evamillan/g…
Browse files Browse the repository at this point in the history
…rimoirelab-sortinghat'

Merges #939
Closes #939
Fixes #937
  • Loading branch information
sduenas authored Nov 21, 2024
2 parents f508600 + 4570a03 commit b40492f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
9 changes: 9 additions & 0 deletions releases/unreleased/skip-recommendations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Skip recommendations
category: added
author: Eva Millán <[email protected]>
issue: 937
notes: >
Users can now skip a recommendation and review
the next one if they are unsure of whether to
apply it or dismiss it.
20 changes: 16 additions & 4 deletions ui/src/components/Recommendations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,14 @@
{{ errorMessage }}
</v-alert>

<v-card-actions class="pr-0 mt-4">
<v-card-actions class="px-0 mt-4">
<v-btn
color="primary darken-1"
variant="text"
@click.prevent="fetchItem(page + 1)"
>
Skip
</v-btn>
<v-spacer></v-spacer>
<v-btn
color="primary darken-1"
Expand Down Expand Up @@ -158,6 +165,7 @@ export default {
isOpen: false,
errorMessage: null,
menu: null,
page: 1,
};
},
methods: {
Expand All @@ -169,9 +177,12 @@ export default {
this.$logger.error(`Error fetching recommendations: ${error}`);
}
},
async fetchItem() {
async fetchItem(page = 1) {
if (this.currentItem && !this.currentItem.pageInfo.hasNext) {
return this.onClose();
}
try {
const response = await this.getRecommendations(1, 1);
const response = await this.getRecommendations(page, 1);
if (response.data.recommendedMerge.entities) {
const recommendation = response.data.recommendedMerge.entities[0];
this.currentItem = {
Expand All @@ -181,6 +192,7 @@ export default {
pageInfo: response.data.recommendedMerge.pageInfo,
};
this.count = this.currentItem.pageInfo.totalResults;
this.page = this.currentItem.pageInfo.page;
}
} catch (error) {
this.errorMessage = this.$getErrorMessage(error);
Expand All @@ -199,7 +211,7 @@ export default {
if (!this.currentItem.pageInfo.hasNext) {
this.onClose();
} else {
this.fetchItem();
this.fetchItem(this.page);
}
} catch (error) {
this.errorMessage = this.$getErrorMessage(error);
Expand Down

0 comments on commit b40492f

Please sign in to comment.