Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions public/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,18 @@ window.pkp = {
ROLE_ID_SUB_EDITOR: 17,
ROLE_ID_SUBSCRIPTION_MANAGER: 2097152,
STAGE_STATUS_SUBMISSION_UNASSIGNED: 1,
STATUS_QUEUED: 1,
STATUS_PUBLISHED: 3,
STATUS_DECLINED: 4,
STATUS_SCHEDULED: 5,
submission: {
STATUS_QUEUED: 1,
STATUS_PUBLISHED: 3,
STATUS_DECLINED: 4,
STATUS_SCHEDULED: 5,
},
publication: {
STATUS_QUEUED: 1,
STATUS_PUBLISHED: 3,
STATUS_DECLINED: 4,
STATUS_SCHEDULED: 5,
},
WORKFLOW_STAGE_ID_SUBMISSION: 1,
WORKFLOW_STAGE_ID_INTERNAL_REVIEW: 2,
WORKFLOW_STAGE_ID_EXTERNAL_REVIEW: 3,
Expand Down
2 changes: 0 additions & 2 deletions src/components/Form/FormGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ import FieldRadioInput from './fields/FieldRadioInput.vue';
import FieldRichTextarea from './fields/FieldRichTextarea.vue';
import FieldRichText from './fields/FieldRichText.vue';
import FieldSelect from './fields/FieldSelect.vue';
import FieldSelectIssue from './fields/FieldSelectIssue.vue';
import FieldSelectIssues from './fields/FieldSelectIssues.vue';
import FieldSelectSubmissions from './fields/FieldSelectSubmissions.vue';
import FieldSelectUsers from './fields/FieldSelectUsers.vue';
Expand Down Expand Up @@ -125,7 +124,6 @@ export default {
FieldRichTextarea,
FieldRichText,
FieldSelect,
FieldSelectIssue,
FieldSelectIssues,
FieldSelectSubmissions,
FieldSelectUsers,
Expand Down
23 changes: 0 additions & 23 deletions src/components/Form/fields/FieldSelectIssue.mdx

This file was deleted.

45 changes: 0 additions & 45 deletions src/components/Form/fields/FieldSelectIssue.stories.js

This file was deleted.

13 changes: 8 additions & 5 deletions src/components/Form/fields/FieldSelectIssue.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- TODO: need this anymore ? remove this after testing -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts on this? I don't see FieldSelectIssue used anywhere.. so I am supportive to remove it.. and just make sure that the tests are passing.

<template>
<div class="pkpFormField pkpFormField--select pkpFormField--selectIssue">
<div class="pkpFormField__heading">
Expand Down Expand Up @@ -75,7 +76,7 @@ export default {
type: String,
required: true,
},
/** One of the `PKPSubmission::STATUS_` constants. When set to `PKPSubmission::STATUS_QUEUED` or `PKPSubmission::STATUS_PUBLISHED` the issue selection will be hidden. */
/** One of the `PKPPublication::STATUS_` constants. When set to `PKPPublication::STATUS_QUEUED` or `PKPPublication::STATUS_PUBLISHED` the issue selection will be hidden. */
publicationStatus: {
type: Number,
required: true,
Expand Down Expand Up @@ -112,7 +113,7 @@ export default {
*/
button() {
let button = null;
if (this.publicationStatus !== pkp.const.STATUS_PUBLISHED) {
if (this.publicationStatus !== pkp.const.publication.STATUS_PUBLISHED) {
button = {
label: this.value ? this.changeIssueLabel : this.assignLabel,
};
Expand All @@ -128,9 +129,11 @@ export default {
*/
notice() {
let notice = '';
if (this.publicationStatus === pkp.const.STATUS_PUBLISHED) {
if (this.publicationStatus === pkp.const.publication.STATUS_PUBLISHED) {
notice = this.publishedNoticeBase;
} else if (this.publicationStatus === pkp.const.STATUS_SCHEDULED) {
} else if (
this.publicationStatus === pkp.const.publication.STATUS_SCHEDULED
) {
notice = this.scheduledNoticeBase;
} else if (this.value) {
notice = this.assignedNoticeBase;
Expand Down Expand Up @@ -167,7 +170,7 @@ export default {
const workflowStore = useWorkflowStore();

workflowStore.workflowAssignToIssue({}, (finishedData) => {
if (finishedData.data) {
if (finishedData?.data) {
this.currentValue = finishedData.data.issueId;
}
});
Expand Down
51 changes: 0 additions & 51 deletions src/components/Form/mocks/field-select-issue.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/ListPanel/doi/DoiListPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ export default {
* @returns {Boolean} Publication status of pubObject
*/
getIsPublishedBase(item) {
return item.status === pkp.const.STATUS_PUBLISHED;
return item.status === pkp.const.submission.STATUS_PUBLISHED;
},
getVersions(item) {
return (
Expand Down
14 changes: 7 additions & 7 deletions src/components/ListPanel/submissions/SubmissionsListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export default {
pkp.const.ROLE_ID_MANAGER,
pkp.const.ROLE_ID_SITE_ADMIN,
]) &&
this.item.status === pkp.const.STATUS_DECLINED
this.item.status === pkp.const.submission.STATUS_DECLINED
) {
return true;
} else if (
Expand Down Expand Up @@ -501,9 +501,9 @@ export default {
*/
isArchived() {
return (
this.item.status === pkp.const.STATUS_SCHEDULED ||
this.item.status === pkp.const.STATUS_PUBLISHED ||
this.item.status === pkp.const.STATUS_DECLINED
this.item.status === pkp.const.submission.STATUS_SCHEDULED ||
this.item.status === pkp.const.submission.STATUS_PUBLISHED ||
this.item.status === pkp.const.submission.STATUS_DECLINED
);
},

Expand All @@ -513,7 +513,7 @@ export default {
* @return {Boolean}
*/
isDeclined() {
return this.item.status === pkp.const.STATUS_DECLINED;
return this.item.status === pkp.const.submission.STATUS_DECLINED;
},

/**
Expand All @@ -522,7 +522,7 @@ export default {
* @return {Boolean}
*/
isScheduled() {
return this.item.status === pkp.const.STATUS_SCHEDULED;
return this.item.status === pkp.const.submission.STATUS_SCHEDULED;
},

/**
Expand All @@ -531,7 +531,7 @@ export default {
* @return {Boolean}
*/
isPublished() {
return this.item.status === pkp.const.STATUS_PUBLISHED;
return this.item.status === pkp.const.submission.STATUS_PUBLISHED;
},

/**
Expand Down
21 changes: 21 additions & 0 deletions src/composables/useForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,24 @@ export function useForm(_form = {}, {customSubmit} = {}) {
}
}

/**
* Set a hidden field's value
* @param {string} name - The field name
* @param {*} value - The value to set
*/
function setHiddenValue(name, value) {
form.value.hiddenFields[name] = value;
}

/**
* Get a hidden field's value
* @param {string} name - The field name
* @returns {*} The hidden field's value
*/
function getHiddenValue(name) {
return form.value.hiddenFields[name];
}

/**
* Clear a specific form field
* @param {string} fieldName - The name of the field to clear
Expand Down Expand Up @@ -344,6 +362,7 @@ export function useForm(_form = {}, {customSubmit} = {}) {
form.value.pages = [];
form.value.groups = [];
form.value.fields = [];
form.value.hiddenFields = [];

form.value.id = formId;
form.value.locales = locales;
Expand Down Expand Up @@ -584,7 +603,9 @@ export function useForm(_form = {}, {customSubmit} = {}) {
set,
setValue,
setValues,
setHiddenValue,
getValue,
getHiddenValue,
removeFieldValue,
isFieldValueArray,
clearForm,
Expand Down
10 changes: 5 additions & 5 deletions src/composables/useLegacyGridUrl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ describe('useLegacyGridUrl', () => {
);
});

test('modals.publish.AssignToIssueHandler', () => {
test('modals.documentLibrary.DocumentLibraryHandler', () => {
const {url} = useLegacyGridUrl({
component: 'modals.publish.AssignToIssueHandler',
op: 'assign',
params: {submissionId: 13, publicationId: 14},
component: 'modals.documentLibrary.DocumentLibraryHandler',
op: 'documentLibrary',
params: {submissionId: 13},
});

expect(url.value).toBe(
'http://mock/index.php/publicknowledge/$$$call$$$/modals/publish/assign-to-issue/assign?submissionId=13&publicationId=14',
'http://mock/index.php/publicknowledge/$$$call$$$/modals/document-library/document-library/document-library?submissionId=13',
);
});
});
12 changes: 6 additions & 6 deletions src/composables/useSubmission.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export function useSubmission() {
*/
function getExtendedStage(submission) {
const activeStage = getActiveStage(submission);
if (submission.status === pkp.const.STATUS_DECLINED) {
if (submission.status === pkp.const.submission.STATUS_DECLINED) {
return ExtendedStages.DECLINED;
}
switch (activeStage.id) {
Expand All @@ -239,20 +239,20 @@ export function useSubmission() {
return ExtendedStages.EXTERNAL_REVIEW;
case pkp.const.WORKFLOW_STAGE_ID_EDITING:
switch (submission.status) {
case pkp.const.STATUS_SCHEDULED:
case pkp.const.submission.STATUS_SCHEDULED:
return ExtendedStages.PRODUCTION_SCHEDULED;
case pkp.const.STATUS_PUBLISHED:
case pkp.const.submission.STATUS_PUBLISHED:
return ExtendedStages.PRODUCTION_PUBLISHED;
default:
return ExtendedStages.EDITING;
}
case pkp.const.WORKFLOW_STAGE_ID_PRODUCTION:
switch (submission.status) {
case pkp.const.STATUS_QUEUED:
case pkp.const.submission.STATUS_QUEUED:
return ExtendedStages.PRODUCTION_QUEUED;
case pkp.const.STATUS_SCHEDULED:
case pkp.const.submission.STATUS_SCHEDULED:
return ExtendedStages.PRODUCTION_SCHEDULED;
case pkp.const.STATUS_PUBLISHED:
case pkp.const.submission.STATUS_PUBLISHED:
return ExtendedStages.PRODUCTION_PUBLISHED;
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/managers/GalleyManager/useGalleyManagerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function useGalleyManagerConfig() {
const permittedActions = GalleyManagerConfiguration.actions
.filter((action) => {
if (
publication.value.status === pkp.const.STATUS_PUBLISHED &&
publication.value.status === pkp.const.publication.STATUS_PUBLISHED &&
GalleyManagerConfiguration.actionsRequiresUnpublishedState.includes(
action,
)
Expand Down Expand Up @@ -141,12 +141,14 @@ export function useGalleyManagerConfig() {

if (config.permittedActions.includes(Actions.GALLEY_EDIT)) {
const label =
publication.status === pkp.const.STATUS_PUBLISHED
publication.status === pkp.const.publication.STATUS_PUBLISHED
? t('common.view')
: t('common.edit');

const icon =
publication.status === pkp.const.STATUS_PUBLISHED ? 'View' : 'Edit';
publication.status === pkp.const.publication.STATUS_PUBLISHED
? 'View'
: 'Edit';

actions.push({
label,
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/fetch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ All components implementing this mixin have the following props.
| --- | --- |
| `apiUrl` | **Required** The URL to the API endpoint to use when retrieving items. |
| `count` | The number of items to return with each request. Default: `30` |
| `getParams` | Any query params that should be added to every request. For example, if you are showing a list of declined submissions, use `{statusIds: [pkp.const.STATUS_DECLINED]}`. |
| `getParams` | Any query params that should be added to every request. For example, if you are showing a list of declined submissions, use `{statusIds: [pkp.const.submission.STATUS_DECLINED]}`. |
| `lazyLoad` | Pass `true` to load the items as soon as the component is mounted. Default: `false` |

## Data
Expand Down
Loading