add service name field to add custom dialog

pull/30/head
IvashchenkoCW 5 years ago
parent 737d45d532
commit f3cc5c2e43

@ -65,7 +65,7 @@ export class ManageProjectDialogComponent implements OnInit, OnDestroy {
) { ) {
this.serviceName = this.data.name this.serviceName = this.data.name
this.formGeneral = this.formBuilder.group({ this.formGeneral = this.formBuilder.group({
image: new FormControl({ value: this.data.image, disabled: true }, Validators.required), image: new FormControl( this.data.image, Validators.required),
name: new FormControl('', [Validators.required, this.serviceNameAlreadyExistsValidator]), name: new FormControl('', [Validators.required, this.serviceNameAlreadyExistsValidator]),
tag: new FormControl('', [Validators.required]), tag: new FormControl('', [Validators.required]),
restart: new FormControl('', [Validators.required]), restart: new FormControl('', [Validators.required]),

@ -9,8 +9,13 @@
<mat-label>Tag</mat-label> <mat-label>Tag</mat-label>
<input matInput [(ngModel)]="tag" /> <input matInput [(ngModel)]="tag" />
</mat-form-field> </mat-form-field>
<mat-form-field appearance="fill">
<mat-label>Service name</mat-label>
<input matInput required [(ngModel)]="serviceName" />
</mat-form-field>
</div> </div>
<div mat-dialog-actions fxLayoutAlign="end"> <div mat-dialog-actions fxLayoutAlign="end">
<button mat-raised-button (click)="addProject()" cdkFocusInitial>Add</button> <button mat-raised-button [disabled]="!serviceName" (click)="addProject()" cdkFocusInitial>Add</button>
</div> </div>

@ -94,7 +94,7 @@ export class RepoSearchComponent implements OnInit, OnDestroy {
shm_size: null, shm_size: null,
stdin_open: null, stdin_open: null,
tty: null, tty: null,
name: `${data['name']}_${postfix}`, name: data['serviceName'] ? `${data['serviceName']}_${postfix}` : `${data['name']}_${postfix}`,
container_name: null, container_name: null,
deploy: null, deploy: null,
image: imageName, image: imageName,
@ -250,9 +250,10 @@ export class DialogAddCustom {
@Output() onAddProject = new EventEmitter() @Output() onAddProject = new EventEmitter()
imageName: string imageName: string
tag: string tag: string
serviceName: string
constructor(public dialogRef: MatDialogRef<DialogDetails>) {} constructor(public dialogRef: MatDialogRef<DialogDetails>) {}
addProject() { addProject() {
this.onAddProject.emit({name: this.imageName, tag: this.tag}) this.onAddProject.emit({name: this.imageName, tag: this.tag, serviceName: this.serviceName})
} }
} }

Loading…
Cancel
Save