@@ -15,10 +15,7 @@ import pickBy from 'lodash/pickBy';
15
15
import uniq from 'lodash/uniq' ;
16
16
import without from 'lodash/without' ;
17
17
import * as React from 'react' ;
18
- import { useCallback , useLayoutEffect , useMemo , useRef , useState } from 'react' ;
19
- import { FeatureFlag } from 'shared/app/FeatureFlags.oss' ;
20
- import { AssetGraphAssetSelectionInput } from 'shared/asset-graph/AssetGraphAssetSelectionInput.oss' ;
21
- import { useAssetGraphExplorerFilters } from 'shared/asset-graph/useAssetGraphExplorerFilters.oss' ;
18
+ import { useCallback , useMemo , useRef , useState } from 'react' ;
22
19
import { AssetSelectionInput } from 'shared/asset-selection/input/AssetSelectionInput.oss' ;
23
20
import { CreateCatalogViewButton } from 'shared/assets/CreateCatalogViewButton.oss' ;
24
21
import styled from 'styled-components' ;
@@ -53,18 +50,15 @@ import {
53
50
useFullAssetGraphData ,
54
51
} from './useAssetGraphData' ;
55
52
import { AssetLocation , useFindAssetLocation } from './useFindAssetLocation' ;
56
- import { featureEnabled } from '../app/Flags' ;
57
53
import { AssetLiveDataRefreshButton } from '../asset-data/AssetLiveDataProvider' ;
58
54
import { LaunchAssetExecutionButton } from '../assets/LaunchAssetExecutionButton' ;
59
55
import { AssetKey } from '../assets/types' ;
60
56
import { DEFAULT_MAX_ZOOM } from '../graph/SVGConsts' ;
61
57
import { SVGViewport , SVGViewportRef } from '../graph/SVGViewport' ;
62
58
import { useAssetLayout } from '../graph/asyncGraphLayout' ;
63
59
import { closestNodeInDirection , isNodeOffscreen } from '../graph/common' ;
64
- import { AssetGroupSelector } from '../graphql/types' ;
65
60
import { usePreviousDistinctValue } from '../hooks/usePrevious' ;
66
61
import { useQueryAndLocalStoragePersistedState } from '../hooks/useQueryAndLocalStoragePersistedState' ;
67
- import { useUpdatingRef } from '../hooks/useUpdatingRef' ;
68
62
import {
69
63
GraphExplorerOptions ,
70
64
OptionsOverlay ,
@@ -80,7 +74,6 @@ import {
80
74
} from '../pipelines/GraphNotices' ;
81
75
import { ExplorerPath } from '../pipelines/PipelinePathUtils' ;
82
76
import { SyntaxError } from '../selection/CustomErrorListener' ;
83
- import { StaticSetFilter } from '../ui/BaseFilters/useStaticSetFilter' ;
84
77
import { IndeterminateLoadingBar } from '../ui/IndeterminateLoadingBar' ;
85
78
import { LoadingSpinner } from '../ui/Loading' ;
86
79
import { isIframe } from '../util/isIframe' ;
@@ -105,71 +98,19 @@ type Props = {
105
98
export const MINIMAL_SCALE = 0.6 ;
106
99
export const GROUPS_ONLY_SCALE = 0.15 ;
107
100
108
- const DEFAULT_SET_HIDE_NODES_MATCH = ( _node : AssetNodeForGraphQueryFragment ) => true ;
109
-
110
101
export const AssetGraphExplorer = React . memo ( ( props : Props ) => {
111
102
const { fullAssetGraphData : currentFullAssetGraphData } = useFullAssetGraphData ( props . fetchOptions ) ;
112
103
const previousFullAssetGraphData = usePreviousDistinctValue ( currentFullAssetGraphData ) ;
113
104
114
105
const fullAssetGraphData = currentFullAssetGraphData ?? previousFullAssetGraphData ;
115
- const [ hideNodesMatching , setHideNodesMatching ] = useState ( ( ) => DEFAULT_SET_HIDE_NODES_MATCH ) ;
116
106
117
107
const {
118
108
loading : graphDataLoading ,
119
109
fetchResult,
120
110
assetGraphData : currentAssetGraphData ,
121
111
graphQueryItems : currentGraphQueryItems ,
122
112
allAssetKeys : currentAllAssetKeys ,
123
- } = useAssetGraphData (
124
- props . explorerPath . opsQuery ,
125
- useMemo (
126
- ( ) => ( {
127
- ...props . fetchOptions ,
128
- hideNodesMatching : ( node ) => {
129
- let hide = false ;
130
- if ( props . fetchOptions . hideNodesMatching ?.( node ) ) {
131
- hide = true ;
132
- }
133
- if ( hideNodesMatching ( node ) ) {
134
- hide = true ;
135
- }
136
- return hide ;
137
- } ,
138
- } ) ,
139
- [ props . fetchOptions , hideNodesMatching ] ,
140
- ) ,
141
- ) ;
142
-
143
- const { explorerPath, onChangeExplorerPath} = props ;
144
-
145
- const explorerPathRef = useUpdatingRef ( explorerPath ) ;
146
-
147
- const { button, filterBar, groupsFilter, kindFilter, filterFn, filteredAssetsLoading} =
148
- useAssetGraphExplorerFilters ( {
149
- nodes : React . useMemo (
150
- ( ) => ( fullAssetGraphData ? Object . values ( fullAssetGraphData . nodes ) : [ ] ) ,
151
- [ fullAssetGraphData ] ,
152
- ) ,
153
- loading : graphDataLoading ,
154
- viewType : props . viewType ,
155
- assetSelection : explorerPath . opsQuery ,
156
- setAssetSelection : React . useCallback (
157
- ( assetSelection : string ) => {
158
- onChangeExplorerPath (
159
- {
160
- ...explorerPathRef . current ,
161
- opsQuery : assetSelection ,
162
- } ,
163
- 'push' ,
164
- ) ;
165
- } ,
166
- [ explorerPathRef , onChangeExplorerPath ] ,
167
- ) ,
168
- } ) ;
169
-
170
- useLayoutEffect ( ( ) => {
171
- setHideNodesMatching ( ( ) => ( node : AssetNodeForGraphQueryFragment ) => ! filterFn ( node ) ) ;
172
- } , [ filterFn ] ) ;
113
+ } = useAssetGraphData ( props . explorerPath . opsQuery , props . fetchOptions ) ;
173
114
174
115
const previousAssetGraphData = usePreviousDistinctValue ( currentAssetGraphData ) ;
175
116
const previousGraphQueryItems = usePreviousDistinctValue ( currentGraphQueryItems ) ;
@@ -179,10 +120,7 @@ export const AssetGraphExplorer = React.memo((props: Props) => {
179
120
const graphQueryItems = currentGraphQueryItems ?? previousGraphQueryItems ;
180
121
const allAssetKeys = currentAllAssetKeys ?? previousAllAssetKeys ;
181
122
182
- if (
183
- ( fetchResult . loading || graphDataLoading || filteredAssetsLoading ) &&
184
- ( ! assetGraphData || ! allAssetKeys )
185
- ) {
123
+ if ( ( fetchResult . loading || graphDataLoading ) && ( ! assetGraphData || ! allAssetKeys ) ) {
186
124
return < LoadingSpinner purpose = "page" /> ;
187
125
}
188
126
@@ -203,11 +141,7 @@ export const AssetGraphExplorer = React.memo((props: Props) => {
203
141
fullAssetGraphData = { fullAssetGraphData ?? assetGraphData }
204
142
allAssetKeys = { allAssetKeys }
205
143
graphQueryItems = { graphQueryItems }
206
- filterBar = { filterBar }
207
- filterButton = { button }
208
- kindFilter = { kindFilter }
209
- groupsFilter = { groupsFilter }
210
- loading = { filteredAssetsLoading || graphDataLoading || fetchResult . loading }
144
+ loading = { graphDataLoading || fetchResult . loading }
211
145
{ ...props }
212
146
/>
213
147
) ;
@@ -220,12 +154,7 @@ type WithDataProps = Props & {
220
154
graphQueryItems : AssetGraphQueryItem [ ] ;
221
155
loading : boolean ;
222
156
223
- filterButton : React . ReactNode ;
224
- filterBar : React . ReactNode ;
225
157
viewType : AssetGraphViewType ;
226
-
227
- kindFilter : StaticSetFilter < string > ;
228
- groupsFilter : StaticSetFilter < AssetGroupSelector > ;
229
158
} ;
230
159
231
160
const AssetGraphExplorerWithData = ( {
@@ -239,11 +168,7 @@ const AssetGraphExplorerWithData = ({
239
168
graphQueryItems,
240
169
fetchOptions,
241
170
allAssetKeys,
242
- filterButton,
243
- filterBar,
244
171
viewType,
245
- kindFilter,
246
- groupsFilter,
247
172
loading : dataLoading ,
248
173
setHideEdgesToNodesOutsideQuery,
249
174
} : WithDataProps ) => {
@@ -501,21 +426,9 @@ const AssetGraphExplorerWithData = ({
501
426
const [ showSidebar , setShowSidebar ] = React . useState ( viewType === 'global' ) ;
502
427
503
428
const onFilterToGroup = ( group : AssetGroup | GroupLayout ) => {
504
- if ( featureEnabled ( FeatureFlag . flagSelectionSyntax ) ) {
505
- onChangeAssetSelection (
506
- `group:"${ group . groupName } " and code_location:"${ group . repositoryLocationName } "` ,
507
- ) ;
508
- } else {
509
- groupsFilter ?. setState (
510
- new Set ( [
511
- {
512
- groupName : group . groupName ,
513
- repositoryName : group . repositoryName ,
514
- repositoryLocationName : group . repositoryLocationName ,
515
- } ,
516
- ] ) ,
517
- ) ;
518
- }
429
+ onChangeAssetSelection (
430
+ `group:"${ group . groupName } " and code_location:"${ group . repositoryLocationName } "` ,
431
+ ) ;
519
432
} ;
520
433
521
434
const svgViewport = layout ? (
@@ -691,7 +604,6 @@ const AssetGraphExplorerWithData = ({
691
604
< AssetNode
692
605
definition = { graphNode . definition }
693
606
selected = { selectedGraphNodes . includes ( graphNode ) }
694
- kindFilter = { kindFilter }
695
607
onChangeAssetSelection = { onChangeAssetSelection }
696
608
/>
697
609
</ AssetNodeContextMenuWrapper >
@@ -788,34 +700,19 @@ const AssetGraphExplorerWithData = ({
788
700
/>
789
701
</ Tooltip >
790
702
) }
791
- { featureEnabled ( FeatureFlag . flagSelectionSyntax ) ? null : (
792
- < div > { filterButton } </ div >
793
- ) }
794
703
< GraphQueryInputFlexWrap >
795
- { featureEnabled ( FeatureFlag . flagSelectionSyntax ) ? (
796
- < AssetSelectionInput
797
- assets = { graphQueryItems }
798
- value = { explorerPath . opsQuery }
799
- onChange = { onChangeAssetSelection }
800
- onErrorStateChange = { ( errors ) => {
801
- if ( errors !== errorState ) {
802
- setErrorState ( errors ) ;
803
- }
804
- } }
805
- />
806
- ) : (
807
- < AssetGraphAssetSelectionInput
808
- items = { graphQueryItems }
809
- value = { explorerPath . opsQuery }
810
- placeholder = "Type an asset subset…"
811
- onChange = { onChangeAssetSelection }
812
- popoverPosition = "bottom-left"
813
- />
814
- ) }
704
+ < AssetSelectionInput
705
+ assets = { graphQueryItems }
706
+ value = { explorerPath . opsQuery }
707
+ onChange = { onChangeAssetSelection }
708
+ onErrorStateChange = { ( errors : SyntaxError [ ] ) => {
709
+ if ( errors !== errorState ) {
710
+ setErrorState ( errors ) ;
711
+ }
712
+ } }
713
+ />
815
714
</ GraphQueryInputFlexWrap >
816
- { featureEnabled ( FeatureFlag . flagSelectionSyntax ) ? (
817
- < CreateCatalogViewButton />
818
- ) : null }
715
+ < CreateCatalogViewButton />
819
716
< AssetLiveDataRefreshButton />
820
717
{ isIframe ( ) ? null : (
821
718
< LaunchAssetExecutionButton
@@ -828,7 +725,6 @@ const AssetGraphExplorerWithData = ({
828
725
/>
829
726
) }
830
727
</ Box >
831
- { featureEnabled ( FeatureFlag . flagSelectionSyntax ) ? null : filterBar }
832
728
< IndeterminateLoadingBar
833
729
$loading = { nextLayoutLoading }
834
730
style = { {
0 commit comments