This is an automated email from the ASF dual-hosted git repository.

brandboat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-web.git


The following commit(s) were added to refs/heads/master by this push:
     new 58dab20  [YUNIKORN-2624] Enable hotlinking to YuniKorn (#191)
58dab20 is described below

commit 58dab20c68949c36fe003ea5532a4d1f259778a9
Author: Denis Coric <[email protected]>
AuthorDate: Mon Jun 3 21:58:41 2024 +0800

    [YUNIKORN-2624] Enable hotlinking to YuniKorn (#191)
    
    applicationId can be passed as a query parameter together with partition 
and queue. This will autoselect all of the options in the applications page.
    
    Closes: #191
    
    Signed-off-by: Kuan-Po Tseng <[email protected]>
---
 .../components/apps-view/apps-view.component.ts    | 43 ++++++++++++++--------
 1 file changed, 27 insertions(+), 16 deletions(-)

diff --git a/src/app/components/apps-view/apps-view.component.ts 
b/src/app/components/apps-view/apps-view.component.ts
index edbf0bb..b23a863 100644
--- a/src/app/components/apps-view/apps-view.component.ts
+++ b/src/app/components/apps-view/apps-view.component.ts
@@ -163,8 +163,7 @@ export class AppsViewComponent implements OnInit {
         if (data && data.rootQueue) {
           const leafQueueList = this.generateLeafQueueList(data.rootQueue);
           this.leafQueueList = [new DropdownItem('-- Select --', ''), 
...leafQueueList];
-          this.fetchApplicationsUsingQueryParams();
-          this.setDefaultQueue(leafQueueList);
+          if (!this.fetchApplicationsUsingQueryParams()) 
this.setDefaultQueue(leafQueueList);
         } else {
           this.leafQueueList = [new DropdownItem('-- Select --', '')];
         }
@@ -206,7 +205,11 @@ export class AppsViewComponent implements OnInit {
     return list;
   }
 
-  fetchAppListForPartitionAndQueue(partitionName: string, queueName: string) {
+  fetchAppListForPartitionAndQueue(
+    partitionName: string,
+    queueName: string,
+    applicationId?: string
+  ) {
     this.spinner.show();
 
     this.scheduler
@@ -219,27 +222,37 @@ export class AppsViewComponent implements OnInit {
       .subscribe((data) => {
         this.initialAppData = data;
         this.appDataSource.data = data;
+
+        const row = this.initialAppData.find((app) => app.applicationId === 
applicationId);
+        if (row) {
+          this.toggleRowSelection(row);
+        }
       });
   }
 
-  fetchApplicationsUsingQueryParams() {
+  fetchApplicationsUsingQueryParams(): boolean {
     const partitionName = 
this.activatedRoute.snapshot.queryParams['partition'];
     const queueName = this.activatedRoute.snapshot.queryParams['queue'];
+    const applicationId = 
this.activatedRoute.snapshot.queryParams['applicationId'];
 
     if (partitionName && queueName) {
       this.partitionSelected = partitionName;
       this.leafQueueSelected = queueName;
-      this.fetchAppListForPartitionAndQueue(partitionName, queueName);
+      this.fetchAppListForPartitionAndQueue(partitionName, queueName, 
applicationId);
       CommonUtil.setStoredQueueAndPartition(partitionName, queueName);
-    }
 
-    this.router.navigate([], {
-      queryParams: {
-        partition: null,
-        queue: null,
-      },
-      queryParamsHandling: 'merge',
-    });
+      this.router.navigate([], {
+        queryParams: {
+          partition: null,
+          queue: null,
+          applicationId: null,
+        },
+        queryParamsHandling: 'merge',
+      });
+
+      return true;
+    }
+    return false;
   }
 
   unselectAllRowsButOne(row: AppInfo) {
@@ -253,9 +266,7 @@ export class AppsViewComponent implements OnInit {
   toggleRowSelection(row: AppInfo) {
     this.unselectAllRowsButOne(row);
     if (row.isSelected) {
-      this.selectedRow = null;
-      row.isSelected = false;
-      this.allocDataSource.data = [];
+      this.removeRowSelection();
     } else {
       this.selectedRow = row;
       row.isSelected = true;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to