Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jardakotesovec committed Sep 10, 2024
1 parent b37f75c commit 7040ec0
Show file tree
Hide file tree
Showing 18 changed files with 502 additions and 596 deletions.
24 changes: 23 additions & 1 deletion src/composables/useLegacyGridUrl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {ref, computed} from 'vue';
import {useModal} from '@/composables/useModal';

function camelCaseToDashes(str) {
return str.replace(/([a-z]+)([A-Z])/g, '$1-$2').toLowerCase();
Expand Down Expand Up @@ -34,5 +35,26 @@ export function useLegacyGridUrl({
return `${baseUrl}${queryParamsString.value}`;
});

return {url};
function openLegacyModal({title, closeOnFormSuccessId}, finishedCallback) {
const {openSideModal} = useModal();

openSideModal(
'LegacyAjax',
{
legacyOptions: {
title,
url,
closeOnFormSuccessId,
},
},
{
onClose: async () => {
console.log('openLegacyModel OnClose');
finishedCallback();
},
},
);
}

return {url, openLegacyModal};
}
5 changes: 3 additions & 2 deletions src/managers/FileManager/FileManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<TableColumn>Date Uploaded</TableColumn>
<TableColumn>Type</TableColumn>
<TableColumn v-if="fileManagerStore.itemActions.length">
<span class="sr-only">Actions (t)</span>
<span class="sr-only">{{ t('common.moreActions') }}</span>
</TableColumn>
</TableHeader>
<TableBody>
Expand All @@ -35,7 +35,7 @@
:key="file.id"
:action-items="fileManagerStore.itemActions"
:file="file"
@action="fileManagerStore.handleItemAction"
@action="fileManagerStore.handleAction"
></FileManagerTableRow>
</TableBody>
</PkpTable>
Expand Down Expand Up @@ -63,6 +63,7 @@ import TableHeader from '@/components/TableNext/TableHeader.vue';
import TableBody from '@/components/TableNext/TableBody.vue';
import TableColumn from '@/components/TableNext/TableColumn.vue';
import FileManagerTableRow from './FileManagerTableRow.vue';
import {t} from '@/utils/i18n.js';
const props = defineProps({
configName: {
Expand Down
30 changes: 8 additions & 22 deletions src/managers/FileManager/fileManagerStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,11 @@ export const useFileManagerStore = defineComponentStore(
}),
);

function handleItemAction(actionName, {file}) {
_actionFns.handleItemAction(
actionName,
{
file,
submissionStageId: props.submissionStageId,
reviewRoundId: props.reviewRoundId,
submission: props.submission,
},
() => {
triggerDataChange();
// delete actions creates legacy notifications
// calling explicitely to check for it
if (actionName === Actions.DELETE) {
$('body').trigger('notifyUser');
}
},
);
}

function handleAction(actionName) {
function handleAction(actionName, _args) {
_actionFns.handleAction(
actionName,
{
..._args,
submissionStageId: props.submissionStageId,
reviewRoundId: props.reviewRoundId,
submission: props.submission,
Expand All @@ -99,6 +80,12 @@ export const useFileManagerStore = defineComponentStore(
},
() => {
triggerDataChange();

// delete actions creates legacy notifications
// calling explicitely to check for it
if (actionName === Actions.DELETE) {
$('body').trigger('notifyUser');
}
},
);
}
Expand All @@ -111,7 +98,6 @@ export const useFileManagerStore = defineComponentStore(
topActions,
bottomActions,
itemActions,
handleItemAction,
handleAction,
/** exposed for extensibility purposes */
_actionFns,
Expand Down
Loading

0 comments on commit 7040ec0

Please sign in to comment.