Skip to content

Commit a8648d8

Browse files
committed
[#1269] addressed review comments
1 parent ad50997 commit a8648d8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

webui/src/app/machines-page/machines-page.component.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ export class MachinesPageComponent implements OnInit, OnDestroy {
403403
_changeMachineAuthorization(machine: Machine, authorized: boolean, machinesTable: Table) {
404404
// Block table UI when machine authorization is in progress.
405405
this.dataLoading = true
406-
const state_backup = machine.authorized
406+
const stateBackup = machine.authorized
407407

408408
machine.authorized = authorized
409409
const prefix = authorized ? '' : 'un'
@@ -420,7 +420,7 @@ export class MachinesPageComponent implements OnInit, OnDestroy {
420420
this.serverData.forceReloadAppsStats()
421421
},
422422
error: (err) => {
423-
machine.authorized = state_backup
423+
machine.authorized = stateBackup
424424
this.dataLoading = false
425425
const msg = getErrorMessage(err)
426426
this.msgSrv.add({
@@ -641,13 +641,15 @@ export class MachinesPageComponent implements OnInit, OnDestroy {
641641
// Calling servicesApi.updateMachine() API sequentially for all selected machines.
642642
// Max expected count of selected machines is max machines per table page,
643643
// which currently is 50.
644-
let authorizations$: Observable<Machine> = concat()
644+
const updateObservables: Observable<Machine>[] = []
645645
for (const m of this.selectedMachines) {
646646
m.authorized = true
647-
// Use concat to call servicesApi sequentially.
648-
authorizations$ = concat(authorizations$, this.servicesApi.updateMachine(m.id, m))
647+
updateObservables.push(this.servicesApi.updateMachine(m.id, m))
649648
}
650649

650+
// Use concat to call servicesApi sequentially.
651+
const authorizations$: Observable<Machine> = concat(...updateObservables)
652+
651653
// Block table UI when bulk machines authorization is in progress.
652654
this.dataLoading = true
653655
authorizations$.subscribe({

0 commit comments

Comments
 (0)