-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
invitation table view and api integration
- Loading branch information
Showing
27 changed files
with
1,226 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,23 +119,6 @@ window.pkp = { | |
* Locale keys loaded on the server-side | ||
*/ | ||
localeKeys: { | ||
'acceptInvitation.modal.button': '##acceptInvitation.modal.button##', | ||
'acceptInvitation.modal.message': '##acceptInvitation.modal.message##', | ||
'acceptInvitation.modal.title': '##acceptInvitation.modal.title##', | ||
'acceptInvitation.passwordField.description': | ||
'##acceptInvitation.passwordField.description##', | ||
'acceptInvitation.privacyStatement.btn': | ||
'##acceptInvitation.privacyStatement.btn##', | ||
'acceptInvitation.privacyStatement.label': | ||
'##acceptInvitation.privacyStatement.label##', | ||
'acceptInvitation.review.accountDetails': | ||
'##acceptInvitation.review.accountDetails##', | ||
'acceptInvitation.review.userDetails': | ||
'##acceptInvitation.review.userDetails##', | ||
'acceptInvitation.skipVerifyOrcid': '##acceptInvitation.skipVerifyOrcid##', | ||
'acceptInvitation.usernameField.description': | ||
'##acceptInvitation.usernameField.description##', | ||
'acceptInvitation.verifyOrcid': '##acceptInvitation.verifyOrcid##', | ||
'admin.jobs.failed.action.redispatch': 'Try Again', | ||
'admin.jobs.failed.action.redispatch.all': 'Requeue All Failed Jobs', | ||
'article.article': 'Article', | ||
|
@@ -441,14 +424,12 @@ window.pkp = { | |
'Log in as this user? All actions you perform will be attributed to this user.', | ||
'help.help': 'Help', | ||
'informationCenter.informationCenter': 'Information Center', | ||
'invitation.orcid.acceptInvitation.message': | ||
'##invitation.orcid.acceptInvitation.message##', | ||
'invitation.role.addRole.button': '##invitation.role.addRole.button##', | ||
'invitation.role.dateStart': '##invitation.role.dateStart##', | ||
'invitation.role.masthead': '##invitation.role.masthead##', | ||
'invitation.role.addRole.button': 'Add Another Role', | ||
'invitation.role.dateStart': 'Start Date', | ||
'invitation.role.masthead': 'Journal Masthead', | ||
'invitation.role.removeRole.button': | ||
'##invitation.role.removeRole.button##', | ||
'invitation.role.selectRole': '##invitation.role.selectRole##', | ||
'Remove Role', | ||
'invitation.role.selectRole': 'Select a new role', | ||
'invitation.wizard.completeSteps': '##invitation.wizard.completeSteps##', | ||
'invitation.wizard.errors': '##invitation.wizard.errors##', | ||
'issue.issue': 'Issue', | ||
|
@@ -695,31 +676,52 @@ window.pkp = { | |
'submissions.declined': 'Declined', | ||
'submissions.incomplete': 'Incomplete', | ||
todo: '##todo##', | ||
'about.contact.email': 'Email', | ||
'user.email': 'Email Address', | ||
'user.affiliation': 'Affiliation', | ||
'user.email': 'Email', | ||
'user.emailAddress': '##user.emailAddress##', | ||
'user.familyName': 'Family Name', | ||
'user.givenName': 'Given Name', | ||
'user.gossip': 'Editorial Notes', | ||
'user.orcid': 'ORCID iD', | ||
'user.password': 'Password', | ||
'user.username': 'Username', | ||
'userInvitation.emailField.description': | ||
'##userInvitation.emailField.description##', | ||
'userInvitation.modal.button': '##userInvitation.modal.button##', | ||
'userInvitation.modal.message': '##userInvitation.modal.message##', | ||
'userInvitation.modal.title': '##userInvitation.modal.title##', | ||
'userInvitation.orcidField.description': | ||
'##userInvitation.orcidField.description##', | ||
'userInvitation.roleTable.endDate': '##userInvitation.roleTable.endDate##', | ||
'userInvitation.roleTable.journalMasthead': | ||
'##userInvitation.roleTable.journalMasthead##', | ||
'userInvitation.roleTable.role': '##userInvitation.roleTable.role##', | ||
'userInvitation.roleTable.startDate': | ||
'##userInvitation.roleTable.startDate##', | ||
'userInvitation.usernameField.description': | ||
'##userInvitation.usernameField.description##', | ||
'validator.required': 'This field is required.', | ||
'invitation.notification.closeBtn':'View all users', | ||
'invitation.orcid.acceptInvitation.message':'Not verified. You can verify your ORCID iD from your profile section in OJS', | ||
'userInvitation.emailField.description':'e.g. [email protected]', | ||
'userInvitation.usernameField.description':'e.g. mickeymouse', | ||
'userInvitation.orcidField.description':'e.g. 0000-0000-0000-0000', | ||
'userInvitation.roleTable.role':'Role', | ||
'userInvitation.roleTable.startDate':'Start Date', | ||
'userInvitation.roleTable.endDate':'End Date', | ||
'userInvitation.roleTable.journalMasthead':'Journal Masthead', | ||
'userInvitation.modal.title':'Invitation Sent', | ||
'userInvitation.modal.message':'{$email} has been invited to new role in OJS.You can be updated about users on the User and Roles page, your ojs notification and/ or your email', | ||
'userInvitation.modal.button':'View All Users', | ||
'acceptInvitation.usernameField.description':'It should be 10 characters long and could be a combination of uppercase letters, lowercase letters or numbers', | ||
'acceptInvitation.passwordField.description':'It should be 12 characters long and should be a combination of uppercase letters, lowercase letters, numbers and symbols', | ||
'acceptInvitation.review.userDetails':'User Details', | ||
'acceptInvitation.review.accountDetails':'Account Details', | ||
'acceptInvitation.verifyOrcid':'Verify ORCID iD', | ||
'acceptInvitation.skipVerifyOrcid':'Skip ORCID verification', | ||
'acceptInvitation.modal.title':"You've been assigned a new role in OJS", | ||
'acceptInvitation.modal.message':'Congratulations on your new role in OJS! You might now have access to new options. If you need assistance navigating the system, please click on the “Help” buttons throughout the interface for guidance', | ||
'acceptInvitation.modal.button':'View All Submissions', | ||
'acceptInvitation.privacyStatement.btn':'Privacy Statement', | ||
'acceptInvitation.privacyStatement.label':'Yes, I agree to have my data collected and stored according to the', | ||
'invitation.cancel': 'Cancel Invite', | ||
'invitation.inviteToRole.btn': 'Invite to a role', | ||
'invitation.header': 'Invitation', | ||
'invitation.tableHeader.name': 'Name', | ||
'invitation.searchForm.emptyError': 'At least provide one search criteria.', | ||
'invitation.cancelInvite.actionName':'Cancel Invite', | ||
'invitation.cancelInvite.title':'Cancel Invitation', | ||
'invitation.cancelInvite.message': 'Cancel the invitation sent to {$givenName} {$familyName} will deactivate acceptance link sent via email. Here are the invitation details: <ul><li>Email Address : {$email}</li><li>Role : {$roles}</li><li>Status : {$status}</li><li>Affiliation : {$affiliation}</li></ul>', | ||
'invitation.role.modifyRole.button':'Modify Role', | ||
'invitation.masthead.show':'Appear on the masthead', | ||
'invitation.masthead.hidden':'Does not appear on the masthead', | ||
'invitation.roles':'Roles', | ||
'invitation.removeRoles':'Remove Role', | ||
}, | ||
|
||
tinyMCE: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {Primary, Controls, Stories, Meta, ArgTypes} from '@storybook/blocks'; | ||
|
||
import * as InvitationManager from './InvitationManager.stories.js'; | ||
|
||
<Meta of={InvitationManager} /> | ||
|
||
# Invitation page | ||
|
||
<ArgTypes /> |
50 changes: 50 additions & 0 deletions
50
src/managers/InvitationManager/InvitationManager.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import InvitationManager from './InvitationManager.vue'; | ||
import {http, HttpResponse} from 'msw'; | ||
import invitationMock from './mocks/invitationMock.js'; | ||
|
||
export default { | ||
title: 'Managers/InvitationManager', | ||
component: InvitationManager, | ||
}; | ||
|
||
export const Init = { | ||
render: (args) => ({ | ||
components: {InvitationManager}, | ||
setup() { | ||
return {args}; | ||
}, | ||
template: '<InvitationManager v-bind="args"/>', | ||
}), | ||
parameters: { | ||
msw: { | ||
handlers: [ | ||
http.get( | ||
'https://mock/index.php/publicknowledge/api/v1/invitations', | ||
async ({request}) => { | ||
const url = new URL(request.url); | ||
const offset = parseInt(url.searchParams.get('offset') || 0); | ||
const count = parseInt(url.searchParams.get('count')); | ||
const invitations = invitationMock.items.slice( | ||
offset, | ||
offset + count, | ||
); | ||
|
||
return HttpResponse.json({ | ||
itemsMax: invitationMock.itemsMax, | ||
items: invitations, | ||
}); | ||
}, | ||
), | ||
http.post( | ||
'https://mock/index.php/publicknowledge/api/v1/invitations/1/cancel', | ||
async ({request}) => { | ||
return HttpResponse.json({ | ||
request, | ||
}); | ||
}, | ||
), | ||
], | ||
}, | ||
}, | ||
args: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<template> | ||
<div | ||
v-if="!isInvitationLoading" | ||
class="flex items-center pb-2 pt-2 text-3xl-normal" | ||
> | ||
<h4> | ||
{{ t('invitation.header') }}({{ store.invitationsPagination.itemCount }}) | ||
</h4> | ||
<div class="ml-auto"> | ||
<PkpButton @click="store.sendInvitation"> | ||
{{ t('invitation.inviteToRole.btn') }} | ||
</PkpButton> | ||
</div> | ||
</div> | ||
<PkpTable aria-label="Example for basic table"> | ||
<TableHeader> | ||
<TableColumn>{{ t('invitation.tableHeader.name') }}</TableColumn> | ||
<TableColumn>{{ t('about.contact.email') }}</TableColumn> | ||
<TableColumn>{{ t('invitation.header') }}</TableColumn> | ||
<TableColumn>{{ t('common.status') }}</TableColumn> | ||
<TableColumn>{{ t('user.affiliation') }}</TableColumn> | ||
<TableColumn></TableColumn> | ||
</TableHeader> | ||
<TableBody> | ||
<TableRow v-for="(row, index) in store.invitations" :key="index"> | ||
<TableCell> | ||
{{ | ||
row.userId | ||
? row.existingUser.fullName | ||
: store.getFullName(row.givenName, row.familyName) | ||
}} | ||
<Icon icon="orcid" :inline="true" /> | ||
</TableCell> | ||
<TableCell> | ||
{{ row.userId ? row.existingUser.email : row.email }} | ||
</TableCell> | ||
<TableCell> | ||
<template v-for="(userGroups, i) in row.userGroupsToAdd" :key="i"> | ||
<span> | ||
{{ localize(userGroups.userGroupName) }} | ||
</span> | ||
<br /> | ||
</template> | ||
</TableCell> | ||
<TableCell> | ||
Invited | ||
{{ new Date(row.createdAt).toLocaleDateString('en-US') }} | ||
</TableCell> | ||
<TableCell> | ||
{{ | ||
row.userId | ||
? localize(row.existingUser.affiliation) | ||
: localize(row.affiliation) | ||
}} | ||
</TableCell> | ||
<TableCell> | ||
<DropdownActions | ||
:actions="[ | ||
{ | ||
label: t('common.edit'), | ||
url: store.pageUrl + '/' + row.id, | ||
icon: 'Edit', | ||
}, | ||
{ | ||
label: t('invitation.cancelInvite.actionName'), | ||
icon: 'Cancel', | ||
name: 'cancelInvite', | ||
isWarnable: true, | ||
}, | ||
]" | ||
label="Invitation management options" | ||
:display-as-ellipsis="true" | ||
direction="left" | ||
@action="(actionName) => store.handleReviewAction(row)" | ||
/> | ||
</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
</PkpTable> | ||
<div class="flex justify-end"> | ||
<Pagination | ||
:current-page="store.invitationsPagination.currentPage" | ||
:last-page="store.invitationsPagination.pageCount" | ||
:is-loading="store.isInvitationLoading" | ||
:show-adjacent-pages="3" | ||
@set-page="store.setCurrentPage" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import PkpTable from '@/components/Table/Table.vue'; | ||
import TableCell from '@/components/Table/TableCell.vue'; | ||
import TableHeader from '@/components/Table/TableHeader.vue'; | ||
import TableColumn from '@/components/Table/TableColumn.vue'; | ||
import TableBody from '@/components/Table/TableBody.vue'; | ||
import TableRow from '@/components/Table/TableRow.vue'; | ||
import Icon from '@/components/Icon/Icon.vue'; | ||
import PkpButton from '@/components/Button/Button.vue'; | ||
import {useInvitationManagerStore} from './InvitationManagerStore.js'; | ||
import Pagination from '@/components/Pagination/Pagination.vue'; | ||
import {useTranslation} from '@/composables/useTranslation'; | ||
import DropdownActions from '@/components/DropdownActions/DropdownActions.vue'; | ||
const store = useInvitationManagerStore(); | ||
const {t} = useTranslation(); | ||
</script> |
Oops, something went wrong.