Skip to content

Commit

Permalink
Corrected mutation hook to return archive in current directory instea…
Browse files Browse the repository at this point in the history
…d of root
  • Loading branch information
Jeff McMillen authored and Jeff McMillen committed Dec 6, 2024
1 parent 6e13705 commit 9ff27eb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
1 change: 0 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
"@testing-library/jest-dom": "^5.0.2",
"@testing-library/react": "^16.0.1",
"@types/js-cookie": "^3.0.6",
"@types/node": "^22.9.0",
"@types/react": "^18.3.10",
"@types/react-dom": "^18.3.0",
"@types/react-redux": "^7.1.18",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const DataFilesCompressModal = () => {
/>
<p>
A job to compress these files will be submitted. The
compressed file archive will appear in the Root directory.
compressed file archive will appear in this directory.
</p>
</ModalBody>
<ModalFooter>
Expand Down
6 changes: 4 additions & 2 deletions client/src/hooks/datafiles/mutations/useCompress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ async function submitJobUtil(body: TJobBody) {
return res.data.response;
}



function useCompress() {
const dispatch = useDispatch();
const status = useSelector(
Expand Down Expand Up @@ -78,6 +76,10 @@ function useCompress() {

let defaultPrivateSystem: TPortalSystem | undefined;

if (files[0].scheme === 'private' && files[0].api === 'tapis') {
defaultPrivateSystem === null
};

if (scheme !== 'private' && scheme !== 'projects') {
defaultPrivateSystem = systems.find((s: any) => s.default);

Expand Down
17 changes: 10 additions & 7 deletions client/src/utils/getCompressParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ export const getCompressParams = (

let archivePath, archiveSystem;

if (defaultPrivateSystem) {
archivePath = defaultPrivateSystem.homeDir;
archiveSystem = defaultPrivateSystem.system;
} else {
archivePath = `${files[0].path.slice(0, -files[0].name.length)}`;
archiveSystem = files[0].system;
}
// if (defaultPrivateSystem) {
// archivePath = defaultPrivateSystem.homeDir;
// archiveSystem = defaultPrivateSystem.system;
// } else {
// archivePath = `${files[0].path.slice(0, -files[0].name.length)}`;
// archiveSystem = files[0].system;
// }

archivePath = `${files[0].path.slice(0, -files[0].name.length)}`;
archiveSystem = files[0].system;

return {
fileInputs: fileInputs,
Expand Down
2 changes: 2 additions & 0 deletions client/src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,6 @@ export type TTapisFile = {
length: number;
permissions: string;
doi?: string;
scheme?: string;
api?: string;
};

0 comments on commit 9ff27eb

Please sign in to comment.