mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
fix(Explore): Undefined owners (#17167)
* Reconcile owners data * Fix on save
This commit is contained in:
parent
e32acd22fd
commit
f580f6bcba
@ -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 {
|
||||
|
@ -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 => {
|
||||
|
Loading…
Reference in New Issue
Block a user