Skip to content

Commit 2b4d721

Browse files
NVSHAS-9931: Add warning if there are inconsistent version of NeuVector products in multi-cluster
1 parent a63bea9 commit 2b4d721

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

admin/src/main/scala/com/neu/model/DashboardJsonProtocal.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,8 @@ case class Metrics(
728728
openshift_version: String,
729729
new_service_policy_mode: String,
730730
new_service_profile_mode: String,
731-
adm_mode: String,
732-
enabled_deny_adm_ctrl_rules: Int,
731+
adm_mode: Option[String],
732+
enabled_deny_adm_ctrl_rules: Option[Int],
733733
deny_adm_ctrl_rules: Int,
734734
hosts: Int,
735735
workloads: RiskScoreMetricsWL,

admin/src/main/scala/com/neu/service/dashboard/DashboardService.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class DashboardService()(implicit executionContext: ExecutionContext)
8686
"",
8787
"",
8888
"",
89-
"",
90-
0,
89+
Some(""),
90+
Some(0),
9191
0,
9292
0,
9393
RiskScoreMetricsWL(0, 0, 0, 0, 0, 0, 0, 0),

admin/webapp/websrc/app/routes/components/multi-cluster-grid/multi-cluster-grid.component.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export class MultiClusterGridComponent implements OnInit, OnDestroy {
174174
filteredCount: number = 0;
175175
context;
176176
hasDiffManager: boolean = false;
177+
pendingTaskNum: number = 0;
177178

178179
get clusterCount() {
179180
return this.clusterData.clusters!.length;
@@ -192,15 +193,17 @@ export class MultiClusterGridComponent implements OnInit, OnDestroy {
192193
}
193194

194195
set finishedNum(value: number) {
195-
if (value === this.clusterCount && this.taskQueue.length === 0) {
196-
let componentVersions = this.rowData.map(data => {
197-
data.component_versions;
198-
});
199-
this.hasDiffManager = componentVersions.some((ver) => ver !== componentVersions[0]);
196+
if (value === this.clusterCount && this.pendingTaskNum === 0) {
197+
let componentVersions = this.rowData
198+
.map(data => data.component_versions)
199+
.flatMap(data => data);
200+
this.hasDiffManager = componentVersions.some(
201+
ver => ver !== componentVersions[0]
202+
);
200203
if (this.hasDiffManager) {
201204
this.notificationService.open(
202205
this.translate.instant('multiCluster.HAS_INCOMPATIBLE_VERSION'),
203-
GlobalConstant.NOTIFICATION_TYPE.ERROR
206+
GlobalConstant.NOTIFICATION_TYPE.WARNING
204207
);
205208
}
206209
}
@@ -268,6 +271,7 @@ export class MultiClusterGridComponent implements OnInit, OnDestroy {
268271
};
269272

270273
this._activeTaskNum = 0;
274+
this.pendingTaskNum = 0;
271275
this.finishedNum = 0;
272276
}
273277

@@ -280,6 +284,8 @@ export class MultiClusterGridComponent implements OnInit, OnDestroy {
280284
) {
281285
this.updateRow4Error(rowNode, '');
282286
this._activeTaskNum--;
287+
this.pendingTaskNum--;
288+
this.finishedNum++;
283289
} else {
284290
const params =
285291
cluster.clusterType === MapConstant.FED_ROLES.MASTER
@@ -290,6 +296,8 @@ export class MultiClusterGridComponent implements OnInit, OnDestroy {
290296
res => {
291297
this.updateRow4Success(index, rowNode, res);
292298
this._activeTaskNum--;
299+
this.pendingTaskNum--;
300+
this.finishedNum++;
293301
},
294302
error => {
295303
console.error(error);
@@ -298,6 +306,8 @@ export class MultiClusterGridComponent implements OnInit, OnDestroy {
298306
this.translate.instant('multiCluster.messages.SCORE_UNAVAILIBlE')
299307
);
300308
this._activeTaskNum--;
309+
this.pendingTaskNum--;
310+
this.finishedNum++;
301311
}
302312
);
303313
}
@@ -333,6 +343,7 @@ export class MultiClusterGridComponent implements OnInit, OnDestroy {
333343
this.taskQueue = this._taskQueue;
334344
if (task) {
335345
this._activeTaskNum++;
346+
this.pendingTaskNum++;
336347
this.updateSummaryForRow(task.rowNode, task.cluster, task.index);
337348
}
338349
}

0 commit comments

Comments
 (0)