This is an automated email from the ASF dual-hosted git repository.

sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git


The following commit(s) were added to refs/heads/main by this push:
     new f6b6b13  Add a button to select or unselect all files in the file 
movement form
f6b6b13 is described below

commit f6b6b13493e77f78682128da6dbda24caebb4f6b
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Jun 26 19:00:13 2025 +0100

    Add a button to select or unselect all files in the file movement form
---
 atr/static/js/finish-selected-move.js     | 24 ++++++++++++++++++++++++
 atr/static/js/finish-selected-move.js.map |  2 +-
 atr/static/ts/finish-selected-move.ts     | 25 +++++++++++++++++++++++++
 atr/templates/finish-selected.html        |  3 +++
 4 files changed, 53 insertions(+), 1 deletion(-)

diff --git a/atr/static/js/finish-selected-move.js 
b/atr/static/js/finish-selected-move.js
index 122bedb..3f33281 100644
--- a/atr/static/js/finish-selected-move.js
+++ b/atr/static/js/finish-selected-move.js
@@ -25,6 +25,7 @@ const ID = Object.freeze({
     fileFilter: "file-filter",
     fileListMoreInfo: "file-list-more-info",
     fileListTableBody: "file-list-table-body",
+    selectFilesToggleButton: "select-files-toggle-button",
     mainScriptData: "main-script-data",
     maxFilesInput: "max-files-input",
     selectedFileNameTitle: "selected-file-name-title",
@@ -44,6 +45,7 @@ let selectedFileNameTitleElement;
 let dirFilterInput;
 let dirListTableBody;
 let confirmMoveButton;
+let selectFilesToggleButton;
 let currentMoveSelectionInfoElement;
 let errorAlert;
 let uiState;
@@ -235,6 +237,10 @@ function renderAllLists() {
     };
     renderListItems(dirListTableBody, filteredDirs, dirsConfig);
     updateMoveSelectionInfo();
+    if (selectFilesToggleButton) {
+        const anySelected = uiState.currentlySelectedPaths.size > 0 || 
uiState.currentlyChosenDirectoryPath !== null;
+        selectFilesToggleButton.textContent = anySelected ? "Unselect all" : 
"Select these files";
+    }
 }
 function handleDirSelection(dirPath) {
     uiState.currentlyChosenDirectoryPath = dirPath;
@@ -410,6 +416,7 @@ document.addEventListener("DOMContentLoaded", () => {
     dirFilterInput = $(ID.dirFilterInput);
     dirListTableBody = $(ID.dirListTableBody);
     confirmMoveButton = $(ID.confirmMoveButton);
+    selectFilesToggleButton = $(ID.selectFilesToggleButton);
     currentMoveSelectionInfoElement = $(ID.currentMoveSelectionInfo);
     currentMoveSelectionInfoElement.setAttribute("aria-live", "polite");
     errorAlert = $(ID.errorAlert);
@@ -455,6 +462,23 @@ document.addEventListener("DOMContentLoaded", () => {
             }
         });
     });
+    selectFilesToggleButton.addEventListener("click", () => {
+        const anySelected = uiState.currentlySelectedPaths.size > 0 || 
uiState.currentlyChosenDirectoryPath !== null;
+        if (anySelected) {
+            setState({ currentlySelectedPaths: new Set(), 
currentlyChosenDirectoryPath: null });
+        }
+        else {
+            const displayedCheckboxes = 
fileListTableBody.querySelectorAll("input[type='checkbox'][data-item-path]");
+            const newSelected = new Set(uiState.currentlySelectedPaths);
+            displayedCheckboxes.forEach(cb => {
+                const p = cb.dataset.itemPath;
+                if (p) {
+                    newSelected.add(p);
+                }
+            });
+            setState({ currentlySelectedPaths: newSelected });
+        }
+    });
     renderAllLists();
 });
 //# sourceMappingURL=finish-selected-move.js.map
