Skip to content

Commit

Permalink
pkp/pkp-lib#4787 WIP: most todos resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir committed Feb 7, 2025
1 parent 0c6319f commit f4a4bb4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 28 deletions.
3 changes: 2 additions & 1 deletion src/components/Form/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ export default {
*/
error: function (r) {
// Field validation errors
if (r.status && r.status === 400) {
// [422 --> Unprocessable Content/Entities] represent standard validation errors
if (r.status && (r.status === 400 || r.status === 422)) {
pkp.eventBus.$emit(
'notify',
this.t('form.errors', {
Expand Down
1 change: 0 additions & 1 deletion src/components/ListPanel/users/SelectReviewerListPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ export default {
},
error: this.ajaxErrorCallback,
success(r) {
// TODO : may be some better appraoch than this ?
if (r.approvedAt) {
this.suggestions.forEach((reviewerSuggestion) => {
if (reviewerSuggestion.id == reviewerSuggestionId) {
Expand Down
32 changes: 16 additions & 16 deletions src/components/ListPanel/users/SelectReviewerSuggestionListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
<div class="listPanel__itemSummary">
<div class="listPanel__itemIdentity">
<div class="listPanel__itemTitle">
<!-- TODO: check why localize(fullName) causing error -->
{{ fullName }}
{{ localize(item.fullName) }}
</div>

<div class="listPanel__itemSubtitle">
<div class="listPanel__item--reviewer__affiliation">
{{ affiliation }}
{{ localize(item.affiliation) }}
</div>
<!-- TODO: check alternative of v-html as v-strip-unsafe-html not working -->
<div v-html="suggestionReason"></div>
<div
class="reviewer_sugestion_reason_container"
v-html="localize(item.suggestionReason)"
></div>
</div>

<div v-if="currentlyAssigned" class="listPanel__item--reviewer__notice">
Expand Down Expand Up @@ -100,18 +102,6 @@ export default {
return false;
},
fullName() {
return this.localize(this.item.fullName);
},
affiliation() {
return this.localize(this.item.affiliation);
},
suggestionReason() {
return this.localize(this.item.suggestionReason);
},
},
methods: {
/**
Expand Down Expand Up @@ -153,3 +143,13 @@ export default {
},
};
</script>

<style lang="less">
@import '../../../styles/_import';
.reviewer_sugestion_reason_container {
white-space: normal;
margin-right: 4rem;
text-align: justify;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div>
<UserAvatar
:user-id="reviewerSuggestion.id"
:user-full-name="reviewerSuggestion.fullName"
:initials="reviewerSuggestion.displayInitial"
></UserAvatar>
</div>
<div class="ms-2 flex flex-col justify-center">
Expand All @@ -37,16 +37,16 @@
></div>
</div>
</div>
<div v-if="reviewerSuggestionManagerStore.hasActiveReviewStage">
<div v-if="reviewerSuggestionManagerStore.atActiveReviewStage()">
<DropdownActions
:actions="reviewerSuggestionManagerStore.itemActions"
:label="`${reviewerSuggestion.fullName} ${t('common.moreActions')}`"
:display-as-ellipsis="true"
button-variant="ellipsis"
@action="
(actionName) =>
reviewerSuggestionManagerStore[actionName]({
reviewerSuggestion: reviewerSuggestion,
stageAssignmen,
stageAssignment,
})
"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ export const useReviewerSuggestionManagerStore = defineComponentStore(

const {apiUrl: reviewerSuggestionApiUrl} = useUrl(relativeUrl);

const {data: reviewerSuggestions, fetch: fetchreviewerSuggestion} =
const {data: reviewerSuggestions, fetch: fetchReviewerSuggestion} =
useFetch(reviewerSuggestionApiUrl);

watch(relativeUrl, () => {
reviewerSuggestions.value = null;
fetchreviewerSuggestion();
fetchReviewerSuggestion();
});

fetchreviewerSuggestion();
fetchReviewerSuggestion();

const {triggerDataChange} = useDataChanged(() => fetchreviewerSuggestion());
const {triggerDataChange} = useDataChanged(() => fetchReviewerSuggestion());

function triggerDataChangeCallback() {
triggerDataChange();
Expand All @@ -56,6 +56,7 @@ export const useReviewerSuggestionManagerStore = defineComponentStore(
list.push({
id: reviewerSuggestion.id,
fullName: localize(reviewerSuggestion.fullName),
displayInitial: localize(reviewerSuggestion.displayInitial),
affiliation: localize(reviewerSuggestion.affiliation),
suggestionReason: localize(reviewerSuggestion.suggestionReason),
existingReviewerRole: reviewerSuggestion.existingReviewerRole,
Expand All @@ -74,7 +75,13 @@ export const useReviewerSuggestionManagerStore = defineComponentStore(

const itemActions = computed(() => _actionFns.getItemActions({}));

const hasActiveReviewStage = props.reviewRoundId ? true : false;
function atActiveReviewStage() {
return props.reviewRoundId
&& (
props.submissionStageId == pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW
|| props.submissionStageId == pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW
);
}

function enrichActionArg(args) {
return {
Expand All @@ -97,7 +104,7 @@ export const useReviewerSuggestionManagerStore = defineComponentStore(
_actionFns,
itemActions,
reviewerSuggestionApprove,
hasActiveReviewStage,
atActiveReviewStage,
};
},
);

0 comments on commit f4a4bb4

Please sign in to comment.