message: fix default vm name not always being set
diff: @@ -124,7 +124,6 @@ export class VmCreationComponent implements OnInit {
  public ngOnInit(): void {
  this.resetVmCreateData();
  - this.setDefaultVmName();
  }
  public updateDiskOffering(offering: DiskOffering): void {
  @@ -163,8 +162,16 @@ export class VmCreationComponent implements OnInit {
  }
  public resetVmCreateData(): void {
  - this.getVmCreateData()
  - .subscribe(result => this.vmCreationData = result);
  + Observable.forkJoin([
  + this.getVmCreateData(),
  + this.getDefaultVmName()
  + ])
  + .subscribe(([creationData, defaultName]) => {
  + this.vmCreationData = creationData;
  + if (!this.vmCreationData.vm.displayName) {
  + setTimeout(() => this.vmCreationData.vm.displayName = defaultName);
  + }
  + });
  }
  public deployVm(): void {
  @@ -274,11 +281,11 @@ export class VmCreationComponent implements OnInit {
  }
  }
  - private setDefaultVmName(): void {
  + private getDefaultVmName(): Observable<string> {
  const regex = /vm-.*-(\d+)/;
  - this.vmService.getList({}, true)
  - .subscribe(vmList => {
  + return this.vmService.getList({}, true)
  + .map(vmList => {
  let max = 0;
  vmList.forEach(vm => {
  const match = vm.displayName.match(regex);
  @@ -288,9 +295,7 @@ export class VmCreationComponent implements OnInit {
  }
  });
  - if (!this.vmCreationData.vm.displayName) {
  - setTimeout(() => this.vmCreationData.vm.displayName = `vm-${this.auth.username}-${++max}`);
  - }
  + return `vm-${this.auth.username}-${++max}`;
  });
  }
  