-
Notifications
You must be signed in to change notification settings - Fork 919
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 DocView links pluggable injection capability #1200
Add DocView links pluggable injection capability #1200
Conversation
test/plugin_functional/plugins/doc_views_links_plugin/public/plugin.tsx
Outdated
Show resolved
Hide resolved
57d308f
to
944f7c3
Compare
56bd0e7
to
9f0c57b
Compare
Nice PR. I just had one question. In your Before and After images, there is an "open in new tab" icon (EUI |
Oh right, I missed the how you were extending |
Thanks, added a small fix. |
if (item.generateurlcb) { | ||
item.href = item.generateurlcb(renderProps); | ||
delete item.generateurlcb; | ||
} |
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.
Sorry i didnt catch this earlier but we should avoid mutating the docViewLink object directly. We can return a new object instead e.g.
.map((item) => {
const { generateurlcb, href, ...props } = item;
const listItem: EuiListGroupItemProps = {
...props,
href: generateurlcb ? generateurlcb(renderProps) : href,
}
return listItem;
}
This way we also ensure that the new object has only the props that the EuiListGroup
component accepts.
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.
amazing, thanks
@@ -10,7 +10,7 @@ import { IndexPattern } from '../../../../data/public'; | |||
export interface DocViewLink extends EuiListGroupItemProps { | |||
href?: string; | |||
order: number; | |||
generateurlfn?(renderProps: any): string; | |||
generateurlcb?(renderProps: any): string; |
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.
Any reason this property isn't camel cased?
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.
Not really, changed.
6b62b70
to
7a25121
Compare
71712a3
to
b77de09
Compare
@ashwin-pc , it passed all the tests. Thanks |
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 making the changes. This looks good to me
@RoyiSitbon, can you run |
done :) |
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 that, LGTM
@@ -0,0 +1,21 @@ | |||
.osdDocViewerLinks { |
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 guess we don't lint scss files? I wonder if we broke something with the linter or perhaps we need to add it to the linter file.
In the meantime, I see most of our scss files are two space indented and I think some of the indention could use some loving.
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.
done
data-test-subj="docTableRowAction" | ||
ng-href="{{ getContextAppHref() }}" | ||
ng-if="indexPattern.isTimeBased()" | ||
i18n-id="discover.docTable.tableRow.viewSurroundingDocumentsLinkText" |
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 way to utilize i18n within the updated component once we have i18n translations?
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.
sure, added.
class="euiLink" | ||
data-test-subj="docTableRowAction" | ||
ng-href="{{ getContextAppHref() }}" | ||
ng-if="indexPattern.isTimeBased()" |
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 not seeing this logic in the src/plugins/discover/public/plugin.ts, could we include that?
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.
done
I think this is an awesome change! I have some comments, I'm also wondering where can include some of this information of how to access this functionality as a plugin as it's not really called out anywhere. Perhaps we can tack on this information on this issue: opensearch-project/documentation-website#171? |
@RoyiSitbon, apologies we were targeting to get this into the release for Again, sorry about the inconvenience but thank you for the awesome changes! |
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu <[email protected]>
5e7e53c
to
5ec302b
Compare
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.
PR was updated with main.
Re-approving. This looks good to me @tmarkley, @ashwin-pc, have any objections? I think we can target for 2.2 as well.
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 💚
Thanks for converting part of the detail view to react component, registering it and fixing the link
💚 |
* Add DocView links pluggable injection capability * Add proper e2e + bugfix * set prop as lower case * Better name * Delete prop after usage * Camel case + avoid mutating * Added right data-test-subj in order to fix tests * update snapshot * Add hide prop in order to mimic ng-if condition * Add i18n translation support * Fix tests * Made text smaller + used eui components instead of custom css * Snapshots Signed-off-by: sitbubu <[email protected]> (cherry picked from commit c33bf8c)
* Add DocView links pluggable injection capability * Add proper e2e + bugfix * set prop as lower case * Better name * Delete prop after usage * Camel case + avoid mutating * Added right data-test-subj in order to fix tests * update snapshot * Add hide prop in order to mimic ng-if condition * Add i18n translation support * Fix tests * Made text smaller + used eui components instead of custom css * Snapshots Signed-off-by: sitbubu <[email protected]> Signed-off-by: Royi Sitbon <[email protected]> (cherry picked from commit c33bf8c)
…1200) * Add DocView links pluggable injection capability * Add proper e2e + bugfix * set prop as lower case * Better name * Delete prop after usage * Camel case + avoid mutating * Added right data-test-subj in order to fix tests * update snapshot * Add hide prop in order to mimic ng-if condition * Add i18n translation support * Fix tests * Made text smaller + used eui components instead of custom css * Snapshots Signed-off-by: sitbubu <[email protected]>
* Add DocView links pluggable injection capability * Add proper e2e + bugfix * set prop as lower case * Better name * Delete prop after usage * Camel case + avoid mutating * Added right data-test-subj in order to fix tests * update snapshot * Add hide prop in order to mimic ng-if condition * Add i18n translation support * Fix tests * Made text smaller + used eui components instead of custom css * Snapshots Signed-off-by: sitbubu <[email protected]> Signed-off-by: Royi Sitbon <[email protected]> (cherry picked from commit c33bf8c) Co-authored-by: Royi Sitbon <[email protected]>
…1200) * Add DocView links pluggable injection capability * Add proper e2e + bugfix * set prop as lower case * Better name * Delete prop after usage * Camel case + avoid mutating * Added right data-test-subj in order to fix tests * update snapshot * Add hide prop in order to mimic ng-if condition * Add i18n translation support * Fix tests * Made text smaller + used eui components instead of custom css * Snapshots Signed-off-by: sitbubu <[email protected]>
Signed-off-by: sitbubu [email protected]
Description
Currently, we don't have an option to assimilate links under our top doc view section.
The “view surrounding documents” and “view single document” were written as static content.
We would like to make the top right side under doc view to be pluggable,
in order to assimilate new abilities such as “open in new tab icons” etc.
Before:
After:
Additional info under linked issue:
#1199