diff --git a/pkg/services/publicdashboards/database/database.go b/pkg/services/publicdashboards/database/database.go index 50a319478da..f786909b4f0 100644 --- a/pkg/services/publicdashboards/database/database.go +++ b/pkg/services/publicdashboards/database/database.go @@ -55,7 +55,7 @@ func (d *PublicDashboardStoreImpl) FindAllWithPagination(ctx context.Context, qu } pubdashBuilder := db.NewSqlBuilder(d.cfg, d.features, d.sqlStore.GetDialect(), recursiveQueriesAreSupported) - pubdashBuilder.Write("SELECT dashboard_public.uid, dashboard_public.access_token, dashboard.uid as dashboard_uid, dashboard_public.is_enabled, dashboard.title") + pubdashBuilder.Write("SELECT dashboard_public.uid, dashboard_public.access_token, dashboard.uid as dashboard_uid, dashboard_public.is_enabled, dashboard.title, dashboard.slug") pubdashBuilder.Write(" FROM dashboard_public") pubdashBuilder.Write(" JOIN dashboard ON dashboard.uid = dashboard_public.dashboard_uid AND dashboard.org_id = dashboard_public.org_id") pubdashBuilder.Write(` WHERE dashboard_public.org_id = ?`, query.OrgID) diff --git a/pkg/services/publicdashboards/models/models.go b/pkg/services/publicdashboards/models/models.go index 55407d9a561..e646be7f548 100644 --- a/pkg/services/publicdashboards/models/models.go +++ b/pkg/services/publicdashboards/models/models.go @@ -117,6 +117,7 @@ type PublicDashboardListResponse struct { Title string `json:"title" xorm:"title"` DashboardUid string `json:"dashboardUid" xorm:"dashboard_uid"` IsEnabled bool `json:"isEnabled" xorm:"is_enabled"` + Slug string `json:"slug" xorm:"slug"` } type TimeSettings struct { diff --git a/public/api-merged.json b/public/api-merged.json index 3a954af77e3..f0090d41dca 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -17364,6 +17364,9 @@ "isEnabled": { "type": "boolean" }, + "slug": { + "type": "string" + }, "title": { "type": "string" }, diff --git a/public/app/features/admin/UserListPublicDashboardPage/DashboardsListModalButton.tsx b/public/app/features/admin/UserListPublicDashboardPage/DashboardsListModalButton.tsx index ae1c4ada569..5a0b0c3e434 100644 --- a/public/app/features/admin/UserListPublicDashboardPage/DashboardsListModalButton.tsx +++ b/public/app/features/admin/UserListPublicDashboardPage/DashboardsListModalButton.tsx @@ -40,7 +40,7 @@ export const DashboardsListModal = ({ email, onDismiss }: { email: string; onDis • Public dashboard settings diff --git a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.ts b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.ts index 2e782b75e53..cd5ca7c6faf 100644 --- a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.ts +++ b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.ts @@ -32,6 +32,7 @@ export interface SessionDashboard { dashboardTitle: string; dashboardUid: string; publicDashboardAccessToken: string; + slug: string; } export interface SessionUser { @@ -87,8 +88,8 @@ export const generatePublicDashboardUrl = (accessToken: string): string => { return `${getConfig().appUrl}public-dashboards/${accessToken}`; }; -export const generatePublicDashboardConfigUrl = (dashboardUid: string): string => { - return `/d/${dashboardUid}?shareView=${shareDashboardType.publicDashboard}`; +export const generatePublicDashboardConfigUrl = (dashboardUid: string, dashboardName: string): string => { + return `/d/${dashboardUid}/${dashboardName}?shareView=${shareDashboardType.publicDashboard}`; }; export const validEmailRegex = /^[A-Z\d._%+-]+@[A-Z\d.-]+\.[A-Z]{2,}$/i; diff --git a/public/app/features/manage-dashboards/components/PublicDashboardListTable/PublicDashboardListTable.test.tsx b/public/app/features/manage-dashboards/components/PublicDashboardListTable/PublicDashboardListTable.test.tsx index 0b1337781cb..5c69c16bc2c 100644 --- a/public/app/features/manage-dashboards/components/PublicDashboardListTable/PublicDashboardListTable.test.tsx +++ b/public/app/features/manage-dashboards/components/PublicDashboardListTable/PublicDashboardListTable.test.tsx @@ -22,6 +22,7 @@ const publicDashboardListResponse: PublicDashboardListResponse[] = [ title: 'New dashboardasdf', dashboardUid: 'iF36Qb6nz', isEnabled: false, + slug: 'new-dashboardasdf', }, { uid: 'EuiEbd3nz', @@ -29,6 +30,7 @@ const publicDashboardListResponse: PublicDashboardListResponse[] = [ title: 'New dashboard', dashboardUid: 'kFlxbd37k', isEnabled: true, + slug: 'new-dashboard', }, ]; @@ -39,6 +41,7 @@ const orphanedDashboardListResponse: PublicDashboardListResponse[] = [ title: '', dashboardUid: '', isEnabled: false, + slug: '', }, { uid: 'EuiEbd3nz2', @@ -46,6 +49,7 @@ const orphanedDashboardListResponse: PublicDashboardListResponse[] = [ title: '', dashboardUid: '', isEnabled: true, + slug: '', }, ]; diff --git a/public/app/features/manage-dashboards/components/PublicDashboardListTable/PublicDashboardListTable.tsx b/public/app/features/manage-dashboards/components/PublicDashboardListTable/PublicDashboardListTable.tsx index 0129b64e244..909b7c6f8b8 100644 --- a/public/app/features/manage-dashboards/components/PublicDashboardListTable/PublicDashboardListTable.tsx +++ b/public/app/features/manage-dashboards/components/PublicDashboardListTable/PublicDashboardListTable.tsx @@ -106,7 +106,7 @@ const PublicDashboardCard = ({ pd }: { pd: PublicDashboardListResponse }) => { icon="cog" variant="secondary" color={theme.colors.warning.text} - href={generatePublicDashboardConfigUrl(pd.dashboardUid)} + href={generatePublicDashboardConfigUrl(pd.dashboardUid, pd.slug)} key="public-dashboard-config-url" tooltip="Configure public dashboard" data-testid={selectors.ListItem.configButton} diff --git a/public/app/features/manage-dashboards/types.ts b/public/app/features/manage-dashboards/types.ts index f68c3fef98f..fc73951ec36 100644 --- a/public/app/features/manage-dashboards/types.ts +++ b/public/app/features/manage-dashboards/types.ts @@ -20,6 +20,7 @@ export interface PublicDashboardListResponse { accessToken: string; dashboardUid: string; title: string; + slug: string; isEnabled: boolean; } diff --git a/public/openapi3.json b/public/openapi3.json index d03c1b4f50e..ea9d6eeab0a 100644 --- a/public/openapi3.json +++ b/public/openapi3.json @@ -8255,6 +8255,9 @@ "isEnabled": { "type": "boolean" }, + "slug": { + "type": "string" + }, "title": { "type": "string" },