diff --git a/src/app/reducers/accounts/redux/accounts.effects.ts b/src/app/reducers/accounts/redux/accounts.effects.ts index 216ae36842..fb98863bd4 100644 --- a/src/app/reducers/accounts/redux/accounts.effects.ts +++ b/src/app/reducers/accounts/redux/accounts.effects.ts @@ -47,7 +47,7 @@ export class AccountsEffects { @Effect() disableAccount$: Observable = this.actions$ .ofType(accountActions.DISABLE_ACCOUNT) - .switchMap((action: accountActions.DisableAccountRequest) => { + .mergeMap((action: accountActions.DisableAccountRequest) => { return this.accountService.disableAccount(action.payload) .map(updatedAccount => new accountActions.UpdateAccount(updatedAccount)) .catch((error: Error) => { @@ -58,7 +58,7 @@ export class AccountsEffects { @Effect() enableAccount$: Observable = this.actions$ .ofType(accountActions.ENABLE_ACCOUNT) - .switchMap((action: accountActions.EnableAccountRequest) => { + .mergeMap((action: accountActions.EnableAccountRequest) => { return this.accountService.enableAccount(action.payload) .map(updatedAccount => new accountActions.UpdateAccount(updatedAccount)) .catch((error: Error) => { @@ -69,7 +69,7 @@ export class AccountsEffects { @Effect() deleteAccount$: Observable = this.actions$ .ofType(accountActions.DELETE_ACCOUNT) - .switchMap((action: accountActions.DeleteAccountRequest) => { + .mergeMap((action: accountActions.DeleteAccountRequest) => { return this.accountService.removeAccount(action.payload) .map(() => new accountActions.DeleteSuccess(action.payload)) .catch((error: Error) => { @@ -81,7 +81,7 @@ export class AccountsEffects { @Effect() createAccount$: Observable = this.actions$ .ofType(accountActions.CREATE_ACCOUNT) - .switchMap((action: accountActions.CreateAccount) => { + .mergeMap((action: accountActions.CreateAccount) => { return this.accountService.create(action.payload) .map(createdAccount => new accountActions.CreateSuccess(createdAccount)) .catch((error: Error) => { @@ -127,7 +127,7 @@ export class AccountsEffects { @Effect() userDelete$: Observable = this.actions$ .ofType(accountActions.ACCOUNT_USER_DELETE) - .switchMap((action: accountActions.AccountUserDelete) => + .mergeMap((action: accountActions.AccountUserDelete) => this.userService.removeUser(action.payload) .map(() => new accountActions.AccountUserDeleteSuccess(action.payload)) .catch(error => Observable.of(new accountActions.AccountUpdateError(error)))); @@ -142,7 +142,7 @@ export class AccountsEffects { @Effect() userCreate$: Observable = this.actions$ .ofType(accountActions.ACCOUNT_USER_CREATE) - .switchMap((action: accountActions.AccountUserCreate) => + .mergeMap((action: accountActions.AccountUserCreate) => this.userService.createUser(action.payload) .map((user) => new accountActions.AccountUserCreateSuccess(user)) .catch(error => Observable.of(new accountActions.AccountUpdateError(error)))); @@ -158,7 +158,7 @@ export class AccountsEffects { @Effect() userUpdate$: Observable = this.actions$ .ofType(accountActions.ACCOUNT_USER_UPDATE) - .switchMap((action: accountActions.AccountUserUpdate) => + .mergeMap((action: accountActions.AccountUserUpdate) => this.userService.updateUser(action.payload) .map((user) => new accountActions.AccountUserUpdateSuccess(user)) .catch(error => Observable.of(new accountActions.AccountUpdateError(error)))); @@ -173,7 +173,7 @@ export class AccountsEffects { @Effect() userGenerateKeys$: Observable = this.actions$ .ofType(accountActions.ACCOUNT_USER_GENERATE_KEYS) - .switchMap((action: accountActions.AccountUserGenerateKey) => + .mergeMap((action: accountActions.AccountUserGenerateKey) => this.userService.registerKeys(action.payload.id) .map(res => new accountActions.AccountLoadUserKeysSuccess({ user: action.payload, diff --git a/src/app/reducers/configuration/redux/configurations.effects.ts b/src/app/reducers/configuration/redux/configurations.effects.ts index c667e2d44b..b09b132275 100644 --- a/src/app/reducers/configuration/redux/configurations.effects.ts +++ b/src/app/reducers/configuration/redux/configurations.effects.ts @@ -32,7 +32,7 @@ export class ConfigurationEffects { @Effect() updateConfiguration$: Observable = this.actions$ .ofType(configurationActions.UPDATE_CONFIGURATIONS_REQUEST) - .switchMap((action: configurationActions.UpdateConfigurationRequest) => { + .mergeMap((action: configurationActions.UpdateConfigurationRequest) => { return this.configurationService.updateConfiguration( action.payload.configuration, action.payload.account) diff --git a/src/app/reducers/resource-limit/redux/resource-limits.effects.ts b/src/app/reducers/resource-limit/redux/resource-limits.effects.ts index 53fe25bb59..3792156018 100644 --- a/src/app/reducers/resource-limit/redux/resource-limits.effects.ts +++ b/src/app/reducers/resource-limit/redux/resource-limits.effects.ts @@ -1,8 +1,5 @@ import { Injectable } from '@angular/core'; -import { - Actions, - Effect -} from '@ngrx/effects'; +import { Actions, Effect } from '@ngrx/effects'; import { Observable } from 'rxjs/Observable'; import * as resourceLimitActions from './resource-limits.actions'; import { Action } from '@ngrx/store'; @@ -27,7 +24,7 @@ export class ResourceLimitsEffects { @Effect() updateResourceLimits$: Observable = this.actions$ .ofType(resourceLimitActions.UPDATE_RESOURCE_LIMITS_REQUEST) - .switchMap((action: resourceLimitActions.UpdateResourceLimitsRequest) => { + .mergeMap((action: resourceLimitActions.UpdateResourceLimitsRequest) => { const observes = action.payload.limits.map(limit => this.resourceLimitService.updateResourceLimit(limit, action.payload.account)); return Observable.forkJoin(observes) diff --git a/src/app/reducers/security-groups/redux/sg.effects.ts b/src/app/reducers/security-groups/redux/sg.effects.ts index 72bbebd1d2..cc090e3bff 100644 --- a/src/app/reducers/security-groups/redux/sg.effects.ts +++ b/src/app/reducers/security-groups/redux/sg.effects.ts @@ -34,7 +34,7 @@ export class SecurityGroupEffects { @Effect() createSecurityGroup$: Observable = this.actions$ .ofType(securityGroup.CREATE_SECURITY_GROUP) - .switchMap((action: securityGroup.CreateSecurityGroup) => { + .mergeMap((action: securityGroup.CreateSecurityGroup) => { return this.createSecurityGroup(action.payload) .map(sg => new securityGroup.CreateSecurityGroupSuccess(sg)) .catch(error => Observable.of(new securityGroup.CreateSecurityGroupError(error))); @@ -54,7 +54,7 @@ export class SecurityGroupEffects { @Effect() deleteSecurityGroup$: Observable = this.actions$ .ofType(securityGroup.DELETE_SECURITY_GROUP) - .switchMap((action: securityGroup.DeleteSecurityGroup) => { + .mergeMap((action: securityGroup.DeleteSecurityGroup) => { return this.onDeleteConfirmation(action.payload) .map(() => new securityGroup.DeleteSecurityGroupSuccess(action.payload)) .catch(error => Observable.of(new securityGroup.DeleteSecurityGroupError(error))); @@ -73,7 +73,7 @@ export class SecurityGroupEffects { return vmGroup; }) .filter((group: SecurityGroup) => !!group) - .switchMap((group: SecurityGroup) => { + .mergeMap((group: SecurityGroup) => { return this.deleteSecurityGroup(group) .map(() => new securityGroup.DeleteSecurityGroupSuccess(group)); }); @@ -99,7 +99,7 @@ export class SecurityGroupEffects { @Effect() convertSecurityGroup$: Observable = this.actions$ .ofType(securityGroup.CONVERT_SECURITY_GROUP) - .switchMap((action: securityGroup.ConvertSecurityGroup) => { + .mergeMap((action: securityGroup.ConvertSecurityGroup) => { return this.dialogService.confirm({ message: 'DIALOG_MESSAGES.SECURITY_GROUPS.CONFIRM_CONVERT' }) .onErrorResumeNext() .filter(res => Boolean(res)) diff --git a/src/app/reducers/snapshots/redux/snapshot.effects.ts b/src/app/reducers/snapshots/redux/snapshot.effects.ts index dbbf121cdf..c877a14cd2 100644 --- a/src/app/reducers/snapshots/redux/snapshot.effects.ts +++ b/src/app/reducers/snapshots/redux/snapshot.effects.ts @@ -38,7 +38,7 @@ export class SnapshotEffects { @Effect() addSnapshot$: Observable = this.actions$ .ofType(snapshotActions.ADD_SNAPSHOT) - .flatMap((action: snapshotActions.AddSnapshot) => { + .mergeMap((action: snapshotActions.AddSnapshot) => { return this.dialog.open(SnapshotCreationComponent, { data: action.payload }) @@ -74,7 +74,7 @@ export class SnapshotEffects { @Effect() deleteSnapshot$: Observable = this.actions$ .ofType(snapshotActions.DELETE_SNAPSHOT) - .flatMap((action: snapshotActions.DeleteSnapshot) => { + .mergeMap((action: snapshotActions.DeleteSnapshot) => { const notificationId = this.jobsNotificationService.add( 'JOB_NOTIFICATIONS.SNAPSHOT.DELETION_IN_PROGRESS'); return this.snapshotService.remove(action.payload.id) @@ -97,7 +97,7 @@ export class SnapshotEffects { @Effect() deleteSnapshots$: Observable = this.actions$ .ofType(snapshotActions.DELETE_SNAPSHOTS) - .flatMap((action: snapshotActions.DeleteSnapshots) => action.payload + .mergeMap((action: snapshotActions.DeleteSnapshots) => action.payload .map((snapshot: Snapshot) => new snapshotActions.DeleteSnapshot(snapshot))); @Effect() @@ -107,7 +107,7 @@ export class SnapshotEffects { this.store.select(fromVolumes.selectEntities), this.store.select(fromVMs.selectEntities) ) - .flatMap(([action, volumes, vms]: [ + .mergeMap(([action, volumes, vms]: [ snapshotActions.RevertVolumeToSnapshot, Dictionary, Dictionary ]) => { const vmId = Object.entries(volumes) diff --git a/src/app/reducers/ssh-keys/redux/ssh-key.effects.ts b/src/app/reducers/ssh-keys/redux/ssh-key.effects.ts index 845a11cac3..5c82ef677f 100644 --- a/src/app/reducers/ssh-keys/redux/ssh-key.effects.ts +++ b/src/app/reducers/ssh-keys/redux/ssh-key.effects.ts @@ -26,7 +26,7 @@ export class SshKeyEffects { @Effect() removeSshKeyPair$: Observable = this.actions$ .ofType(sshKey.SSH_KEY_PAIR_REMOVE) - .switchMap((action: sshKey.RemoveSshKeyPair) => { + .mergeMap((action: sshKey.RemoveSshKeyPair) => { return this.dialogService.confirm({ message: 'SSH_KEYS.REMOVE_THIS_KEY' }) .onErrorResumeNext() .filter(res => !!res) @@ -60,7 +60,7 @@ export class SshKeyEffects { @Effect() createSshKeyPair$: Observable = this.actions$ .ofType(sshKey.SSH_KEY_PAIR_CREATE) - .switchMap((action: sshKey.CreateSshKeyPair) => { + .mergeMap((action: sshKey.CreateSshKeyPair) => { return (action.payload.publicKey ? this.sshKeyService.register(action.payload) : this.sshKeyService.create(action.payload)) diff --git a/src/app/reducers/templates/redux/template.effects.ts b/src/app/reducers/templates/redux/template.effects.ts index 98ce74423a..26a6c21a0a 100644 --- a/src/app/reducers/templates/redux/template.effects.ts +++ b/src/app/reducers/templates/redux/template.effects.ts @@ -62,7 +62,7 @@ export class TemplateEffects { @Effect() removeTemplate$: Observable = this.actions$ .ofType(template.TEMPLATE_REMOVE) - .switchMap((action: template.RemoveTemplate) => { + .mergeMap((action: template.RemoveTemplate) => { return (action.payload.resourceType === TemplateResourceType.iso.toUpperCase() ? this.isoService.remove(action.payload) : this.templateService.remove(action.payload)) @@ -96,7 +96,7 @@ export class TemplateEffects { @Effect() createTemplate$: Observable = this.actions$ .ofType(template.TEMPLATE_CREATE) - .switchMap((action: template.CreateTemplate) => { + .mergeMap((action: template.CreateTemplate) => { return (action.payload.entity === TemplateResourceType.iso ? this.isoService.register(action.payload) : action.payload.snapshotId @@ -124,7 +124,7 @@ export class TemplateEffects { @Effect() setTemplateGroup$: Observable = this.actions$ .ofType(template.SET_TEMPLATE_GROUP) - .switchMap((action: template.SetTemplateGroup) => this.templateTagService.setGroup( + .mergeMap((action: template.SetTemplateGroup) => this.templateTagService.setGroup( action.payload.template, action.payload.templateGroup ) @@ -134,7 +134,7 @@ export class TemplateEffects { @Effect() resetTemplateGroup$: Observable = this.actions$ .ofType(template.RESET_TEMPLATE_GROUP) - .switchMap((action: template.ResetTemplateGroup) => + .mergeMap((action: template.ResetTemplateGroup) => this.templateTagService.resetGroup(action.payload) .map(temp => new template.ResetTemplateGroupSuccess(action.payload)) .catch(error => Observable.of(new template.SetTemplateGroupError(error)))); diff --git a/src/app/reducers/vm/redux/vm.effects.ts b/src/app/reducers/vm/redux/vm.effects.ts index 6e1730ecdb..cfe103521a 100644 --- a/src/app/reducers/vm/redux/vm.effects.ts +++ b/src/app/reducers/vm/redux/vm.effects.ts @@ -18,13 +18,7 @@ import { UserTagService } from '../../../shared/services/tags/user-tag.service'; import { VmTagService } from '../../../shared/services/tags/vm-tag.service'; import { IsoService } from '../../../template/shared/iso.service'; import { VmDestroyDialogComponent } from '../../../vm/shared/vm-destroy-dialog/vm-destroy-dialog.component'; -import { - getPath, - getPort, - getProtocol, - VirtualMachine, - VmState -} from '../../../vm/shared/vm.model'; +import { getPath, getPort, getProtocol, VirtualMachine, VmState } from '../../../vm/shared/vm.model'; import { VmService } from '../../../vm/shared/vm.service'; import { VmAccessComponent } from '../../../vm/vm-actions/vm-actions-component/vm-access.component'; // tslint:disable-next-line @@ -73,7 +67,7 @@ export class VirtualMachinesEffects { @Effect() changeDescription$: Observable = this.actions$ .ofType(vmActions.VM_CHANGE_DESCRIPTION) - .switchMap((action: vmActions.ChangeDescription) => { + .mergeMap((action: vmActions.ChangeDescription) => { const notificationId = this.jobsNotificationService.add( 'JOB_NOTIFICATIONS.VM.CHANGE_DESCRIPTION_IN_PROGRESS'); return (action.payload.description ? this.vmTagService @@ -96,7 +90,7 @@ export class VirtualMachinesEffects { @Effect() changeServiceOffering$: Observable = this.actions$ .ofType(vmActions.VM_CHANGE_SERVICE_OFFERING) - .switchMap((action: vmActions.ChangeServiceOffering) => { + .mergeMap((action: vmActions.ChangeServiceOffering) => { if (action.payload.vm.state === VmState.Running) { return this.stop(action.payload.vm).map(() => action); } else { @@ -137,7 +131,7 @@ export class VirtualMachinesEffects { @Effect() changeAffinityGroup$: Observable = this.actions$ .ofType(vmActions.VM_CHANGE_AFFINITY_GROUP) - .switchMap((action: vmActions.ChangeAffinityGroup) => { + .mergeMap((action: vmActions.ChangeAffinityGroup) => { return this.askToStopVM( action.payload.vm, 'VM_PAGE.VM_DETAILS.AFFINITY_GROUP.STOP_MACHINE_FOR_AG' @@ -186,7 +180,7 @@ export class VirtualMachinesEffects { @Effect() changeInstanceGroup$: Observable = this.actions$ .ofType(vmActions.VM_CHANGE_INSTANCE_GROUP) - .switchMap((action: vmActions.ChangeInstanceGroup) => { + .mergeMap((action: vmActions.ChangeInstanceGroup) => { const newVm = Object.assign( {}, action.payload.vm, @@ -213,7 +207,7 @@ export class VirtualMachinesEffects { @Effect() removeInstanceGroup$: Observable = this.actions$ .ofType(vmActions.VM_REMOVE_INSTANCE_GROUP) - .switchMap((action: vmActions.RemoveInstanceGroup) => { + .mergeMap((action: vmActions.RemoveInstanceGroup) => { const notificationId = this.jobsNotificationService.add( 'JOB_NOTIFICATIONS.VM.REMOVE_INSTANCE_GROUP_IN_PROGRESS'); @@ -242,7 +236,7 @@ export class VirtualMachinesEffects { @Effect() addSecondaryIp$: Observable = this.actions$ .ofType(vmActions.VM_ADD_SECONDARY_IP) - .switchMap((action: vmActions.AddSecondaryIp) => { + .mergeMap((action: vmActions.AddSecondaryIp) => { return this.vmService.addIpToNic(action.payload.nicId) .do(() => this.jobsNotificationService.finish({ message: 'JOB_NOTIFICATIONS.VM.ADD_SECONDARY_IP_DONE' @@ -273,7 +267,7 @@ export class VirtualMachinesEffects { @Effect() removeSecondaryIp$: Observable = this.actions$ .ofType(vmActions.VM_REMOVE_SECONDARY_IP) - .switchMap((action: vmActions.RemoveSecondaryIp) => { + .mergeMap((action: vmActions.RemoveSecondaryIp) => { return this.vmService.removeIpFromNic(action.payload.id) .do(() => this.jobsNotificationService.finish({ message: 'JOB_NOTIFICATIONS.VM.REMOVE_SECONDARY_IP_DONE' @@ -304,7 +298,7 @@ export class VirtualMachinesEffects { @Effect() changeColor$: Observable = this.actions$ .ofType(vmActions.VM_CHANGE_COLOR) - .switchMap((action: vmActions.ChangeVmColor) => { + .mergeMap((action: vmActions.ChangeVmColor) => { return this.vmTagService.setColor(action.payload.vm, action.payload.color) .do(() => this.jobsNotificationService.finish({ message: 'JOB_NOTIFICATIONS.VM.COLOR_CHANGE_DONE' @@ -321,7 +315,7 @@ export class VirtualMachinesEffects { @Effect() stopVm$: Observable = this.actions$ .ofType(vmActions.STOP_VM) - .flatMap((action: vmActions.StopVm) => { + .mergeMap((action: vmActions.StopVm) => { const notificationId = this.jobsNotificationService.add( 'JOB_NOTIFICATIONS.VM.STOP_IN_PROGRESS'); this.update(action.payload, VmState.Stopping); @@ -347,14 +341,14 @@ export class VirtualMachinesEffects { @Effect() startVm$: Observable = this.actions$ .ofType(vmActions.START_VM) - .flatMap((action: vmActions.StartVm) => { + .mergeMap((action: vmActions.StartVm) => { return this.start(action.payload); }); @Effect() destroyVm$: Observable = this.actions$ .ofType(vmActions.DESTROY_VM) - .flatMap((action: vmActions.DestroyVm) => { + .mergeMap((action: vmActions.DestroyVm) => { return this.dialog.open(VmDestroyDialogComponent, { data: this.authService.canExpungeOrRecoverVm() }).afterClosed() @@ -406,7 +400,7 @@ export class VirtualMachinesEffects { @Effect() rebootVm$: Observable = this.actions$ .ofType(vmActions.REBOOT_VM) - .flatMap((action: vmActions.RebootVm) => { + .mergeMap((action: vmActions.RebootVm) => { return this.dialogService.confirm({ message: 'DIALOG_MESSAGES.VM.CONFIRM_REBOOT' }) .onErrorResumeNext() .filter(res => Boolean(res)) @@ -437,7 +431,7 @@ export class VirtualMachinesEffects { @Effect() restoreVm$: Observable = this.actions$ .ofType(vmActions.RESTORE_VM) - .flatMap((action: vmActions.RestoreVm) => { + .mergeMap((action: vmActions.RestoreVm) => { return this.dialogService.confirm({ message: 'DIALOG_MESSAGES.VM.CONFIRM_RESTORE' }) .onErrorResumeNext() .filter(res => Boolean(res)) @@ -469,7 +463,7 @@ export class VirtualMachinesEffects { @Effect() recoverVm$: Observable = this.actions$ .ofType(vmActions.RECOVER_VM) - .flatMap((action: vmActions.RecoverVm) => { + .mergeMap((action: vmActions.RecoverVm) => { return this.dialogService.confirm({ message: 'DIALOG_MESSAGES.VM.CONFIRM_RECOVER' }) .onErrorResumeNext() .filter(res => Boolean(res)) @@ -500,7 +494,7 @@ export class VirtualMachinesEffects { @Effect() expungeVm$: Observable = this.actions$ .ofType(vmActions.EXPUNGE_VM) - .flatMap((action: vmActions.ExpungeVm) => { + .mergeMap((action: vmActions.ExpungeVm) => { return this.dialogService.confirm({ message: 'DIALOG_MESSAGES.VM.CONFIRM_EXPUNGE' }) .onErrorResumeNext() .filter(res => Boolean(res)) @@ -533,7 +527,7 @@ export class VirtualMachinesEffects { @Effect() attachIso$: Observable = this.actions$ .ofType(vmActions.ATTACH_ISO) - .switchMap((action: vmActions.AttachIso) => { + .mergeMap((action: vmActions.AttachIso) => { const notificationId = this.jobsNotificationService.add( 'JOB_NOTIFICATIONS.ISO.ATTACHMENT_IN_PROGRESS'); return this.isoService.attach(action.payload) @@ -554,7 +548,7 @@ export class VirtualMachinesEffects { @Effect() detachIso$: Observable = this.actions$ .ofType(vmActions.DETACH_ISO) - .switchMap((action: vmActions.DetachIso) => { + .mergeMap((action: vmActions.DetachIso) => { const notificationId = this.jobsNotificationService.add( 'JOB_NOTIFICATIONS.ISO.DETACHMENT_IN_PROGRESS'); return this.isoService.detach(action.payload) @@ -575,7 +569,7 @@ export class VirtualMachinesEffects { @Effect() changeSshKey$: Observable = this.actions$ .ofType(vmActions.CHANGE_SSH_KEY) - .switchMap((action: vmActions.ChangeSshKey) => { + .mergeMap((action: vmActions.ChangeSshKey) => { return this.askToStopVM( action.payload.vm, 'VM_PAGE.VM_DETAILS.SSH_KEY.STOP_MACHINE_FOR_SSH' @@ -626,7 +620,7 @@ export class VirtualMachinesEffects { @Effect() resetPassword$: Observable = this.actions$ .ofType(vmActions.RESET_PASSWORD_VM) - .flatMap((action: vmActions.ResetPasswordVm) => { + .mergeMap((action: vmActions.ResetPasswordVm) => { return this.dialogService.confirm({ message: 'DIALOG_MESSAGES.VM.CONFIRM_RESET_PASSWORD' }) .onErrorResumeNext() .filter(res => Boolean(res)) @@ -672,7 +666,7 @@ export class VirtualMachinesEffects { @Effect() saveNewPassword$: Observable = this.actions$ .ofType(vmActions.SAVE_NEW_VM_PASSWORD) - .switchMap((action: vmActions.SaveNewPassword) => { + .mergeMap((action: vmActions.SaveNewPassword) => { return this.showConfirmDialog().switchMap(() => this.vmTagService.setPassword(action.payload.vm, action.payload.tag) .do(() => this.jobsNotificationService.finish({ diff --git a/src/app/reducers/volumes/redux/volumes.effects.ts b/src/app/reducers/volumes/redux/volumes.effects.ts index 2d8cf46a32..b17af3779e 100644 --- a/src/app/reducers/volumes/redux/volumes.effects.ts +++ b/src/app/reducers/volumes/redux/volumes.effects.ts @@ -40,7 +40,7 @@ export class VolumesEffects { @Effect() createVolume$: Observable = this.actions$ .ofType(volumeActions.CREATE_VOLUME) - .switchMap((action: volumeActions.CreateVolume) => { + .mergeMap((action: volumeActions.CreateVolume) => { return this.volumeService.create(action.payload) .map(createdVolume => { this.dialog.closeAll(); @@ -53,7 +53,7 @@ export class VolumesEffects { @Effect() createVolumeFromSnapshot$: Observable = this.actions$ .ofType(volumeActions.CREATE_VOLUME_FROM_SNAPSHOT) - .switchMap((action: volumeActions.CreateVolumeFromSnapshot) => { + .mergeMap((action: volumeActions.CreateVolumeFromSnapshot) => { return this.volumeService.createFromSnapshot(action.payload) .map(job => { const createdVolume = job.jobresult['volume']; @@ -69,7 +69,7 @@ export class VolumesEffects { @Effect() changeDescription$: Observable = this.actions$ .ofType(volumeActions.VOLUME_CHANGE_DESCRIPTION) - .switchMap((action: volumeActions.ChangeDescription) => { + .mergeMap((action: volumeActions.ChangeDescription) => { const notificationId = this.jobsNotificationService.add( 'JOB_NOTIFICATIONS.VOLUME.CHANGE_DESCRIPTION_IN_PROGRESS'); @@ -97,7 +97,7 @@ export class VolumesEffects { @Effect() attachVolume$: Observable = this.actions$ .ofType(volumeActions.ATTACH_VOLUME) - .switchMap((action: volumeActions.AttachVolume) => { + .mergeMap((action: volumeActions.AttachVolume) => { return this.dialog.open(VolumeAttachmentContainerComponent, { data: { volume: action.payload, @@ -137,7 +137,7 @@ export class VolumesEffects { @Effect() attachVolumeToVM$: Observable = this.actions$ .ofType(volumeActions.ATTACH_VOLUME_TO_VM) - .switchMap((action: volumeActions.AttachVolumeToVM) => { + .mergeMap((action: volumeActions.AttachVolumeToVM) => { const notificationId = this.jobsNotificationService.add( 'JOB_NOTIFICATIONS.VOLUME.ATTACHMENT_IN_PROGRESS'); @@ -166,7 +166,7 @@ export class VolumesEffects { @Effect() detachVolume$: Observable = this.actions$ .ofType(volumeActions.DETACH_VOLUME) - .switchMap((action: volumeActions.DetachVolume) => { + .mergeMap((action: volumeActions.DetachVolume) => { return this.dialogService.confirm({ message: 'DIALOG_MESSAGES.VOLUME.CONFIRM_DETACHMENT' }) .onErrorResumeNext() .filter(res => Boolean(res)) @@ -195,7 +195,7 @@ export class VolumesEffects { @Effect() resizeVolume$: Observable = this.actions$ .ofType(volumeActions.RESIZE_VOLUME) - .switchMap((action: volumeActions.ResizeVolume) => { + .mergeMap((action: volumeActions.ResizeVolume) => { return this.dialog.open(VolumeResizeContainerComponent, { data: { volume: action.payload @@ -230,7 +230,7 @@ export class VolumesEffects { @Effect({ dispatch: false }) addSnapshotSchedule$: Observable = this.actions$ .ofType(volumeActions.ADD_SNAPSHOT_SCHEDULE) - .switchMap((action: volumeActions.AddSnapshotSchedule) => { + .mergeMap((action: volumeActions.AddSnapshotSchedule) => { return this.dialog.open(RecurringSnapshotsComponent, { data: action.payload }).afterClosed(); @@ -271,7 +271,7 @@ export class VolumesEffects { @Effect() deleteVolume$: Observable = this.actions$ .ofType(volumeActions.DELETE_VOLUME) - .flatMap((action: volumeActions.DeleteVolume) => { + .mergeMap((action: volumeActions.DeleteVolume) => { const notificationId = this.jobsNotificationService.add( 'JOB_NOTIFICATIONS.VOLUME.DELETION_IN_PROGRESS'); diff --git a/src/app/reducers/volumes/redux/volumes.reducers.ts b/src/app/reducers/volumes/redux/volumes.reducers.ts index e83859fb8c..75fe988882 100644 --- a/src/app/reducers/volumes/redux/volumes.reducers.ts +++ b/src/app/reducers/volumes/redux/volumes.reducers.ts @@ -6,6 +6,7 @@ import * as volumeActions from './volumes.actions'; import * as fromAccounts from '../../accounts/redux/accounts.reducers'; import * as fromVMs from '../../vm/redux/vm.reducers'; import * as fromSnapshots from '../../snapshots/redux/snapshot.reducers'; +import { VirtualMachine } from '../../../vm/shared/vm.model'; /** * @ngrx/entity provides a predefined interface for handling @@ -291,13 +292,13 @@ export const getSelectedVolumeWithSnapshots = createSelector( export const selectSpareOnlyVolumes = createSelector( - selectVolumesWithSnapshots, + selectAll, fromVMs.getSelectedVM, - (volumes, vm) => { - const zoneFilter = (volume) => vm && volume.zoneId === vm.zoneId; - const spareOnlyFilter = volume => !volume.virtualMachineId; + (volumes: Volume[], vm: VirtualMachine) => { + const zoneFilter = (volume: Volume) => vm && volume.zoneid === vm.zoneId; + const spareOnlyFilter = (volume: Volume) => !volume.virtualmachineid; const accountFilter = - volume => vm && (volume.account === vm.account && volume.domainid === vm.domainid); + (volume: Volume) => vm && (volume.account === vm.account && volume.domainid === vm.domainid); return volumes.filter( volume => zoneFilter(volume) && spareOnlyFilter(volume) && accountFilter(volume)); @@ -309,7 +310,7 @@ export const selectVmVolumes = createSelector( fromVMs.getSelectedId, (volumes, virtualMachineId) => { - const virtualMachineIdFilter = volume => !virtualMachineId || + const virtualMachineIdFilter = (volume: Volume) => !virtualMachineId || volume.virtualmachineid === virtualMachineId; return volumes.filter(volume => { diff --git a/src/app/reducers/zones/redux/zones.effects.ts b/src/app/reducers/zones/redux/zones.effects.ts index 0b542b68d6..44f7a5c23f 100644 --- a/src/app/reducers/zones/redux/zones.effects.ts +++ b/src/app/reducers/zones/redux/zones.effects.ts @@ -1,13 +1,11 @@ import { Injectable } from '@angular/core'; -import { - Actions, - Effect -} from '@ngrx/effects'; -import { Observable } from 'rxjs/Observable'; -import * as zoneActions from './zones.actions'; import { Action } from '@ngrx/store'; +import { Actions, Effect } from '@ngrx/effects'; +import { Observable } from 'rxjs/Observable'; + import { ZoneService } from '../../../shared/services/zone.service'; -import { Zone } from '../../../shared/models/zone.model'; +import { Zone } from '../../../shared/models'; +import * as zoneActions from './zones.actions'; @Injectable() export class ZonesEffects { @@ -26,5 +24,6 @@ export class ZonesEffects { constructor( private actions$: Actions, private zoneService: ZoneService - ) { } + ) { + } } diff --git a/src/app/vm/container/storage-detail.container.ts b/src/app/vm/container/storage-detail.container.ts index 520ad7e6cc..3d71aca88c 100644 --- a/src/app/vm/container/storage-detail.container.ts +++ b/src/app/vm/container/storage-detail.container.ts @@ -23,8 +23,8 @@ import * as fromVolumes from '../../reducers/volumes/redux/volumes.reducers'; [volumes]="volumes$ | async" > +

@@ -6,49 +7,56 @@

+
- - + + + + + {{ 'VM_PAGE.STORAGE_DETAILS.SPARE_DRIVE_ATTACHMENT.SELECT_VOLUME' | translate }} - - + + {{ selectedVolume.name }} - - - - {{ 'VM_PAGE.STORAGE_DETAILS.SPARE_DRIVE_ATTACHMENT.NO_AVAILABLE_VOLUMES_1' | translate }}{{ - 'VM_PAGE.STORAGE_DETAILS.SPARE_DRIVE_ATTACHMENT.NO_AVAILABLE_VOLUMES_2' | translate }}{{ - 'VM_PAGE.STORAGE_DETAILS.SPARE_DRIVE_ATTACHMENT.NO_AVAILABLE_VOLUMES_3' | translate }} - + + + + + {{ 'VM_PAGE.STORAGE_DETAILS.SPARE_DRIVE_ATTACHMENT.NO_AVAILABLE_VOLUMES_1' | translate }} + + {{'VM_PAGE.STORAGE_DETAILS.SPARE_DRIVE_ATTACHMENT.NO_AVAILABLE_VOLUMES_2' | translate }} + + {{'VM_PAGE.STORAGE_DETAILS.SPARE_DRIVE_ATTACHMENT.NO_AVAILABLE_VOLUMES_3' | translate }} +
- - - - - - + + + + + + + + + + + +
+ diff --git a/src/app/vm/vm-sidebar/storage-detail/volume-attachment/volume-attachment-detail/volume-attachment-detail.component.ts b/src/app/vm/vm-sidebar/storage-detail/volume-attachment/volume-attachment-detail/volume-attachment-detail.component.ts index 317723daed..77f3393563 100644 --- a/src/app/vm/vm-sidebar/storage-detail/volume-attachment/volume-attachment-detail/volume-attachment-detail.component.ts +++ b/src/app/vm/vm-sidebar/storage-detail/volume-attachment/volume-attachment-detail/volume-attachment-detail.component.ts @@ -1,9 +1,4 @@ -import { - Component, - EventEmitter, - Input, - Output -} from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { MatDialog } from '@angular/material'; import { Volume } from '../../../../../shared/models'; import { VolumeAttachmentDialogComponent } from '../volume-attchment-dialog/volume-attachment-dialog.component'; @@ -16,9 +11,8 @@ import { VolumeAttachmentDialogComponent } from '../volume-attchment-dialog/volu }) export class VolumeAttachmentDetailComponent { @Input() public volumes: Array; - @Output() public onAttach = new EventEmitter(); + @Output() public onAttach = new EventEmitter(); - public loading: boolean; public selectedVolume: Volume; constructor(