-
Notifications
You must be signed in to change notification settings - Fork 44
feat(metadata): Metadata configuration UI #1951
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1951 +/- ##
==========================================
+ Coverage 60.72% 64.50% +3.78%
==========================================
Files 78 87 +9
Lines 2546 2820 +274
Branches 576 649 +73
==========================================
+ Hits 1546 1819 +273
Misses 956 956
- Partials 44 45 +1
|
eb7f8fb
to
c666ebd
Compare
@lordrip yes that's annoying, it appears with patternfly selectable table (left side). It adds |
src/components/SourceCodeEditor.tsx
Outdated
@@ -57,7 +57,7 @@ export const SourceCodeEditor = (props: ISourceCodeEditor) => { | |||
} else { | |||
fetchTheSourceCode({ flows, properties, metadata }, settings); | |||
} | |||
}, [flows, properties]); | |||
}, [flows, properties, metadata]); |
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.
[Note for the future ourselves]: After #1927 is merged, we would need to add this property to the new location.
@@ -20,3 +20,4 @@ export * from './VisualizationControls'; | |||
export * from './VisualizationStepViews'; | |||
export * from './Visualization'; | |||
export * from './VisualizationStep'; | |||
export { MetadataToolbarItems } from './metadata/MetadataToolbarItems'; |
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.
The content of this file is only exporting one single function, in which case, wouldn't be enough to do something like below?
export { MetadataToolbarItems } from './metadata/MetadataToolbarItems'; | |
export * from './metadata/MetadataToolbarItems'; |
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'm curious if it's preferred in typescript? Generally the wildcard is not preferred in Java coding standards I know
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.
In this case, it's ok as we're exposing tokens and not necessarily mean that they will be incorporated in the final bundle, is mostly convenience I would say.
expect(element).not.toBeInTheDocument(); | ||
}); | ||
|
||
test('editor works', async () => { |
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.
[friendly-suggestion]: This test might be more suited to an e2e test because if it fails, it might not be easy to determine the root cause as there are many expectations and also dependencies from the previous statement.
"Ideally" each test should have a couple expect()
calls only. Notice how I quoted Ideally 😃
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.
OK, I'll try to split the test... I'd like to keep these tests here with mock schemas, as e2e test will only work with the real schema which will be retrieved from backend in the future.
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 think that it makes sense to keep the test with mock schemas as you're doing right now, I was suggesting more like preparing the data that the component will need, then rendering it, and then ensuring that it looks like you would like to.
Pretty much as you have it right now, but instead of interacting with the UI to reach the desired point, already provide that data to the component and then make the assertions on top of it.
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.
So instead of testing everything, add/edit/delete in one place, test one action in one test, e.g. test add button and don't continue with the result of it, correct? I can do that.
Since this is an editor, just testing static rendering is not enough, rather need to verify actions work.
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.
test one action in one test, e.g. test add button and don't continue with the result of it, correct? I can do that.
Exactly, just prepare the stage for the test, execute the action, and then do the evaluation. As AAA suggests.
Arrange, Act, and Assert.
LGTM, just a couple of pending details:
|
It seems that the console error is coming from the |
Discussed with @lordrip and now we think editing property name is important. Also the inline input for property value doesn't work with cursor key, so for now I'll remove the inline input and add "edit" button for the popover similar to "add new property". |
Interestingly, while the following patternfly official doc also contains P.S. it's a known bug - patternfly/patternfly-react#7745 |
72524de
to
11eb9f1
Compare
inlined property add/edit 2023-06-15_16-03-47.mp4 |
23d5545
to
d656f43
Compare
And fixed tests, should be ready now |
* fix: Removed curly brackets for string literal attributes * fix: Prevent resizing * fix: Fixed cursor key behavior in property name/value input * fix: Inlined property add/edit with placeholder, removed popover * fix: Tests
Kudos, SonarCloud Quality Gate passed!
|
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.
LGTM, there are a couple of details that could be improved on the usability aspect but we could improve those along the way iteratively.
jest.mock('@kaoto/api', () => { | ||
return { | ||
__esModule: true, | ||
...jest.requireActual('@kaoto/api'), |
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.
mmm I wonder what happened here, since we're not mocking any API 🤔
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 is a "charm" I found at somewhere, without this the later spyOn didn't work - https://github.com/KaotoIO/kaoto-ui/pull/1951/files/608732269e75d09be304cd20e1d2468378a6ae04#diff-f37f26c5fb3f0d3c46bdfb42592db926f99f7d4db3bdc487958b5a7ac1c8c273R16
I barely remenber the post says __esModule: true
is the key, not sure what it means 😅
Fixes: #1722
BeansUI.mp4