forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.ts
More file actions
24 lines (19 loc) · 891 Bytes
/
utils.ts
File metadata and controls
24 lines (19 loc) · 891 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import type { Reference } from '@kbn/content-management-utils';
import type { LensSerializedState } from '../../public';
import type { LensByRefSerializedState } from '../../public/react_embeddable/types';
import { DOC_TYPE } from '../constants';
export const LENS_SAVED_OBJECT_REF_NAME = 'savedObjectRef';
export function findLensReference(references?: Reference[]) {
return references
? references.find((ref) => ref.type === DOC_TYPE && ref.name === LENS_SAVED_OBJECT_REF_NAME)
: undefined;
}
export function isByRefLensState(state: LensSerializedState): state is LensByRefSerializedState {
return !state.attributes;
}