diff --git a/atr/static/js/finish-selected-move.js.map 
b/atr/static/js/finish-selected-move.js.map
index 2b2e98c..9a4dc2c 100644
--- a/atr/static/js/finish-selected-move.js.map
+++ b/atr/static/js/finish-selected-move.js.map
@@ -1 +1 @@
-{"version":3,"file":"finish-selected-move.js","sourceRoot":"","sources":["../ts/finish-selected-move.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;AAEb,IAAK,QAGJ;AAHD,WAAK,QAAQ;IACT,yBAAa,CAAA;IACb,uBAAW,CAAA;AACf,CAAC,EAHI,QAAQ,KAAR,QAAQ,QAGZ;AAED,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC;IACrB,iBAAiB,EAAE,qBAAqB;IACxC,wBAAwB,EAAE,6BAA6B;IACvD,OAAO,EAAE,UAAU;IACnB,cAAc,EAAE,kBAAkB;IAClC,eAAe,EAAE,oBAAoB;IACrC,gBAAgB,EAAE,qBAAqB;IACvC,UAAU,EAAE,kBAAkB;IAC9B,QAAQ,EAAE,WAAW;IACrB,UAAU,EAAE,
 [...]
+{"version":3,"file":"finish-selected-move.js","sourceRoot":"","sources":["../ts/finish-selected-move.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;AAEb,IAAK,QAGJ;AAHD,WAAK,QAAQ;IACT,yBAAa,CAAA;IACb,uBAAW,CAAA;AACf,CAAC,EAHI,QAAQ,KAAR,QAAQ,QAGZ;AAED,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC;IACrB,iBAAiB,EAAE,qBAAqB;IACxC,wBAAwB,EAAE,6BAA6B;IACvD,OAAO,EAAE,UAAU;IACnB,cAAc,EAAE,kBAAkB;IAClC,eAAe,EAAE,oBAAoB;IACrC,gBAAgB,EAAE,qBAAqB;IACvC,UAAU,EAAE,kBAAkB;IAC9B,QAAQ,EAAE,WAAW;IACrB,UAAU,EAAE,
 [...]
diff --git a/atr/static/ts/finish-selected-move.ts 
b/atr/static/ts/finish-selected-move.ts
index 4722952..050983d 100644
--- a/atr/static/ts/finish-selected-move.ts
+++ b/atr/static/ts/finish-selected-move.ts
@@ -17,6 +17,7 @@ const ID = Object.freeze({
     fileFilter: "file-filter",
     fileListMoreInfo: "file-list-more-info",
     fileListTableBody: "file-list-table-body",
+    selectFilesToggleButton: "select-files-toggle-button",
     mainScriptData: "main-script-data",
     maxFilesInput: "max-files-input",
     selectedFileNameTitle: "selected-file-name-title",
@@ -56,6 +57,7 @@ let selectedFileNameTitleElement!: HTMLElement;
 let dirFilterInput!: HTMLInputElement;
 let dirListTableBody!: HTMLTableSectionElement;
 let confirmMoveButton!: HTMLButtonElement;
+let selectFilesToggleButton!: HTMLButtonElement;
 let currentMoveSelectionInfoElement!: HTMLElement;
 let errorAlert!: HTMLElement;
 
@@ -277,6 +279,11 @@ function renderAllLists(): void {
     renderListItems(dirListTableBody, filteredDirs, dirsConfig);
 
     updateMoveSelectionInfo();
+
+    if (selectFilesToggleButton) {
+        const anySelected = uiState.currentlySelectedPaths.size > 0 || 
uiState.currentlyChosenDirectoryPath !== null;
+        selectFilesToggleButton.textContent = anySelected ? "Unselect all" : 
"Select these files";
+    }
 }
 
 function handleDirSelection(dirPath: string | null): void {
@@ -477,6 +484,7 @@ document.addEventListener("DOMContentLoaded", () => {
   dirFilterInput = $<HTMLInputElement>(ID.dirFilterInput);
   dirListTableBody = $<HTMLTableSectionElement>(ID.dirListTableBody);
   confirmMoveButton = $<HTMLButtonElement>(ID.confirmMoveButton);
+  selectFilesToggleButton = $<HTMLButtonElement>(ID.selectFilesToggleButton);
   currentMoveSelectionInfoElement = $(ID.currentMoveSelectionInfo);
   currentMoveSelectionInfoElement.setAttribute("aria-live", "polite");
   errorAlert = $(ID.errorAlert);
@@ -537,5 +545,22 @@ document.addEventListener("DOMContentLoaded", () => {
     });
   });
 
+  selectFilesToggleButton.addEventListener("click", () => {
+    const anySelected = uiState.currentlySelectedPaths.size > 0 || 
uiState.currentlyChosenDirectoryPath !== null;
+    if (anySelected) {
+        setState({ currentlySelectedPaths: new Set(), 
currentlyChosenDirectoryPath: null });
+    } else {
+        const displayedCheckboxes = 
fileListTableBody.querySelectorAll<HTMLInputElement>("input[type='checkbox'][data-item-path]");
+        const newSelected = new Set(uiState.currentlySelectedPaths);
+        displayedCheckboxes.forEach(cb => {
+            const p = cb.dataset.itemPath;
+            if (p) {
+                newSelected.add(p);
+            }
+        });
+        setState({ currentlySelectedPaths: newSelected });
+    }
+  });
+
   renderAllLists();
 });
diff --git a/atr/templates/finish-selected.html 
b/atr/templates/finish-selected.html
index b50bc68..c2ab03b 100644
--- a/atr/templates/finish-selected.html
+++ b/atr/templates/finish-selected.html
@@ -132,6 +132,9 @@
               </tbody>
             </table>
             <div id="file-list-more-info" class="text-muted small mt-1"></div>
+            <button type="button"
+                    id="select-files-toggle-button"
+                    class="btn btn-outline-secondary w-100 mt-2">Select these 
files</button>
           </div>
         </div>
       </div>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to