Skip to content

Commit

Permalink
Added URL support to object view (#1831)
Browse files Browse the repository at this point in the history
- Added URL support to object view
- Refactored & simplified requests

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
  • Loading branch information
bexsoft committed Apr 14, 2022
1 parent e6404be commit a30d29b
Show file tree
Hide file tree
Showing 17 changed files with 541 additions and 435 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ import { connect } from "react-redux";
import history from "../../../../../../history";
import { decodeFileName, encodeFileName } from "../../../../../../common/utils";
import { setModalErrorSnackMessage } from "../../../../../../actions";
import { BucketObject } from "./types";
import { BucketObjectItem } from "./types";
import { CreateNewPathIcon } from "../../../../../../icons";

interface ICreateFolder {
classes: any;
modalOpen: boolean;
bucketName: string;
folderName: string;
setModalErrorSnackMessage: typeof setModalErrorSnackMessage;
onClose: () => any;
existingFiles: BucketObject[];
existingFiles: BucketObjectItem[];
setModalErrorSnackMessage: typeof setModalErrorSnackMessage;
}

const styles = (theme: Theme) =>
Expand Down Expand Up @@ -74,8 +74,9 @@ const CreateFolderModal = ({
? decodedFolderName
: `${decodedFolderName}/`;
}
const sharesName = (record: BucketObject) =>
const sharesName = (record: BucketObjectItem) =>
record.name === folderPath + pathUrl;

if (existingFiles.findIndex(sharesName) !== -1) {
setModalErrorSnackMessage({
errorMessage: "Folder cannot have the same name as an existing file",
Expand All @@ -84,8 +85,8 @@ const CreateFolderModal = ({
return;
}
const newPath = `/buckets/${bucketName}/browse/${encodeFileName(
`${folderPath}${pathUrl}`
)}/`;
`${folderPath}${pathUrl}/`
)}`;
history.push(newPath);
onClose();
};
Expand Down

0 comments on commit a30d29b

Please sign in to comment.