@@ -20,9 +20,7 @@ import { DashboardPicker } from 'app/core/components/Select/DashboardPicker';
2020import  {  t ,  Trans  }  from  'app/core/internationalization' ; 
2121import  {  LANGUAGES  }  from  'app/core/internationalization/constants' ; 
2222import  {  PreferencesService  }  from  'app/core/services/PreferencesService' ; 
23- import  {  backendSrv  }  from  "app/core/services/backend_srv" ; // LOGZ.IO GRAFANA CHANGE :: DEV-20609 Home dashboard 
2423import  {  changeTheme  }  from  'app/core/services/theme' ; 
25- import  {  DashboardSearchItem  }  from  'app/features/search/types' ; 
2624
2725export  interface  Props  { 
2826  resourceUri : string ; 
@@ -31,7 +29,7 @@ export interface Props {
3129  onConfirm ?: ( )  =>  Promise < boolean > ; 
3230} 
3331
34- export  type  State  =  UserPreferencesDTO   &   {   homeDashboardId ?:  number ;   dashboards :  Array < DashboardSearchItem   &   { id ?:  number } > } ;   // LOGZ.IO GRAFANA CHANGE :: DEV-20609 Home dashboard 
32+ export  type  State  =  UserPreferencesDTO ; 
3533
3634function  getLanguageOptions ( ) : Array < SelectableValue < string > >  { 
3735  const  languageOptions  =  LANGUAGES . map ( ( v )  =>  ( { 
@@ -64,7 +62,6 @@ export class SharedPreferences extends PureComponent<Props, State> {
6462      weekStart : '' , 
6563      language : '' , 
6664      queryHistory : {  homeTab : ''  } , 
67-       dashboards : [ ] , 
6865    } ; 
6966
7067    this . themeOptions  =  getBuiltInThemes ( config . featureToggles . extraThemes ) . map ( ( theme )  =>  ( { 
@@ -77,51 +74,25 @@ export class SharedPreferences extends PureComponent<Props, State> {
7774  } 
7875
7976  async  componentDidMount ( )  { 
80-     // LOGZ.IO GRAFANA CHANGE :: DEV-20609 Home dashboard 
81-     const  prefs  =  await  backendSrv . get ( `/api/${ this . props . resourceUri . toLowerCase ( ) }  ) ; 
82-     const  dashboards  =  await  backendSrv . search ( {  starred : true  } ) ; 
83-     // 
84-     // this.setState({ 
85-     //   homeDashboardUID: prefs.homeDashboardUID, 
86-     //   theme: prefs.theme, 
87-     //   timezone: prefs.timezone, 
88-     //   weekStart: prefs.weekStart, 
89-     //   language: prefs.language, 
90-     //   queryHistory: prefs.queryHistory, 
91-     // }); 
92- 
93-     if  ( prefs . homeDashboardId  >  0  &&  ! dashboards . find ( ( d )  =>  d . id  ===  prefs . homeDashboardId ) )  { 
94-       const  missing  =  await  backendSrv . search ( {  dashboardIds : [ prefs . homeDashboardId ]  } ) ; 
95-       if  ( missing  &&  missing . length  >  0 )  { 
96-         dashboards . push ( missing [ 0 ] ) ; 
97-       } 
98-     } 
77+     const  prefs  =  await  this . service . load ( ) ; 
9978
10079    this . setState ( { 
101-       homeDashboardId : prefs . homeDashboardId , 
10280      homeDashboardUID : prefs . homeDashboardUID , 
10381      theme : prefs . theme , 
10482      timezone : prefs . timezone , 
10583      weekStart : prefs . weekStart , 
106-       dashboards, 
84+       language : prefs . language , 
85+       queryHistory : prefs . queryHistory , 
10786    } ) ; 
108-     // LOGZ.IO GRAFANA CHANGE :: DEV-20609 Remove default dashboard end 
10987  } 
11088
11189  onSubmitForm  =  async  ( event : React . FormEvent < HTMLFormElement > )  =>  { 
11290    event . preventDefault ( ) ; 
11391    const  confirmationResult  =  this . props . onConfirm  ? await  this . props . onConfirm ( )  : true ; 
11492
11593    if  ( confirmationResult )  { 
116-       // LOGZ.IO GRAFANA CHANGE :: DEV-20609 Home dashboard 
117-       const  {  homeDashboardUID,  theme,  timezone }  =  this . state ; 
118-       const  homeDashboard  =  this . state . dashboards . find ( d  =>  d . uid  ===  homeDashboardUID ) ; 
119-       await  backendSrv . put ( `/api/${ this . props . resourceUri . toLowerCase ( ) }  ,  { 
120-         homeDashboardId : homeDashboard ?. id  ||  null , 
121-         theme, 
122-         timezone, 
123-       } ) ; 
124-       // LOGZ.IO GRAFANA CHANGE :: end 
94+       const  {  homeDashboardUID,  theme,  timezone,  weekStart,  language,  queryHistory }  =  this . state ; 
95+       await  this . service . update ( {  homeDashboardUID,  theme,  timezone,  weekStart,  language,  queryHistory } ) ; 
12596      window . location . reload ( ) ; 
12697    } 
12798  } ; 
@@ -221,7 +192,7 @@ export class SharedPreferences extends PureComponent<Props, State> {
221192          </ Field > 
222193
223194          < Field 
224-             hidden  //  LOGZ.IO GRAFANA  CHANGE :: hide language in profile  
195+             hidden  /*  LOGZ.IO CHANGE */  
225196            label = { 
226197              < Label  htmlFor = "locale-select" > 
227198                < span  className = { styles . labelText } > 
0 commit comments