-
Notifications
You must be signed in to change notification settings - Fork 43
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
fix: reuse component detection #3038
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 20076a1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
@@ -19,6 +19,7 @@ import { ContextMenuService } from './context-menu-service'; | |||
|
|||
export default function init( | |||
rta: RuntimeAuthoring, | |||
isReuseComponentChecker: IsReuseComponentApi, |
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 can be undefined
if called directly from RTA.
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.
As discussed after the changes proposed below, this point is taken care of.
Fixed with: a9fa288
* | ||
* @returns boolean | ||
*/ | ||
export function isHigherThanMinimalUi5Version( |
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.
I don't think we need to "duplicate" isLowerThanMinimalUi5Version
function. You can just use negation if you need higher version.
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.
Fixed with: 848ceb5
*/ | ||
export const getExtendControllerItemText = (overlay: ElementOverlay, isReuseComponentChecker: IsReuseComponentApi, isCloud: boolean) => { | ||
if (isCloud && isReuseComponentChecker(overlay.getElement().getId())) { | ||
return 'Extend With Controller (Unavailable due to control being a Reuse component)'; |
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.
Text should be maintained in messagebundle.properties
.
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.
Fixed in: 401d3a2
@@ -40,6 +40,7 @@ export interface QuickActionContext { | |||
flexSettings: FlexSettings; | |||
manifest: Manifest; | |||
changeService: ChangeService; | |||
isReuseComponent: (controlId: string) => boolean; |
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.
Actually looking at this now, it seems that this is a bit overly complex and not needed. We could just "import" the isReuseComponent
in the quick action where it is required, since it no longer has a state.
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.
Fixed in: a9fa288
reuseComponentApi = (await import('sap/ui/rta/util/isReuseComponent')).default; | ||
} | ||
|
||
return function isReuseComponent(controlId: string): boolean { |
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.
There is no need to redefine this function every time.
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.
Fixed in: a9fa288
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.
@mmilko01, some questions and suggestions.
@@ -42,6 +42,11 @@ ADP_SYNC_VIEWS_MESSAGE = Synchronous views are detected for this application. Co | |||
ADP_REUSE_COMPONENTS_MESSAGE_TITLE = Reuse components detected |
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.
ADP_REUSE_COMPONENTS_MESSAGE_TITLE = Reuse components detected | |
ADP_REUSE_COMPONENTS_MESSAGE_TITLE = Reuse Components Detected |
@@ -42,6 +42,11 @@ ADP_SYNC_VIEWS_MESSAGE = Synchronous views are detected for this application. Co | |||
ADP_REUSE_COMPONENTS_MESSAGE_TITLE = Reuse components detected | |||
ADP_REUSE_COMPONENTS_MESSAGE_DESCRIPTION = Reuse components are detected for some views in this application. Controller extensions, adding fragments and manifest changes are not supported for such views and will be disabled. |
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.
ADP_REUSE_COMPONENTS_MESSAGE_DESCRIPTION = Reuse components are detected for some views in this application. Controller extensions, adding fragments and manifest changes are not supported for such views and will be disabled. | |
ADP_REUSE_COMPONENTS_MESSAGE_DESCRIPTION = Reuse components are detected for some views in this application. Controller extensions, adding fragments, and manifest changes are not supported for such views and will be disabled. |
@@ -42,6 +42,11 @@ ADP_SYNC_VIEWS_MESSAGE = Synchronous views are detected for this application. Co | |||
ADP_REUSE_COMPONENTS_MESSAGE_TITLE = Reuse components detected | |||
ADP_REUSE_COMPONENTS_MESSAGE_DESCRIPTION = Reuse components are detected for some views in this application. Controller extensions, adding fragments and manifest changes are not supported for such views and will be disabled. | |||
ADP_QUICK_ACTION_DIALOG_OPEN_MESSAGE = This action is disabled because a dialog is already open |
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.
ADP_QUICK_ACTION_DIALOG_OPEN_MESSAGE = This action is disabled because a dialog is already open | |
ADP_QUICK_ACTION_DIALOG_OPEN_MESSAGE = This action is disabled because a dialog is already open. |
@@ -42,6 +42,11 @@ ADP_SYNC_VIEWS_MESSAGE = Synchronous views are detected for this application. Co | |||
ADP_REUSE_COMPONENTS_MESSAGE_TITLE = Reuse components detected | |||
ADP_REUSE_COMPONENTS_MESSAGE_DESCRIPTION = Reuse components are detected for some views in this application. Controller extensions, adding fragments and manifest changes are not supported for such views and will be disabled. | |||
ADP_QUICK_ACTION_DIALOG_OPEN_MESSAGE = This action is disabled because a dialog is already open | |||
ADP_ADD_FRAGMENT_MENU_ITEM = Add: Fragment | |||
ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT = Add: Fragment (Unavailable due to control being a Reuse component) |
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.
Can you show me what this looks like? Same for the other unavailable texts?
ADP_ADD_FRAGMENT_MENU_ITEM = Add: Fragment | ||
ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT = Add: Fragment (Unavailable due to control being a Reuse component) | ||
ADP_ADD_FRAGMENT_MENU_ITEM_UNSTABLE_ID = Add: Fragment (Unavailable due to unstable ID of the control or its parent control) | ||
ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM = Extend With Controller |
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.
ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM = Extend With Controller | |
ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM = Extend with Controller |
ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT = Add: Fragment (Unavailable due to control being a Reuse component) | ||
ADP_ADD_FRAGMENT_MENU_ITEM_UNSTABLE_ID = Add: Fragment (Unavailable due to unstable ID of the control or its parent control) | ||
ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM = Extend With Controller | ||
ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT = Extend With Controller (Unavailable due to control being a Reuse component) |
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.
ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT = Extend With Controller (Unavailable due to control being a Reuse component) | |
ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT = Extend with Controller (Unavailable due to control being a Reuse component) |
ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT = Add: Fragment (Unavailable due to control being a Reuse component) | ||
ADP_ADD_FRAGMENT_MENU_ITEM_UNSTABLE_ID = Add: Fragment (Unavailable due to unstable ID of the control or its parent control) | ||
ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM = Extend With Controller | ||
ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT = Extend With Controller (Unavailable due to control being a Reuse component) | ||
CPE_CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_MESSAGE = Note: The change will be visible after save and reload. |
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.
Is there a button called save and reload?
ADP_ADD_FRAGMENT_MENU_ITEM_REUSE_COMPONENT = Add: Fragment (Unavailable due to control being a Reuse component) | ||
ADP_ADD_FRAGMENT_MENU_ITEM_UNSTABLE_ID = Add: Fragment (Unavailable due to unstable ID of the control or its parent control) | ||
ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM = Extend With Controller | ||
ADP_ADD_CONTROLLER_EXTENSION_MENU_ITEM_REUSE_COMPONENT = Extend With Controller (Unavailable due to control being a Reuse component) | ||
CPE_CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_MESSAGE = Note: The change will be visible after save and reload. | ||
|
||
TABLE_ROWS_NEEDED_TO_CREATE_CUSTOM_COLUMN=At least one table row is required to create new custom column. Make sure the table data is loaded and try again. |
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.
TABLE_ROWS_NEEDED_TO_CREATE_CUSTOM_COLUMN=At least one table row is required to create new custom column. Make sure the table data is loaded and try again. | |
TABLE_ROWS_NEEDED_TO_CREATE_CUSTOM_COLUMN=At least one table row is required to create a new custom column. Make sure the table data is loaded and try again. |
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.
Code looks good.
Excellent test coverage.
Did not tested manually.
|
#3045
isReuseComponent
API from RTA to detect reuse components.Add: Fragment
andExtend with Controller
on control level only