Skip to content

Commit

Permalink
fix compute resource not set to id in api (#623)
Browse files Browse the repository at this point in the history
Signed-off-by: Meina Zhou <meinaz@vmware.com>
  • Loading branch information
zhoumeina committed Oct 26, 2018
1 parent ec32839 commit 28346a4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ export class ComputeCapacityComponent implements OnInit {
} else {
const cpuLimitValue = this.form.get('cpuLimit').value;
const memoryLimitValue = this.form.get('memoryLimit').value;

results['computeResource'] = this.selectedName;
results['computeResource'] = this.selectedId;
results['computeResourceName'] = this.selectedName;
results['cpu'] = unlimitedPattern.test(cpuLimitValue) ? '0' : cpuLimitValue;
results['memory'] = unlimitedPattern.test(memoryLimitValue) ? '0' : memoryLimitValue;
if (this.inAdvancedMode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ export class CreateVchWizardService {
* @returns {Observable<ComputeResource[]>}
*/
getResourcesCompleteInfo(basicInfoList: ResourceBasicInfo[]): Observable<ComputeResource[]> {
if (!basicInfoList) {
return Observable.of([]);
}
const infoListObs: Observable<ComputeResource>[] = basicInfoList
.map(resourceBasicInfo => {
return this.getResourceCompleteInfo(resourceBasicInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,16 @@ export class SummaryComponent implements OnInit {
}

for (const key in payload[section]) {
if (key === 'computeResource') {// computeResource is a id which is not needed in commandline.
continue;
}
if (!(payload[section][key]) || payload[section][key] === '0') {
continue;
}
const newKey = key.replace(camelCasePattern, '$1-$2').toLowerCase();
let newKey = key.replace(camelCasePattern, '$1-$2').toLowerCase();
if (newKey === 'compute-resource-name') {
newKey = 'compute-resource'; // use computeResource in commandline.
}
let value = payload[section][key];
if (typeof value === 'string') {
value = this.escapeSpecialCharsForCLI(value);
Expand Down

0 comments on commit 28346a4

Please sign in to comment.