generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 51
feat: Store view name as part of additional info in fragment body #3696
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
Open
IvoSG
wants to merge
13
commits into
main
Choose a base branch
from
feat/3479/sotre-view-name-in-fragment
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c33b775
feat: add viewName to additional info for xml fragment
IvoSG 24db6e5
feat: add additional info comments to all templates
IvoSG 59e3f13
test: cover new functionallity with tests
IvoSG 4a6a97f
chore: add cset
IvoSG d3d2161
Linting auto fix commit
github-actions[bot] 22bc2ca
Merge branch 'main' into feat/3479/sotre-view-name-in-fragment
IvoSG 4e58842
Merge branch 'main' into feat/3479/sotre-view-name-in-fragment
IvoSG 2470c19
fix: review comments
IvoSG 216efb4
Merge branch 'feat/3479/sotre-view-name-in-fragment' of https://githu…
IvoSG 9194f5d
Merge branch 'main' into feat/3479/sotre-view-name-in-fragment
IvoSG 7d970b8
Merge branch 'main' into feat/3479/sotre-view-name-in-fragment
IvoSG 225b206
test: fix integration tests
IvoSG e15acce
fix: extend additional info for quick action templates and fix integr…
IvoSG File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@sap-ux-private/preview-middleware-client': patch | ||
| '@sap-ux/adp-tooling': patch | ||
| '@sap-ux/preview-middleware': patch | ||
| --- | ||
|
|
||
| Store fragment parent control info in fragment body |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
packages/adp-tooling/templates/rta/common/analytical-custom-column.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| <!-- Use stable and unique IDs!--> | ||
| <core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'> | ||
| <!-- add your xml here --> | ||
| <core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'><% if (targetAggregation && controlType && viewName) { %> | ||
| <!-- viewName: <%= viewName %> --> | ||
| <!-- controlType: <%= controlType %> --> | ||
| <!-- targetAggregation: <%= targetAggregation %> --> <% } %> | ||
| <!-- add your xml here --> | ||
| <Button text="New Button" id="<%- ids.toolbarActionButton %>"></Button> | ||
| </core:FragmentDefinition> |
5 changes: 4 additions & 1 deletion
5
packages/adp-tooling/templates/rta/common/grid-tree-custom-column.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
packages/adp-tooling/templates/rta/common/v4-table-action.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| <core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'> | ||
| <actiontoolbar:ActionToolbarAction xmlns:actiontoolbar="sap.ui.mdc.actiontoolbar" id="<%- ids.customToolbarAction%>" > | ||
| <core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'><% if (targetAggregation && controlType && viewName) { %> | ||
| <!-- viewName: <%= viewName %> --> | ||
| <!-- controlType: <%= controlType %> --> | ||
| <!-- targetAggregation: <%= targetAggregation %> --> <% } %> | ||
| <actiontoolbar:ActionToolbarAction xmlns:actiontoolbar="sap.ui.mdc.actiontoolbar" id="<%- ids.customToolbarAction%>" > | ||
| <Button xmlns:m="sap.m" id="<%- ids.customActionButton %>" visible="true" text="New Action" /> | ||
| </actiontoolbar:ActionToolbarAction> | ||
| </core:FragmentDefinition> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| <!-- Use stable and unique IDs!--> | ||
| <core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'><% if (targetAggregation && controlType) { %> | ||
| <core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'><% if (targetAggregation && controlType && viewName) { %> | ||
| <!-- viewName: <%= viewName %> --> | ||
| <!-- controlType: <%= controlType %> --> | ||
| <!-- targetAggregation: <%= targetAggregation %> --> <% } %> | ||
| <!-- add your xml here --> | ||
|
|
||
| <!-- add your xml here --> | ||
| </core:FragmentDefinition> |
7 changes: 5 additions & 2 deletions
7
packages/adp-tooling/templates/rta/v2/m-table-custom-column-cell.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| <core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'> | ||
| <!-- add your xml here --> | ||
| <core:FragmentDefinition xmlns:core='sap.ui.core' xmlns='sap.m'><% if (targetAggregation && controlType && viewName) { %> | ||
| <!-- viewName: <%= viewName %> --> | ||
| <!-- controlType: <%= controlType %> --> | ||
| <!-- targetAggregation: <%= targetAggregation %> --> <% } %> | ||
| <!-- add your xml here --> | ||
| <Text id="<%- ids.text %>" text="Sample data" /> | ||
| </core:FragmentDefinition> |
7 changes: 5 additions & 2 deletions
7
packages/adp-tooling/templates/rta/v2/m-table-custom-column.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ import Component from 'sap/ui/core/Component'; | |||||||||||||
| import type { ID } from 'sap/ui/core/library'; | ||||||||||||||
| import type ManagedObject from 'sap/ui/base/ManagedObject'; | ||||||||||||||
| import Element from 'sap/ui/core/Element'; | ||||||||||||||
| import View from 'sap/ui/core/mvc/View'; | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Gets Component by id. | ||||||||||||||
|
|
@@ -71,6 +72,38 @@ export function hasParent(component: ManagedObject, parentIdToFind: string): boo | |||||||||||||
| return hasParent(parent, parentIdToFind); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Utility function to safely call getParent on UI5 elements | ||||||||||||||
| * @param element UI5 element | ||||||||||||||
| * @returns parent element or null | ||||||||||||||
| */ | ||||||||||||||
| function getElementParent(element: Element): ManagedObject | null { | ||||||||||||||
| if (typeof element.getParent === 'function') { | ||||||||||||||
| return element.getParent(); | ||||||||||||||
| } | ||||||||||||||
| return null; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| /** | ||||||||||||||
| * Finds the view that contains the given control. | ||||||||||||||
| * | ||||||||||||||
| * @param control - Control instance | ||||||||||||||
| * @returns View instance if found, undefined otherwise | ||||||||||||||
| */ | ||||||||||||||
| export function findViewByControl(control: Element | ManagedObject): View | undefined { | ||||||||||||||
| if (!control) { | ||||||||||||||
| return undefined; | ||||||||||||||
| } | ||||||||||||||
| if (isA('sap.ui.core.mvc.View', control)) { | ||||||||||||||
| return control as View; | ||||||||||||||
| } | ||||||||||||||
|
||||||||||||||
| if (isA('sap.ui.core.mvc.View', control)) { | |
| return control as View; | |
| } | |
| if (isA<View>('sap.ui.core.mvc.View', control)) { | |
| return control; | |
| } |
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in: 5053c37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to scale well. Next time we need to add something else we'll need to add another set of conditions which are repeated in two places. Maybe we can just check if there are any keys set before we return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in: 5053c37