[PR #14292] [MERGED] Implement MVVM for the Actions page #30048

Open
opened 2026-01-31 09:38:21 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/14292
Author: @PankajBhojwani
Created: 10/26/2022
Status: Merged
Merged: 2/13/2024
Merged by: @microsoft-github-policy-service[bot]

Base: mainHead: dev/pabhoj/actions_vm


📝 Commits (9)

📊 Changes

10 files changed (+618 additions, -513 deletions)

View changed files

📝 src/cascadia/TerminalSettingsEditor/Actions.cpp (+30 -346)
📝 src/cascadia/TerminalSettingsEditor/Actions.h (+3 -113)
📝 src/cascadia/TerminalSettingsEditor/Actions.idl (+2 -52)
📝 src/cascadia/TerminalSettingsEditor/Actions.xaml (+1 -1)
src/cascadia/TerminalSettingsEditor/ActionsViewModel.cpp (+380 -0)
src/cascadia/TerminalSettingsEditor/ActionsViewModel.h (+131 -0)
src/cascadia/TerminalSettingsEditor/ActionsViewModel.idl (+60 -0)
📝 src/cascadia/TerminalSettingsEditor/MainPage.cpp (+1 -1)
📝 src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj (+9 -0)
📝 src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj.filters (+1 -0)

📄 Description

Summary of the Pull Request

Implements an ActionsViewModel for the Actions page in the SUI

References

PR Checklist

  • Closes #xxx
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Documentation updated. If checked, please file a pull request on our docs repo and link it here: #xxx
  • Schema updated.
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

A few annoyances:

  • Because of the shifts in the UI when switching between edit mode/regular mode on the KeyBindingViewModels, the page used to manually handle moving focus accordingly so that focus does not get lost. However, the page no longer owns the KeyBindingViewModel, instead the ActionsViewModel owns them but the ActionsViewModel cannot manually move focus around since it does not own the UI Element. So, the ActionsViewModel emits an event for the page to catch that tells the page to move focus (FocusContainer).
  • Similarly, the page used to manually update the ContainerBackground of the KeyBindingViewModel when the kbdVM enters EditMode. The ActionsViewModel does not have access to the page's resources though (to determine the correct background brush to use). So, the ActionsViewModel emits another event for the page to catch (UpdateBackground).

Validation Steps Performed

Actions page still works as before


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/14292 **Author:** [@PankajBhojwani](https://github.com/PankajBhojwani) **Created:** 10/26/2022 **Status:** ✅ Merged **Merged:** 2/13/2024 **Merged by:** [@microsoft-github-policy-service[bot]](https://github.com/apps/microsoft-github-policy-service) **Base:** `main` ← **Head:** `dev/pabhoj/actions_vm` --- ### 📝 Commits (9) - [`d604ab0`](https://github.com/microsoft/terminal/commit/d604ab05dbac3e958221df762c60cce998308bbf) boilerplate - [`9363254`](https://github.com/microsoft/terminal/commit/9363254e87fa8e87b6e17ed326bb5a264dea2d36) all works except background - [`f5bc3d4`](https://github.com/microsoft/terminal/commit/f5bc3d40e3c4d74d3dccbde685b2532c20d167c7) background - [`f87eac1`](https://github.com/microsoft/terminal/commit/f87eac1125e77b568cc00d25a6d2a1ea7ecfa05d) nits first - [`035ed88`](https://github.com/microsoft/terminal/commit/035ed88bd02fa413c35da74a52fdec736ce79db4) rename - [`d088ae0`](https://github.com/microsoft/terminal/commit/d088ae04b690d385c1e0b6eb2d55d50281609070) Migrate spelling-0.0.21 changes from main - [`338a05b`](https://github.com/microsoft/terminal/commit/338a05bbaba48044def146c8093801be3ffb28e4) conflict - [`e43dc1e`](https://github.com/microsoft/terminal/commit/e43dc1ed602ae50bea2376d5d8b3f1425fa4c5d6) Conflict - [`ab12137`](https://github.com/microsoft/terminal/commit/ab12137af06b89bd2af35d8b2a05a2ea8cb06caa) update ### 📊 Changes **10 files changed** (+618 additions, -513 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalSettingsEditor/Actions.cpp` (+30 -346) 📝 `src/cascadia/TerminalSettingsEditor/Actions.h` (+3 -113) 📝 `src/cascadia/TerminalSettingsEditor/Actions.idl` (+2 -52) 📝 `src/cascadia/TerminalSettingsEditor/Actions.xaml` (+1 -1) ➕ `src/cascadia/TerminalSettingsEditor/ActionsViewModel.cpp` (+380 -0) ➕ `src/cascadia/TerminalSettingsEditor/ActionsViewModel.h` (+131 -0) ➕ `src/cascadia/TerminalSettingsEditor/ActionsViewModel.idl` (+60 -0) 📝 `src/cascadia/TerminalSettingsEditor/MainPage.cpp` (+1 -1) 📝 `src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj` (+9 -0) 📝 `src/cascadia/TerminalSettingsEditor/Microsoft.Terminal.Settings.Editor.vcxproj.filters` (+1 -0) </details> ### 📄 Description ## Summary of the Pull Request Implements an `ActionsViewModel` for the `Actions` page in the SUI ## References ## PR Checklist * [ ] Closes #xxx * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema updated. * [x] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx ## Detailed Description of the Pull Request / Additional comments A few annoyances: - Because of the shifts in the UI when switching between edit mode/regular mode on the `KeyBindingViewModel`s, the page used to manually handle moving focus accordingly so that focus does not get lost. However, the page no longer owns the `KeyBindingViewModel`, instead the `ActionsViewModel` owns them but the `ActionsViewModel` cannot manually move focus around since it does not own the UI Element. So, the `ActionsViewModel` emits an event for the page to catch that tells the page to move focus (`FocusContainer`). - Similarly, the page used to manually update the `ContainerBackground` of the `KeyBindingViewModel` when the kbdVM enters `EditMode`. The `ActionsViewModel` does not have access to the page's resources though (to determine the correct background brush to use). So, the `ActionsViewModel` emits another event for the page to catch (`UpdateBackground`). ## Validation Steps Performed Actions page still works as before --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:38:21 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30048