Skip to content

Commit

Permalink
replace owners_by_name by frontend logic
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpark committed Apr 3, 2024
1 parent 169d0c3 commit 9b0cb6c
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion superset-frontend/spec/fixtures/mockDashboardInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default {
changed_by_name: 'John Doe',
created_on_delta_humanized: '10 days ago',
created_by_name: 'Kay Mon',
owners_by_name: ['John Doe'],
owners: [{ first_name: 'John', last_name: 'Doe', id: 1 }],
userId: 'mock_user_id',
dash_edit_perm: true,
dash_save_perm: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const createProps = () => ({
changed_by_name: 'John Doe',
created_on_delta_humanized: '10 days ago',
created_by_name: 'Kay Mon',
owners_by_name: ['John Doe'],
owners: [{ first_name: 'John', last_name: 'Doe', id: 1 }],
},
user: {
createdOn: '2021-04-27T18:12:38.952304',
Expand Down
5 changes: 3 additions & 2 deletions superset-frontend/src/dashboard/components/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import PublishedStatus from 'src/dashboard/components/PublishedStatus';
import UndoRedoKeyListeners from 'src/dashboard/components/UndoRedoKeyListeners';
import PropertiesModal from 'src/dashboard/components/PropertiesModal';
import { chartPropShape } from 'src/dashboard/util/propShapes';
import getOwnerName from 'src/utils/getOwnerName';
import {
UNDO_LIMIT,
SAVE_TYPE_OVERWRITE,
Expand Down Expand Up @@ -448,8 +449,8 @@ class Header extends React.PureComponent {
type: MetadataType.Owner,
createdBy: dashboardInfo.created_by_name || t('Not available'),
owners:
dashboardInfo.owners_by_name.length > 0
? dashboardInfo.owners_by_name
dashboardInfo.owners.length > 0
? dashboardInfo.owners.map(getOwnerName)
: t('None'),
createdOn: dashboardInfo.created_on_delta_humanized,
},
Expand Down
1 change: 0 additions & 1 deletion superset/dashboards/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ class DashboardGetResponseSchema(Schema):
changed_on = fields.DateTime()
charts = fields.List(fields.String(metadata={"description": charts_description}))
owners = fields.List(fields.Nested(UserSchema(exclude=["username"])))
owners_by_name = fields.List(fields.String())
roles = fields.List(fields.Nested(RolesSchema))
tags = fields.Nested(TagSchema, many=True)
created_on_humanized = fields.String(data_key="created_on_delta_humanized")
Expand Down
4 changes: 0 additions & 4 deletions superset/models/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ def created_by_name(self) -> str:
return ""
return str(self.created_by)

@property
def owners_by_name(self) -> list[str]:
return [owner.get_full_name() for owner in self.owners]

@property
def data(self) -> dict[str, Any]:
positions = self.position_json
Expand Down
1 change: 0 additions & 1 deletion tests/integration_tests/dashboards/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ def test_get_dashboard(self):
"last_name": "user",
}
],
"owners_by_name": ["admin user"],
"roles": [],
"position_json": "",
"published": False,
Expand Down

0 comments on commit 9b0cb6c

Please sign in to comment.