Merge pull request #7 from IvashchenkoCW/feature/deploy-dialog

rewrite ServiceDeploy interface
pull/32/head
IvashchenkoCW 5 years ago committed by GitHub
commit a2432883d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -67,11 +67,6 @@
<mat-label>Endpoint mode</mat-label> <mat-label>Endpoint mode</mat-label>
<input matInput formControlName="endpoint_mode" /> <input matInput formControlName="endpoint_mode" />
</mat-form-field> </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"> <div [formGroup]="formGeneral['controls']['resources']['controls']['limits']" fxLayout="column" fxGrap="10px">
<h3><span>Limits</span></h3> <h3><span>Limits</span></h3>
@ -101,15 +96,21 @@
</form> </form>
</mat-tab> </mat-tab>
<mat-tab label="Placement" [formGroup]="formGeneral"> <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-form-field fxFill appearance="outline">
<mat-label>Constraints</mat-label> <mat-label>Constraints</mat-label>
<textarea <textarea
matInput matInput
cdkTextareaAutosize cdkTextareaAutosize
#autosize="cdkTextareaAutosize" #autosize="cdkTextareaAutosize"
formControlName="placement"></textarea> formControlName="constraints"></textarea>
</mat-form-field> </mat-form-field>
<h2 mat-dialog-title>Preferences</h2> <h2 mat-dialog-title>Preferences</h2>
<key-value #preferences [keyValueArray]="currentPreferences"></key-value> <key-value #preferences [keyValueArray]="currentPreferences"></key-value>
</div> </div>

@ -40,8 +40,10 @@ export class DeployDialogComponent implements OnInit {
window: new FormControl(''), window: new FormControl(''),
}), }),
endpoint_mode: new FormControl(''), endpoint_mode: new FormControl(''),
placement: new FormControl(''), placement: this.formBuilder.group({
max_replicas_per_node: new FormControl('', [Validators.pattern('^[0-9]+$')]), constraints: new FormControl(''),
max_replicas_per_node: new FormControl('', [Validators.pattern('^[0-9]+$')])
}),
resources: this.formBuilder.group({ resources: this.formBuilder.group({
limits: this.formBuilder.group({ limits: this.formBuilder.group({
cpus: new FormControl(''), cpus: new FormControl(''),
@ -60,7 +62,10 @@ export class DeployDialogComponent implements OnInit {
this.formGeneral.patchValue({ this.formGeneral.patchValue({
...this.data.deploy, ...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(',')
}
}) })
} }
} }
@ -69,7 +74,8 @@ export class DeployDialogComponent implements OnInit {
const fields: ServiceDeploy = { const fields: ServiceDeploy = {
...this.formGeneral.getRawValue(), ...this.formGeneral.getRawValue(),
placement: { 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() preferences: this.preferences.getKeyValuePaies()
}, },
labels: this.labels.getKeyValuePaies(), labels: this.labels.getKeyValuePaies(),

@ -56,10 +56,10 @@ export interface ServiceDeploy {
} }
endpoint_mode: string endpoint_mode: string
placement: { placement: {
max_replicas_per_node: number
constraints: [] constraints: []
preferences: KeyValuePair[] preferences: KeyValuePair[]
} }
max_replicas_per_node: number
resources: { resources: {
limits: { limits: {
cpus: string cpus: string

Loading…
Cancel
Save