Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(BREAKING) O3-4077: Improve the workspace group workflow #1185

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

vasharma05
Copy link
Member

@vasharma05 vasharma05 commented Oct 28, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. Ensure your PR title includes a conventional commit label (such as feat, fix, or chore, among others). See existing PR titles for inspiration.

For changes to apps

If applicable

  • My work includes tests or is validated by existing tests.
  • I have updated the esm-framework mock to reflect any API changes I have made.

Summary

Currently, for the related workspaces (current implementation: patient dashboard workspace in the Ward View), the sidebar family (group of workspaces is termed as a family) is defined in the workspace registration using 2 properties hasSidebar and sidebarFamily.

@brandones suggests that we can move this handling to the WorkspaceContainer, and handling of workspace group should be independent to the workspace implementation.

New implementation

Workspace group (rename of the workspace family)

Workspace group refers to the workspaces with a sidebar and shares some common state among different workspaces.

Launching workspace group

Workspace group should be launched with launchWorkspaceGroup and we can pass state, as well as a callback when workspace is launched and a cleanup function when the workspace group closes.

Supported group for a workspace

A new property workspaceGroups is defined in the workspace registration, to validate if a workspace launched is a part of the currently opened workspace group and if not, the current workspace group will be closed and then the workspace will be launched.

Example

<button
        className={styles.wardPatientCardButton}
        onClick={() => {
          launchWorkspaceGroup('ward-patient', {
            state: {
              wardPatient,
              WardPatientHeader,
            },
            onWorkspaceGroupLaunch: () => {
              const store = getPatientChartStore();
              store.setState({
                patientUuid: patient.uuid,
              });
              launchWorkspace<PatientWorkspaceAdditionalProps>('patient-transfer-swap-workspace');
            },
            workspaceGroupCleanup: () => {
              const store = getPatientChartStore();
              store.setState({
                patientUuid: undefined,
              });
            },
          });
        }}>
        {getPatientName(patient.person)}
      </button>

Screenshots

None

Related Issue

https://issues.openmrs.org/browse/O3-4077

Other

Copy link
Contributor

github-actions bot commented Oct 28, 2024

Size Change: -148 kB (-2.36%)

Total Size: 6.14 MB

