@@ -68,11 +68,20 @@ class InsightsViewService(project: Project) : AbstractViewService(project) {
6868
6969 if (! insightsListContainer.listViewItems.isNullOrEmpty()) {
7070 model.status = UiInsightStatus .InsightExist
71- } else {
71+ }
72+ else {
7273 model.status = UiInsightStatus .Unknown
7374 val newLifetimeDefinition = LifetimeDefinition ()
7475 newLifetimeDefinition.lifetime.launchBackground {
75- fetchForInsightStatusAndUpdateUi(methodInfo, model)
76+ fetchForInsightStatus(methodInfo, model)
77+
78+ // Unknown status displays 'loading...' msg on ui. But we cannot do that if there is no envs at all,
79+ // meaning client hasnt started loading data into the system, so we should show 'No data'
80+ if (model.status == UiInsightStatus .Unknown && insightsListContainer.usageStatus.environmentStatuses.isNullOrEmpty()) {
81+ model.status = UiInsightStatus .NoSpanData
82+ }
83+
84+ notifyModelChangedAndUpdateUi()
7685 }
7786 }
7887
@@ -85,13 +94,11 @@ class InsightsViewService(project: Project) : AbstractViewService(project) {
8594 }
8695 }
8796
88- fun fetchForInsightStatusAndUpdateUi (methodInfo : MethodInfo , model : InsightsModel ) {
97+ fun fetchForInsightStatus (methodInfo : MethodInfo , model : InsightsModel ) {
8998 val insightStatus = insightsProvider.getInsightStatus(methodInfo)
9099 val uiInsightStatus = toUiInsightStatus(insightStatus, methodInfo.hasRelatedCodeObjectIds())
91100
92101 model.status = uiInsightStatus
93-
94- notifyModelChangedAndUpdateUi()
95102 }
96103
97104 @VisibleForTesting
0 commit comments