@@ -6,7 +6,9 @@ import { useConfigurationStore } from 'explorviz-frontend/src/stores/configurati
6
6
import { useLandscapeRestructureStore } from '../stores/landscape-restructure' ;
7
7
import { useIdeWebsocketFacadeStore } from '../stores/ide-websocket-facade' ;
8
8
import { useApplicationRepositoryStore } from 'explorviz-frontend/src/stores/repos/application-repository' ;
9
- import ApplicationData , { K8sData } from 'explorviz-frontend/src/utils/application-data' ;
9
+ import ApplicationData , {
10
+ K8sData ,
11
+ } from 'explorviz-frontend/src/utils/application-data' ;
10
12
import computeClassCommunication , {
11
13
computeRestructuredClassCommunication ,
12
14
} from 'explorviz-frontend/src/utils/application-rendering/class-communication-computer' ;
@@ -35,12 +37,14 @@ import LandscapeModel from 'explorviz-frontend/src/view-objects/3d/landscape/lan
35
37
import layoutLandscape from 'explorviz-frontend/src/utils/elk-layouter' ;
36
38
import { useShallow } from 'zustand/react/shallow' ;
37
39
import { updateHighlighting } from '../utils/application-rendering/highlighting' ;
40
+ import debug from 'debug' ;
38
41
39
42
export default function useLandscapeDataWatcher (
40
43
landscapeData : LandscapeData | null ,
41
44
landscape3D : Landscape3D
42
45
) {
43
46
// MARK: Stores
47
+ const log = debug ( 'app:hooks:useLandscapeWatcher' ) ;
44
48
45
49
const applicationRendererState = useApplicationRendererStore (
46
50
useShallow ( ( state ) => ( {
@@ -143,6 +147,7 @@ export default function useLandscapeDataWatcher(
143
147
} ;
144
148
145
149
const handleUpdatedLandscapeData = async ( ) => {
150
+ log ( 'handleUpdateLandscape' ) ;
146
151
await Promise . resolve ( ) ;
147
152
if ( ! structureLandscapeData || ! dynamicLandscapeData || ! landscape3D ) {
148
153
return ;
@@ -156,10 +161,13 @@ export default function useLandscapeDataWatcher(
156
161
157
162
// Applications might be removed in evolution mode
158
163
if ( applications . length !== applicationRepositoryState . applications . size ) {
164
+ console . log ( 'Remove all applications from landscape3D' ) ;
159
165
landscape3D . removeAll ( ) ;
160
166
}
161
167
168
+ log ( 'Layouting landscape ...' ) ;
162
169
const boxLayoutMap = await layoutLandscape ( k8sNodes , applications ) ;
170
+ log ( 'Layouted landscape.' ) ;
163
171
164
172
// Set data model for landscape
165
173
const landscapeLayout = boxLayoutMap . get ( 'landscape' ) ;
@@ -172,19 +180,23 @@ export default function useLandscapeDataWatcher(
172
180
}
173
181
174
182
// ToDo: This can take quite some time. Optimize.
183
+ log ( 'Compute class communication' ) ;
175
184
let classCommunications = computeClassCommunication (
176
185
structureLandscapeData ,
177
186
dynamicLandscapeData
178
187
) ;
188
+ log ( 'Computed class communication' ) ;
179
189
180
190
if ( landscapeRestructureState . restructureMode ) {
191
+ console . log ( 'Computing restructured communication ...' ) ;
181
192
classCommunications = computeRestructuredClassCommunication (
182
193
classCommunications ,
183
194
landscapeRestructureState . createdClassCommunication ,
184
195
landscapeRestructureState . copiedClassCommunications ,
185
196
landscapeRestructureState . updatedClassCommunications ,
186
197
landscapeRestructureState . completelyDeletedClassCommunications
187
198
) ;
199
+ console . log ( 'Computed restructured communication.' ) ;
188
200
}
189
201
landscapeRestructureState . setAllClassCommunications ( classCommunications ) ;
190
202
@@ -208,7 +220,7 @@ export default function useLandscapeDataWatcher(
208
220
const k8sApp3Ds : ApplicationObject3D [ ] = [ ] ;
209
221
210
222
// Add k8sApps
211
- for ( const k8sData of k8sAppData ) {
223
+ for ( const k8sData of k8sAppData ) {
212
224
const applicationData = await updateApplicationData (
213
225
k8sData . app ,
214
226
{
0 commit comments