Filename Size Change
packages/shell/esm-app-shell/dist/22297969d3013a41.js 0 B -45.1 kB (removed) 🏆
packages/shell/esm-app-shell/dist/a6fa7e47859e8927.js 0 B -65 kB (removed) 🏆
packages/shell/esm-app-shell/dist/openmrs.c251fdd08d00b996.js 0 B -21.7 kB (removed) 🏆
ℹ️ View Unchanged
Filename Size Change
packages/apps/esm-devtools-app/dist/593.js 149 kB 0 B
packages/apps/esm-devtools-app/dist/642.js 21.1 kB 0 B
packages/apps/esm-devtools-app/dist/657.js 7.02 kB 0 B
packages/apps/esm-devtools-app/dist/735.js 2.63 kB 0 B
packages/apps/esm-devtools-app/dist/762.js 4.1 kB 0 B
packages/apps/esm-devtools-app/dist/788.js 42.9 kB 0 B
packages/apps/esm-devtools-app/dist/875.js 11.6 kB 0 B
packages/apps/esm-devtools-app/dist/889.js 373 kB -41 B (-0.01%)
packages/apps/esm-devtools-app/dist/988.js 326 B 0 B
packages/apps/esm-devtools-app/dist/main.js 3.23 kB 0 B
packages/apps/esm-devtools-app/dist/openmrs-esm-devtools-app.js 3.28 kB 0 B
packages/apps/esm-help-menu-app/dist/167.js 1.07 kB 0 B
packages/apps/esm-help-menu-app/dist/248.js 9.89 kB 0 B
packages/apps/esm-help-menu-app/dist/611.js 2.45 kB 0 B
packages/apps/esm-help-menu-app/dist/642.js 21.1 kB 0 B
packages/apps/esm-help-menu-app/dist/657.js 7.02 kB 0 B
packages/apps/esm-help-menu-app/dist/662.js 147 kB 0 B
packages/apps/esm-help-menu-app/dist/735.js 2.63 kB 0 B
packages/apps/esm-help-menu-app/dist/788.js 42.9 kB 0 B
packages/apps/esm-help-menu-app/dist/889.js 373 kB -40 B (-0.01%)
packages/apps/esm-help-menu-app/dist/958.js 3.74 kB 0 B
packages/apps/esm-help-menu-app/dist/main.js 8.56 kB 0 B
packages/apps/esm-help-menu-app/dist/openmrs-esm-help-menu-app.js 3.23 kB 0 B
packages/apps/esm-implementer-tools-app/dist/152.js 585 B 0 B
packages/apps/esm-implementer-tools-app/dist/236.js 583 B 0 B
packages/apps/esm-implementer-tools-app/dist/240.js 584 B 0 B
packages/apps/esm-implementer-tools-app/dist/261.js 585 B 0 B
packages/apps/esm-implementer-tools-app/dist/271.js 744 B 0 B
packages/apps/esm-implementer-tools-app/dist/272.js 584 B 0 B
packages/apps/esm-implementer-tools-app/dist/289.js 14.2 kB 0 B
packages/apps/esm-implementer-tools-app/dist/319.js 675 B 0 B
packages/apps/esm-implementer-tools-app/dist/336.js 137 kB 0 B
packages/apps/esm-implementer-tools-app/dist/36.js 2.49 kB 0 B
packages/apps/esm-implementer-tools-app/dist/378.js 687 B 0 B
packages/apps/esm-implementer-tools-app/dist/426.js 27.8 kB 0 B
packages/apps/esm-implementer-tools-app/dist/441.js 4.38 kB 0 B
packages/apps/esm-implementer-tools-app/dist/448.js 4.66 kB 0 B
packages/apps/esm-implementer-tools-app/dist/460.js 775 B 0 B
packages/apps/esm-implementer-tools-app/dist/491.js 134 kB 0 B
packages/apps/esm-implementer-tools-app/dist/539.js 583 B 0 B
packages/apps/esm-implementer-tools-app/dist/574.js 584 B 0 B
packages/apps/esm-implementer-tools-app/dist/587.js 2.93 kB 0 B
packages/apps/esm-implementer-tools-app/dist/625.js 585 B 0 B
packages/apps/esm-implementer-tools-app/dist/642.js 21.1 kB 0 B
packages/apps/esm-implementer-tools-app/dist/644.js 739 B 0 B
packages/apps/esm-implementer-tools-app/dist/652.js 584 B 0 B
packages/apps/esm-implementer-tools-app/dist/657.js 7.03 kB 0 B
packages/apps/esm-implementer-tools-app/dist/667.js 121 kB 0 B
packages/apps/esm-implementer-tools-app/dist/673.js 584 B 0 B
packages/apps/esm-implementer-tools-app/dist/705.js 585 B 0 B
packages/apps/esm-implementer-tools-app/dist/711.js 584 B 0 B
packages/apps/esm-implementer-tools-app/dist/727.js 584 B 0 B
packages/apps/esm-implementer-tools-app/dist/735.js 2.63 kB 0 B
packages/apps/esm-implementer-tools-app/dist/737.js 584 B 0 B
packages/apps/esm-implementer-tools-app/dist/744.js 710 B 0 B
packages/apps/esm-implementer-tools-app/dist/757.js 692 B 0 B
packages/apps/esm-implementer-tools-app/dist/788.js 42.9 kB 0 B
packages/apps/esm-implementer-tools-app/dist/807.js 583 B 0 B
packages/apps/esm-implementer-tools-app/dist/833.js 714 B 0 B
packages/apps/esm-implementer-tools-app/dist/845.js 6.43 kB 0 B
packages/apps/esm-implementer-tools-app/dist/859.js 3.09 kB 0 B
packages/apps/esm-implementer-tools-app/dist/873.js 3.67 kB 0 B
packages/apps/esm-implementer-tools-app/dist/889.js 373 kB -40 B (-0.01%)
packages/apps/esm-implementer-tools-app/dist/899.js 581 B 0 B
packages/apps/esm-implementer-tools-app/dist/main.js 21 kB 0 B
packages/apps/esm-implementer-tools-app/dist/openmrs-esm-implementer-tools-app.js 3.4 kB 0 B
packages/apps/esm-login-app/dist/202.js 2.57 kB 0 B
packages/apps/esm-login-app/dist/236.js 721 B 0 B
packages/apps/esm-login-app/dist/240.js 803 B 0 B
packages/apps/esm-login-app/dist/261.js 698 B 0 B
packages/apps/esm-login-app/dist/271.js 883 B 0 B
packages/apps/esm-login-app/dist/272.js 707 B 0 B
packages/apps/esm-login-app/dist/319.js 817 B 0 B
packages/apps/esm-login-app/dist/336.js 782 B 0 B
packages/apps/esm-login-app/dist/378.js 833 B 0 B
packages/apps/esm-login-app/dist/415.js 26.7 kB 0 B
packages/apps/esm-login-app/dist/460.js 879 B 0 B
packages/apps/esm-login-app/dist/539.js 729 B 0 B
packages/apps/esm-login-app/dist/574.js 698 B 0 B
packages/apps/esm-login-app/dist/593.js 149 kB 0 B
packages/apps/esm-login-app/dist/625.js 698 B 0 B
packages/apps/esm-login-app/dist/63.js 16.5 kB 0 B
packages/apps/esm-login-app/dist/638.js 31.2 kB 0 B
packages/apps/esm-login-app/dist/642.js 21.1 kB 0 B
packages/apps/esm-login-app/dist/644.js 883 B 0 B
packages/apps/esm-login-app/dist/652.js 698 B 0 B
packages/apps/esm-login-app/dist/657.js 7.02 kB 0 B
packages/apps/esm-login-app/dist/673.js 737 B 0 B
packages/apps/esm-login-app/dist/676.js 2.23 kB 0 B
packages/apps/esm-login-app/dist/7.js 3.03 kB 0 B
packages/apps/esm-login-app/dist/705.js 698 B 0 B
packages/apps/esm-login-app/dist/711.js 697 B 0 B
packages/apps/esm-login-app/dist/727.js 698 B 0 B
packages/apps/esm-login-app/dist/735.js 2.62 kB 0 B
packages/apps/esm-login-app/dist/737.js 697 B 0 B
packages/apps/esm-login-app/dist/744.js 964 B 0 B
packages/apps/esm-login-app/dist/755.js 3.36 kB 0 B
packages/apps/esm-login-app/dist/757.js 860 B 0 B
packages/apps/esm-login-app/dist/788.js 42.9 kB 0 B
packages/apps/esm-login-app/dist/807.js 1.01 kB 0 B
packages/apps/esm-login-app/dist/833.js 846 B 0 B
packages/apps/esm-login-app/dist/859.js 3.08 kB 0 B
packages/apps/esm-login-app/dist/889.js 373 kB -41 B (-0.01%)
packages/apps/esm-login-app/dist/899.js 694 B 0 B
packages/apps/esm-login-app/dist/93.js 2.16 kB 0 B
packages/apps/esm-login-app/dist/main.js 59.4 kB 0 B
packages/apps/esm-login-app/dist/openmrs-esm-login-app.js 3.46 kB 0 B
packages/apps/esm-offline-tools-app/dist/236.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/240.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/261.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/271.js 1.19 kB 0 B
packages/apps/esm-offline-tools-app/dist/272.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/319.js 1.13 kB 0 B
packages/apps/esm-offline-tools-app/dist/336.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/378.js 1.17 kB 0 B
packages/apps/esm-offline-tools-app/dist/460.js 1.3 kB 0 B
packages/apps/esm-offline-tools-app/dist/539.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/574.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/601.js 142 kB 0 B
packages/apps/esm-offline-tools-app/dist/625.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/63.js 16.5 kB 0 B
packages/apps/esm-offline-tools-app/dist/642.js 21.1 kB 0 B
packages/apps/esm-offline-tools-app/dist/644.js 1.19 kB 0 B
packages/apps/esm-offline-tools-app/dist/645.js 91.5 kB 0 B
packages/apps/esm-offline-tools-app/dist/652.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/657.js 7.02 kB 0 B
packages/apps/esm-offline-tools-app/dist/673.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/703.js 6.32 kB 0 B
packages/apps/esm-offline-tools-app/dist/705.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/711.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/727.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/735.js 2.63 kB 0 B
packages/apps/esm-offline-tools-app/dist/737.js 1.03 kB 0 B
packages/apps/esm-offline-tools-app/dist/744.js 1.28 kB 0 B
packages/apps/esm-offline-tools-app/dist/757.js 1.19 kB 0 B
packages/apps/esm-offline-tools-app/dist/788.js 42.9 kB 0 B
packages/apps/esm-offline-tools-app/dist/807.js 1.1 kB 0 B
packages/apps/esm-offline-tools-app/dist/833.js 1.21 kB 0 B
packages/apps/esm-offline-tools-app/dist/859.js 3.09 kB 0 B
packages/apps/esm-offline-tools-app/dist/889.js 373 kB -41 B (-0.01%)
packages/apps/esm-offline-tools-app/dist/899.js 1.02 kB 0 B
packages/apps/esm-offline-tools-app/dist/947.js 8.66 kB 0 B
packages/apps/esm-offline-tools-app/dist/main.js 107 kB 0 B
packages/apps/esm-offline-tools-app/dist/openmrs-esm-offline-tools-app.js 3.39 kB 0 B
packages/apps/esm-primary-navigation-app/dist/236.js 230 B 0 B
packages/apps/esm-primary-navigation-app/dist/240.js 231 B 0 B
packages/apps/esm-primary-navigation-app/dist/261.js 231 B 0 B
packages/apps/esm-primary-navigation-app/dist/271.js 270 B 0 B
packages/apps/esm-primary-navigation-app/dist/272.js 231 B 0 B
packages/apps/esm-primary-navigation-app/dist/319.js 235 B 0 B
packages/apps/esm-primary-navigation-app/dist/336.js 231 B 0 B
packages/apps/esm-primary-navigation-app/dist/378.js 248 B 0 B
packages/apps/esm-primary-navigation-app/dist/460.js 266 B 0 B
packages/apps/esm-primary-navigation-app/dist/482.js 15.2 kB 0 B
packages/apps/esm-primary-navigation-app/dist/513.js 146 kB 0 B
packages/apps/esm-primary-navigation-app/dist/539.js 230 B 0 B
packages/apps/esm-primary-navigation-app/dist/574.js 231 B 0 B
packages/apps/esm-primary-navigation-app/dist/577.js 7.64 kB 0 B
packages/apps/esm-primary-navigation-app/dist/619.js 6.45 kB 0 B
packages/apps/esm-primary-navigation-app/dist/625.js 231 B 0 B
packages/apps/esm-primary-navigation-app/dist/63.js 16.5 kB 0 B
packages/apps/esm-primary-navigation-app/dist/644.js 270 B 0 B
packages/apps/esm-primary-navigation-app/dist/652.js 231 B 0 B
packages/apps/esm-primary-navigation-app/dist/657.js 7.03 kB 0 B
packages/apps/esm-primary-navigation-app/dist/673.js 231 B 0 B
packages/apps/esm-primary-navigation-app/dist/705.js 231 B 0 B
packages/apps/esm-primary-navigation-app/dist/711.js 231 B 0 B
packages/apps/esm-primary-navigation-app/dist/727.js 231 B 0 B
packages/apps/esm-primary-navigation-app/dist/735.js 2.63 kB 0 B
packages/apps/esm-primary-navigation-app/dist/737.js 230 B 0 B
packages/apps/esm-primary-navigation-app/dist/744.js 278 B 0 B
packages/apps/esm-primary-navigation-app/dist/757.js 237 B 0 B
packages/apps/esm-primary-navigation-app/dist/788.js 42.9 kB 0 B
packages/apps/esm-primary-navigation-app/dist/807.js 291 B 0 B
packages/apps/esm-primary-navigation-app/dist/833.js 258 B 0 B
packages/apps/esm-primary-navigation-app/dist/888.js 24.7 kB 0 B
packages/apps/esm-primary-navigation-app/dist/889.js 373 kB -38 B (-0.01%)
packages/apps/esm-primary-navigation-app/dist/899.js 228 B 0 B
packages/apps/esm-primary-navigation-app/dist/933.js 3.63 kB 0 B
packages/apps/esm-primary-navigation-app/dist/main.js 30.1 kB 0 B
packages/apps/esm-primary-navigation-app/dist/openmrs-esm-primary-navigation-app.js 3.38 kB 0 B
packages/framework/esm-api/dist/openmrs-esm-api.js 16.8 kB 0 B
packages/framework/esm-config/dist/openmrs-esm-module-config.js 8.41 kB 0 B
packages/framework/esm-context/dist/openmrs-esm-context.js 1.16 kB 0 B
packages/framework/esm-dynamic-loading/dist/openmrs-esm-dynamic-loading.js 2.89 kB 0 B
packages/framework/esm-error-handling/dist/openmrs-esm-error-handling.js 891 B 0 B
packages/framework/esm-expression-evaluator/dist/openmrs-esm-expression-evaluator.js 8.98 kB 0 B
packages/framework/esm-extensions/dist/openmrs-esm-extensions.js 25.3 kB -10 B (-0.04%)
packages/framework/esm-feature-flags/dist/openmrs-esm-feature-flags.js 1.66 kB 0 B
packages/framework/esm-framework/dist/278.openmrs-esm-framework.js 14.5 kB 0 B
packages/framework/esm-framework/dist/530.openmrs-esm-framework.js 2.93 kB 0 B
packages/framework/esm-framework/dist/588.openmrs-esm-framework.js 2.15 kB 0 B
packages/framework/esm-framework/dist/619.openmrs-esm-framework.js 6.49 kB 0 B
packages/framework/esm-framework/dist/645.openmrs-esm-framework.js 9.3 kB 0 B
packages/framework/esm-framework/dist/735.openmrs-esm-framework.js 2.65 kB 0 B
packages/framework/esm-framework/dist/746.openmrs-esm-framework.js 6.14 kB 0 B
packages/framework/esm-framework/dist/788.openmrs-esm-framework.js 42.9 kB 0 B
packages/framework/esm-framework/dist/openmrs-esm-framework.js 458 kB +311 B (+0.07%)
packages/framework/esm-globals/dist/openmrs-esm-globals.js 791 B 0 B
packages/framework/esm-navigation/dist/openmrs-esm-navigation.js 9.34 kB 0 B
packages/framework/esm-offline/dist/openmrs-esm-offline.js 34.4 kB 0 B
packages/framework/esm-react-utils/dist/openmrs-esm-react-utils.js 21.9 kB 0 B
packages/framework/esm-routes/dist/openmrs-esm-utils.js 4.66 kB -11 B (-0.24%)
packages/framework/esm-state/dist/openmrs-esm-state.js 1.59 kB 0 B
packages/framework/esm-styleguide/dist/openmrs-esm-styleguide.js 193 kB +8 B (0%)
packages/framework/esm-translations/dist/openmrs-esm-core-translations.js 1.89 kB 0 B
packages/framework/esm-utils/dist/openmrs-esm-utils.js 45.5 kB 0 B
packages/shell/esm-app-shell/dist/020865a9f65321f0.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/02af6181aebfc3a3.js 172 kB 0 B
packages/shell/esm-app-shell/dist/03b9c28659344ad3.js 5.89 kB 0 B
packages/shell/esm-app-shell/dist/0cc265fb6bd38e85.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/0e635f5176c099d7.js 1.19 kB 0 B
packages/shell/esm-app-shell/dist/1347daab66baf860.js 1.06 kB 0 B
packages/shell/esm-app-shell/dist/2464185114a2d3d0.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/358f0cf024cd4eee.js 0 B -7.04 kB (removed) 🏆
packages/shell/esm-app-shell/dist/38d4b8fb75f8850c.js 18.3 kB 0 B
packages/shell/esm-app-shell/dist/3b01402cd7292844.js 2.85 kB 0 B
packages/shell/esm-app-shell/dist/417374b674636e58.js 1.29 kB 0 B
packages/shell/esm-app-shell/dist/48f90114f3481db0.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/5632dfc52256aec6.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/572e81f004cc10c5.js 15.1 kB 0 B
packages/shell/esm-app-shell/dist/5df8dba06c8b79a1.js 3.84 kB 0 B
packages/shell/esm-app-shell/dist/5f0c5677fa573f65.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/67cea7270046f293.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/6f47008d9c93c1cb.js 3.33 kB 0 B
packages/shell/esm-app-shell/dist/71ab27e0b8d1949e.js 2.58 kB 0 B
packages/shell/esm-app-shell/dist/78e6c1cc175f1d2f.js 1.27 kB 0 B
packages/shell/esm-app-shell/dist/7a500e8de0a9283e.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/7b204450699b0daf.js 2.6 kB 0 B
packages/shell/esm-app-shell/dist/8100dc81fab85923.js 7.05 kB 0 B
packages/shell/esm-app-shell/dist/8e0d11f862dfbba6.js 626 B 0 B
packages/shell/esm-app-shell/dist/8edec91e406a4eaf.js 1.59 kB 0 B
packages/shell/esm-app-shell/dist/90c9a6a8b268b4a3.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/932785417ef383b8.js 6.99 kB 0 B
packages/shell/esm-app-shell/dist/9b9a48062557475a.js 45.1 kB 0 B
packages/shell/esm-app-shell/dist/a7792d6252d85b20.js 43 kB 0 B
packages/shell/esm-app-shell/dist/a7efa2596cd2be4f.js 168 kB 0 B
packages/shell/esm-app-shell/dist/b407f548b6fadfa3.js 3.08 kB 0 B
packages/shell/esm-app-shell/dist/b84549c6f6e14c16.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/b87a5878f8961d1a.js 2.23 kB 0 B
packages/shell/esm-app-shell/dist/b88532bde74b513a.js 9.41 kB 0 B
packages/shell/esm-app-shell/dist/bb04bb60f8aa150f.js 3.04 kB 0 B
packages/shell/esm-app-shell/dist/c8c6807fe4119742.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/cc0d293bb9b870d9.js 3.38 kB 0 B
packages/shell/esm-app-shell/dist/d5b7ae80834013a3.js 1.05 kB 0 B
packages/shell/esm-app-shell/dist/d79c587e59dee595.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/d80464c66e5d20d7.js 3.23 kB 0 B
packages/shell/esm-app-shell/dist/d94ae646e56f98a5.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/e242801468e5bab7.js 1.03 kB 0 B
packages/shell/esm-app-shell/dist/e39badf41d01af52.js 1.19 kB 0 B
packages/shell/esm-app-shell/dist/e419a658f4742c3e.js 9.36 kB 0 B
packages/shell/esm-app-shell/dist/e49c127ca058e379.js 1.3 kB 0 B
packages/shell/esm-app-shell/dist/e50c284908cadda5.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/e733f4ca112cf3e1.js 1.01 kB 0 B
packages/shell/esm-app-shell/dist/ea5058e80ed14eaf.js 0 B -5.89 kB (removed) 🏆
packages/shell/esm-app-shell/dist/ec5d3f5f76832d62.js 1.34 kB 0 B
packages/shell/esm-app-shell/dist/eee81f283a304377.js 0 B -3.83 kB (removed) 🏆
packages/shell/esm-app-shell/dist/f5c65190072bb3f7.js 626 B 0 B
packages/shell/esm-app-shell/dist/fcb385df17a82210.js 6.77 kB 0 B
packages/shell/esm-app-shell/dist/fd38d20ebd36ddb0.js 65.3 kB 0 B
packages/shell/esm-app-shell/dist/openmrs.566b18bca1b43712.js 21.7 kB 0 B
packages/shell/esm-app-shell/dist/service-worker.js 46.6 kB +2 B (0%)
packages/tooling/openmrs/dist/cli.js 2.96 kB 0 B
packages/tooling/openmrs/dist/commands/assemble.js 3.31 kB 0 B
packages/tooling/openmrs/dist/commands/build.js 1.34 kB 0 B
packages/tooling/openmrs/dist/commands/debug.js 543 B 0 B
packages/tooling/openmrs/dist/commands/develop.js 2.71 kB 0 B
packages/tooling/openmrs/dist/commands/index.js 437 B 0 B
packages/tooling/openmrs/dist/commands/start.js 850 B 0 B
packages/tooling/openmrs/dist/index.js 517 B 0 B
packages/tooling/openmrs/dist/runner.js 640 B 0 B
packages/tooling/openmrs/dist/utils/config.js 726 B 0 B
packages/tooling/openmrs/dist/utils/debugger.js 575 B 0 B
packages/tooling/openmrs/dist/utils/dependencies.js 643 B 0 B
packages/tooling/openmrs/dist/utils/helpers.js 397 B 0 B
packages/tooling/openmrs/dist/utils/importmap.js 3.07 kB 0 B
packages/tooling/openmrs/dist/utils/index.js 443 B 0 B
packages/tooling/openmrs/dist/utils/logger.js 368 B 0 B
packages/tooling/openmrs/dist/utils/npmConfig.js 831 B 0 B
packages/tooling/openmrs/dist/utils/untar.js 725 B 0 B
packages/tooling/openmrs/dist/utils/variables.js 192 B 0 B
packages/tooling/openmrs/dist/utils/webpack.js 278 B 0 B
packages/tooling/webpack-config/dist/index.js 3.61 kB 0 B

