-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add image suggestion feature to iMatrics widget #4175
Conversation
Hi! After we pushed a commit with linting fixes, the fire:www workflow still fails, but we cannot see the linting errors anymore. It's very hard to guess what is still wrong. Is there a way around this? |
I didn't get to reviewing the code yet, but plan to do so soon. Ignore the failing |
Regarding linting errros, you should see them by clicking "details" in "CI / test (pull_request) " row. Or running |
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 specification/documentation somewhere describing how this should work? If not, maybe you could add it in the PR description?
It would also be useful to have a screen recording attached of the feature in action.
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
Hi, Tomas! Currently, there is no official documentation. Below I attach a snippet of the extended widget. Similar to the tagging, two additional variables need to be set in the config/env such as the image URL and credentials which we will provide upon request. |
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.
Thanks for explaining @hanstchou. Screenshots are especially useful.
editors should be able to drag and drop any images on the article
from the code it seems it's only possible to drag the selected image and judging from the screenshot there are no visual clues for users to understand this. It would be good to either add a visual indication or make all images draggable, not only the selected one.
See my new comments on a class based component. Also finish fixing the lint issues. We have 2 linters and the second one only starts when first one doesn't report any issues. I did push a small change to make the first one pass. Main problems now are indentation style and usage of double quotes.
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Show resolved
Hide resolved
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
scripts/extensions/auto-tagging-widget/src/ImageTaggingComponent/ImageTaggingComponent.tsx
Outdated
Show resolved
Hide resolved
Hi, Tomas! I noticed this and we have now fixed the second lint issue. Additionally, the payload has been adjusted according to the backend changes. The users can also drag the images on the list since they have a similar attribute (onDragStart) to the selected image. However, you have a point that there is no indication that they are draggable. However, the indicator feature has not been demanded/explained by the stakeholder. From the UX/UI perspective, do you have an idea of how may we provide an indicator of the drag feature without needing to fill up more space in the widget for future development? Thanks! |
We think we have adjusted the necessary code according to the feedback. Thank you! |
For the indicator, added a grab pointer on the images. |
One of the things I was about to suggest is using a relevant mouse cursor which you did already. Another useful thing to do would be to use a |
When you push new commits, GitHub requires me to authorize running of tests, so it might look like lint issues are fixed when they're not. You can check it locally by running |
I've been running lint locally. It looks fine, and no error appears. |
We will make another commit with your suggested approach. Thanks for feedback. |
hi @tomaskikutis |
Ensure you add
You can use |
@tomaskikutis I pushed a commit with adjustments according to your feedback on the other points. |
We have now replaced the ToggleBoxNext with a ToggleBox with a info button with popover showing the information. Hope everything is good now. Thank you! |
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.
@hanstchou I did push a few improvements. I'd like you to fix one more thing comment and we're good to merge it then. Take a look at my changes and see if they're not breaking anything - I think they should NOT. One more thing - ensure the server returns an empty array in IImageServerResponse['result']
if no image suggestions are available.
<img | ||
style={imageStyle} | ||
alt="" | ||
src={selectedImage?.imageUrl} |
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.
<img
shouldn't be rendered at all if we don't have a url. Same for figcaption.
correction: by mistake I wrote that I expect my changes to break things. I meant to write that I do NOT expect them to break anything |
Thank you for all the help and feedback! Also, the changes you made did not break anything, however, I could not test the method superdesk.ui.article.prepareExternalImageForDroppingToEditor since my local version is not on the latest branch. We will modify the server to ensure return of an empty list if no images were found in the server repo. Let me know if I missed something. Appreciated! |
We have now also updated the server to return empty array if no image suggestions are available. |
Also, we may provide you with a key to the image tagging if you would like to try it and see the result. |
I did check it in action on one of our instances. It's good that you've filtered images that don't have a URL, but do update usage so optional chaining is not used then. Same for caption - either don't use optional chaining if it will always be present, or don't render If you updated the server to never return images that don't have a src, update the typescript interface on the client to make the |
…sary optional chaining
Hi @tomaskikutis ! Sorry that I missed the figcaption point. We have now fixed that figcaption is only rendered if there is a caption, and also removed unnecessary optional chaining in imageUrl. On the other hand, we did only ensured that the server returns a result of an array. No filter of src in the server. Therefore we keep the filtering on the client. Thank you for checking this through. |
Can you filter it on the server instead? Other than that, I don't have any other comments and we can merge it when unit tests pass. |
Hi @tomaskikutis ! We have now added the filter of images with no src on the server and removed the now unnecessary filter in the client. Let's pray for the unit test to pass! Thank you for everything! |
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.
Thanks @hanstchou
Hi! This is our first time contributing to Superdesk!
If you want to discuss any changes, we are able to hop on a call in our shared slack or discuss the changes in the comments. Happy reading!