From 13b31997a5476e96cce81c9c5093149ce2829f9f Mon Sep 17 00:00:00 2001 From: Elijah Dunemask Date: Thu, 18 Nov 2021 00:23:24 +0000 Subject: [PATCH] Upgraded APIS to use the new Nubian ones --- Dockerfile | 1 + src/stash/FileBox.jsx | 6 ++++-- src/stash/StashBoard.jsx | 4 ++-- src/stash/StashContextMenu.jsx | 5 ++--- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8f75db6..ced7e12 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ COPY package.json . RUN npm i COPY public public COPY src src +ARG REACT_APP_CAIRO_URL RUN npm run build:react COPY server server CMD ["npm", "start"] diff --git a/src/stash/FileBox.jsx b/src/stash/FileBox.jsx index 7ccfe80..bf6d9bb 100644 --- a/src/stash/FileBox.jsx +++ b/src/stash/FileBox.jsx @@ -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 { >
- {this.props.file.name} + + {this.props.file.original_filename} +
{this.readableDate()} diff --git a/src/stash/StashBoard.jsx b/src/stash/StashBoard.jsx index a0995a1..b502b60 100644 --- a/src/stash/StashBoard.jsx +++ b/src/stash/StashBoard.jsx @@ -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 }); } diff --git a/src/stash/StashContextMenu.jsx b/src/stash/StashContextMenu.jsx index 0dbbc4e..ecf85c3 100644 --- a/src/stash/StashContextMenu.jsx +++ b/src/stash/StashContextMenu.jsx @@ -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) => {