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 5b10fe9  Eliminate states where no progress can be made in the 
movement form
5b10fe9 is described below

commit 5b10fe969689293333454fe76958c896e7e0220a
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed May 21 15:26:33 2025 +0100

    Eliminate states where no progress can be made in the movement form
---
 atr/static/js/finish-selected-move.js | 11 ++++-------
 atr/static/ts/finish-selected-move.ts | 18 +++---------------
 2 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/atr/static/js/finish-selected-move.js 
b/atr/static/js/finish-selected-move.js
index 5f6da4c..734855d 100644
--- a/atr/static/js/finish-selected-move.js
+++ b/atr/static/js/finish-selected-move.js
@@ -114,9 +114,6 @@ function renderListItems(tbodyElement, items, config) {
             button.className = `btn btn-sm ${config.buttonClassBase} 
${config.buttonClassOutline}`;
             button.dataset[config.itemType === ItemType.File ? "filePath" : 
"dirPath"] = itemPathString;
             button.textContent = config.buttonTextDefault;
-            if (config.disableCondition(itemPathString, 
uiState.currentlySelectedFilePath, uiState.currentlyChosenDirectoryPath, 
getParentPath)) {
-                button.disabled = true;
-            }
             buttonCell.appendChild(button);
         }
         pathCell.appendChild(span);
@@ -146,8 +143,7 @@ function renderAllLists() {
         buttonClassActive: "btn-primary",
         buttonTextSelected: TXT_SELECTED,
         buttonTextDefault: TXT_SELECT,
-        moreInfoId: FILE_LIST_MORE_INFO_ID,
-        disableCondition: (itemPath, _selectedFile, chosenDir, getParent) => 
!!chosenDir && (getParent(itemPath) === chosenDir),
+        moreInfoId: FILE_LIST_MORE_INFO_ID
     };
     renderListItems(fileListTableBody, filteredFilePaths, filesConfig);
     const lowerDirFilter = toLower(uiState.dirFilter);
@@ -160,8 +156,7 @@ function renderAllLists() {
         buttonClassActive: "btn-secondary",
         buttonTextSelected: TXT_CHOSEN,
         buttonTextDefault: TXT_CHOOSE,
-        moreInfoId: DIR_LIST_MORE_INFO_ID,
-        disableCondition: (itemPath, selectedFile, _chosenDir, getParent) => 
!!selectedFile && (getParent(selectedFile) === itemPath),
+        moreInfoId: DIR_LIST_MORE_INFO_ID
     };
     renderListItems(dirListTableBody, filteredDirs, dirsConfig);
     updateMoveSelectionInfo();
@@ -177,6 +172,8 @@ function handleFileSelection(filePath) {
     renderAllLists();
 }
 function handleDirSelection(dirPath) {
+    if (dirPath && uiState.currentlySelectedFilePath && 
getParentPath(uiState.currentlySelectedFilePath) === dirPath)
+        uiState.currentlySelectedFilePath = null;
     uiState.currentlyChosenDirectoryPath = dirPath;
     renderAllLists();
 }
diff --git a/atr/static/ts/finish-selected-move.ts 
b/atr/static/ts/finish-selected-move.ts
index 1f5b270..8545381 100644
--- a/atr/static/ts/finish-selected-move.ts
+++ b/atr/static/ts/finish-selected-move.ts
@@ -60,12 +60,6 @@ interface RenderListDisplayConfig {
     buttonTextSelected: string;
     buttonTextDefault: string;
     moreInfoId: string;
-    disableCondition: (
-        itemPath: string,
-        selectedFile: string | null,
-        chosenDir: string | null,
-        getParent: (filePath: string) => string
-    ) => boolean;
 }
 
 let fileFilterInput: HTMLInputElement;
@@ -165,9 +159,6 @@ function renderListItems(
             button.dataset[config.itemType === ItemType.File ? "filePath" : 
"dirPath"] = itemPathString;
             button.textContent = config.buttonTextDefault;
 
-            if (config.disableCondition(itemPathString, 
uiState.currentlySelectedFilePath, uiState.currentlyChosenDirectoryPath, 
getParentPath)) {
-                button.disabled = true;
-            }
             buttonCell.appendChild(button);
         }
 
@@ -202,9 +193,7 @@ function renderAllLists(): void {
         buttonClassActive: "btn-primary",
         buttonTextSelected: TXT_SELECTED,
         buttonTextDefault: TXT_SELECT,
-        moreInfoId: FILE_LIST_MORE_INFO_ID,
-        disableCondition: (itemPath, _selectedFile, chosenDir, getParent) =>
-            !!chosenDir && (getParent(itemPath) === chosenDir),
+        moreInfoId: FILE_LIST_MORE_INFO_ID
     };
     renderListItems(fileListTableBody, filteredFilePaths, filesConfig);
 
@@ -220,9 +209,7 @@ function renderAllLists(): void {
         buttonClassActive: "btn-secondary",
         buttonTextSelected: TXT_CHOSEN,
         buttonTextDefault: TXT_CHOOSE,
-        moreInfoId: DIR_LIST_MORE_INFO_ID,
-        disableCondition: (itemPath, selectedFile, _chosenDir, getParent) =>
-            !!selectedFile && (getParent(selectedFile) === itemPath),
+        moreInfoId: DIR_LIST_MORE_INFO_ID
     };
     renderListItems(dirListTableBody, filteredDirs, dirsConfig);
 
@@ -241,6 +228,7 @@ function handleFileSelection(filePath: string | null): void 
{
 }
 
 function handleDirSelection(dirPath: string | null): void {
+    if (dirPath && uiState.currentlySelectedFilePath && 
getParentPath(uiState.currentlySelectedFilePath) === dirPath) 
uiState.currentlySelectedFilePath = null;
     uiState.currentlyChosenDirectoryPath = dirPath;
     renderAllLists();
 }


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

Reply via email to