Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Some bug fixes #219

Merged
merged 5 commits into from
Aug 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions src/__tests__/__snapshots__/storybook.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -369,27 +369,12 @@ exports[`Storyshots Filesystem default 1`] = `
>
<span />
<span>
<button
className="fade btn btn-outline-secondary btn-sm"
disabled={true}
type="button"
>
Rename
</button>
<span
className="fade"
>
<button
className="mx-1 btn btn-outline-secondary btn-sm"
disabled={true}
onClick={[Function]}
type="button"
>
Delete
</button>
<a
aria-disabled={true}
className="btn btn-outline-secondary btn-sm disabled"
className="mx-1 btn btn-outline-secondary btn-sm disabled"
href="http://localhost/data/download?ids="
onClick={[Function]}
onKeyDown={[Function]}
Expand All @@ -399,7 +384,7 @@ exports[`Storyshots Filesystem default 1`] = `
</a>
</span>
<button
className="btn btn-outline-secondary btn-sm"
className="ml-1 btn btn-outline-secondary btn-sm"
disabled={false}
onClick={[Function]}
type="button"
Expand Down
13 changes: 9 additions & 4 deletions src/background/api/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import {
changeStatus,
nextFsEntity
} from "../redux/actions/apiActions";
import { addToContents, removeFromContents } from "../redux/actions/filesystem";
import {
addToContents,
removeFromContents,
removeFromSelected
} from "../redux/actions/filesystem";
import {
EditableFileWithPreflightInfo,
PreflightEntity
Expand Down Expand Up @@ -118,9 +122,10 @@ export const deleteFsEntities = (files: FsEntity[]) => {
fhHostname + "/delete/" + fsEntity.fileSystemId
)
.then((response: AxiosResponse<FsEntity[]>) => {
response.data.forEach((e) =>
store.dispatch(removeFromContents(e))
);
response.data.forEach((e) => {
store.dispatch(removeFromContents(e));
store.dispatch(removeFromSelected(e));
});
resolve(response);
})
.catch((error) => reject(error));
Expand Down
8 changes: 5 additions & 3 deletions src/background/api/registration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ export const registerNewUser = async (
.catch((error: AxiosError) => {
console.log(error.response);
const response: IRegisterServerResponse = {
httpStatus: error.response!.status,
httpMessage: error.response!.statusText,
outputMessage: error.response!.data.message
httpStatus: error.response?.status ?? 500,
httpMessage:
error.response?.statusText ?? "Internal Server Error",
outputMessage:
error.response?.data.message ?? "Internal Server Error"
};
reject(response);
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/filesytem/SelectedFsEntities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function SelectedFsEntities(props: Props): ReactElement {
if (props.selectedFsEntities?.length < 1) return <span>{}</span>;

return (
<div className={"pt-2"}>
<div>
<OverlayTrigger
placement={"bottom"}
overlay={
Expand Down
35 changes: 20 additions & 15 deletions src/components/pages/filesytem/ToolbarActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { NewFolder } from "./upload/NewFolder";
import { Search } from "./search/Search";

const mapState = (state: SystemState) => ({
selectedFsEntities: state.filesystem.selectedFsEntities
selectedFsEntities: state.filesystem.selectedFsEntities,
currentFsItemId: state.filesystem.currentFsItemId
});

const connector = connect(mapState);
Expand All @@ -25,30 +26,34 @@ function ToolbarActions(props: Props): ReactElement | null {

return (
<span>
{/*
<Fade in={props.selectedFsEntities.length === 1}>
<Button
size="sm"
variant="outline-secondary"
disabled={props.selectedFsEntities.length !== 1}
>
Rename
</Button>
</Fade>
<Fade in={props.selectedFsEntities.length > 0}>
<span>
<Button
size="sm"
variant="outline-secondary"
onClick={handleDeleteClicked}
disabled={props.selectedFsEntities.length < 1}
className="mx-1"
disabled={props.selectedFsEntities.length !== 1}
>
Delete
Rename
</Button>
</Fade> */}
<Fade in={props.selectedFsEntities.length > 0}>
<span>
{props.currentFsItemId !== "-1" && (
<Button
size="sm"
variant="outline-secondary"
onClick={handleDeleteClicked}
disabled={props.selectedFsEntities.length < 1}
className="mx-1"
>
Delete
</Button>
)}
<Button
size="sm"
variant="outline-secondary"
disabled={props.selectedFsEntities.length < 1}
className="mx-1"
href={
constants.url.FH_URL +
"/download?ids=" +
Expand Down
7 changes: 6 additions & 1 deletion src/components/pages/filesytem/search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ function Search(): ReactElement {

return (
<>
<Button size="sm" variant="outline-secondary" onClick={handleShow}>
<Button
size="sm"
variant="outline-secondary"
className="ml-1"
onClick={handleShow}
>
Search
</Button>
<Modal
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/filesytem/upload/NewFolder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function NewFolder(): ReactElement {
size="sm"
variant="outline-secondary"
onClick={handleShow}
className="ml-1"
className="mx-1"
>
New Folder
</Button>
Expand Down