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

feat: Ensuring UI5 2.x compliance for cards-editor-middleware Plugin #2613

Merged
merged 32 commits into from
Dec 10, 2024

Conversation

UBSusmitha
Copy link
Contributor

@UBSusmitha UBSusmitha commented Nov 22, 2024

Copy link

changeset-bot bot commented Nov 22, 2024

🦋 Changeset detected

Latest commit: 3c9b09a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sap-ux/cards-editor-middleware Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

cla-assistant bot commented Nov 22, 2024

CLA assistant check
All committers have signed the CLA.

@heimwege
Copy link
Contributor

Did you test this with UI5 2 ? I'm quite confident that this line in your editor.html will not work in UI5 2

<script src="../test-resources/sap/ushell/bootstrap/sandbox.js" id="sap-ushell-bootstrap"></script>

because in UI5 2 it must be

<script src="../resources/sap/ushell/bootstrap/sandbox2.js" id="sap-ushell-bootstrap"></script>

In preview-middleware our first approach was trying to solve this dynamically in the respective flp html template but that seems to create a race condition. So I completely refactored this to loading the UI5 version upfront and using a UI5 version dependent template (see #2598).

Also using ../ hard coded is kind of dangerous as the basePath (here ../) is kind of dynamic (e.g. in case you want to support cds-plugin-ui5)

@UBSusmitha
Copy link
Contributor Author

UBSusmitha commented Nov 25, 2024

@heimwege > Thanks for pointing, I have seen the same in another commit as well.
After linking cards-editor-middleware to sap.ap.cards in local I was not seeing any issue, I will check with you to see if there is anything I am missing while testing.

@heimwege
Copy link
Contributor

@heimwege > Thanks for pointing, I have seen the same in another commit as well. After linking cards-editor-middleware to sap.ap.cards in local I was not seeing any issue, I will check with you to see if there is anything I am missing while testing.

Using the UI5 2 sources from sap.ap.cards does only verify that the code within you sandbox will work. The issue I described is that the sandbox bootstrap as such will change in UI5 2. So even if your code would run in UI5 2, the sandbox the middleware is currently using will not. You will get a blank browser window and the console will show an http 404 error message telling you that /test-resources/sap/ushell/bootstrap/sandbox.js was not found (because it's located at /resources/sap/ushell/bootstrap/sandbox2.js in UI5 2)

@tobiasqueck tobiasqueck requested a review from heimwege December 3, 2024 07:52
Copy link
Contributor

@heimwege heimwege left a comment

Choose a reason for hiding this comment

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

see Comments

packages/cards-editor-middleware/templates/Init.js Outdated Show resolved Hide resolved
packages/cards-editor-middleware/templates/Init.js Outdated Show resolved Hide resolved
packages/cards-editor-middleware/templates/Init.js Outdated Show resolved Hide resolved
packages/cards-editor-middleware/templates/Init.js Outdated Show resolved Hide resolved
packages/cards-editor-middleware/templates/flpSandbox.html Outdated Show resolved Hide resolved
packages/cards-editor-middleware/templates/flpSandbox.html Outdated Show resolved Hide resolved
packages/cards-editor-middleware/templates/Init.js Outdated Show resolved Hide resolved
@UBSusmitha UBSusmitha requested a review from heimwege December 4, 2024 04:45
Copy link
Contributor

@heimwege heimwege left a comment

Choose a reason for hiding this comment

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

see additional comments

packages/cards-editor-middleware/templates/Init.js Outdated Show resolved Hide resolved
packages/cards-editor-middleware/templates/Init.js Outdated Show resolved Hide resolved
packages/cards-editor-middleware/templates/Init.js Outdated Show resolved Hide resolved
packages/cards-editor-middleware/templates/flpSandbox.html Outdated Show resolved Hide resolved
@UBSusmitha UBSusmitha requested a review from heimwege December 5, 2024 15:55
@UBSusmitha
Copy link
Contributor Author

UBSusmitha commented Dec 10, 2024

Testing steps:

Go to open-ux-tools -> packages -> cards-editor-middleware
pnpm build
To change node version npm i -g [email protected]
npm link

Go to any app in your project:

npm link @sap-ux/cards-editor-middleware
start the app <use the command in your package.json>          #To start the app

To check if app is updated with changes in this PR:
Right click when the app is launched after opening generator preview >> View Page Source >> Check for the below line:

<script src="[./Init.js](http://localhost:8081/test/Init.js)"></script>

Within <your app>/node_modules/@sap-ux/cards-editor-middleware/templates

If you are able to see both flpSandbox.html & Init.js, then cards-editor-middleware package is linked correctly and node_modules is up to date with the changes in this PR.

After running command for starting the app, you should be able to launch the app and see manifest.json & i18n.properties files getting saved correctly after closing the dialog.

Copy link
Contributor

@heimwege heimwege left a comment

Choose a reason for hiding this comment

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

  • changeset ok
  • sonar issue with duplications should be ignored because of the upcoming integration of this middleware into preview middleware
  • test coverage is good
  • did NOT test locally

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
25.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@tobiasqueck
Copy link
Contributor

Quality Gate Failed Quality Gate failed

Failed conditions 25.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

As this is a temporary solution and we are already planning how to merge it into the preview-middleware, we are ok with the quality-gate-failure

Copy link
Contributor

@tobiasqueck tobiasqueck left a comment

Choose a reason for hiding this comment

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

  • changeset ok
  • code is duplicated but as mentioned in a comment earlier, agreed and accepted as temporary solution

@tobiasqueck tobiasqueck merged commit 1b3c47d into main Dec 10, 2024
15 of 16 checks passed
@tobiasqueck tobiasqueck deleted the feat/ensure-UI5-2.0-compliance branch December 10, 2024 13:38
devinea added a commit that referenced this pull request Dec 12, 2024
…g-message-_input

* origin/main:
  chore: apply latest changesets
  fix: load changes from workspace in Preview after deployment (#2650)
  chore: apply latest changesets
  fix(`odata-service-inquirer`): Apply additional messages to service selection prompt (#2693)
  chore: apply latest changesets
  Cleanup cf tests (#2690)
  chore: apply latest changesets
  fix: Manifest template for services (#2686)
  chore: apply latest changesets
  fix: mock os-name (#2689)
  chore: apply latest changesets
  fix: running test multiple times (#2685)
  chore: apply latest changesets
  fix(app-config-writer): add missing logger parameter for convert preview-config (#2687)
  chore: apply latest changesets
  Replace Keytar with @zowe/secrets-for-zowe-sdk (#2635)
  chore: apply latest changesets
  feat: Enhance extracted FLP prompts to support ADP scenario (#2610)
  chore: apply latest changesets
  feat: Ensuring UI5 2.x compliance for cards-editor-middleware Plugin (#2613)
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