Skip to content
This repository was archived by the owner on Jul 15, 2022. It is now read-only.

Commit eebc027

Browse files
author
Leonardo Chaia
committed
feat: adds auto remove falg
1 parent 6215aba commit eebc027

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

src/app/daemon-tools/container-create/container-create.component.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,16 @@ <h2 class="tim-text-title">
7171
</mat-form-field>
7272

7373
<mat-checkbox formControlName="Tty"
74-
style="margin-left:8px;">TTY</mat-checkbox>
74+
style="margin-left:8px;">
75+
TTY
76+
</mat-checkbox>
77+
78+
<ng-container formGroupName="HostConfig">
79+
<mat-checkbox formControlName="AutoRemove"
80+
style="margin-left:8px;">
81+
Auto Remove
82+
</mat-checkbox>
83+
</ng-container>
7584
</div>
7685
<div>
7786
<button mat-raised-button
@@ -84,4 +93,6 @@ <h2 class="tim-text-title">
8493
</div>
8594
</mat-card>
8695

87-
</form>
96+
</form>
97+
98+
<pre>{{form.value|json}}</pre>

src/app/daemon-tools/container-create/container-create.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export class ContainerCreateComponent implements OnInit {
4949

5050
public ngOnInit() {
5151
this.form = this.containerForm.createForm(this.initialConfig);
52-
console.log(this.form.getRawValue());
5352
if (this.disableImage) {
5453
const imgCtrl = this.form.get('Image');
5554
imgCtrl.disable();
@@ -62,7 +61,6 @@ export class ContainerCreateComponent implements OnInit {
6261

6362
public launch() {
6463
const data = this.containerForm.formToData(this.form);
65-
console.log(data);
6664
const job = this.dockerJobs.createContainer(data);
6765
this.created.emit(job);
6866
}

src/app/daemon-tools/container-form.service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,16 @@ export class ContainerFormService {
123123
form.setControl('Cmd', this.fb.control(null));
124124
form.setControl('Tty', this.fb.control(data.Tty));
125125

126+
if (!data.HostConfig) {
127+
form.setControl('HostConfig', this.fb.group({}));
128+
}
129+
130+
// Setup some healthy deaults if not provided
131+
if (!data.HostConfig
132+
|| typeof data.HostConfig.AutoRemove !== 'boolean') {
133+
(form.get('HostConfig') as FormGroup).setControl('AutoRemove', this.fb.control(true));
134+
}
135+
126136
if (typeof data.Tty !== 'boolean') {
127137
form.get('Tty').setValue(true);
128138
}

0 commit comments

Comments
 (0)