File tree 4 files changed +7
-7
lines changed
4 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ export default function useDuplicateDashboard(dashboard) {
25
25
const tab = window . open ( "" , tabName ) ;
26
26
27
27
setIsDuplicating ( true ) ;
28
- Dashboard . fork ( { slug : dashboard . slug } )
28
+ Dashboard . fork ( { id : dashboard . id } )
29
29
. then ( newDashboard => {
30
30
tab . location = keepCurrentUrlParams ( newDashboard . url ) ;
31
31
} )
32
32
. finally ( ( ) => {
33
33
setIsDuplicating ( false ) ;
34
34
} ) ;
35
- } , [ dashboard . slug ] ) ;
35
+ } , [ dashboard . id ] ) ;
36
36
37
37
return [ isDuplicating , isDuplicating ? noop : duplicateDashboard ] ;
38
38
}
Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ const DashboardService = {
166
166
getByToken : ( { token } ) => axios . get ( `api/dashboards/public/${ token } ` ) . then ( transformResponse ) ,
167
167
getEmbed : ( { dashboard_id, token } ) =>
168
168
axios . get ( `/api/dashboards/embed/${ dashboard_id } ` + token ) . then ( transformResponse ) ,
169
- fork : ( { slug } ) => axios . post ( "api/dashboards/fork" , { slug } ) . then ( transformResponse ) ,
169
+ fork : ( { id } ) => axios . post ( "api/dashboards/fork" , { id } ) . then ( transformResponse ) ,
170
170
save : data => axios . post ( saveOrCreateUrl ( data ) , data ) . then ( transformResponse ) ,
171
171
delete : ( { id } ) => axios . delete ( `api/dashboards/${ id } ` ) . then ( transformResponse ) ,
172
172
query : params => axios . get ( "api/dashboards" , { params } ) . then ( transformResponse ) ,
Original file line number Diff line number Diff line change @@ -391,8 +391,8 @@ class DashboardForkResource(BaseResource):
391
391
@require_permission ('edit_dashboard' )
392
392
def post (self ):
393
393
dashboard_properties = request .get_json (force = True )
394
- dashboard_slug = dashboard_properties ['slug ' ]
395
- dashboard = models .Dashboard .get_by_slug_and_org ( dashboard_slug , self .current_org )
394
+ dashboard_id = dashboard_properties ['id ' ]
395
+ dashboard = models .Dashboard .get_by_id_and_org ( dashboard_id , self .current_org )
396
396
397
397
require_admin_or_owner (dashboard .user_id )
398
398
@@ -401,7 +401,7 @@ def post(self):
401
401
.outerjoin (models .Visualization )
402
402
.outerjoin (models .Query ))
403
403
404
- dashboard_duplicate = models .Dashboard (name = u'fork-of-{}' .format (dashboard .name , dashboard_slug ),
404
+ dashboard_duplicate = models .Dashboard (name = u'fork-of-{}' .format (dashboard .name ),
405
405
org = self .current_org ,
406
406
user = self .current_user ,
407
407
is_draft = True ,
Original file line number Diff line number Diff line change @@ -261,7 +261,7 @@ def test_fork_success(self):
261
261
262
262
res = self .make_request (
263
263
"POST" , "/api/dashboards/fork" ,
264
- data = {"slug " : dashboard .slug }
264
+ data = {"id " : dashboard .id }
265
265
)
266
266
self .assertEqual (res .status_code , 200 )
267
267
n = json_loads (res .data )
You can’t perform that action at this time.
0 commit comments