generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 35
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: Modified indicators incorrectly displayed for some UI5 controls in Adaptation Project #2264
Open
mmilko01
wants to merge
35
commits into
main
Choose a base branch
from
fix/2263/incorrect-modified-indicators
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.
+1,506
−543
Open
Changes from 5 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
0e58c1a
fix: incorrectly placed modified indicators
mmilko01 21d92fd
refacor: enhance types
mmilko01 0c74987
fix: type
mmilko01 3f485ce
refactor: get control instance based on App Component
mmilko01 8e35073
fix: check if change is available
mmilko01 5c8efed
Merge branch 'main' into fix/2263/incorrect-modified-indicators
mmilko01 d67e8eb
refactor: dynamically import ChangeHandlerAPI
mmilko01 0035131
refactor: get control id via JsControlTreeModifier
mmilko01 5eefabb
refactor: use different FL API based on UI5 Version
mmilko01 92f9fb5
test: amend tests
mmilko01 c4aafd3
chore: merge with main
mmilko01 e9018da
chore: fix main merge conflicts
mmilko01 11bd958
chore: create changeset
mmilko01 2b73513
Merge branch 'main' into fix/2263/incorrect-modified-indicators
mmilko01 130ba00
chore: fix lint error
mmilko01 dbc093f
Merge branch 'fix/2263/incorrect-modified-indicators' of https://gith…
mmilko01 0e6a23a
test: add tests
mmilko01 55b6b23
fix: sonar issue
mmilko01 b4f4ee6
test: improve coverage
mmilko01 4c99027
fix: lint issue
mmilko01 5dfca73
doc: fix JSDoc
mmilko01 1931d00
Merge branch 'main' into fix/2263/incorrect-modified-indicators
mmilko01 9931f05
refactor: do not leak change files to UI
mmilko01 67f0abf
Merge branch 'fix/2263/incorrect-modified-indicators' of https://gith…
mmilko01 748bd9d
refactor: change Selector type
mmilko01 75d7ba3
Merge branch 'main' into fix/2263/incorrect-modified-indicators
mmilko01 574c393
Merge branch 'main' into fix/2263/incorrect-modified-indicators
mmilko01 809dc7f
refactor: change changeFiles type
mmilko01 21ab914
refactor: define changedFiles as object
mmilko01 64b1527
fix: resolve conflicts
mmilko01 5a86c0d
fix: correctly display control changes
mmilko01 729bc12
feat: add control change component
nikmace fa6bd6e
Merge branch 'main' into fix/2263/incorrect-modified-indicators
mmilko01 9c4030d
chore: return cap.ts to original state
mmilko01 65d7d2f
refactor: rename interface
nikmace 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 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 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
78 changes: 78 additions & 0 deletions
78
packages/control-property-editor/src/panels/changes/ControlChange.module.scss
This file contains 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,78 @@ | ||
.text { | ||
line-height: 18px; | ||
display: inline-block; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
color: var(--vscode-editor-foreground); | ||
width: 240px; | ||
direction: rtl; | ||
text-align: left; | ||
} | ||
.fileLabel { | ||
min-width: 30px; | ||
margin-top: 5px; | ||
} | ||
.fileText { | ||
margin-top: 5px; | ||
line-height: 18px; | ||
display: inline-block; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
color: var(--vscode-editor-foreground); | ||
width: 210px; | ||
direction: rtl; | ||
text-align: left; | ||
} | ||
.controlLabel { | ||
min-width: 75px; | ||
margin-top: 5px; | ||
} | ||
.controlText { | ||
margin-top: 5px; | ||
line-height: 18px; | ||
display: inline-block; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
color: var(--vscode-editor-foreground); | ||
width: 165px; | ||
direction: rtl; | ||
text-align: left; | ||
} | ||
.timestamp { | ||
margin-top: 5px; | ||
color: var(--vscode-editor-foreground); | ||
font-size: 11px; | ||
line-height: 15px; | ||
opacity: 0.5; | ||
} | ||
.textHeader { | ||
display: inline-block; | ||
color: var(--vscode-foreground); | ||
font-size: 13px; | ||
font-weight: bold; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
line-height: 18px; | ||
} | ||
|
||
.property { | ||
overflow-wrap: anywhere; | ||
|
||
&:hover { | ||
background-color: var(--vscode-dropdown-background); | ||
color: var(--vscode-dropdown-foreground); | ||
outline: 1px dashed var(--vscode-contrastActiveBorder); | ||
|
||
.actions { | ||
visibility: visible; | ||
} | ||
} | ||
} | ||
|
||
.actions { | ||
visibility: hidden; | ||
} |
138 changes: 138 additions & 0 deletions
138
packages/control-property-editor/src/panels/changes/ControlChange.tsx
This file contains 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,138 @@ | ||
import type { ReactElement } from 'react'; | ||
import React, { useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Text, Stack, Link } from '@fluentui/react'; | ||
import { useDispatch } from 'react-redux'; | ||
import styles from './ControlChange.module.scss'; | ||
import { UIIconButton, UiIcons, UIDialog } from '@sap-ux/ui-components'; | ||
import type { | ||
ControlSavedChange, | ||
PendingControlChange, | ||
PropertyChangeDeletionDetails | ||
} from '@sap-ux-private/control-property-editor-common'; | ||
import { | ||
SAVED_CHANGE_TYPE, | ||
convertCamelCaseToPascalCase, | ||
deletePropertyChanges, | ||
selectControl | ||
} from '@sap-ux-private/control-property-editor-common'; | ||
import { getFormattedDateAndTime } from './utils'; | ||
|
||
export interface ControlChangeProps { | ||
/** | ||
* Class used for showing and hiding actions | ||
*/ | ||
actionClassName: string; | ||
change: PendingControlChange | ControlSavedChange; | ||
} | ||
|
||
/** | ||
* React element for control change in change stack. | ||
* | ||
* @returns ReactElement | ||
*/ | ||
export function ControlChange({ change }: ControlChangeProps): ReactElement { | ||
const { changeType, controlId, fileName, type, kind } = change; | ||
const { t } = useTranslation(); | ||
const dispatch = useDispatch(); | ||
const [dialogState, setDialogState] = useState<PropertyChangeDeletionDetails | undefined>(undefined); | ||
|
||
function onConfirmDelete(): void { | ||
if (dialogState) { | ||
dispatch(deletePropertyChanges(dialogState)); | ||
setDialogState(undefined); | ||
} | ||
} | ||
|
||
function onCancelDelete(): void { | ||
setDialogState(undefined); | ||
} | ||
|
||
const parts = fileName.split('_'); | ||
const changeName = parts[parts.length - 1]; | ||
const name = convertCamelCaseToPascalCase(changeName); | ||
|
||
return ( | ||
<> | ||
<Stack.Item className={styles.property}> | ||
<Stack horizontal> | ||
<Stack.Item> | ||
{changeType === 'renameLabel' ? ( | ||
<Link | ||
className={styles.textHeader} | ||
onClick={(): void => { | ||
const action = selectControl(controlId); | ||
dispatch(action); | ||
}} | ||
style={{ | ||
color: 'var(--vscode-textLink-foreground)', | ||
fontSize: '13px', | ||
fontWeight: 'bold', | ||
textOverflow: 'ellipsis', | ||
whiteSpace: 'nowrap', | ||
overflowX: 'hidden', | ||
lineHeight: '18px' | ||
}}> | ||
{name} {t('CHANGE')} | ||
</Link> | ||
) : ( | ||
<Text className={styles.textHeader}> | ||
{name} {t('CHANGE')} | ||
</Text> | ||
)} | ||
|
||
<Stack horizontal> | ||
<Stack.Item className={styles.fileLabel}>{t('FILE')}</Stack.Item> | ||
<Stack.Item className={styles.fileText} title={fileName}> | ||
{fileName} | ||
</Stack.Item> | ||
</Stack> | ||
{controlId && ( | ||
<Stack horizontal> | ||
<Stack.Item className={styles.controlLabel}>{t('CONTROL')}</Stack.Item> | ||
<Stack.Item className={styles.controlText} title={controlId}> | ||
{controlId} | ||
</Stack.Item> | ||
</Stack> | ||
)} | ||
</Stack.Item> | ||
|
||
{fileName && ( | ||
<Stack.Item className={styles.actions}> | ||
<UIIconButton | ||
iconProps={{ iconName: UiIcons.TrashCan }} | ||
onClick={(): void => { | ||
setDialogState({ | ||
controlId: '', | ||
propertyName: '', | ||
fileName | ||
}); | ||
}} | ||
/> | ||
</Stack.Item> | ||
)} | ||
</Stack> | ||
</Stack.Item> | ||
{type === SAVED_CHANGE_TYPE && ( | ||
<Stack.Item> | ||
<Stack horizontal horizontalAlign="space-between"> | ||
<Text className={styles.timestamp}>{getFormattedDateAndTime(change.timestamp ?? 0)}</Text> | ||
</Stack> | ||
</Stack.Item> | ||
)} | ||
{dialogState && ( | ||
<UIDialog | ||
hidden={dialogState === undefined} | ||
onAccept={onConfirmDelete} | ||
acceptButtonText={t('CONFIRM_DELETE')} | ||
cancelButtonText={t('CANCEL_DELETE')} | ||
onCancel={onCancelDelete} | ||
dialogContentProps={{ | ||
title: t('CONFIRM_OTHER_CHANGE_DELETE_TITLE'), | ||
subText: t('CONFIRM_OTHER_CHANGE_DELETE_SUBTEXT', { name }) | ||
}} | ||
/> | ||
)} | ||
</> | ||
); | ||
} |
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 word order sounds quite strange. It would be better if it matched other change type names e.g
PendingControlChange
andSavedPropertyChange
.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.
Renamed in: 65d7d2f