ktmud commented on a change in pull request #10630: URL: https://github.com/apache/incubator-superset/pull/10630#discussion_r473346458
########## File path: superset-frontend/src/components/CertifiedIconWithTooltip.tsx ########## @@ -0,0 +1,49 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import React from 'react'; +import { t } from '@superset-ui/translation'; +import { supersetTheme } from '@superset-ui/style'; +import Icon from 'src/components/Icon'; +import TooltipWrapper from 'src/components/TooltipWrapper'; + +interface CertifiedIconWithTooltipProps { Review comment: Naming/API design nit: is there a variant of `CertifiedIcon` which doesn't have a tooltip? If no, then `WithTooltip` is probably not needed; if yes, you can also just make `tooltip` as an optional prop and add the `TooltipWrapper` conditionally. ########## File path: superset-frontend/src/CRUD/Field.jsx ########## @@ -32,7 +32,7 @@ import './crud.less'; const propTypes = { value: PropTypes.any.isRequired, label: PropTypes.string.isRequired, - descr: PropTypes.node, Review comment: +1 ########## File path: superset/connectors/sqla/models.py ########## @@ -391,6 +394,38 @@ def lookup_obj(lookup_metric: SqlMetric) -> SqlMetric: return import_datasource.import_simple_obj(db.session, i_metric, lookup_obj) + @property + def is_certified(self) -> bool: + try: + extra_object = json.loads(self.extra) Review comment: Not sure what's the practice of other SQLA models, but do you think it makes sense parse `self.extra` on initialization? Or at least make it a property to DRY. ```python def __init__(...): ... self._extra_json = None @property def extra_json(self) -> Dict[String, Any]: if self._extra_json: return self._extra_object try: self._extra_object = json.loads(self.extra) return extra_object except (TypeError, json.JSONDecodeError): self._extra_json = {} return self._extra_object @property def is_certified(self) -> bool: return bool(self.extra_json.get("certification")) @property def certified_by(self) -> Optional[str]: return self.extra_json.get("certification", {}).get("certified_by") ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
