You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by da...@apache.org on 2023/03/23 15:54:42 UTC

[daffodil-vscode] branch main updated: rename the Clear button to Revert All with modal confirmation dialog

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

davin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-vscode.git


The following commit(s) were added to refs/heads/main by this push:
     new 5c0fed5  rename the Clear button to Revert All with modal confirmation dialog
5c0fed5 is described below

commit 5c0fed50bbcd67511971cfcf7b76580c21ddcca2
Author: Davin Shearer <22...@users.noreply.github.com>
AuthorDate: Wed Mar 22 13:30:37 2023 -0400

    rename the Clear button to Revert All with modal confirmation dialog
---
 src/omega_edit/dataEditWebView.ts           | 24 ++++++++++++++++--------
 src/svelte/src/components/dataEditor.svelte |  8 ++++----
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/omega_edit/dataEditWebView.ts b/src/omega_edit/dataEditWebView.ts
index b638568..ed57d48 100644
--- a/src/omega_edit/dataEditWebView.ts
+++ b/src/omega_edit/dataEditWebView.ts
@@ -288,14 +288,22 @@ export class DataEditWebView implements vscode.Disposable {
         break
 
       case MessageCommand.clear:
-        await omegaEditChange
-          .clear(this.omegaSessionId)
-          .then(async () => {
-            await this.sendChangesInfo()
-          })
-          .catch(() => {
-            vscode.window.showErrorMessage('Failed to clear changes')
-          })
+        const confirmation = await vscode.window.showInformationMessage(
+          'Are you sure you want to revert all changes?',
+          { modal: true },
+          'Yes',
+          'No'
+        )
+        if (confirmation === 'Yes') {
+          await omegaEditChange
+            .clear(this.omegaSessionId)
+            .then(async () => {
+              await this.sendChangesInfo()
+            })
+            .catch(() => {
+              vscode.window.showErrorMessage('Failed to revert all changes')
+            })
+        }
         break
 
       case MessageCommand.save:
diff --git a/src/svelte/src/components/dataEditor.svelte b/src/svelte/src/components/dataEditor.svelte
index 5a2b7ac..afb8b67 100644
--- a/src/svelte/src/components/dataEditor.svelte
+++ b/src/svelte/src/components/dataEditor.svelte
@@ -1227,9 +1227,9 @@ limitations under the License.
               <button disabled>Undo</button>
             {/if}
             {#if $undoCount + $changeCount > 0}
-              <button on:click={clearChangeStack}>Clear</button>
+              <button on:click={clearChangeStack}>Revert All</button>
             {:else}
-              <button disabled>Clear</button>
+              <button disabled>Revert All</button>
             {/if}
           </span>
         </div>
@@ -1325,9 +1325,9 @@ limitations under the License.
               <button disabled>Undo</button>
             {/if}
             {#if $undoCount + $changeCount > 0}
-              <button on:click={clearChangeStack}>Clear</button>
+              <button on:click={clearChangeStack}>Revert All</button>
             {:else}
-              <button disabled>Clear</button>
+              <button disabled>Revert All</button>
             {/if}
           </span>
         </div>