compressed-size-action

@chibongho
Copy link
Contributor

chibongho commented Oct 29, 2024

With this change, does it mean that the workspaceFamily of a workspace is only defined when we call launchWorkspace(workspaceName, props, workspaceFamily)? For example, let's say we have a patient search workspace defined in esm-patient-search-app. Can we have the same workspace be launched in different workspace families (such as "service-queues-app-family" and "ward-app-family", depending on which app it's launched from)?

Also, is there a way to close a all workspaces in a workspace family?

If yes to the above questions, then yeah, I'm generally on board.

This change is a bit hard for me to review without seeing it in action. If people are on board with this, maybe we can also have a draft for corresponding changes in patient chart or patient management?

@vasharma05
Copy link
Member Author

let's say we have a patient search workspace defined in esm-patient-search-app. Can we have the same workspace be launched in different workspace families (such as "service-queues-app-family" and "ward-app-family", depending on which app it's launched from)?

Exactly, we won't have to duplicate workspaces to configure it and to open it in the workspace family, now we use the same workspace either individually or in the workspace family, with minimal to no changes. I am using the same to add Order Basket to the Ward Workspace.

Also, is there a way to close a all workspaces in a workspace family?

Yes, we have a function to close all workspaces, I need to tweak it to allow closing only the workspaces in a family.

