Skip to content

Commit

Permalink
Fixed delete object behavior (#1646)
Browse files Browse the repository at this point in the history
Also fixed an issue with multi-select & panel sizes

Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>

Co-authored-by: Benjamin Perez <benjamin@bexsoft.net>
  • Loading branch information
bexsoft and Benjamin Perez committed Mar 1, 2022
1 parent 57e995f commit a0bf2b4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const styles = (theme: Theme) =>
browsePaper: {
height: "calc(100vh - 210px)",
"&.actionsPanelOpen": {
height: "100%",
minHeight: "100%",
},
},
"@global": {
Expand Down Expand Up @@ -1043,6 +1043,17 @@ const ListObjects = ({
uploadPath = uploadPath.concat(currentPath);
}

const onClosePanel = (forceRefresh: boolean) => {
setDetailsOpen(false);
setSelectedInternalPaths(null);
setSelectedObjects([]);
setVersionsModeEnabled(false);

if(forceRefresh) {
setLoading(true);
}
};

const tableActions: ItemActions[] = [
{
type: "view",
Expand Down Expand Up @@ -1309,10 +1320,7 @@ const ListObjects = ({
<DetailsListPanel
open={detailsOpen}
closePanel={() => {
setDetailsOpen(false);
setSelectedInternalPaths(null);
setSelectedObjects([]);
setVersionsModeEnabled(false);
onClosePanel(false);
}}
>
{selectedObjects.length > 0 && (
Expand All @@ -1325,6 +1333,7 @@ const ListObjects = ({
<ObjectDetailPanel
internalPaths={selectedInternalPaths}
bucketName={bucketName}
onClosePanel={onClosePanel}
/>
)}
</DetailsListPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import {
VersionsIcon,
} from "../../../../../../icons";
import { ShareIcon, DownloadIcon, DeleteIcon } from "../../../../../../icons";
import history from "../../../../../../history";
import api from "../../../../../../common/api";
import ShareFile from "../ObjectDetails/ShareFile";
import SetRetention from "../ObjectDetails/SetRetention";
Expand Down Expand Up @@ -147,6 +146,7 @@ interface IObjectDetailPanelProps {
distributedSetup: boolean;
versionsMode: boolean;
selectedVersion: string;
onClosePanel: (hardRefresh: boolean) => void;
setErrorSnackMessage: typeof setErrorSnackMessage;
setSnackBarMessage: typeof setSnackBarMessage;
setNewObject: typeof setNewObject;
Expand Down Expand Up @@ -178,6 +178,7 @@ const ObjectDetailPanel = ({
completeObject,
versionsMode,
selectedVersion,
onClosePanel,
setVersionsModeEnabled,
}: IObjectDetailPanelProps) => {
const [loadObjectData, setLoadObjectData] = useState<boolean>(true);
Expand Down Expand Up @@ -328,16 +329,11 @@ const ObjectDetailPanel = ({
);
};

const closeDeleteModal = (redirectBack: boolean) => {
const closeDeleteModal = (closeAndReload: boolean) => {
setDeleteOpen(false);

if (redirectBack) {
const newPath = allPathData.join("/");
history.push(
`/buckets/${bucketName}/browse${
newPath === "" ? "" : `/${encodeFileName(newPath)}`
}`
);
if (closeAndReload) {
onClosePanel(true);
}
};

Expand Down Expand Up @@ -454,35 +450,6 @@ const ObjectDetailPanel = ({
},
];

/*
*
*
* <Box className={classes.detailContainer}>
{selectedVersion === "" ? (
<LabelValuePair
label={"Tags:"}
value={
<ObjectTags
objectInfo={actualInfo}
tagKeys={tagKeys}
bucketName={bucketName}
onDeleteTag={deleteTag}
onAddTagClick={() => {
setTagModalOpen(true);
}}
/>
}
/>
) : (
<Fragment>
<strong>Tags: </strong>
<br />
</Fragment>
)}
</Box>
*
* */
const calculateLastModifyTime = (lastModified: string) => {
const currentTime = new Date();
const modifiedTime = new Date(lastModified);
Expand Down

0 comments on commit a0bf2b4

Please sign in to comment.