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

(refactor) O3-2815: Replace usages of /ws/rest/v1 with restBaseUrl #1661

Merged
merged 2 commits into from
Feb 24, 2024

Conversation

jwnasambu
Copy link
Contributor

@jwnasambu jwnasambu commented Feb 13, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

Change all instances of the hard-coded API base URL '/ws/rest/v1/' to use the restBaseUrl variable instead. To enhances maintainability and flexibility of the API base URL configuration.

Screenshots

None

Related Issue

https://openmrs.atlassian.net/browse/O3-2815

Other

@jwnasambu jwnasambu marked this pull request as draft February 13, 2024 14:58
@jwnasambu jwnasambu changed the title Replace usages of '/ws/rest/v1' with restBaseUrl (Refactor)O3-2815: Replace usages of '/ws/rest/v1' with restBaseUrl Feb 13, 2024
@@ -10,7 +10,7 @@ import { type OHRIFormSchema } from '@openmrs/openmrs-form-engine-lib';
* @returns An object containing the form schema, error, and loading state
*/
const useFormSchema = (formUuid: string) => {
const url = formUuid ? `/ws/rest/v1/o3/forms/${formUuid}` : null;
const url = formUuid ? `/restBaseUrl/o3/forms/${formUuid}` : null;
Copy link
Member

Choose a reason for hiding this comment

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

You might need to check on this @jwnasambu

@usamaidrsk
Copy link
Member

Thanks @jwnasambu for the initiative.
Looking at the value restBaseUrl resolves to, I think it's about replacing '/ws/rest/v1/' with restBaseUrl

cc @denniskigen

@jwnasambu
Copy link
Contributor Author

jwnasambu commented Feb 14, 2024

@usamaidrsk Thanks so much for the catch! @denis' ticket description is very clear its me on the wrong and am trying to fix my errors.

@jwnasambu
Copy link
Contributor Author

@denniskigen, @usamaidrsk, @ibacher kindly how can I go about with the E2E Tests build faller. Basing on the research I have done, Am getting The error you're encountering (SyntaxError: Unexpected token 'export') suggests that the environment in which you're running your code doesn't support ECMAScript module syntax.

To resolve this, you can try the following steps:

Ensure Node.js Version:
Make sure you are using a version of Node.js that supports ECMAScript modules (ESM). Node.js versions 13.2.0 and later support ESM. You can check your Node.js version using: node --version` Apparently am running node -v
v18.12.0 which shouldn't be the cause.

@jwnasambu jwnasambu marked this pull request as ready for review February 15, 2024 18:04
@ibacher
Copy link
Member

ibacher commented Feb 15, 2024

Do not change the strings in mocks or test files at all. Only in the production code. Also, in one place, a regular expression was changed to remove the preceding .+, which makes that code non-functional.

@jwnasambu jwnasambu marked this pull request as draft February 15, 2024 20:56
@denniskigen denniskigen changed the title (Refactor)O3-2815: Replace usages of '/ws/rest/v1' with restBaseUrl (refactor) O3-2815: Replace usages of /ws/rest/v1 with restBaseUrl Feb 15, 2024
@jwnasambu jwnasambu marked this pull request as ready for review February 20, 2024 22:02
@vasharma05
Copy link
Member

yarn up @openmrs/esm-framework@next openmrs@next

@denniskigen denniskigen force-pushed the (refactor)O3-2815 branch 4 times, most recently from ce9da4d to 0671d4d Compare February 24, 2024 21:52
@denniskigen
Copy link
Member

Thanks, @jwnasambu!

@denniskigen denniskigen merged commit 6aa9325 into openmrs:main Feb 24, 2024
6 checks passed
jnsereko added a commit to jnsereko/openmrs-esm-patient-chart that referenced this pull request Mar 3, 2024
(feat) O3-2760: Add a `closeWorkspaceWithSavedChanges` function to the workspace API (openmrs#1689)

* Added new function 'closeWorkspaceWithSavedChanges' to close workspace after form is saved

* Passing 'closeWorkspaceWithSavedChanges' as workspace props

(docs) Amend steps for updating core libraries in README (openmrs#1690)

(chore) Bump @openmrs/ngx-formentry (openmrs#1684)

(fix) O3 2804: Reuse the ResponsiveWrapper component from esm-framework (openmrs#1673)

* (feat) Reuse ResponsiveWrapper component from esm-framework

* feat: Added Layer in visit-notes-form

* Fix styleguide imports by bumping both openmrs tooling and framework

* Misc fixes

---------

Co-authored-by: Dennis Kigen <[email protected]>

(refactor) O3-2815: Replace usages of `/ws/rest/v1` with `restBaseUrl` (openmrs#1661)

* (Refactor)O3-2815: Replace usages of '/ws/rest/v1' with restBaseUrl

* Fixup

---------

Co-authored-by: jwnasambu <wamalwa1844.com>
Co-authored-by: Dennis Kigen <[email protected]>

(feat) Add ability to cancel orders (openmrs#1640)

* (feat) cancel order

* clean up

* pr changes, reload fixes and clean up

* translations

* wip cancel order via action

* mutate orders on cancel

* order mutations and pr comments

* fixes to labs

* button text change

* Fixup

* More tweaks

---------

Co-authored-by: Dennis Kigen <[email protected]>

(chore) Add generic slot to Visit Form (openmrs#1688)

* (chore) Add billing slot to Start Visit Form

* Add generic visit attribute slot

* remove slot from config

---------

Co-authored-by: CynthiaKamau <[email protected]>

(chore) Bump Angular form engine (openmrs#1694)

(feat) Makes orders widget expandable and adds detailed order view (openmrs#1696)

* (feat) Expandable orders widget

* adds order item cards when expanded

* changes button to tooltip

(fix) O3-2629: Submit button on Allergy Form remains disabled when filling allergen and severity before reactions (openmrs#1699)

fix the allergy reaction dependency

(feat) Hide bottom navigation on tablets and phones when workspace is active (openmrs#1695)

(feat) Relocate Load More button in visits section (openmrs#1702)

(chore) Relocate Load More button in visits section

add closeWorkspaceWithSavedChanges argument to Allergy form

parameterised allergy reaction should be checked correctly

maintain non-coded allergen array

remove test

(chore) Prettier should only list files that don't formatting config

(feat) Add config to handle bill submission in start visit form (openmrs#1700)

Upgrade peter-evans/create-pull-request

See peter-evans/create-pull-request#2790

(chore) Update translations from Transifex (openmrs#1683)

add test

fix added test
jnsereko added a commit to jnsereko/openmrs-esm-patient-chart that referenced this pull request Mar 3, 2024
(feat) O3-2760: Add a `closeWorkspaceWithSavedChanges` function to the workspace API (openmrs#1689)

* Added new function 'closeWorkspaceWithSavedChanges' to close workspace after form is saved

* Passing 'closeWorkspaceWithSavedChanges' as workspace props

(docs) Amend steps for updating core libraries in README (openmrs#1690)

(chore) Bump @openmrs/ngx-formentry (openmrs#1684)

(fix) O3 2804: Reuse the ResponsiveWrapper component from esm-framework (openmrs#1673)

* (feat) Reuse ResponsiveWrapper component from esm-framework

* feat: Added Layer in visit-notes-form

* Fix styleguide imports by bumping both openmrs tooling and framework

* Misc fixes

---------

Co-authored-by: Dennis Kigen <[email protected]>

(refactor) O3-2815: Replace usages of `/ws/rest/v1` with `restBaseUrl` (openmrs#1661)

* (Refactor)O3-2815: Replace usages of '/ws/rest/v1' with restBaseUrl

* Fixup

---------

Co-authored-by: jwnasambu <wamalwa1844.com>
Co-authored-by: Dennis Kigen <[email protected]>

(feat) Add ability to cancel orders (openmrs#1640)

* (feat) cancel order

* clean up

* pr changes, reload fixes and clean up

* translations

* wip cancel order via action

* mutate orders on cancel

* order mutations and pr comments

* fixes to labs

* button text change

* Fixup

* More tweaks

---------

Co-authored-by: Dennis Kigen <[email protected]>

(chore) Add generic slot to Visit Form (openmrs#1688)

* (chore) Add billing slot to Start Visit Form

* Add generic visit attribute slot

* remove slot from config

---------

Co-authored-by: CynthiaKamau <[email protected]>

(chore) Bump Angular form engine (openmrs#1694)

(feat) Makes orders widget expandable and adds detailed order view (openmrs#1696)

* (feat) Expandable orders widget

* adds order item cards when expanded

* changes button to tooltip

(fix) O3-2629: Submit button on Allergy Form remains disabled when filling allergen and severity before reactions (openmrs#1699)

fix the allergy reaction dependency

(feat) Hide bottom navigation on tablets and phones when workspace is active (openmrs#1695)

(feat) Relocate Load More button in visits section (openmrs#1702)

(chore) Relocate Load More button in visits section

add closeWorkspaceWithSavedChanges argument to Allergy form

parameterised allergy reaction should be checked correctly

maintain non-coded allergen array

remove test

(chore) Prettier should only list files that don't formatting config

(feat) Add config to handle bill submission in start visit form (openmrs#1700)

Upgrade peter-evans/create-pull-request

See peter-evans/create-pull-request#2790

(chore) Update translations from Transifex (openmrs#1683)

add test

fix added test
jnsereko pushed a commit to jnsereko/openmrs-esm-patient-chart that referenced this pull request Mar 4, 2024
openmrs#1661)

* (Refactor)O3-2815: Replace usages of '/ws/rest/v1' with restBaseUrl

* Fixup

---------

Co-authored-by: jwnasambu <wamalwa1844.com>
Co-authored-by: Dennis Kigen <[email protected]>
denniskigen added a commit that referenced this pull request Mar 7, 2024
)

* Add functionality to allow deleting and editing an allergy

(feat) O3-2760: Add a `closeWorkspaceWithSavedChanges` function to the workspace API (#1689)

* Added new function 'closeWorkspaceWithSavedChanges' to close workspace after form is saved

* Passing 'closeWorkspaceWithSavedChanges' as workspace props

(docs) Amend steps for updating core libraries in README (#1690)

(chore) Bump @openmrs/ngx-formentry (#1684)

(fix) O3 2804: Reuse the ResponsiveWrapper component from esm-framework (#1673)

* (feat) Reuse ResponsiveWrapper component from esm-framework

* feat: Added Layer in visit-notes-form

* Fix styleguide imports by bumping both openmrs tooling and framework

* Misc fixes

---------

Co-authored-by: Dennis Kigen <[email protected]>

(refactor) O3-2815: Replace usages of `/ws/rest/v1` with `restBaseUrl` (#1661)

* (Refactor)O3-2815: Replace usages of '/ws/rest/v1' with restBaseUrl

* Fixup

---------

Co-authored-by: jwnasambu <wamalwa1844.com>
Co-authored-by: Dennis Kigen <[email protected]>

(feat) Add ability to cancel orders (#1640)

* (feat) cancel order

* clean up

* pr changes, reload fixes and clean up

* translations

* wip cancel order via action

* mutate orders on cancel

* order mutations and pr comments

* fixes to labs

* button text change

* Fixup

* More tweaks

---------

Co-authored-by: Dennis Kigen <[email protected]>

(chore) Add generic slot to Visit Form (#1688)

* (chore) Add billing slot to Start Visit Form

* Add generic visit attribute slot

* remove slot from config

---------

Co-authored-by: CynthiaKamau <[email protected]>

(chore) Bump Angular form engine (#1694)

(feat) Makes orders widget expandable and adds detailed order view (#1696)

* (feat) Expandable orders widget

* adds order item cards when expanded

* changes button to tooltip

(fix) O3-2629: Submit button on Allergy Form remains disabled when filling allergen and severity before reactions (#1699)

fix the allergy reaction dependency

(feat) Hide bottom navigation on tablets and phones when workspace is active (#1695)

(feat) Relocate Load More button in visits section (#1702)

(chore) Relocate Load More button in visits section

add closeWorkspaceWithSavedChanges argument to Allergy form

parameterised allergy reaction should be checked correctly

maintain non-coded allergen array

remove test

(chore) Prettier should only list files that don't formatting config

(feat) Add config to handle bill submission in start visit form (#1700)

Upgrade peter-evans/create-pull-request

See peter-evans/create-pull-request#2790

(chore) Update translations from Transifex (#1683)

add test

fix added test

* clean deletePatientAllergy function

* Update packages/esm-patient-allergies-app/src/allergies/allergies-form/allergy-form.component.tsx

Co-authored-by: Dennis Kigen <[email protected]>

* Update packages/esm-patient-allergies-app/src/allergies/allergies-form/allergy-form.test.tsx

Co-authored-by: Dennis Kigen <[email protected]>

* Update packages/esm-patient-allergies-app/src/allergies/allergies-form/allergy-form.resource.ts

Co-authored-by: Dennis Kigen <[email protected]>

* (chore) Bump @openmrs/ngx-formentry

* make default allergy loading more clean

* fix linting

---------

Co-authored-by: Dennis Kigen <[email protected]>
usamaidrsk pushed a commit to usamaidrsk/openmrs-esm-patient-chart that referenced this pull request Mar 11, 2024
openmrs#1661)

* (Refactor)O3-2815: Replace usages of '/ws/rest/v1' with restBaseUrl

* Fixup

---------

Co-authored-by: jwnasambu <wamalwa1844.com>
Co-authored-by: Dennis Kigen <[email protected]>
usamaidrsk pushed a commit to usamaidrsk/openmrs-esm-patient-chart that referenced this pull request Mar 11, 2024
…enmrs#1703)

* Add functionality to allow deleting and editing an allergy

(feat) O3-2760: Add a `closeWorkspaceWithSavedChanges` function to the workspace API (openmrs#1689)

* Added new function 'closeWorkspaceWithSavedChanges' to close workspace after form is saved

* Passing 'closeWorkspaceWithSavedChanges' as workspace props

(docs) Amend steps for updating core libraries in README (openmrs#1690)

(chore) Bump @openmrs/ngx-formentry (openmrs#1684)

(fix) O3 2804: Reuse the ResponsiveWrapper component from esm-framework (openmrs#1673)

* (feat) Reuse ResponsiveWrapper component from esm-framework

* feat: Added Layer in visit-notes-form

* Fix styleguide imports by bumping both openmrs tooling and framework

* Misc fixes

---------

Co-authored-by: Dennis Kigen <[email protected]>

(refactor) O3-2815: Replace usages of `/ws/rest/v1` with `restBaseUrl` (openmrs#1661)

* (Refactor)O3-2815: Replace usages of '/ws/rest/v1' with restBaseUrl

* Fixup

---------

Co-authored-by: jwnasambu <wamalwa1844.com>
Co-authored-by: Dennis Kigen <[email protected]>

(feat) Add ability to cancel orders (openmrs#1640)

* (feat) cancel order

* clean up

* pr changes, reload fixes and clean up

* translations

* wip cancel order via action

* mutate orders on cancel

* order mutations and pr comments

* fixes to labs

* button text change

* Fixup

* More tweaks

---------

Co-authored-by: Dennis Kigen <[email protected]>

(chore) Add generic slot to Visit Form (openmrs#1688)

* (chore) Add billing slot to Start Visit Form

* Add generic visit attribute slot

* remove slot from config

---------

Co-authored-by: CynthiaKamau <[email protected]>

(chore) Bump Angular form engine (openmrs#1694)

(feat) Makes orders widget expandable and adds detailed order view (openmrs#1696)

* (feat) Expandable orders widget

* adds order item cards when expanded

* changes button to tooltip

(fix) O3-2629: Submit button on Allergy Form remains disabled when filling allergen and severity before reactions (openmrs#1699)

fix the allergy reaction dependency

(feat) Hide bottom navigation on tablets and phones when workspace is active (openmrs#1695)

(feat) Relocate Load More button in visits section (openmrs#1702)

(chore) Relocate Load More button in visits section

add closeWorkspaceWithSavedChanges argument to Allergy form

parameterised allergy reaction should be checked correctly

maintain non-coded allergen array

remove test

(chore) Prettier should only list files that don't formatting config

(feat) Add config to handle bill submission in start visit form (openmrs#1700)

Upgrade peter-evans/create-pull-request

See peter-evans/create-pull-request#2790

(chore) Update translations from Transifex (openmrs#1683)

add test

fix added test

* clean deletePatientAllergy function

* Update packages/esm-patient-allergies-app/src/allergies/allergies-form/allergy-form.component.tsx

Co-authored-by: Dennis Kigen <[email protected]>

* Update packages/esm-patient-allergies-app/src/allergies/allergies-form/allergy-form.test.tsx

Co-authored-by: Dennis Kigen <[email protected]>

* Update packages/esm-patient-allergies-app/src/allergies/allergies-form/allergy-form.resource.ts

Co-authored-by: Dennis Kigen <[email protected]>

* (chore) Bump @openmrs/ngx-formentry

* make default allergy loading more clean

* fix linting

---------

Co-authored-by: Dennis Kigen <[email protected]>
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.

5 participants