Skip to content

Commit

Permalink
fix: update dashboard URLs to new path structure
Browse files Browse the repository at this point in the history
  • Loading branch information
kalyan540 committed Jan 2, 2025
1 parent 48bbdcd commit e657a22
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions superset-frontend/cypress-base/cypress/utils/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

export const DASHBOARD_LIST = '/dashboard/list/';
export const CHART_LIST = '/chart/list/';
export const WORLD_HEALTH_DASHBOARD = '/dashboard1/world_health/';
export const SAMPLE_DASHBOARD_1 = '/dashboard1/1-sample-dashboard/';
export const WORLD_HEALTH_DASHBOARD = '/dashboard/world_health/';
export const SAMPLE_DASHBOARD_1 = '/dashboard/1-sample-dashboard/';
export const SUPPORTED_CHARTS_DASHBOARD =

Check failure on line 24 in superset-frontend/cypress-base/cypress/utils/urls.ts

View workflow job for this annotation

GitHub Actions / frontend-build

Delete `⏎·`
'/dashboard1/supported_charts_dash/';
export const TABBED_DASHBOARD = '/dashboard1/tabbed_dash/';
'/dashboard/supported_charts_dash/';
export const TABBED_DASHBOARD = '/dashboard/tabbed_dash/';
export const DATABASE_LIST = '/databaseview/list';
export const DATASET_LIST_PATH = 'tablemodelview/list';
export const ALERT_LIST = '/alert/list/';
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/components/ListView/CrossLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const StyledCrossLinks = styled.div`
function CrossLinks({
crossLinks,
maxLinks = 20,
linkPrefix = '/dashboard1/',
linkPrefix = '/dashboard/',
}: CrossLinksProps) {
const [crossLinksRef, plusRef, elementsTruncated, hasHiddenElements] =
useTruncation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const SupersetListViewCard = ({
<ListViewCard
title="Superset Card Title"
loading={loading}
url="/dashboard1/births/"
url="/dashboard/births/"
imgURL={imgURL}
imgFallbackURL={imgFallbackURL}
description="Lorem ipsum dolor sit amet, consectetur adipiscing elit..."
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/dashboard/actions/dashboardState.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export function saveDashboardRequest(data, id, saveType) {
window.history.pushState(
{ event: 'dashboard_properties_changed' },
'',
`/dashboard1/${slug || id}/`,
`/dashboard/${slug || id}/`,
);

dispatch(addSuccessToast(t('This dashboard was saved successfully.')));
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/dashboard/components/SaveModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class SaveModal extends PureComponent<SaveModalProps, SaveModalState> {
} else {
this.onSave(data, dashboardId, saveType).then((resp: JsonResponse) => {
if (saveType === SAVE_TYPE_NEWDASHBOARD && resp.json?.result?.id) {
window.location.href = `/dashboard1/${resp.json.result.id}/`;
window.location.href = `/dashboard/${resp.json.result.id}/`;
}
});
this.modal?.current?.close?.();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const publishDataMask = debounce(
// keep react router history in sync with window history
// replace params only when current page is /dashboard
// this prevents a race condition between updating filters and navigating to Explore
if (window.location.pathname.includes('/dashboard1')) {
if (window.location.pathname.includes('/dashboard')) {
history.location.pathname = window.location.pathname;
history.replace({
search: newParams.toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const DashboardsSubMenu = ({
<Link
target="_blank"
rel="noreferer noopener"
to={`/dashboard1/${dashboard.id}${urlQueryString}`}
to={`/dashboard/${dashboard.id}${urlQueryString}`}
>
<div
css={css`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const DEFAULT_PAGE_SIZE = 25;

const getLinkProps = (dashboard: ChartLinkedDashboard) => ({
key: dashboard.id,
to: `/dashboard1/${dashboard.id}`,
to: `/dashboard/${dashboard.id}`,
target: '_blank',
rel: 'noreferer noopener',
children: dashboard.dashboard_title,
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/pages/DatabaseList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ function DatabaseList({
) => (
<li key={result.id}>
<a
href={`/dashboard1/${result.id}`}
href={`/dashboard/${result.id}`}
target="_atRiskItem"
>
{result.title}
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/pages/DatasetList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
) => (
<li key={result.id}>
<a
href={`/dashboard1/${result.id}`}
href={`/dashboard/${result.id}`}
target="_atRiskItem"
>
{result.title}
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/views/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const routes: Routes = [
Component: DashboardList,
},
{
path: '/dashboard1/:idOrSlug/',
path: '/dashboard/:idOrSlug/',
Component: Dashboard,
},
{
Expand Down
2 changes: 1 addition & 1 deletion superset/dashboards/permalink/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def post(self, pk: str) -> Response:
state=state,
).run()
http_origin = request.headers.environ.get("HTTP_ORIGIN")
url = f"{http_origin}/dashboard1/p/{key}/"
url = f"{http_origin}/dashboard/p/{key}/"
return self.response(201, key=key, url=url)
except (ValidationError, DashboardPermalinkInvalidStateError) as ex:
return self.response(400, message=str(ex))
Expand Down
2 changes: 1 addition & 1 deletion superset/models/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ def _get_sqla_engine( # pylint: disable=too-many-locals

if DB_CONNECTION_MUTATOR:
if not source and request and request.referrer:
if "/dashboard1/" in request.referrer:
if "/dashboard/" in request.referrer:
source = utils.QuerySource.DASHBOARD
elif "/explore/" in request.referrer:
source = utils.QuerySource.CHART
Expand Down
4 changes: 2 additions & 2 deletions superset/models/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,12 @@ def __repr__(self) -> str:

@property
def url(self) -> str:
return f"/dashboard1/{self.slug or self.id}/"
return f"/dashboard/{self.slug or self.id}/"

@staticmethod
def get_url(id_: int, slug: str | None = None) -> str:
# To be able to generate URL's without instantiating a Dashboard object
return f"/dashboard1/{slug or id_}/"
return f"/dashboard/{slug or id_}/"

@property
def datasources(self) -> set[BaseDatasource]:
Expand Down
2 changes: 1 addition & 1 deletion superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ def dashboard_permalink(
if not value:
return json_error_response(_("permalink state not found"), status=404)
dashboard_id, state = value["dashboardId"], value.get("state", {})
url = f"/dashboard1/{dashboard_id}?permalink_key={key}"
url = f"/dashboard/{dashboard_id}?permalink_key={key}"
if url_params := state.get("urlParams"):
params = parse.urlencode(url_params)
url = f"{url}&{params}"
Expand Down
2 changes: 1 addition & 1 deletion superset/views/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def new(self) -> FlaskResponse:
)
db.session.add(new_dashboard)
db.session.commit() # pylint: disable=consider-using-transaction
return redirect(f"/dashboard1/{new_dashboard.id}/?edit=true")
return redirect(f"/dashboard/{new_dashboard.id}/?edit=true")

@expose("/<dashboard_id_or_slug>/embedded")
@event_logger.log_this_with_extra_payload
Expand Down

0 comments on commit e657a22

Please sign in to comment.