mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 19:33:11 +02:00
Export folder scanning (#5544)
# Description of Changes <!-- Please provide a summary of the changes, including: - What was changed - Why the change was made - Any challenges encountered Closes #(issue_number) --> --- ## Checklist ### General - [ ] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [ ] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [ ] I have performed a self-review of my own code - [ ] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [ ] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) ### Testing (if applicable) - [ ] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing) for more details.
This commit is contained in:
+1
-1
@@ -67,7 +67,7 @@ springBoot {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
group = 'stirling.software'
|
group = 'stirling.software'
|
||||||
version = '2.3.1'
|
version = '2.4.0'
|
||||||
|
|
||||||
configurations.configureEach {
|
configurations.configureEach {
|
||||||
exclude group: 'commons-logging', module: 'commons-logging'
|
exclude group: 'commons-logging', module: 'commons-logging'
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ selectOperation = "Select Operation"
|
|||||||
addOperationButton = "Add operation"
|
addOperationButton = "Add operation"
|
||||||
pipelineHeader = "Pipeline:"
|
pipelineHeader = "Pipeline:"
|
||||||
saveButton = "Download"
|
saveButton = "Download"
|
||||||
|
saveForFolderScanning = "Save for Folder Scanning"
|
||||||
validateButton = "Validate"
|
validateButton = "Validate"
|
||||||
|
|
||||||
[enterpriseEdition]
|
[enterpriseEdition]
|
||||||
@@ -5465,6 +5466,7 @@ desc = "Build multi-step workflows by chaining together PDF actions. Ideal for r
|
|||||||
invalidStep = "Invalid step"
|
invalidStep = "Invalid step"
|
||||||
reviewTitle = "Automation Results"
|
reviewTitle = "Automation Results"
|
||||||
copyToSaved = "Copy to Saved"
|
copyToSaved = "Copy to Saved"
|
||||||
|
exportForFolderScanning = "Export for Folder Scanning"
|
||||||
|
|
||||||
[automate.files]
|
[automate.files]
|
||||||
placeholder = "Select files to process with this automation"
|
placeholder = "Select files to process with this automation"
|
||||||
@@ -5486,6 +5488,7 @@ createTitle = "Create Automation"
|
|||||||
editTitle = "Edit Automation"
|
editTitle = "Edit Automation"
|
||||||
intro = "Automations run tools sequentially. To get started, add tools in the order you want them to run."
|
intro = "Automations run tools sequentially. To get started, add tools in the order you want them to run."
|
||||||
save = "Save Automation"
|
save = "Save Automation"
|
||||||
|
exportForFolderScanning = "Export for Folder Scanning"
|
||||||
|
|
||||||
[automate.creation.name]
|
[automate.creation.name]
|
||||||
label = "Automation Name"
|
label = "Automation Name"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||||
"productName": "Stirling-PDF",
|
"productName": "Stirling-PDF",
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"identifier": "stirling.pdf.dev",
|
"identifier": "stirling.pdf.dev",
|
||||||
"build": {
|
"build": {
|
||||||
"frontendDist": "../dist",
|
"frontendDist": "../dist",
|
||||||
|
|||||||
@@ -12,12 +12,14 @@ import {
|
|||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { Z_INDEX_AUTOMATE_MODAL } from '@app/styles/zIndex';
|
import { Z_INDEX_AUTOMATE_MODAL } from '@app/styles/zIndex';
|
||||||
import CheckIcon from '@mui/icons-material/Check';
|
import CheckIcon from '@mui/icons-material/Check';
|
||||||
|
import DownloadIcon from '@mui/icons-material/Download';
|
||||||
import { ToolRegistry } from '@app/data/toolsTaxonomy';
|
import { ToolRegistry } from '@app/data/toolsTaxonomy';
|
||||||
import ToolConfigurationModal from '@app/components/tools/automate/ToolConfigurationModal';
|
import ToolConfigurationModal from '@app/components/tools/automate/ToolConfigurationModal';
|
||||||
import ToolList from '@app/components/tools/automate/ToolList';
|
import ToolList from '@app/components/tools/automate/ToolList';
|
||||||
import IconSelector from '@app/components/tools/automate/IconSelector';
|
import IconSelector from '@app/components/tools/automate/IconSelector';
|
||||||
import { AutomationConfig, AutomationMode, AutomationTool } from '@app/types/automation';
|
import { AutomationConfig, AutomationMode, AutomationTool } from '@app/types/automation';
|
||||||
import { useAutomationForm } from '@app/hooks/tools/automate/useAutomationForm';
|
import { useAutomationForm } from '@app/hooks/tools/automate/useAutomationForm';
|
||||||
|
import { downloadFolderScanningConfig } from '@app/utils/automationConverter';
|
||||||
|
|
||||||
|
|
||||||
interface AutomationCreationProps {
|
interface AutomationCreationProps {
|
||||||
@@ -194,15 +196,42 @@ export default function AutomationCreation({ mode, existingAutomation, onBack, o
|
|||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
{/* Save Button */}
|
{/* Action Buttons */}
|
||||||
<Button
|
<Stack gap="sm">
|
||||||
leftSection={<CheckIcon />}
|
<Button
|
||||||
onClick={saveAutomation}
|
leftSection={<CheckIcon />}
|
||||||
disabled={!canSaveAutomation()}
|
onClick={saveAutomation}
|
||||||
fullWidth
|
disabled={!canSaveAutomation()}
|
||||||
>
|
fullWidth
|
||||||
{t('automate.creation.save', 'Save Automation')}
|
>
|
||||||
</Button>
|
{t('automate.creation.save', 'Save Automation')}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
leftSection={<DownloadIcon />}
|
||||||
|
onClick={() => {
|
||||||
|
// Create a temporary automation config from current state
|
||||||
|
const tempAutomation: AutomationConfig = {
|
||||||
|
id: existingAutomation?.id || 'temp',
|
||||||
|
name: automationName.trim(),
|
||||||
|
description: automationDescription.trim(),
|
||||||
|
icon: automationIcon,
|
||||||
|
operations: selectedTools.map(tool => ({
|
||||||
|
operation: tool.operation,
|
||||||
|
parameters: tool.parameters || {}
|
||||||
|
})),
|
||||||
|
createdAt: existingAutomation?.createdAt || new Date().toISOString(),
|
||||||
|
updatedAt: new Date().toISOString()
|
||||||
|
};
|
||||||
|
downloadFolderScanningConfig(tempAutomation);
|
||||||
|
}}
|
||||||
|
disabled={!canSaveAutomation()}
|
||||||
|
variant="light"
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
|
{t('automate.creation.exportForFolderScanning', 'Export for Folder Scanning')}
|
||||||
|
</Button>
|
||||||
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
|
|
||||||
{/* Tool Configuration Modal */}
|
{/* Tool Configuration Modal */}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|||||||
import EditIcon from '@mui/icons-material/Edit';
|
import EditIcon from '@mui/icons-material/Edit';
|
||||||
import DeleteIcon from '@mui/icons-material/Delete';
|
import DeleteIcon from '@mui/icons-material/Delete';
|
||||||
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
||||||
|
import DownloadIcon from '@mui/icons-material/Download';
|
||||||
import { Tooltip } from '@app/components/shared/Tooltip';
|
import { Tooltip } from '@app/components/shared/Tooltip';
|
||||||
import { ToolIcon } from '@app/components/shared/ToolIcon';
|
import { ToolIcon } from '@app/components/shared/ToolIcon';
|
||||||
import { ToolRegistry } from '@app/data/toolsTaxonomy';
|
import { ToolRegistry } from '@app/data/toolsTaxonomy';
|
||||||
@@ -31,6 +32,8 @@ interface AutomationEntryProps {
|
|||||||
onDelete?: () => void;
|
onDelete?: () => void;
|
||||||
/** Copy handler (for suggested automations) */
|
/** Copy handler (for suggested automations) */
|
||||||
onCopy?: () => void;
|
onCopy?: () => void;
|
||||||
|
/** Export handler (for folder scanning) */
|
||||||
|
onExport?: () => void;
|
||||||
/** Tool registry to resolve operation names */
|
/** Tool registry to resolve operation names */
|
||||||
toolRegistry?: Partial<ToolRegistry>;
|
toolRegistry?: Partial<ToolRegistry>;
|
||||||
}
|
}
|
||||||
@@ -46,6 +49,7 @@ export default function AutomationEntry({
|
|||||||
onEdit,
|
onEdit,
|
||||||
onDelete,
|
onDelete,
|
||||||
onCopy,
|
onCopy,
|
||||||
|
onExport,
|
||||||
toolRegistry
|
toolRegistry
|
||||||
}: AutomationEntryProps) {
|
}: AutomationEntryProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -225,6 +229,17 @@ export default function AutomationEntry({
|
|||||||
{t('edit', 'Edit')}
|
{t('edit', 'Edit')}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
)}
|
)}
|
||||||
|
{onExport && (
|
||||||
|
<Menu.Item
|
||||||
|
leftSection={<DownloadIcon style={{ fontSize: 16 }} />}
|
||||||
|
onClick={(e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
onExport();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t('automate.exportForFolderScanning', 'Export for Folder Scanning')}
|
||||||
|
</Menu.Item>
|
||||||
|
)}
|
||||||
{onDelete && (
|
{onDelete && (
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
leftSection={<DeleteIcon style={{ fontSize: 16 }} />}
|
leftSection={<DeleteIcon style={{ fontSize: 16 }} />}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { useSuggestedAutomations } from "@app/hooks/tools/automate/useSuggestedA
|
|||||||
import { AutomationConfig, SuggestedAutomation } from "@app/types/automation";
|
import { AutomationConfig, SuggestedAutomation } from "@app/types/automation";
|
||||||
import { iconMap } from '@app/components/tools/automate/iconMap';
|
import { iconMap } from '@app/components/tools/automate/iconMap';
|
||||||
import { ToolRegistry } from '@app/data/toolsTaxonomy';
|
import { ToolRegistry } from '@app/data/toolsTaxonomy';
|
||||||
|
import { downloadFolderScanningConfig } from '@app/utils/automationConverter';
|
||||||
|
|
||||||
interface AutomationSelectionProps {
|
interface AutomationSelectionProps {
|
||||||
savedAutomations: AutomationConfig[];
|
savedAutomations: AutomationConfig[];
|
||||||
@@ -58,6 +59,7 @@ export default function AutomationSelection({
|
|||||||
onClick={() => onRun(automation)}
|
onClick={() => onRun(automation)}
|
||||||
showMenu={true}
|
showMenu={true}
|
||||||
onEdit={() => onEdit(automation)}
|
onEdit={() => onEdit(automation)}
|
||||||
|
onExport={() => downloadFolderScanningConfig(automation)}
|
||||||
onDelete={() => onDelete(automation)}
|
onDelete={() => onDelete(automation)}
|
||||||
toolRegistry={toolRegistry}
|
toolRegistry={toolRegistry}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const FREE_LICENSE_INFO: LicenseInfo = {
|
|||||||
|
|
||||||
const BASE_NO_LOGIN_CONFIG: AppConfig = {
|
const BASE_NO_LOGIN_CONFIG: AppConfig = {
|
||||||
enableAnalytics: true,
|
enableAnalytics: true,
|
||||||
appVersion: '2.3.1',
|
appVersion: '2.4.0',
|
||||||
serverCertificateEnabled: false,
|
serverCertificateEnabled: false,
|
||||||
enableAlphaFunctionality: false,
|
enableAlphaFunctionality: false,
|
||||||
serverPort: 8080,
|
serverPort: 8080,
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
* Utility functions for converting between automation formats
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { AutomationConfig } from '@app/types/automation';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pipeline configuration format used by folder scanning
|
||||||
|
*/
|
||||||
|
interface FolderScanningPipeline {
|
||||||
|
name: string;
|
||||||
|
pipeline: Array<{
|
||||||
|
operation: string;
|
||||||
|
parameters: Record<string, any>;
|
||||||
|
}>;
|
||||||
|
_examples: {
|
||||||
|
outputDir: string;
|
||||||
|
outputFileName: string;
|
||||||
|
};
|
||||||
|
outputDir: string;
|
||||||
|
outputFileName: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an AutomationConfig to a folder scanning pipeline configuration
|
||||||
|
* @param automation The automation configuration to convert
|
||||||
|
* @returns Folder scanning pipeline configuration
|
||||||
|
*/
|
||||||
|
export function convertToFolderScanningConfig(automation: AutomationConfig): FolderScanningPipeline {
|
||||||
|
return {
|
||||||
|
name: automation.name,
|
||||||
|
pipeline: automation.operations.map(op => ({
|
||||||
|
operation: op.operation,
|
||||||
|
parameters: {
|
||||||
|
...op.parameters,
|
||||||
|
fileInput: "automated"
|
||||||
|
}
|
||||||
|
})),
|
||||||
|
_examples: {
|
||||||
|
outputDir: "{outputFolder}/{folderName}",
|
||||||
|
outputFileName: "{filename}-{pipelineName}-{date}-{time}"
|
||||||
|
},
|
||||||
|
outputDir: "{outputFolder}",
|
||||||
|
outputFileName: "{filename}"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downloads a folder scanning configuration as a JSON file
|
||||||
|
* @param automation The automation configuration to export
|
||||||
|
*/
|
||||||
|
export function downloadFolderScanningConfig(automation: AutomationConfig): void {
|
||||||
|
const config = convertToFolderScanningConfig(automation);
|
||||||
|
const json = JSON.stringify(config, null, 2);
|
||||||
|
const blob = new Blob([json], { type: 'application/json' });
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = url;
|
||||||
|
a.download = `${automation.name}.json`;
|
||||||
|
a.style.display = 'none';
|
||||||
|
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
document.body.removeChild(a);
|
||||||
|
|
||||||
|
URL.revokeObjectURL(url);
|
||||||
|
}
|
||||||
@@ -48,7 +48,7 @@ const FREE_LICENSE_INFO: LicenseInfo = {
|
|||||||
|
|
||||||
const BASE_NO_LOGIN_CONFIG: AppConfig = {
|
const BASE_NO_LOGIN_CONFIG: AppConfig = {
|
||||||
enableAnalytics: true,
|
enableAnalytics: true,
|
||||||
appVersion: '2.3.1',
|
appVersion: '2.4.0',
|
||||||
serverCertificateEnabled: false,
|
serverCertificateEnabled: false,
|
||||||
enableAlphaFunctionality: false,
|
enableAlphaFunctionality: false,
|
||||||
enableDesktopInstallSlide: true,
|
enableDesktopInstallSlide: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user