diff --git a/browser/app/js/uploads/Dropzone.js b/browser/app/js/uploads/Dropzone.js index 7792306b3..8e5afdb87 100644 --- a/browser/app/js/uploads/Dropzone.js +++ b/browser/app/js/uploads/Dropzone.js @@ -48,18 +48,29 @@ export class Dropzone extends React.Component { const rejectStyle = { backgroundColor: "#ffdddd" } + const getStyle = (isDragActive, isDragAccept, isDragReject) => ({ + ...style, + ...(isDragActive ? activeStyle : {}), + ...(isDragReject ? rejectStyle : {}) + }) // disableClick means that it won't trigger a file upload box when // the user clicks on a file. return ( - {this.props.children} + {({getRootProps, getInputProps, isDragActive, isDragAccept, isDragReject}) => ( +
event.stopPropagation() + })} + style={getStyle(isDragActive, isDragAccept, isDragReject)} + > + + {this.props.children} +
+ )}
) } diff --git a/browser/app/js/uploads/actions.js b/browser/app/js/uploads/actions.js index 33a756148..9d6ac4da0 100644 --- a/browser/app/js/uploads/actions.js +++ b/browser/app/js/uploads/actions.js @@ -89,11 +89,16 @@ export const uploadFile = file => { return } const currentPrefix = getCurrentPrefix(state) - const objectName = `${currentPrefix}${file.name}` + var _filePath = file.path || file.name + if (_filePath.charAt(0) == '/') { + _filePath = _filePath.substring(1) + } + const filePath = _filePath + const objectName = `${currentPrefix}${filePath}` const uploadUrl = `${ window.location.origin }${minioBrowserPrefix}/upload/${currentBucket}/${objectName}` - const slug = `${currentBucket}-${currentPrefix}-${file.name}` + const slug = `${currentBucket}-${currentPrefix}-${filePath}` let xhr = new XMLHttpRequest() xhr.open("PUT", uploadUrl, true) @@ -141,7 +146,7 @@ export const uploadFile = file => { dispatch( alertActions.set({ type: "success", - message: "File '" + file.name + "' uploaded successfully." + message: "File '" + filePath + "' uploaded successfully." }) ) dispatch(objectsActions.selectPrefix(currentPrefix)) @@ -153,7 +158,7 @@ export const uploadFile = file => { dispatch( alertActions.set({ type: "danger", - message: "Error occurred uploading '" + file.name + "'." + message: "Error occurred uploading '" + filePath + "'." }) ) }) diff --git a/browser/package-lock.json b/browser/package-lock.json index 51224b0c8..7bd5cd11a 100644 --- a/browser/package-lock.json +++ b/browser/package-lock.json @@ -2368,19 +2368,9 @@ "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==" }, "attr-accept": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/attr-accept/-/attr-accept-1.1.3.tgz", - "integrity": "sha512-iT40nudw8zmCweivz6j58g+RT33I4KbaIvRUhjNmDwO2WmsQUxFEZZYZ5w3vXe5x5MX9D7mfvA/XaLOZYFR9EQ==", - "requires": { - "core-js": "^2.5.0" - }, - "dependencies": { - "core-js": { - "version": "2.6.11", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.11.tgz", - "integrity": "sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg==" - } - } + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/attr-accept/-/attr-accept-2.1.0.tgz", + "integrity": "sha512-sLzVM3zCCmmDtDNhI0i96k6PUztkotSOXqE4kDGQt/6iDi5M+H0srjeF+QC6jN581l4X/Zq3Zu/tgcErEssavg==" }, "aws-sign2": { "version": "0.7.0", @@ -6758,6 +6748,14 @@ "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==" }, + "file-selector": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/file-selector/-/file-selector-0.1.12.tgz", + "integrity": "sha512-Kx7RTzxyQipHuiqyZGf+Nz4vY9R1XGxuQl/hLoJwq+J4avk/9wxxgZyHKtbyIPJmbD4A66DWGYfyykWNpcYutQ==", + "requires": { + "tslib": "^1.9.0" + } + }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", @@ -12737,12 +12735,33 @@ } }, "react-dropzone": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-4.3.0.tgz", - "integrity": "sha512-ULfrLaTSsd8BDa9KVAGCueuq1AN3L14dtMsGGqtP0UwYyjG4Vhf158f/ITSHuSPYkZXbvfcIiOlZsH+e3QWm+Q==", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/react-dropzone/-/react-dropzone-11.0.1.tgz", + "integrity": "sha512-x/6wqRHaR8jsrNiu/boVMIPYuoxb83Vyfv77hO7/3ZRn8Pr+KH5onsCsB8MLBa3zdJl410C5FXPUINbu16XIzw==", "requires": { - "attr-accept": "^1.1.3", - "prop-types": "^15.5.7" + "attr-accept": "^2.0.0", + "file-selector": "^0.1.12", + "prop-types": "^15.7.2" + }, + "dependencies": { + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "prop-types": { + "version": "15.7.2", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz", + "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==", + "requires": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.8.1" + } + } } }, "react-infinite-scroller": { diff --git a/browser/package.json b/browser/package.json index ddf200f08..aaf5b7da4 100644 --- a/browser/package.json +++ b/browser/package.json @@ -81,7 +81,7 @@ "react-copy-to-clipboard": "^5.0.2", "react-custom-scrollbars": "^4.2.1", "react-dom": "^16.13.1", - "react-dropzone": "^4.3.0", + "react-dropzone": "^11.0.1", "react-infinite-scroller": "^1.2.4", "react-onclickout": "^2.0.8", "react-redux": "^5.1.2",