From 5b985f8bd09be728eae440a598572cb6a08134b6 Mon Sep 17 00:00:00 2001 From: Yuepeng Pan Date: Sat, 9 May 2026 11:55:39 +0800 Subject: [PATCH] [FLINK-39641][runtime-web] Fix unstable position of the Rescales Tab --- .../job/job-detail/status/job-status.component.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/flink-runtime-web/web-dashboard/src/app/pages/job/job-detail/status/job-status.component.ts b/flink-runtime-web/web-dashboard/src/app/pages/job/job-detail/status/job-status.component.ts index c5def1f2aec53..c9a1e07cb9d4d 100644 --- a/flink-runtime-web/web-dashboard/src/app/pages/job/job-detail/status/job-status.component.ts +++ b/flink-runtime-web/web-dashboard/src/app/pages/job/job-detail/status/job-status.component.ts @@ -63,7 +63,6 @@ export class JobStatusComponent implements OnInit, OnDestroy { urlLoading = true; readonly listOfNavigation: RouterTab[]; private readonly checkpointIndexOfNavigation: number; - private readonly rescalesIndexOfNavigation: number; webCancelEnabled = this.statusService.configuration.features['web-cancel']; isHistoryServer = this.statusService.configuration.features['web-history']; @@ -82,7 +81,6 @@ export class JobStatusComponent implements OnInit, OnDestroy { // Create a copy to avoid mutating the shared config this.listOfNavigation = [...(moduleConfig.routerTabs || JOB_MODULE_DEFAULT_CONFIG.routerTabs)]; this.checkpointIndexOfNavigation = this.checkpointIndexOfNav(); - this.rescalesIndexOfNavigation = this.rescalesIndexOfNav(); } ngOnInit(): void { @@ -133,6 +131,11 @@ export class JobStatusComponent implements OnInit, OnDestroy { return this.listOfNavigation.findIndex(item => item.path === 'rescales'); } + private getRescalesTabIndexAfter(path: string): number { + const index = this.listOfNavigation.findIndex(item => item.path === path); + return index >= 0 ? index + 1 : this.listOfNavigation.length; + } + private handleJobDetailChanged(data: JobDetailCorrect): void { this.jobDetail = data; const checkpointNavIndex = this.checkpointIndexOfNav(); @@ -150,7 +153,9 @@ export class JobStatusComponent implements OnInit, OnDestroy { if (!shouldShowRescales && rescalesNavIndex > -1) { this.listOfNavigation.splice(rescalesNavIndex, 1); } else if (shouldShowRescales && rescalesNavIndex == -1) { - this.listOfNavigation.splice(this.rescalesIndexOfNavigation, 0, { + // Insert deterministically after configuration to avoid stale index issues across job transitions. + const insertIndex = this.getRescalesTabIndexAfter('configuration'); + this.listOfNavigation.splice(insertIndex, 0, { path: 'rescales', title: 'Rescales' });