Always include task files in company export, remove toggle button
Tasks are now loaded by default on the export page (unchecked and folded as before). The "Load task files" / "Hide task files" button is removed since it is no longer needed. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -536,7 +536,6 @@ export function CompanyExport() {
|
|||||||
const [checkedFiles, setCheckedFiles] = useState<Set<string>>(new Set());
|
const [checkedFiles, setCheckedFiles] = useState<Set<string>>(new Set());
|
||||||
const [treeSearch, setTreeSearch] = useState("");
|
const [treeSearch, setTreeSearch] = useState("");
|
||||||
const [taskLimit, setTaskLimit] = useState(TASKS_PAGE_SIZE);
|
const [taskLimit, setTaskLimit] = useState(TASKS_PAGE_SIZE);
|
||||||
const [includeTasks, setIncludeTasks] = useState(false);
|
|
||||||
const savedExpandedRef = useRef<Set<string> | null>(null);
|
const savedExpandedRef = useRef<Set<string> | null>(null);
|
||||||
const initialFileFromUrl = useRef(filePathFromLocation(location.pathname));
|
const initialFileFromUrl = useRef(filePathFromLocation(location.pathname));
|
||||||
|
|
||||||
@@ -581,7 +580,7 @@ export function CompanyExport() {
|
|||||||
const exportPreviewMutation = useMutation({
|
const exportPreviewMutation = useMutation({
|
||||||
mutationFn: () =>
|
mutationFn: () =>
|
||||||
companiesApi.exportPreview(selectedCompanyId!, {
|
companiesApi.exportPreview(selectedCompanyId!, {
|
||||||
include: { company: true, agents: true, projects: true, issues: includeTasks },
|
include: { company: true, agents: true, projects: true, issues: true },
|
||||||
}),
|
}),
|
||||||
onSuccess: (result) => {
|
onSuccess: (result) => {
|
||||||
setExportData(result);
|
setExportData(result);
|
||||||
@@ -627,7 +626,7 @@ export function CompanyExport() {
|
|||||||
const downloadMutation = useMutation({
|
const downloadMutation = useMutation({
|
||||||
mutationFn: () =>
|
mutationFn: () =>
|
||||||
companiesApi.exportPackage(selectedCompanyId!, {
|
companiesApi.exportPackage(selectedCompanyId!, {
|
||||||
include: { company: true, agents: true, projects: true, issues: includeTasks },
|
include: { company: true, agents: true, projects: true, issues: true },
|
||||||
selectedFiles: Array.from(checkedFiles).sort(),
|
selectedFiles: Array.from(checkedFiles).sort(),
|
||||||
}),
|
}),
|
||||||
onSuccess: (result) => {
|
onSuccess: (result) => {
|
||||||
@@ -653,7 +652,7 @@ export function CompanyExport() {
|
|||||||
setExportData(null);
|
setExportData(null);
|
||||||
exportPreviewMutation.mutate();
|
exportPreviewMutation.mutate();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [selectedCompanyId, includeTasks]);
|
}, [selectedCompanyId]);
|
||||||
|
|
||||||
const tree = useMemo(
|
const tree = useMemo(
|
||||||
() => (exportData ? buildFileTree(exportData.files) : []),
|
() => (exportData ? buildFileTree(exportData.files) : []),
|
||||||
@@ -833,13 +832,6 @@ export function CompanyExport() {
|
|||||||
<span className="text-muted-foreground">
|
<span className="text-muted-foreground">
|
||||||
{selectedCount} / {totalFiles} file{totalFiles === 1 ? "" : "s"} selected
|
{selectedCount} / {totalFiles} file{totalFiles === 1 ? "" : "s"} selected
|
||||||
</span>
|
</span>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="text-muted-foreground underline underline-offset-4"
|
|
||||||
onClick={() => setIncludeTasks((value) => !value)}
|
|
||||||
>
|
|
||||||
{includeTasks ? "Hide task files" : "Load task files"}
|
|
||||||
</button>
|
|
||||||
{warnings.length > 0 && (
|
{warnings.length > 0 && (
|
||||||
<span className="text-amber-500">
|
<span className="text-amber-500">
|
||||||
{warnings.length} warning{warnings.length === 1 ? "" : "s"}
|
{warnings.length} warning{warnings.length === 1 ? "" : "s"}
|
||||||
|
|||||||
Reference in New Issue
Block a user