private assignWaveMigration()

in frontend/src/app/modules/migration-mapper/components/migration-mapper/migration-mapper.component.ts [512:541]


  private assignWaveMigration(name: string): void {
    const db_ids = this.dataSource.filteredData.map((data) => data.db_id);
    const assignWaveObj: AddWave = {
      name,
      project_id: this.project_id,
      db_ids
    };
  
    this.waveService.createMigrationWave(assignWaveObj).subscribe((resp: AddWaveResp) => {
      let message = '';
      if (resp.assigned) {
        message += `Wave '${name}' has been successfully assigned to ${resp.assigned} mappings.`
      }
      if (resp.skipped) {
        message += `And ${resp.skipped} mapping(s) were not assigned due to their relation to already started the migration.`
      }
      if (resp.unmapped) {
        message += `${resp.unmapped} mapping(s) were not assigned due to target absence`;
      }
      this.openSnackBar(message);

      if (resp.assigned) {
        this.getWaves();
        this.getMigrations();
      }
    },
    (error) => {
      this.openSnackBar(error);
    })
  }