1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-11-23 15:21:25 +01:00

lang, save to browser (#923)

This commit is contained in:
Anthony Stirling 2024-03-17 09:33:05 +00:00 committed by GitHub
parent 11193b1b6d
commit f474651f36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 113 additions and 107 deletions

View File

@ -1,13 +1,5 @@
## User Guide for Local Directory Scanning and File Processing
### Whilst Pipelines are in alpha...
You must enable this alpha functionality by setting
```yaml
system:
enableAlphaFunctionality: true
```
To true like in the above for your `/config/settings.yml` file, after restarting Stirling-PDF you should see both UI and folder scanning enabled.
### Setting Up Watched Folders:
- Create a folder where you want your files to be monitored. This is your 'watched folder'.
- The default directory for this is `./pipeline/watchedFolders/`

View File

@ -1,13 +1,6 @@
# Pipeline Configuration and Usage Tutorial
## Whilst Pipelines are in alpha...
You must enable this alpha functionality by setting
```yaml
system:
enableAlphaFunctionality: true
```
To true like in the above for your `/config/settings.yml` file, after restarting Stirling-PDF you should see both UI and folder scanning enabled.
- Configure the pipeline config file and input files to run files against it
- For reuse, download the config file and re-upload it when needed, or place it in /pipeline/defaultWebUIConfigs/ to auto-load in the web UI for all users
## Steps to Configure and Use Your Pipeline
@ -40,3 +33,12 @@ To true like in the above for your `/config/settings.yml` file, after restarting
10. **Note on Web UI Limitations**
- The current web UI version does not support operations that require multiple different types of inputs, such as adding a separate image to a PDF.
### Current Limitations
- Cannot have more than one of the same operation
- Cannot input additional files via UI
- All files and operations run in serial mode

View File

@ -17,6 +17,7 @@ true=\u0635\u062D\u064A\u062D
false=\u062E\u0637\u0623
unknown=\u063A\u064A\u0631 \u0645\u0639\u0631\u0648\u0641
save=\u062D\u0641\u0638
saveToBrowser=Save to Browser
close=\u0625\u063A\u0644\u0627\u0642
filesSelected=الملفات المحددة
noFavourites=لم تتم إضافة أي مفضلات
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Вярно
false=Невярно
unknown=Непознат
save=Съхранете
saveToBrowser=Save to Browser
close=Затворете
filesSelected=избрани файлове
noFavourites=Няма добавени любими
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Verdader
false=Fals
unknown=Desconegut
save=Desa
saveToBrowser=Save to Browser
close=Tanca
filesSelected=fitxers seleccionats
noFavourites=No s'ha afegit cap favorit
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Wahr
false=Falsch
unknown=Unbekannt
save=Speichern
saveToBrowser=Save to Browser
close=Schließen
filesSelected=Dateien ausgewählt
noFavourites=Keine Favoriten hinzugefügt

View File

@ -17,6 +17,7 @@ true=\u0391\u03BB\u03B7\u03B8\u03AD\u03C2
false=\u039B\u03B1\u03BD\u03B8\u03B1\u03C3\u03BC\u03AD\u03BD\u03BF
unknown=\u0386\u03B3\u03BD\u03C9\u03C3\u03C4\u03BF
save=\u0391\u03C0\u03BF\u03B8\u03AE\u03BA\u03B5\u03C5\u03C3\u03B7
saveToBrowser=Save to Browser
close=\u039A\u03BB\u03B5\u03AF\u03C3\u03B9\u03BC\u03BF
filesSelected=\u03B1\u03C1\u03C7\u03B5\u03AF\u03B1 \u03C0\u03BF\u03C5 \u03B5\u03C0\u03B9\u03BB\u03AD\u03C7\u03B8\u03B7\u03BA\u03B1\u03BD
noFavourites=\u039A\u03B1\u03BD\u03AD\u03BD\u03B1 \u03B1\u03B3\u03B1\u03C0\u03AE\u03BC\u03B5\u03BD\u03BF \u03B4\u03B5\u03BD \u03AD\u03C7\u03B5\u03B9 \u03C0\u03C1\u03BF\u03C3\u03C4\u03B5\u03B8\u03B5\u03AF
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=True
false=False
unknown=Unknown
save=Save
saveToBrowser=Save to Browser
close=Close
filesSelected=files selected
noFavourites=No favourites added
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=True
false=False
unknown=Unknown
save=Save
saveToBrowser=Save to Browser
close=Close
filesSelected=files selected
noFavourites=No favorites added
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Verdadero
false=Falso
unknown=Desconocido
save=Guardar
saveToBrowser=Save to Browser
close=Cerrar
filesSelected=archivos seleccionados
noFavourites=No se agregaron favoritos

View File

@ -17,6 +17,7 @@ true=Egiazkoa
false=Faltsua
unknown=Ezezaguna
save=Gorde
saveToBrowser=Save to Browser
close=Itxi
filesSelected=Hautatutako fitxategiak
noFavourites=Ez dira gogokoak gehitu
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Vrai
false=Faux
unknown=Inconnu
save=Enregistrer
saveToBrowser=Save to Browser
close=Fermer
filesSelected=fichiers sélectionnés
noFavourites=Aucun favori ajouté

View File

@ -17,6 +17,7 @@ true=सही
false=गलत
unknown=अज्ञात
save=सहेजें
saveToBrowser=Save to Browser
close=बंद करें
filesSelected=फ़ाइलें चयनित हैं
noFavourites=कोई पसंदीदा जोड़ा नहीं गया है
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Igaz
false=Hamis
unknown=Ismeretlen
save=Mentés
saveToBrowser=Save to Browser
close=Bezárás
filesSelected=kiválasztott fájlok
noFavourites=Nincs hozzáadva kedvenc
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Benar
false=Salah
unknown=Tidak diketahui
save=Simpan
saveToBrowser=Save to Browser
close=Tutup
filesSelected=berkas dipilih
noFavourites=Tidak ada favorit yang ditambahkan
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Vero
false=Falso
unknown=Sconosciuto
save=Salva
saveToBrowser=Save to Browser
close=Chiudi
filesSelected=file selezionati
noFavourites=Nessun preferito
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=Il nome utente non esiste e non può essere eliminat
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Caricamento personalizzato
pipeline.configureButton=Configura
pipeline.defaultOption=Personalizzato

View File

@ -17,6 +17,7 @@ true=True
false=False
unknown=不明
save=保存
saveToBrowser=Save to Browser
close=閉じる
filesSelected=選択されたファイル
noFavourites=お気に入りはありません

View File

@ -17,6 +17,7 @@ true=참
false=거짓
unknown=알 수 없음
save=저장
saveToBrowser=Save to Browser
close=닫기
filesSelected=개 파일 선택됨
noFavourites=즐겨찾기 없음
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Waar
false=Onwaar
unknown=Onbekend
save=Opslaan
saveToBrowser=Save to Browser
close=Sluiten
filesSelected=Bestanden geselecteerd
noFavourites=Geen favorieten toegevoegd

View File

@ -17,6 +17,7 @@ true=Tak
false=Nie
unknown=Nieznany
save=Zapisz
saveToBrowser=Save to Browser
close=Zamknij
filesSelected=wybrane pliki
noFavourites=Nie dodano ulubionych
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Verdadeiro
false=Falso
unknown=Desconhecido
save=Salvar
saveToBrowser=Save to Browser
close=Fechar
filesSelected=arquivos selecionados
noFavourites=Nenhum favorito adicionado
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Verdadeiro
false=Falso
unknown=Desconhecido
save=Salvar
saveToBrowser=Save to Browser
close=Fechar
filesSelected=Ficheiros Selecionados
noFavourites=Nenhum favorito adicionado
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Carregar personalizado
pipeline.configureButton=Configurar
pipeline.defaultOption=Personalizar

View File

@ -17,6 +17,7 @@ true=Adevărat
false=Fals
unknown=Necunoscut
save=Salvează
saveToBrowser=Save to Browser
close=Închide
filesSelected=fișiere selectate
noFavourites=Niciun favorit adăugat
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Истина
false=Ложь
unknown=Неизвестно
save=Сохранить
saveToBrowser=Save to Browser
close=Закрыть
filesSelected=файлов выбрано
noFavourites=Нет избранного
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Tačno
false=Netačno
unknown=Nepoznato
save=Sačuvaj
saveToBrowser=Save to Browser
close=Zatvori
filesSelected=odabrani fajlovi
noFavourites=Nema dodatih favorita

View File

@ -17,6 +17,7 @@ true=True
false=Falskt
unknown=Okänt
save=Spara
saveToBrowser=Save to Browser
close=Stäng
filesSelected=filer valda
noFavourites=Inga favoriter har lagts till
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=Doğru
false=Yanlış
unknown=Bilinmeyen
save=Kaydet
saveToBrowser=Save to Browser
close=Kapat
filesSelected=dosya seçildi
noFavourites=Favori eklenmedi
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=对
false=
unknown=未知
save=保存
saveToBrowser=Save to Browser
close=关闭
filesSelected=选中的文件
noFavourites=没有添加收藏夹
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -17,6 +17,7 @@ true=是
false=
unknown=未知
save=儲存
saveToBrowser=Save to Browser
close=關閉
filesSelected=已選擇的檔案
noFavourites=未新增收藏
@ -61,7 +62,7 @@ deleteUsernameExistsMessage=The username does not exist and cannot be deleted.
###############
# Pipeline #
###############
pipeline.header=Pipeline Menu (Alpha)
pipeline.header=Pipeline Menu (Beta)
pipeline.uploadButton=Upload Custom
pipeline.configureButton=Configure
pipeline.defaultOption=Custom

View File

@ -479,6 +479,31 @@ document.getElementById("addOperationBtn").addEventListener("click", function ()
hideOrShowPipelineHeader();
});
function loadBrowserPipelinesIntoDropdown() {
let pipelineSelect = document.getElementById("pipelineSelect");
// Retrieve the current set of option values for comparison
let existingOptions = new Set();
for (let option of pipelineSelect.options) {
existingOptions.add(option.value);
}
// Iterate over all items in localStorage
for (let i = 0; i < localStorage.length; i++) {
let key = localStorage.key(i);
if (key.startsWith("#Pipeline-")) {
let pipelineData = localStorage.getItem(key);
// Check if the data is already in the dropdown
if (!existingOptions.has(pipelineData)) {
let pipelineName = key.replace("#Pipeline-", ""); // Extract pipeline name from the key
let option = new Option(pipelineName, pipelineData); // Use pipeline data as the option value
pipelineSelect.appendChild(option);
}
}
}
}
loadBrowserPipelinesIntoDropdown();
function updateConfigInDropdown() {
let pipelineSelect = document.getElementById("pipelineSelect");
let selectedOption = pipelineSelect.options[pipelineSelect.selectedIndex];
@ -496,13 +521,13 @@ function updateConfigInDropdown() {
}
var saveBtn = document.getElementById("savePipelineBtn");
var saveBrowserBtn = document.getElementById("saveBrowserPipelineBtn");
// Remove any existing event listeners
saveBtn.removeEventListener("click", savePipeline);
saveBrowserBtn.removeEventListener("click", savePipelineToBrowser);
// Add the event listener
saveBtn.addEventListener("click", savePipeline);
console.log("saveBtn", saveBtn);
saveBrowserBtn.addEventListener("click", savePipelineToBrowser);
function configToJson() {
if (!validatePipeline()) {
@ -537,6 +562,21 @@ function configToJson() {
return JSON.stringify(pipelineConfig, null, 2);
}
function savePipelineToBrowser() {
let pipelineConfigJson = configToJson();
if (!pipelineConfigJson) {
console.error("Failed to save pipeline: Invalid configuration");
return;
}
let pipelineName = document.getElementById("pipelineName").value;
if (!pipelineName) {
console.error("Failed to save pipeline: Pipeline name is required");
return;
}
localStorage.setItem("#Pipeline-" +pipelineName, pipelineConfigJson);
console.log("Pipeline configuration saved to localStorage");
}
function savePipeline() {
let pipelineConfigJson = configToJson();
if (!pipelineConfigJson) {

View File

@ -15,8 +15,13 @@
<br /><br />
<div class="container">
<div class="row justify-content-center">
<h1 th:text="#{pipeline.header}"></h1>
<h2 th:text="#{WorkInProgess}"></h2>
<div style="text-align: center;">
<h1 th:text="#{pipeline.header}"></h1>
<img src="images/pipeline.svg" alt="icon" style="filter: invert(33%) sepia(100%) saturate(5000%) hue-rotate(183deg) brightness(90%) contrast(100%); width: 100px; height: 100px;">
</div>
<div class="bordered-box">
<div class="text-end text-top">
<button id="uploadPipelineBtn" class="btn btn-primary" th:text="#{pipeline.uploadButton}"></button>
@ -38,73 +43,12 @@
<div class="element-margin">
<button class="btn btn-primary" id="submitConfigBtn" th:text="#{pipeline.submitButton}"></button>
</div>
<a href="https://github.com/Stirling-Tools/Stirling-PDF/blob/main/PipelineFeature.md" target="_blank">Pipeline Help</a>
</br>
<a href="https://github.com/Stirling-Tools/Stirling-PDF/blob/main/FolderScanning.md" target="_blank">Folder Scanning Help</a>
</div>
</div>
<p>Below info is Alpha only, will be removed and hence not translated</p>
<h3>Current Limitations</h3>
<ul>
<li>Cannot have more than one of the same operation</li>
<li>Cannot input additional files via UI</li>
<li>All files and operations run in serial mode</li>
</ul>
<h3>How it Works Notes</h3>
<ul>
<li>Configure the pipeline config file and input files to run files against it</li>
<li>For reuse, download the config file and re-upload it when needed, or place it in /pipeline/defaultWebUIConfigs/ to auto-load in the web UI for all users</li>
</ul>
<h3>How to use pre-load configs in web UI</h3>
<ul>
<li>Download config files</li>
<li>For reuse, download the config file and re-upload it when needed, or place it in /pipeline/defaultWebUIConfigs/ to auto-load in the web UI for all users</li>
</ul>
<h3>Todo</h3>
<ul>
<li>Save to browser/Account</li>
<li>offline folder scan mode checks and testing for unique usecases</li>
<li>Improve operation config settings UI</li>
</ul>
<h2>User Guide for Local Directory Scanning and File Processing</h2>
<h3>Setting Up Watched Folders:</h3>
<p>Create a folder where you want your files to be monitored. This is your 'watched folder'.</p>
<p>The default directory for this is <code>./pipeline/watchedFolders/</code></p>
<p>Place any directories you want to be scanned into this folder, this folder should contain multiple folders each for their own tasks and pipelines.</p>
<h3>Configuring Processing with JSON Files:</h3>
<p>In each directory you want processed (e.g. <code>./pipeline/watchedFolders/officePrinter</code>), include a JSON configuration file.</p>
<p>This JSON file should specify how you want the files in the directory to be handled (e.g., what operations to perform on them) which can be made, configured and downloaded from Stirling-PDF Pipeline interface.</p>
<h3>Automatic Scanning and Processing:</h3>
<p>The system automatically checks the watched folder every minute for new directories and files to process.</p>
<p>When a directory with a valid JSON configuration file is found, it begins processing the files inside as per the configuration.</p>
<h3>Processing Steps:</h3>
<p>Files in each directory are processed according to the instructions in the JSON file.</p>
<p>This might involve file conversions, data filtering, renaming files, etc. If the output of a step is a zip, this zip will be automatically unzipped as it passes to next process.</p>
<h3>Results and Output:</h3>
<p>After processing, the results are saved in a specified output location. This could be a different folder or location as defined in the JSON file or the default location <code>./pipeline/finishedFolders/</code>.</p>
<p>Each processed file is named and organized according to the rules set in the JSON configuration.</p>
<h3>Completion and Cleanup:</h3>
<p>Once processing is complete, the original files in the watched folder's directory are removed.</p>
<p>You can find the processed files in the designated output location.</p>
<h3>Error Handling:</h3>
<p>If there's an error during processing, the system will not delete the original files, allowing you to check and retry if necessary.</p>
<h3>User Interaction:</h3>
<p>As a user, your main tasks are to set up the watched folders, place directories with files for processing, and create the corresponding JSON configuration files.</p>
<p>The system handles the rest, including scanning, processing, and outputting results.</p>
<!-- The Modal -->
<div class="modal" id="pipelineSettingsModal">
<div class="modal-dialog">
@ -143,6 +87,7 @@
<!-- Modal footer -->
<div class="modal-footer">
<button id="saveBrowserPipelineBtn" class="btn btn-success" th:text="#{saveToBrowser}"></button>
<button id="savePipelineBtn" class="btn btn-success" th:text="#{pipelineOptions.saveButton}"></button>
<button id="validateButton" class="btn btn-success" th:text="#{pipelineOptions.validateButton}"></button>