import { DashboardSavedObject } from '../..' ; import { SavedObjectsClientContract } from '../../../../../core/public' ; export async function attemptLoadDashboardByTitle ( title , savedObjectsClient ) { const results = await savedObjectsClient . find < DashboardSavedObject > ( { search : `"${ title }"` , searchFields : [ 'title' ] , type : 'dashboard' , } ) ; const matchingDashboards = results . savedObjects . filter ( ( dashboard ) => dashboard . attributes . title . toLowerCase ( ) === title . toLowerCase ( ) ) ; if ( matchingDashboards . length === 1 ) { return { id : matchingDashboards [ 0 ] . id } ; } }