Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YUNIKORN-2624] Implemented hotlinking to applications page using the query parameters #191

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 27 additions & 16 deletions src/app/components/apps-view/apps-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 --', '')];
}
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand All @@ -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;
Expand Down