Skip to content

Commit

Permalink
Merge branch 'pkp:main' into multiple-author-affiliations
Browse files Browse the repository at this point in the history
  • Loading branch information
GaziYucel authored Oct 10, 2024
2 parents 87ec4d5 + 9e986d6 commit 013c7c5
Show file tree
Hide file tree
Showing 40 changed files with 587 additions and 644 deletions.
12 changes: 6 additions & 6 deletions src/components/Container/WorkflowPage.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<script type="text/javascript">
import Page from './Page.vue';
import ContributorsListPanel from '@/components/ListPanel/contributors/ContributorsListPanel.vue';
import PublicationSectionJats from '@/pages/workflow/PublicationSectionJats.vue';
import WorkflowPublicationJats from '@/pages/workflow/components/publication/WorkflowPublicationJats.vue';
import Composer from '@/components/Composer/Composer.vue';
import Dropdown from '@/components/Dropdown/Dropdown.vue';
import Modal from '@/components/Modal/Modal.vue';
import PkpHeader from '@/components/Header/Header.vue';
import LocalizeSubmission from '@/mixins/localizeSubmission.js';
import ajaxError from '@/mixins/ajaxError';
import dialog from '@/mixins/dialog.js';
import ChangeSubmissionLanguage from '@/pages/workflow/ChangeSubmissionLanguage.vue';
import SelectRevisionDecisionModal from '@/pages/workflow/SelectRevisionDecisionModal.vue';
import WorkflowChangeSubmissionLanguage from '@/pages/workflow/components/publication/WorkflowChangeSubmissionLanguage.vue';
import SelectRevisionDecisionModal from '@/pages/workflow/modals/WorkflowSelectRevisionDecisionModalLegacyWorkflow.vue';
import {useModal} from '@/composables/useModal';
export default {
name: 'WorkflowPage',
components: {
ChangeSubmissionLanguage,
WorkflowChangeSubmissionLanguage,
ContributorsListPanel,
Composer,
Dropdown,
Modal,
PkpHeader,
PublicationSectionJats,
WorkflowPublicationJats,
},
extends: Page,
mixins: [LocalizeSubmission, dialog, ajaxError],
Expand Down Expand Up @@ -320,7 +320,7 @@ export default {
*/
openChangeSubmissionLanguageModal() {
const {openSideModal} = useModal();
openSideModal(ChangeSubmissionLanguage, {
openSideModal(WorkflowChangeSubmissionLanguage, {
form: this.components[
pkp.const.FORM_CHANGE_SUBMISSION_LANGUAGE_METADATA
],
Expand Down
8 changes: 4 additions & 4 deletions src/components/Form/fields/FieldSelectIssue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ export default {
// workaround to avoid circular dependencies in storybook
// There is chain if imports, and some of them imported form
// which seems to be causing circular dependency
const {useSubmissionSummaryStore} = await import(
'@/pages/dashboard/SubmissionSummaryModal/submissionSummaryStore.js'
const {useWorkflowStore} = await import(
'@/pages/workflow/workflowStore.js'
);
const summaryStore = useSubmissionSummaryStore();
const workflowSotre = useWorkflowStore();
summaryStore.workflowAssignToIssue({}, (finishedData) => {
workflowSotre.workflowAssignToIssue({}, (finishedData) => {
if (finishedData.data.issueId) {
this.currentValue = finishedData.data.issueId;
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/Modal/ModalManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ import {storeToRefs} from 'pinia';
import SideModal from '@/components/Modal/SideModal.vue';
import LegacyAjax from '@/components/Modal/SideModalBodyLegacyAjax.vue';
import PkpDialog from '@/components/Modal/Dialog.vue';
import WorkflowLogResponseForModal from '@/pages/workflow/WorkflowLogResponseForModal.vue';
const GlobalModals = {LegacyAjax, WorkflowLogResponseForModal};
const GlobalModals = {LegacyAjax};
const modalStore = useModalStore();
const {
Expand Down
40 changes: 38 additions & 2 deletions src/composables/useSideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,41 @@ export function useSideMenu(_items, opts = {}) {
return expandedKeys;
}

function findParentKeys(items, key, parents = []) {
for (const item of items) {
// if item key matches the active key, return the item parents
if (item.key === key) {
return parents;
}

// if the item has nested items, continue searching
if (item.items) {
const result = findParentKeys(item.items, key, [...parents, item.key]);
if (result) {
return result;
}
}
}

// if the key was not found, return null
return null;
}

function setActiveItemKey(key = '') {
activeItemKey.value = key;

const parentKeys = findParentKeys(items.value, key);
if (parentKeys) {
setExpandedKeys([...parentKeys, ...Object.keys(_expandedKeys)]);
}
}

function compareUrlPaths(url1, url2) {
const parsedUrl1 = new URL(url1);
const parsedUrl2 = new URL(url2);
const parsedUrl1 = isValidURL(url1) ? new URL(url1) : false;
const parsedUrl2 = isValidURL(url2) ? new URL(url2) : false;
return (
parsedUrl1 &&
parsedUrl2 &&
parsedUrl1.pathname === parsedUrl2.pathname &&
parsedUrl1.hostname === parsedUrl2.hostname
);
Expand Down Expand Up @@ -110,6 +137,15 @@ export function useSideMenu(_items, opts = {}) {
return result;
}

function isValidURL(string) {
try {
new URL(string);
return true;
} catch (_) {
return false;
}
}

const sideMenuProps = computed(() => ({
items: items.value,
expandedKeys: expandedKeys.value,
Expand Down
2 changes: 1 addition & 1 deletion src/composables/useSideMenu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const {selectedItem} = useSideMenu(items, 'menuItem2_1'); // will return {label:

### setActiveItemKey

This function allows you to set a new active item key dynamically from within your component or from other components that consume the `useSideMenu` composable. It accepts a string that represents the key of the item you want to set as active. This value will be assigned to the `activeItemKey` ref.
This function allows you to set a new active item key dynamically from within your component or from other components that consume the `useSideMenu` composable. It accepts a string that represents the key of the item you want to set as active. This value will be assigned to the `activeItemKey` ref. Additionally, the function updates the `expandedKeys` to include the parent keys of the active item, while retaining the initially expanded keys set in the API.

```javascript
const {activeItemKey, setActiveItemKey} = useSideMenu(items, {
Expand Down
5 changes: 3 additions & 2 deletions src/pages/dashboard/DashboardPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
</div>
<div class="mt-4">
<ActiveFilters
<DashboardActiveFilters
:active-filters-list="store.filtersFormList"
@clear-filters="store.clearFiltersForm"
@remove-filter="store.clearFiltersFormField"
Expand All @@ -44,7 +44,7 @@
</template>
<script setup>
import PkpButton from '@/components/Button/Button.vue';
import ActiveFilters from './components/ActiveFilters.vue';
import DashboardActiveFilters from './components/DashboardActiveFilters.vue';
import DashboardTable from './components/DashboardTable/DashboardTable.vue';
import Search from '@/components/Search/Search.vue';
Expand Down Expand Up @@ -102,3 +102,4 @@ const store = useDashboardPageStore(props);
@apply bg-secondary p-0;
}
</style>
./components/DashboardActiveFilters.vue

This file was deleted.

This file was deleted.

Loading

0 comments on commit 013c7c5

Please sign in to comment.