This change is a bit hard for me to review without seeing it in action. If people are on board with this, maybe we can also have a draft for corresponding changes in patient chart or patient management?

I understand, hence I am implementing this with the order basket addition to the ward workspaces, and will share the results here, currently keeping this PR in draft and will make changes as I find more observations.

Thanks @chibongho for supporting the work!

@vasharma05 vasharma05 marked this pull request as ready for review November 11, 2024 09:07
Copy link
Member Author

@vasharma05 vasharma05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some notes to myself

@vasharma05
Copy link
Member Author

@brandones @ibacher @denniskigen, this PR is open for review now. Hoping for your timely review.
Thanks!

@brandones
Copy link
Collaborator

As a total aside: looking at this code

            onWorkspaceGroupLaunch: () => {
              const store = getPatientChartStore();
              store.setState({
                patientUuid: patient.uuid,
              });
              launchWorkspace<PatientWorkspaceAdditionalProps>('patient-transfer-swap-workspace');
            },

I think we should wrap the patient chart state in a higher-level API. Something like setCurrentPatient and getCurrentPatient.

@brandones
Copy link
Collaborator

I've provided some feedback. I did some pairing with Vineet and Usama on this so it would be great if someone else could review after the next revision. Generally I think the approach is good. @mogoodrich @chibongho @denniskigen @ibacher

