Skip to content

Commit 6d2c8bb

Browse files
UI: Handle missing TrialTemplates (#1652)
* Use YAML input if TrialParams are missing Signed-off-by: Kimonas Sotirchos <[email protected]> * review: Separate TrialTemplates in two words Co-authored-by: Andrey Velichkevich <[email protected]> Co-authored-by: Andrey Velichkevich <[email protected]>
1 parent 2d87caa commit 6d2c8bb

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

pkg/new-ui/v1beta1/frontend/src/app/pages/experiment-creation/trial-template/trial-template.component.html

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@
3737
<mat-form-field appearance="outline" class="fit-content">
3838
<mat-label>Source Type</mat-label>
3939
<mat-select formControlName="type">
40-
<mat-option value="configmap">ConfigMap</mat-option>
40+
<mat-option
41+
[disabled]="!templates.length"
42+
[matTooltip]="!templates.length ? 'No Trial templates found' : ''"
43+
value="configmap"
44+
>
45+
ConfigMap
46+
</mat-option>
4147
<mat-option value="yaml">YAML</mat-option>
4248
</mat-select>
4349
</mat-form-field>
@@ -90,7 +96,7 @@
9096
<mat-divider class="margin-bottom margin-top"></mat-divider>
9197

9298
<app-trial-parameter
93-
*ngFor="let ctrl of trialParameters.controls"
99+
*ngFor="let ctrl of trialParameters?.controls"
94100
[formGroup]="ctrl"
95101
></app-trial-parameter>
96102
</div>

pkg/new-ui/v1beta1/frontend/src/app/pages/experiment-creation/trial-template/trial-template.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class FormTrialTemplateComponent implements OnInit, OnDestroy {
1818
public templates: ConfigMapResponse[] = [];
1919
public configmaps: ConfigMapBody[] = [];
2020
public paths: string[] = [];
21-
public trialParameters: FormArray;
21+
public trialParameters = new FormArray([]);
2222
private selectedConfigMap: ConfigMapBody;
2323
private subs = new Subscription();
2424
private yamlPrv = '';
@@ -53,6 +53,12 @@ export class FormTrialTemplateComponent implements OnInit, OnDestroy {
5353
this.backend.getTrialTemplates('').subscribe(templates => {
5454
this.templates = templates.Data;
5555
this.formGroup.get('cmNamespace').setValue('kubeflow');
56+
57+
// Use the ConfigMap option if the TrialTemplates were successfully
58+
// fetched
59+
if (this.templates && this.templates.length) {
60+
this.formGroup.get('type').setValue('configmap');
61+
}
5662
}),
5763
);
5864

pkg/new-ui/v1beta1/frontend/src/app/services/experiment-form.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ export class ExperimentFormService {
212212

213213
createTrialTemplateForm(): FormGroup {
214214
return this.builder.group({
215-
type: 'configmap',
215+
type: 'yaml',
216216
podLabels: this.builder.array([]),
217217
containerName: 'training-container',
218218
successCond: 'status.conditions.#(type=="Complete")#|#(status=="True")#',

0 commit comments

Comments
 (0)