Merge branch 'master' of gitlab.com:Dunemask/khufu
This commit is contained in:
commit
a42da94621
3 changed files with 8 additions and 7 deletions
|
@ -10,7 +10,7 @@ import PropTypes from "prop-types";
|
|||
import "./scss/stash/FileBox.scss";
|
||||
class FileBox extends React.Component {
|
||||
readableDate() {
|
||||
let d = new Date(parseInt(this.props.file.date));
|
||||
let d = new Date(Date.parse(this.props.file.created));
|
||||
if (isNaN(d.getMonth())) return "";
|
||||
return `${
|
||||
d.getMonth() + 1
|
||||
|
@ -34,7 +34,9 @@ class FileBox extends React.Component {
|
|||
>
|
||||
<div className="file">
|
||||
<div className="file-details">
|
||||
<span className="file-name">{this.props.file.name}</span>
|
||||
<span className="file-name">
|
||||
{this.props.file.original_filename}
|
||||
</span>
|
||||
</div>
|
||||
<div className="file-details">
|
||||
<span className="file-date">{this.readableDate()}</span>
|
||||
|
|
|
@ -40,7 +40,7 @@ class StashBoard extends React.Component {
|
|||
return toast.error("Error Loading Files");
|
||||
var fileBoxes = {};
|
||||
res.data.forEach((file, index) => {
|
||||
fileBoxes[file._id] = buildFilebox(file, index);
|
||||
fileBoxes[file.id] = buildFilebox(file, index);
|
||||
});
|
||||
this.setState({ fileBoxes });
|
||||
})
|
||||
|
@ -64,7 +64,7 @@ class StashBoard extends React.Component {
|
|||
|
||||
addFilebox(file) {
|
||||
var fileBoxes = this.state.fileBoxes;
|
||||
fileBoxes[file._id] = buildFilebox(file, Object.keys(fileBoxes).length);
|
||||
fileBoxes[file.id] = buildFilebox(file, Object.keys(fileBoxes).length);
|
||||
this.setState({ fileBoxes });
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ export default class StashContextMenu extends React.Component {
|
|||
this.props.fileBoxesChanged(fileBoxes);
|
||||
}
|
||||
handleDownload(url, file) {
|
||||
const downloadName = `${file.date}-${file.name}`;
|
||||
const downloadName = `${file.filename}`;
|
||||
const config = {
|
||||
method: "GET",
|
||||
"Content-Type": "application/octet-stream",
|
||||
|
@ -72,7 +72,7 @@ export default class StashContextMenu extends React.Component {
|
|||
onDownloadProgress: (e) =>
|
||||
this.props.updateDownload(downloadId, e.loaded, e.total),
|
||||
};
|
||||
const downloadId = this.props.startDownload(file.name);
|
||||
const downloadId = this.props.startDownload(file.filename);
|
||||
window.cairoApi.request(url, config).then((response) => {
|
||||
if (response.status !== 200)
|
||||
return toast.error("There was an error downloading that!");
|
||||
|
@ -87,7 +87,6 @@ export default class StashContextMenu extends React.Component {
|
|||
*/
|
||||
handleDelete(res, selectedBoxes) {
|
||||
const failedFiles = res.data || [];
|
||||
console.log(res);
|
||||
if (res.status !== 200) toast.error("Error Deleting Some Files");
|
||||
let fileBoxes = this.props.fileBoxes;
|
||||
selectedBoxes.forEach((selectedBoxId) => {
|
||||
|
|
Reference in a new issue