@vasharma05 vasharma05 changed the title (DRAFT) (refactor) O3-4077: Move workspace family to the workspace container (refactor) O3-4077: Move workspace family to the workspace container Nov 12, 2024
Copy link
Contributor

@chibongho chibongho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I think this will simplify the workspace sidebar

Questions:

  • Should a workspace instance have access to its currentWorkspaceGroup (since it is required to close its workspace group)?
  • When launchWorkspace is called from within a workspace or from an action menu item, does the new workspace get launched within the same workspace group?
  • Is it still true that a WorkspaceContainer is not tied to any particular workspace or workspace group? (so we don't need to create multiple WorkspaceContainer for multiple workspace groups?)
  • Tangent. I'm not that comfortable with the idea of contextKey for WorkspaceContainer, which defines the URL subpath to match on to determine whether any workspaces in the WorkspaceContainer should remain open. It feels like we should just close any open workspaces when the <WorkspaceContainer> dismounts. Thoughts?

@@ -171,7 +183,7 @@ function Workspace({ workspaceInstance, additionalWorkspaceProps }: WorkspacePro
<div className={styles.overlayHeaderSpacer} />
<HeaderGlobalBar className={styles.headerButtons}>
<ExtensionSlot
name={`workspace-header-family-${workspaceInstance.sidebarFamily}-slot`}
name={`workspace-header-family-${workspaceInstance.currentWorkspaceGroup}-slot`}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break things, but should we also rename this to not say "family"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No @chibongho, this will not break anything, because the previous sidebarFamily is the same as the currentWorkspaceGroup for the ward app.

*/
sidebarFamily?: string;
preferredWindowSize?: WorkspaceWindowState;
groups: Array<string>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? Shouldn't what group a workspace belongs to be defined by the caller of launchWorkspaceGroup?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the registration of the workspace is the right place to define the groups, else, the developer will have to handle different scenarios of whether to open it in the group or individual, which right now is handled by the workspace system.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think I misunderstood our earlier conversation. Does that mean that a workspace must have a workspace group defined in routes.json for it to be launched in that workspace group? (in other words, it's impossible to create a workspace that can be launched in any arbitrary workspace group.)

I'm thinking of something like the patient search workspace in esm-patient-serach-app, where it's really meant for other apps (ex: esm-service-queues-app) to launch it. There is no way to launch the patient search workspace in the "service-queues-app" group, correct? (Admittedly, if we really want this, we can work around it by having the patient search workspace be an extension instead, and slot it into a workspace in the "service-service-app" group defined within esm-service-queues-app)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think I misunderstood our earlier conversation. Does that mean that a workspace must have a workspace group defined in routes.json for it to be launched in that workspace group? (in other words, it's impossible to create a workspace that can be launched in any arbitrary workspace group.)

Yes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Admittedly, if we really want this, we can work around it by having the patient search workspace be an extension instead, and slot it into a workspace in the "service-service-app" group defined within esm-service-queues-app

I didn't understand this

Copy link
Contributor

@chibongho chibongho Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the typos. I was saying if we need the patient search workspace defined in patient-search-app to belong to either the "service-queues-app" or "ward-app" workspace group (depending where we want to open it from), then the patient search workspace probably shouldn't be a workspace at all, but instead an extension that can be slotted into a workspace.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just a set of React components, so it can be added to the styleguide? That seems the cleanest to me...

@@ -440,29 +441,29 @@ describe('workspace system', () => {
expect(store.getState().openWorkspaces.length).toBe(0);
});

describe('Testing `getWorkspaceFamilyStore` function', () => {
describe('Testing `getWorkspaceGroupStore` function', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: replace "Family" in variables names inside this function

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'm on it

@brandones
Copy link
Collaborator

@chibongho thanks for the thoughtful review, much appreciated. Just a note:

I'm not that comfortable with the idea of contextKey for WorkspaceContainer, which defines the URL subpath to match on to determine whether any workspaces in the WorkspaceContainer should remain open. It feels like we should just close any open workspaces when the dismounts. Thoughts?

The reason we designed it this way is because it doesn't always line up well with mounts/unmounts. In particular, when transitioning between different patients in the patient chart, the WorkspaceContainer will not be unmounted; however, any open workspaces should certainly be closed. On the home page, I don't remember whether things like Service Queues are dashboards or independent pages that just happen to be served under the /home path, but in the latter case, this would be a thing where the workspace should stay open even though the component would need to unmount.

@vasharma05 vasharma05 changed the title (refactor) O3-4077: Move workspace family to the workspace container (refactor) O3-4077: Improve the workspace group workflow Nov 19, 2024
@vasharma05
Copy link
Member Author

  • Should a workspace instance have access to its currentWorkspaceGroup (since it is required to close its workspace group)?

Yes, when the launchWorkspace is called, the openWorkspace stores the group name.

  • When launchWorkspace is called from within a workspace or from an action menu item, does the new workspace get launched within the same workspace group?

If the workspace registration (inside the routes.json) defines the current open workspace group inside the workspace's groups properties, it will open inside the container, else it will close the workspace group and then open the new workspace.

  • Is it still true that a WorkspaceContainer is not tied to any particular workspace or workspace group? (so we don't need to create multiple WorkspaceContainer for multiple workspace groups?)

Yes, we just need 1 workspace container

@vasharma05
Copy link
Member Author

Hi @brandones @chibongho ,
Requesting your review here and if all good, may we merge it, given it's needed for some other tasks too.
Thanks!

@chibongho
Copy link
Contributor

Yes, when the launchWorkspace is called, the openWorkspace stores the group name.

Shouldn't the group name also be accessible in DefaultWorkspaceProps? If not, how does a workspace access the group name?

If the workspace registration (inside the routes.json) defines the current open workspace group inside the workspace's groups properties, it will open inside the container, else it will close the workspace group and then open the new workspace.

Ok, that makes sense.

@vasharma05
Copy link
Member Author

Shouldn't the group name also be accessible in DefaultWorkspaceProps? If not, how does a workspace access the group name?

What's the use case for this? As far as the common data of a group is concerned, all the common data is shared in the workspace props, as previously implemented.
Thanks!

@chibongho
Copy link
Contributor

Shouldn't the group name also be accessible in DefaultWorkspaceProps? If not, how does a workspace access the group name?

What's the use case for this? As far as the common data of a group is concerned, all the common data is shared in the workspace props, as previously implemented. Thanks!

Ok, never mind. Your answer to the other question makes this moot. I was thinking something like this:

function MyWorkspace(props: DefaultWorkspaceProps) {
  const onSubmit = () => {
     submitData().then(() => closeWorkspaceGroup('myWorkspaceGroup')); 
  }
  return (<button onClick={onSubmit} />);
}

But since MyWorkspace must be defined with a workspace group (myWroskpaceGroup), we should always know what it is without needing to access it programmatically.

Copy link
Contributor

@chibongho chibongho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work! I think this looks good, but would be nice to get input from others.

@ibacher ibacher changed the title (refactor) O3-4077: Improve the workspace group workflow (BREAKING) O3-4077: Improve the workspace group workflow Nov 22, 2024
Copy link
Member

@ibacher ibacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great overall work here, aside from the nit-picking comments I left.

There's some documentation work to be improved and, since this affects the routes.json file, we should also have a a PR to update the schema.

@@ -12,18 +11,18 @@ import type { StoreApi } from 'zustand/vanilla';
*
* @param {string} sidebarFamilyName The sidebarFamilyName of the workspace used when registering the workspace in the module's routes.json file.
*/
export function useWorkspaceFamilyStore(sidebarFamilyName: string) {
export function useWorkspaceGroupStore(workspaceGroupName?: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is workspaceGroupName optional here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this function was initially made to be called for workspaces launched with and without a group name, the argument is hence optional. If the argument is undefined, this function will return undefined, else will return a global store.

I have already added tests for this function.

expect(sidebarFamilyStore?.getState()?.['foo']).toBe(true);
launchWorkspace('transfer-patient-workspace', { bar: false });
expect(workspaceGroupStore).toBeTruthy();
expect(workspaceGroupStore?.getState()?.['foo']).toBe(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a comment, but since we've already asserted that workspaceGroupStore is truthy, we can assume below that it's not null or undefined.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has become a habit of mine to use null checks, so that I can check things validity, and also it doesn't break the code at any point. I'll try to improve on this.

*/
sidebarFamily?: string;
preferredWindowSize?: WorkspaceWindowState;
groups: Array<string>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just a set of React components, so it can be added to the styleguide? That seems the cleanest to me...

* - Updates the main workspace store to remove the workspace group
* - Calls the optional closeup callback if provided
*/
function closeWorkspaceGroup(groupName: string, onWorkspaceCloseup?: Function) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always prefer () => void over Function. It's substantially more explicit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

workspaceGroup: undefined,
}));
if (onWorkspaceCloseup && typeof onWorkspaceCloseup === 'function') {
onWorkspaceCloseup?.();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already did the checking that this is defined, so...

Suggested change
onWorkspaceCloseup?.();
onWorkspaceCloseup();

});
return;
}
const currentGroupName = store.getState().workspaceGroup?.name;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const currentGroupName = store.getState().workspaceGroup?.name;
const currentGroupName = currentWorkspaceGroup?.name;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After closing the workspace group, the updated workspace group might have been updated, hence I am fetching the workspace group name from the state.

Comment on lines 510 to 513
.every(({ name }) => {
const canCloseWorkspace = canCloseWorkspaceWithoutPrompting(name);
return canCloseWorkspace;
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.every(({ name }) => {
const canCloseWorkspace = canCloseWorkspaceWithoutPrompting(name);
return canCloseWorkspace;
});
.every(({ name }) => canCloseWorkspaceWithoutPrompting(name));

@@ -302,19 +302,15 @@ export type WorkspaceDefinition = {
* The width "extra-wide" is for workspaces that contain their own sidebar.
*/
width?: 'narrow' | 'wider' | 'extra-wide';
preferredWindowSize?: WorkspaceWindowState;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs docs...

Comment on lines 307 to 311
* Workspaces can open either individually or in a group of workspaces. The workspace groups
* will define the groups in which a workspace can be opened.
*
* In case the currently opened workspace is not present in the groups of a workspace,
* the current group will close and then the workspace will be launched.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the description here is unclear. Maybe:

Suggested change
* Workspaces can open either individually or in a group of workspaces. The workspace groups
* will define the groups in which a workspace can be opened.
*
* In case the currently opened workspace is not present in the groups of a workspace,
* the current group will close and then the workspace will be launched.
* Workspaces can open either independently or as part of a "workspace group". A
* "workspace group" groups related workspaces together, so that only one is visible
* at a time. For example, <USE CASE DESCRIPTION HERE>.
*
* In case the currently opened workspace is not present in the groups of a workspace,
* the current group will close and then the workspace will be launched.

Comment on lines 310 to 311
* In case the currently opened workspace is not present in the groups of a workspace,
* the current group will close and then the workspace will be launched.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These last two lines are really ambiguous. Can you think of a way to rephrase it? I'm not entirely sure what this is trying to communicate, so I'm not sure what to suggest.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's unclear to me: What does "currently opened workspace" here mean? Is the workspace being opened, the workspace currently opened, any workspace in the workspace stack? What does this have to do with "launching"?

* workspaceGroupCleanup: () => console.log("Cleaning up workspace group")
* });
*/
export function launchWorkspaceGroup(groupName: string, args: LaunchWorkspaceGroupArg) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a workspace can only ever be opened within the workspace group declared in routes.json, do we need a separate launchWorkspaceGroup function instead of just using launchWorkspace (and overload it it with group related params)?

If we still want to keep this function, we might want to make it generic on both workspace props and workspace group props.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it makes sense to have a separate launchWorkspaceGroup function for the following reasons:

  1. Making clear distinction between launching workspace and launching workspace group. Providing different function orderloads will in the end confuse the developer too.
  2. launchWorkspace function is used for every workspace launch, and on the other hand, launchWorkspaceGroup function is used only at the initial launch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants