Skip to content

Commit

Permalink
[ui] Skip recommendation
Browse files Browse the repository at this point in the history
Adds a button on the Review recommendations modal
to skip the current recommendation and load the
next one.

Signed-off-by: Eva Millán <[email protected]>
  • Loading branch information
evamillan committed Nov 6, 2024
1 parent e157e0f commit dec31e1
Show file tree
Hide file tree
Showing 2 changed files with 23 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.
18 changes: 14 additions & 4 deletions ui/src/components/Recommendations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,15 @@
{{ errorMessage }}
</v-alert>

<v-card-actions class="pr-0 mt-4">
<v-card-actions class="px-0 mt-4">
<v-btn
v-if="page !== count"
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 +166,7 @@ export default {
isOpen: false,
errorMessage: null,
menu: null,
page: 1,
};
},
methods: {
Expand All @@ -169,9 +178,9 @@ export default {
this.$logger.error(`Error fetching recommendations: ${error}`);
}
},
async fetchItem() {
async fetchItem(page = 1) {
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 +190,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 +209,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 dec31e1

Please sign in to comment.