Skip to content

Commit

Permalink
fix(Explore): Undefined owners (apache#17167)
Browse files Browse the repository at this point in the history
* Reconcile owners data

* Fix on save

(cherry picked from commit f580f6b)
  • Loading branch information
geido authored and sadpandajoe committed Oct 22, 2021
1 parent 45b6580 commit e8517fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions superset-frontend/src/datasource/DatasourceEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 5 additions & 2 deletions superset-frontend/src/datasource/DatasourceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit e8517fd

Please sign in to comment.