IO-889 Document Upload notification and file list clear
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { UploadOutlined } from "@ant-design/icons";
|
||||
import { notification, Progress, Result, Space, Upload } from "antd";
|
||||
import React, { useMemo } from "react";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -27,6 +27,7 @@ export function DocumentsUploadComponent({
|
||||
ignoreSizeLimit = false,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [fileList, setFileList] = useState([]);
|
||||
|
||||
const pct = useMemo(() => {
|
||||
return parseInt(
|
||||
@@ -40,12 +41,24 @@ export function DocumentsUploadComponent({
|
||||
status="error"
|
||||
title={t("documents.labels.storageexceeded_title")}
|
||||
subTitle={t("documents.labels.storageexceeded")}
|
||||
></Result>
|
||||
/>
|
||||
);
|
||||
|
||||
const handleDone = (uid) => {
|
||||
setTimeout(() => {
|
||||
setFileList((fileList) => fileList.filter((x) => x.uid !== uid));
|
||||
}, 2000);
|
||||
};
|
||||
|
||||
return (
|
||||
<Upload.Dragger
|
||||
multiple={true}
|
||||
fileList={fileList}
|
||||
onChange={(f) => {
|
||||
console.log(`f`, f);
|
||||
if (f.event && f.event.percent === 100) handleDone(f.file.uid);
|
||||
setFileList(f.fileList);
|
||||
}}
|
||||
beforeUpload={(file, fileList) => {
|
||||
if (ignoreSizeLimit) return true;
|
||||
const newFiles = fileList.reduce((acc, val) => acc + val.size, 0);
|
||||
|
||||
@@ -56,9 +56,12 @@ export default function JobsDocumentsDeleteButton({
|
||||
.then((response) => {
|
||||
deleteDocument({ variables: { id: image.id } })
|
||||
.then((r) => {
|
||||
notification["success"]({
|
||||
notification.open({
|
||||
key: "docdeletedsuccesfully",
|
||||
type: "success",
|
||||
message: t("documents.successes.delete"),
|
||||
});
|
||||
|
||||
if (deletionCallback) deletionCallback();
|
||||
})
|
||||
.catch((error) => {
|
||||
|
||||
@@ -679,7 +679,7 @@
|
||||
"usage": "of job storage used. ({{used}} / {{total}})"
|
||||
},
|
||||
"successes": {
|
||||
"delete": "Document deleted successfully.",
|
||||
"delete": "Document(s) deleted successfully.",
|
||||
"insert": "Uploaded document successfully. ",
|
||||
"updated": "Document updated successfully. "
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import { setEmailOptions } from "../redux/email/email.actions";
|
||||
import { store } from "../redux/store";
|
||||
import client from "../utils/GraphQLClient";
|
||||
import { TemplateList } from "./TemplateConstants";
|
||||
import _ from "lodash";
|
||||
const server = process.env.REACT_APP_REPORTS_SERVER_URL;
|
||||
jsreport.serverUrl = server;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user