Skip to content

Commit 89341a3

Browse files
authored
Merge pull request #100 from rclone/uploadfile
Add upload file feature in explorer.
2 parents 6c87676 + 0238025 commit 89341a3

28 files changed

+944
-244
lines changed

greenkeeper.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

package-lock.json

Lines changed: 64 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
"react-autosuggest": "^10.0.0",
3535
"react-awesome-player": "^1.0.11",
3636
"react-chartjs-2": "^2.9.0",
37-
"react-dnd": "^7.7.0",
38-
"react-dnd-html5-backend": "^7.7.0",
37+
"react-dnd": "^11.1.3",
38+
"react-dnd-html5-backend": "^11.1.3",
3939
"react-dom": "^16.12.0",
4040
"react-in-viewport": "0.0.38",
4141
"react-redux": "^7.1.3",
@@ -58,8 +58,8 @@
5858
"enzyme-adapter-react-16": "^1.15.2",
5959
"enzyme-to-json": "^3.4.4",
6060
"fetch-mock": "^9.4.0",
61-
"react-dnd-test-backend": "^7.7.0",
62-
"react-dnd-test-utils": "^7.4.4",
61+
"react-dnd-test-backend": "^11.1.3",
62+
"react-dnd-test-utils": "^11.1.3",
6363
"react-scripts": "^3.3.1",
6464
"redux-mock-store": "^1.5.4"
6565
},

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ ReactDOM.render(
1717
// If you want your app to work offline and load faster, you can change
1818
// unregister() to register() below. Note this comes with some pitfalls.
1919
// Learn more about service workers: http://bit.ly/CRA-PWA
20-
serviceWorker.unregister();
20+
serviceWorker.unregister();

src/scss/_custom.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,3 +370,10 @@ body{
370370
-ms-transform: rotate(270deg) translateX(-100%);
371371
}
372372

373+
.upload-box {
374+
height: 150px;
375+
border: 2px darkgray dashed;
376+
background: rgba(211, 211, 211, 0.23);
377+
color: rgb(101, 101, 101);
378+
}
379+

src/utils/testData.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,4 +352,13 @@ export const FILE_ITEM_DATA = {
352352
MimeType: 'application/octet-stream',
353353
ModTime: '2019-06-07T22:44:37.357539000+05:30',
354354
IsDir: false
355+
};
356+
357+
export const DIR_ITEM_DATA = {
358+
Path: 'abc',
359+
Name: 'abc',
360+
Size: 0,
361+
MimeType: '',
362+
ModTime: '2019-06-07T22:44:37.357539000+05:30',
363+
IsDir: true
355364
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from "react";
2+
3+
const DropOverlay = (props) => (<div data-test="dropOverlay"
4+
style={{
5+
position: 'absolute',
6+
top: 0,
7+
left: 0,
8+
height: '100%',
9+
width: '100%',
10+
zIndex: 1,
11+
opacity: 0.5,
12+
backgroundColor: 'gray',
13+
}}
14+
/>);
15+
16+
export default DropOverlay;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import React from "react";
2+
import {shallow} from "enzyme";
3+
import toJson from "enzyme-to-json";
4+
import DropOverlay from "./DropOverlay";
5+
import {findByTestAttr, testStore} from "../../../../Utils";
6+
7+
8+
const setUp = (intialState = {}, props = {}) => {
9+
const store = testStore(intialState);
10+
11+
const component = shallow(<DropOverlay {...props} store={store}/>);
12+
return component;
13+
};
14+
15+
16+
describe('Drop Overlay', function () {
17+
describe('renders', function () {
18+
let wrapper;
19+
beforeEach(() => {
20+
const initialState = {};
21+
22+
const props = {};
23+
wrapper = setUp(initialState, props)
24+
});
25+
26+
it('should render without crashing', function () {
27+
const component = findByTestAttr(wrapper, "dropOverlay");
28+
expect(component).toHaveLength(1);
29+
});
30+
31+
it('should match snapshot', function () {
32+
expect(toJson(wrapper)).toMatchSnapshot();
33+
});
34+
35+
});
36+
});
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Drop Overlay renders should match snapshot 1`] = `
4+
<div
5+
data-test="dropOverlay"
6+
style={
7+
Object {
8+
"backgroundColor": "gray",
9+
"height": "100%",
10+
"left": 0,
11+
"opacity": 0.5,
12+
"position": "absolute",
13+
"top": 0,
14+
"width": "100%",
15+
"zIndex": 1,
16+
}
17+
}
18+
/>
19+
`;

src/views/Base/FileOperations/FileOperations.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ import {toast} from "react-toastify";
3838
import {PROP_FS_INFO} from "../../../utils/RclonePropTypes";
3939
import newFolderImg from '../../../assets/img/new-folder.png';
4040
import {cleanTrashForRemote} from "rclone-api";
41-
import {createSelector} from "reselect"; // with import
41+
import {createSelector} from "reselect";
42+
import FileUploadModal from "./FileUploadModal"; // with import
4243

4344
function getUrl(currentPath) {
4445
const {remoteName, remotePath} = currentPath;
@@ -195,11 +196,6 @@ class FileOperations extends React.Component {
195196
changePath(containerID, urlSplits[0], urlSplits[1])
196197
}
197198

198-
getLg = (n) => {
199-
const {numCols} = this.props;
200-
return Math.abs(n * numCols);
201-
}
202-
203199
render() {
204200
const {containerID, getFilesForContainerID, gridMode, navigateFwd, navigateBack, searchQuery, currentPath, doughnutData} = this.props;
205201
const {newFolderModalIsVisible, dropdownOpen, isAboutModalOpen, searchOpen, tempUrl, isUrlBarFocused} = this.state;
@@ -273,7 +269,8 @@ class FileOperations extends React.Component {
273269
<UncontrolledTooltip placement="right" target="InfoButton">
274270
Show Remote Info
275271
</UncontrolledTooltip>
276-
272+
<FileUploadModal currentPath={currentPath} buttonLabel={"Upload"}
273+
buttonClass={"btn-explorer-action"}/>
277274
<Form inline>
278275
<FormGroup>
279276
{searchOpen && <Input type="text" placeholder="Search" value={searchQuery}

0 commit comments

Comments
 (0)