-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
feat: add warning metadata to tables and metrics #13606
feat: add warning metadata to tables and metrics #13606
Conversation
/testenv up |
@etr2460 Ephemeral environment creation is currently limited to committers. |
db80bab
to
aeb83f3
Compare
aeb83f3
to
8302744
Compare
@@ -482,7 +496,7 @@ class SqlaTable( # pylint: disable=too-many-public-methods,too-many-instance-at | |||
"fetch_values_predicate", | |||
"extra", | |||
] | |||
update_from_object_fields = [f for f in export_fields if not f == "database_id"] | |||
update_from_object_fields = [f for f in export_fields if f != "database_id"] |
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.
ran into this while debugging and got really confused. this seems clearer
Codecov Report
@@ Coverage Diff @@
## master #13606 +/- ##
==========================================
+ Coverage 77.10% 77.25% +0.14%
==========================================
Files 921 922 +1
Lines 46745 46798 +53
Branches 5733 5746 +13
==========================================
+ Hits 36043 36152 +109
+ Misses 10567 10510 -57
- Partials 135 136 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
/testenv up |
@ktmud Ephemeral environment creation is currently limited to committers. |
@robdiciuccio it seems there's something wrong with the committer detection logic in the Ephemeral environment workflow. |
@ktmud yep, turns out your Apache org membership needs to be public to work correctly. There's another possible code fix, but this should hopefully unblock for now. |
/testenv up |
@etr2460 Ephemeral environment spinning up at http://54.68.109.205:8080. Credentials are |
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.
Love the idea! One small question/comment
<Field | ||
label={t('Deprecation link')} | ||
fieldKey="deprecation_link" | ||
description={t( | ||
'A link with more details regarding the deprecation of this metric', | ||
)} | ||
control={ | ||
<TextControl | ||
controlId="deprecation_link" | ||
placeholder="https://www.example.com" | ||
/> | ||
} | ||
/> |
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 having a freetext description field would be more convenient for most orgs. Instead of having a dedicated link field, could we have a general description field in which one can paste links if needed?
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.
That's a good suggestion, how would you recommend structuring a description field like that? Ideally, we could provide the capability for someone to embed a link and make it clickable/open in a new tab. Would rendering arbitrary markdown be a bad idea?
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 we should be ok supporting the same markdown allowances we support on the dashboard markdown component:
I might be oversimplifying, but I'd be happy with just a simple freetext field that's then rendered as markdown (not sure if there's a simple way of forcing a new tab, but I suppose it should be doable).
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 forcing a new tab in markdown is possible unless you use html a
tags. i can play around a bit with supporting markdown descriptions. it's a bit less structured (which i'm not sure if that's good or bad).
For context, in internal use, the learn more link typically goes to a google doc or something else with lots of detailed, freeform content. So we made the choice in other products to just link out to there instead of making people write more context/details in product
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 we can allow both the free-text markdown and the "Learn more" link, if it's not too much 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.
I found this, and making the following change seems to send the links to _blank
:
diff --git a/superset-frontend/src/dashboard/components/gridComponents/Markdown.jsx b/superset-frontend/src/dashboard/components/gridComponents/Markdown.jsx
index b071a9982..5b30cd400 100644
--- a/superset-frontend/src/dashboard/components/gridComponents/Markdown.jsx
+++ b/superset-frontend/src/dashboard/components/gridComponents/Markdown.jsx
@@ -286,6 +286,7 @@ class Markdown extends React.PureComponent {
isValidNode: node => node.type !== 'script',
}),
]}
+ linkTarget="_blank"
/>
);
}
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.
Nice feature!
Would it make sense to extend this to more than Deprecation? E.g. It could also be used as a general warning for things like delayed data and suggesting an alternative field:
- "This data has been delayed for x hours. We are working on addressing this issue".
- "This field is for advanced use only. Please use "xxx_xxx" for simpler categorization."
superset/connectors/sqla/models.py
Outdated
"is_certified", | ||
"certified_by", | ||
"certification_details", | ||
"deprecated_at", |
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.
it may be nice to have deprecated_by field as well to have point of contact
A bunch of good suggestions here, thanks for the comments! I think if we're going to provide the flexibility of free text, then we should let the user add whatever content they want there (links, POCs, descriptions, replacements, etc.) and not worry about structuring it more. However, making this a generic warning might be even better. If we want to take the flexible route, then we could get rid of the deprecated_at field too and just rely on everything to be provided in markdown. Then it's just one simple field that anyone could use for whatever purpose. Super extensible for other users, and would serve the deprecation use case. I'm going to simplify and move forward with a generic |
8302744
to
3c7995f
Compare
/testenv up |
@etr2460 Ephemeral environment spinning up at http://54.184.90.208:8080. Credentials are |
3c7995f
to
f8a15af
Compare
f8a15af
to
fb91c83
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.
Thanks for the updates! Code LGTM, tested it locally and found a couple of UX issues:
-
Just remembered we already have
warning_text
for metrics, can we maybe migrate it to the sameextra.warning_markdown
field? -
The icon for metric warning markdown does not show up in any of the Dataset panel, Select options, or selected options. Maybe we should add all of them in a separate PR and only do datasource warning in this PR.
It does show up, however, in the Datasource editor modal.
BTW, there are like 3 different warning icons in this screen. Should we consolidate and make them more consistent?
Not related to this PR, but I think we also need some UI adjustment in the datasource editor modal:
- Move "extra" to "Advanced"
- Make the AceEditor for
extra
taller and resizable - Move the two column layout to be two rows with Basic options on top and Advanced in the bottom.
- Add two column layout within the Basic and Advanced container
Here are the follow ups i'll make here:
Here's what i'll do in future PRs:
|
@etr2460 Thank you, Erik, for opening this PR and adjusting the UI element for consistency. Really appreciate it! |
@junlincc That's part of the user provided string, and isn't actually in the code anywhere. FWIW, we use |
fb91c83
to
ddd90c8
Compare
I've made the changes mentioned above, but it won't build until apache-superset/superset-ui#1011 is merged and we have a new superset-ui version |
b89012d
to
c8993ac
Compare
@ktmud i think this is ready to go now |
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! Could you also add a screenshot of how the icon looks like in the "SAVED" tab of metrics select popover (if it does appear there)?
|
c8993ac
to
c124618
Compare
c124618
to
9318fd6
Compare
Ephemeral environment shutdown and build artifacts deleted. |
SUMMARY
Similar to the need for certifying metrics and tables, often data should have warnings attached. This provides support for arbitrary warning markdown text to be provided for a metric or table
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
Verify the icon is displayed whenever the deprecated_at param is set. Also add unit tests
ADDITIONAL INFORMATION
to: @graceguo-supercat @ktmud @junlincc (could you tag the appropriate engineers from Preset here?)