Skip to content

Commit

Permalink
Merge pull request #7 from IvashchenkoCW/feature/deploy-dialog
Browse files Browse the repository at this point in the history
rewrite ServiceDeploy interface
  • Loading branch information
IvashchenkoCW committed Jul 14, 2020
2 parents 57096d5 + eb5bd66 commit a243288
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ <h3><span>Restart policy</span></h3>
<mat-label>Endpoint mode</mat-label>
<input matInput formControlName="endpoint_mode" />
</mat-form-field>

<mat-form-field appearance="outline">
<mat-label>Max replicas per node</mat-label>
<input matInput formControlName="max_replicas_per_node" />
</mat-form-field>

<div [formGroup]="formGeneral['controls']['resources']['controls']['limits']" fxLayout="column" fxGrap="10px">
<h3><span>Limits</span></h3>
Expand Down Expand Up @@ -101,15 +96,21 @@ <h3><span>Limits</span></h3>
</form>
</mat-tab>
<mat-tab label="Placement" [formGroup]="formGeneral">
<div fxLayout="column">
<div fxLayout="column" [formGroup]="formGeneral['controls']['placement']">
<mat-form-field appearance="outline">
<mat-label>Max replicas per node</mat-label>
<input matInput formControlName="max_replicas_per_node" />
</mat-form-field>

<mat-form-field fxFill appearance="outline">
<mat-label>Constraints</mat-label>
<textarea
matInput
matInput
cdkTextareaAutosize
#autosize="cdkTextareaAutosize"
formControlName="placement"></textarea>
formControlName="constraints"></textarea>
</mat-form-field>

<h2 mat-dialog-title>Preferences</h2>
<key-value #preferences [keyValueArray]="currentPreferences"></key-value>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ export class DeployDialogComponent implements OnInit {
window: new FormControl(''),
}),
endpoint_mode: new FormControl(''),
placement: new FormControl(''),
max_replicas_per_node: new FormControl('', [Validators.pattern('^[0-9]+$')]),
placement: this.formBuilder.group({
constraints: new FormControl(''),
max_replicas_per_node: new FormControl('', [Validators.pattern('^[0-9]+$')])
}),
resources: this.formBuilder.group({
limits: this.formBuilder.group({
cpus: new FormControl(''),
Expand All @@ -60,7 +62,10 @@ export class DeployDialogComponent implements OnInit {

this.formGeneral.patchValue({
...this.data.deploy,
placement: this.data.deploy.placement.constraints.join(',')
placement: {
max_replicas_per_node: this.data.deploy.placement.max_replicas_per_node,
constraints: this.data.deploy.placement.constraints.join(',')
}
})
}
}
Expand All @@ -69,7 +74,8 @@ export class DeployDialogComponent implements OnInit {
const fields: ServiceDeploy = {
...this.formGeneral.getRawValue(),
placement: {
constraints: this.formGeneral.get('placement').value.split(','),
max_replicas_per_node: this.formGeneral.get('placement').value.max_replicas_per_node,
constraints: this.formGeneral.get('placement').value.constraints.split(','),
preferences: this.preferences.getKeyValuePaies()
},
labels: this.labels.getKeyValuePaies(),
Expand Down
2 changes: 1 addition & 1 deletion src/composer/src/app/core/store/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export interface ServiceDeploy {
}
endpoint_mode: string
placement: {
max_replicas_per_node: number
constraints: []
preferences: KeyValuePair[]
}
max_replicas_per_node: number
resources: {
limits: {
cpus: string
Expand Down

0 comments on commit a243288

Please sign in to comment.