Upgraded APIS to use the new Nubian ones

This commit is contained in:
Elijah Dunemask 2021-11-18 00:23:24 +00:00
parent 690ce1ef7b
commit 13b31997a5
4 changed files with 9 additions and 7 deletions

View file

@ -4,6 +4,7 @@ COPY package.json .
RUN npm i RUN npm i
COPY public public COPY public public
COPY src src COPY src src
ARG REACT_APP_CAIRO_URL
RUN npm run build:react RUN npm run build:react
COPY server server COPY server server
CMD ["npm", "start"] CMD ["npm", "start"]

View file

@ -10,7 +10,7 @@ import PropTypes from "prop-types";
import "./scss/stash/FileBox.scss"; import "./scss/stash/FileBox.scss";
class FileBox extends React.Component { class FileBox extends React.Component {
readableDate() { 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 ""; if (isNaN(d.getMonth())) return "";
return `${ return `${
d.getMonth() + 1 d.getMonth() + 1
@ -34,7 +34,9 @@ class FileBox extends React.Component {
> >
<div className="file"> <div className="file">
<div className="file-details"> <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>
<div className="file-details"> <div className="file-details">
<span className="file-date">{this.readableDate()}</span> <span className="file-date">{this.readableDate()}</span>

View file

@ -40,7 +40,7 @@ class StashBoard extends React.Component {
return toast.error("Error Loading Files"); return toast.error("Error Loading Files");
var fileBoxes = {}; var fileBoxes = {};
res.data.forEach((file, index) => { res.data.forEach((file, index) => {
fileBoxes[file._id] = buildFilebox(file, index); fileBoxes[file.id] = buildFilebox(file, index);
}); });
this.setState({ fileBoxes }); this.setState({ fileBoxes });
}) })
@ -64,7 +64,7 @@ class StashBoard extends React.Component {
addFilebox(file) { addFilebox(file) {
var fileBoxes = this.state.fileBoxes; 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 }); this.setState({ fileBoxes });
} }

View file

@ -64,7 +64,7 @@ export default class StashContextMenu extends React.Component {
this.props.fileBoxesChanged(fileBoxes); this.props.fileBoxesChanged(fileBoxes);
} }
handleDownload(url, file) { handleDownload(url, file) {
const downloadName = `${file.date}-${file.name}`; const downloadName = `${file.filename}`;
const config = { const config = {
method: "GET", method: "GET",
"Content-Type": "application/octet-stream", "Content-Type": "application/octet-stream",
@ -72,7 +72,7 @@ export default class StashContextMenu extends React.Component {
onDownloadProgress: (e) => onDownloadProgress: (e) =>
this.props.updateDownload(downloadId, e.loaded, e.total), 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) => { window.cairoApi.request(url, config).then((response) => {
if (response.status !== 200) if (response.status !== 200)
return toast.error("There was an error downloading that!"); return toast.error("There was an error downloading that!");
@ -87,7 +87,6 @@ export default class StashContextMenu extends React.Component {
*/ */
handleDelete(res, selectedBoxes) { handleDelete(res, selectedBoxes) {
const failedFiles = res.data || []; const failedFiles = res.data || [];
console.log(res);
if (res.status !== 200) toast.error("Error Deleting Some Files"); if (res.status !== 200) toast.error("Error Deleting Some Files");
let fileBoxes = this.props.fileBoxes; let fileBoxes = this.props.fileBoxes;
selectedBoxes.forEach((selectedBoxId) => { selectedBoxes.forEach((selectedBoxId) => {