You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by el...@apache.org on 2021/10/27 21:07:05 UTC
[superset] 21/26: fix(Explore): Undefined owners (#17167)
This is an automated email from the ASF dual-hosted git repository.
elizabeth pushed a commit to branch 1.4
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 23313fdb1f350e42f3039c87a307ac36b61f67df
Author: Geido <60...@users.noreply.github.com>
AuthorDate: Wed Oct 20 18:45:58 2021 +0300
fix(Explore): Undefined owners (#17167)
* Reconcile owners data
* Fix on save
(cherry picked from commit f580f6bcba15a20c12ead5b3e6eef643cc0aa1d6)
---
superset-frontend/src/datasource/DatasourceEditor.jsx | 4 ++--
superset-frontend/src/datasource/DatasourceModal.tsx | 7 +++++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/superset-frontend/src/datasource/DatasourceEditor.jsx b/superset-frontend/src/datasource/DatasourceEditor.jsx
index e725cdc..e80e402 100644
--- a/superset-frontend/src/datasource/DatasourceEditor.jsx
+++ b/superset-frontend/src/datasource/DatasourceEditor.jsx
@@ -409,8 +409,8 @@ class DatasourceEditor extends React.PureComponent {
datasource: {
...props.datasource,
owners: props.datasource.owners.map(owner => ({
- value: owner.id,
- label: `${owner.first_name} ${owner.last_name}`,
+ value: owner.value || owner.id,
+ label: owner.label || `${owner.first_name} ${owner.last_name}`,
})),
metrics: props.datasource.metrics?.map(metric => {
const {
diff --git a/superset-frontend/src/datasource/DatasourceModal.tsx b/superset-frontend/src/datasource/DatasourceModal.tsx
index 5cd6f3a..89b7b5d 100644
--- a/superset-frontend/src/datasource/DatasourceModal.tsx
+++ b/superset-frontend/src/datasource/DatasourceModal.tsx
@@ -119,14 +119,17 @@ const DatasourceModal: FunctionComponent<DatasourceModalProps> = ({
),
type: currentDatasource.type || currentDatasource.datasource_type,
owners: currentDatasource.owners.map(
- (o: { label: string; value: number }) => o.value,
+ (o: Record<string, number>) => o.value || o.id,
),
},
},
})
.then(({ json }) => {
addSuccessToast(t('The dataset has been saved'));
- onDatasourceSave(json);
+ onDatasourceSave({
+ ...json,
+ owners: currentDatasource.owners,
+ });
onHide();
})
.catch(response => {